From 1dc3a0f9c03fe5cd640be791a379919bc4db20f2 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Wed, 24 Jul 2024 18:48:41 +0530 Subject: [PATCH] DOC: Replace references to the API with standard code text --- doc/source/regression/dwt-idwt.md | 58 ++++++++++++++----------------- doc/source/regression/gotchas.md | 4 +-- doc/source/regression/modes.md | 10 +++--- doc/source/regression/wavelet.md | 50 +++++++++++++------------- doc/source/regression/wp.md | 51 +++++++++++++-------------- doc/source/regression/wp2d.md | 53 +++++++++++++--------------- 6 files changed, 109 insertions(+), 117 deletions(-) diff --git a/doc/source/regression/dwt-idwt.md b/doc/source/regression/dwt-idwt.md index 6fcff41e..92289ff8 100644 --- a/doc/source/regression/dwt-idwt.md +++ b/doc/source/regression/dwt-idwt.md @@ -43,8 +43,8 @@ mystnb: ## Discrete Wavelet Transform -Let's do a {func}`Discrete Wavelet Transform ` of a sample data `x` -using the `db2` wavelet. It's simple.. +Let's do a Discrete Wavelet Transform of some sample data `x` +using the `db2` wavelet. It's simple: ```{code-cell} import pywt @@ -65,8 +65,7 @@ cD ## Inverse Discrete Wavelet Transform -Now let's do an opposite operation -\- {func}`Inverse Discrete Wavelet Transform `: +Now, let's do the opposite operation: an Inverse Discrete Wavelet Transform: ```{code-cell} pywt.idwt(cA, cD, 'db2') @@ -76,10 +75,10 @@ VoilĂ ! That's it! ## More examples -Now let's experiment with the {func}`dwt` some more. For example let's pass a -{class}`Wavelet` object instead of the wavelet name and specify signal -extension mode (the default is {ref}`symmetric `) for the -border effect handling: +Now, let's experiment with `dwt` some more. For example, let's pass a +`Wavelet` object instead of the wavelet name and specify the signal +extension mode (the default is `Modes.symmetric`) for the border effect +handling: ```{code-cell} w = pywt.Wavelet('sym3') @@ -94,11 +93,11 @@ print(cA) print(cD) ``` -Note that the output coefficients arrays length depends not only on the input -data length but also on the :class:Wavelet type (particularly on its -{attr}`filters length <~Wavelet.dec_len>` that are used in the transformation). +Note that the output coefficients arrays' length depends not only on the +input data length but also on the `Wavelet` type (particularly on its +filters length `Wavelet.dec_len` that are used in the transformation). -To find out what the size of the output data will be, use the {func}`dwt_coeff_len` +To find out what the size of the output data will be, use the `dwt_coeff_len` function: ```{code-cell} @@ -119,23 +118,20 @@ Looks fine. (And if you expected that the output length would be a half of the input data length, well, that's the trade-off that allows for the perfect reconstruction...). -The third argument of the {func}`dwt_coeff_len` is the already mentioned signal -extension mode (please refer to the PyWavelets' documentation for the -{ref}`modes ` description). Currently, there are six -{ref}`extension modes ` available: +The third argument of the `dwt_coeff_len` function is the already mentioned signal +extension mode (please refer to the PyWavelets' documentation for the `modes` +description). Currently, there are six extension modes available under `Modes`: ```{code-cell} pywt.Modes.modes ``` -As you see in the above example, the {ref}`periodization ` -(periodization) mode is slightly different from the others. It's aim when -doing the {func}`DWT ` transform is to output coefficients arrays that -are half of the length of the input data. +As you see in the above example, the periodization (`Modes.periodization`) mode +is slightly different from the others. Its aim when doing the `pywt.dwt` transform +is to output coefficients arrays that are half of the length of the input data. Knowing that, you should never mix the periodization mode with other modes when -doing {func}`DWT ` and {func}`IDWT `. Otherwise, it will produce -**invalid results**: +doing `dwt` and `idwt`. Otherwise, it will produce **invalid results**: ```{code-cell} x = [3, 7, 1, 1, -2, 5, 4, 6] @@ -150,9 +146,9 @@ print(pywt.idwt(cA, cD, 'sym3', 'periodization')) ## Tips & tricks -### Passing `None` instead of coefficients data to {func}`idwt` +### Passing `None` instead of coefficients data to `pywt.idwt()` -Now, we showcase some tips & tricks. Passing `None` as one of the coefficient +Now, we showcase some tips and tricks. Passing `None` as one of the coefficient arrays parameters is similar to passing a _zero-filled_ array. The results are simply the same: @@ -181,9 +177,9 @@ tags: [raises-exception] print(pywt.idwt(None, None, 'db2', 'symmetric')) ``` -### Coefficients data size in {attr}`idwt` +### Coefficients data size in `pywt.idwt` -When doing the {func}`IDWT ` transform, usually the coefficient arrays +When doing the `idwt` transform, usually the coefficient arrays must have the same size. ```{code-cell} @@ -193,11 +189,11 @@ tags: [raises-exception] print(pywt.idwt([1, 2, 3, 4, 5], [1, 2, 3, 4], 'db2', 'symmetric')) ``` -Not every coefficient array can be used in {func}`IDWT `. In the -following example the {func}`idwt` will fail because the input arrays are -invalid - they couldn't be created as a result of {func}`DWT `, because -the minimal output length for dwt using `db4` wavelet and the {ref}`symmetric -` mode is `4`, not `3`: +Not every coefficient array can be used in `idwt`. In the +following example the `idwt` will fail because the input arrays are +invalid - they couldn't be created as a result of `dwt`, because +the minimal output length for dwt using `db4` wavelet and the `Modes.symmetric` +mode is `4`, not `3`: ```{code-cell} --- diff --git a/doc/source/regression/gotchas.md b/doc/source/regression/gotchas.md index 2985fb2a..6d3b4719 100644 --- a/doc/source/regression/gotchas.md +++ b/doc/source/regression/gotchas.md @@ -39,8 +39,8 @@ kernelspec: # Gotchas PyWavelets utilizes `NumPy` under the hood. That's why handling the data -containing `None` values can be surprising. `None` values are converted to -'not a number' (`numpy.NaN`) values: +that contains `None` values can be surprising. `None` values are converted to +'not a number' (`numpy.nan`) values: ```{code-cell} import numpy, pywt diff --git a/doc/source/regression/modes.md b/doc/source/regression/modes.md index 45689f3d..38ea50b0 100644 --- a/doc/source/regression/modes.md +++ b/doc/source/regression/modes.md @@ -38,7 +38,7 @@ kernelspec: # Signal Extension Modes -Let's import {mod}`pywt`, first: +Let's import `pywt`, first: ```{code-cell} import pywt @@ -57,13 +57,13 @@ def format_array(a): return numpy.array2string(a, precision=5, separator=' ', suppress_small=True) ``` -A list of available signal extension {ref}`modes ` is as follows: +A list of available signal extension modes (`Modes`) is provided as follows: ```{code-cell} pywt.Modes.modes ``` -Therefore, an invalid mode name should rise a {exc}`ValueError`: +Therefore, an invalid mode name should raise a `ValueError`: ```{code-cell} --- @@ -72,7 +72,7 @@ tags: [raises-exception] pywt.dwt([1,2,3,4], 'db2', 'invalid') ``` -You can also refer to modes via {ref}`Modes ` class attributes: +You can also refer to modes via the attributes of the `Modes` class: ```{code-cell} x = [1, 2, 1, 5, -1, 8, 4, 6] @@ -82,7 +82,7 @@ for mode_name in ['zero', 'constant', 'symmetric', 'reflect', 'periodic', 'smoot print("Mode: %d (%s)" % (mode, mode_name)) ``` -The default mode is {ref}`symmetric `: +The default mode is symmetric, i.e., `Modes.symmetric`: ```{code-cell} cA, cD = pywt.dwt(x, 'db2') diff --git a/doc/source/regression/wavelet.md b/doc/source/regression/wavelet.md index 4b90389b..03a52a9c 100644 --- a/doc/source/regression/wavelet.md +++ b/doc/source/regression/wavelet.md @@ -40,12 +40,12 @@ kernelspec: ## Wavelet families and builtin Wavelets names -{class}`Wavelet` objects are really a handy carriers of a bunch of DWT-specific +`pywt.Wavelet` objects are really handy carriers of a bunch of DWT-specific data like _quadrature mirror filters_ and some general properties associated with them. -At first let's go through the methods of creating a {class}`Wavelet` object. -The easiest and the most convenient way is to use builtin named Wavelets. +At first let's go through the methods of creating a `Wavelet` object. +The easiest and the most convenient way is to use built-in named Wavelets. These wavelets are organized into groups called wavelet families. The most commonly used families are: @@ -63,12 +63,12 @@ for family in pywt.families(): print("%s family: " % family + ', '.join(pywt.wavelist(family))) ``` -To get the full list of builtin wavelets' names, just use the {func}`wavelist` +To get the full list of built-in wavelets' names, just use the `pywt.wavelist` function without any arguments. ## Creating Wavelet objects -Now, since we know all the names, let's finally create a {class}`Wavelet` object: +Now that we know all the names, let's finally create a `Wavelet` object: ```{code-cell} w = pywt.Wavelet('db3') @@ -78,10 +78,10 @@ and, that's it! ## Wavelet properties -But what can we do with {class}`Wavelet` objects? Well, they carry some +But what can we do with `Wavelet` objects? Well, they carry some interesting pieces of information. -First, let's try printing a {class}`Wavelet` object that we used earlier. +First, let's try printing a `Wavelet` object that we used earlier. This shows a brief information about its name, its family name and some properties like orthogonality and symmetry. @@ -90,10 +90,10 @@ print(w) ``` But the most important bits of information are the wavelet filters coefficients, -which are used in {ref}`Discrete Wavelet Transform `. These coefficients -can be obtained via the {attr}`~Wavelet.dec_lo`, {attr}`Wavelet.dec_hi`, -{attr}`~Wavelet.rec_lo` and {attr}`~Wavelet.rec_hi` attributes, which -correspond to lowpass & highpass decomposition filters and lowpass & +which are used in Discrete Wavelet Transform. These coefficients +can be obtained via the `Wavelet.dec_lo`, `Wavelet.dec_hi`, `Wavelet.rec_lo`, +and the `~Wavelet.rec_hi` attributes, which +correspond to lowpass & highpass decomposition filters, and lowpass & highpass reconstruction filters respectively: ```{code-cell} @@ -101,7 +101,7 @@ def print_array(arr): print("[%s]" % ", ".join(["%.14f" % x for x in arr])) ``` -Another way to get the filters data is to use the {attr}`~Wavelet.filter_bank` +Another way to get the filters data is to use the `Wavelet.filter_bank` attribute, which returns all four filters in a tuple: ```{code-cell} @@ -110,7 +110,7 @@ w.filter_bank == (w.dec_lo, w.dec_hi, w.rec_lo, w.rec_hi) Other properties of a `Wavelet` object are: -1. Wavelet {attr}`~Wavelet.name`, {attr}`~Wavelet.short_family_name` and {attr}`~Wavelet.family_name`: +1. `Wavelet.name`, `Wavelet.short_family_name`, and `Wavelet.family_name`: ```{code-cell} print(w.name) @@ -118,7 +118,7 @@ print(w.short_family_name) print(w.family_name) ``` -2. Decomposition ({attr}`~Wavelet.dec_len`) and reconstruction ({attr}`~.Wavelet.rec_len`) filter lengths: +2. Decomposition (`Wavelet.dec_len`) and reconstruction (`Wavelet.rec_len`) filter lengths: ```{code-cell} w.dec_len @@ -128,7 +128,7 @@ w.dec_len w.rec_len ``` -3. Orthogonality ({attr}`~Wavelet.orthogonal`) and biorthogonality ({attr}`~Wavelet.biorthogonal`): +3. Orthogonality (`Wavelet.orthogonal`) and biorthogonality (`Wavelet.biorthogonal`): ```{code-cell} w.orthogonal @@ -138,14 +138,14 @@ w.orthogonal w.biorthogonal ``` -3. Symmetry ({attr}`~Wavelet.symmetry`): +3. Symmetry (`Wavelet.symmetry`): ```{code-cell} print(w.symmetry) ``` -4. Number of vanishing moments for the scaling function `phi` ({attr}`~Wavelet.vanishing_moments_phi`) - and the wavelet function `psi` ({attr}`~Wavelet.vanishing_moments_psi`), associated with the filters: +4. Number of vanishing moments for the scaling function `phi` (`Wavelet.vanishing_moments_phi`) + and the wavelet function `psi` (`Wavelet.vanishing_moments_psi`), associated with the filters: ```{code-cell} w.vanishing_moments_phi @@ -156,7 +156,7 @@ w.vanishing_moments_psi ``` Now when we know a bit about the builtin Wavelets, let's see how to create -{ref}`custom Wavelets ` objects. These can be done in two ways: +custom `Wavelets` objects. These can be done in two ways: 1. Passing the filter bank object that implements the `filter_bank` attribute. The attribute must return four filters coefficients. @@ -189,7 +189,7 @@ my_filter_bank = ( my_wavelet = pywt.Wavelet('My Haar Wavelet', filter_bank=my_filter_bank) ``` -Note that such custom wavelets **will not** have all the properties set +Note that such custom `Wavelets` objects **will not** have all the properties set to correct values and some of them could be missing: ```{code-cell} @@ -212,10 +212,10 @@ print(my_wavelet) ## And now... the `wavefun`! We all know that the fun with wavelets is in wavelet functions. -Now, what would be this package without a tool to compute wavelet +Now, what would this package be without a tool to compute wavelet and scaling functions approximations? -This is the purpose of the {meth}`~Wavelet.wavefun` method, which is used to +This is the purpose of the `Wavelet.wavefun` method, which is used to approximate scaling function (`phi`) and wavelet function (`psi`) at the given level of refinement, based on the filters coefficients. @@ -234,8 +234,8 @@ w.orthogonal For biorthogonal (non-orthogonal) wavelets, different scaling and wavelet functions are used for decomposition and reconstruction, and thus, five -elements are returned: decomposition scaling & wavelet functions -approximations, reconstruction scaling & wavelet functions approximations, +elements are returned: decomposition scaling and wavelet functions +approximations, reconstruction scaling and wavelet functions approximations, and the xgrid. ```{code-cell} @@ -248,7 +248,7 @@ w.orthogonal ``` :::{seealso} -You can find live examples of the usage of {meth}`~Wavelet.wavefun` and +You can find live examples of the usage of `Wavelet.wavefun` and images of all the built-in wavelets on the [Wavelet Properties Browser](http://wavelets.pybytes.com) page. diff --git a/doc/source/regression/wp.md b/doc/source/regression/wp.md index 24316f93..5c230cda 100644 --- a/doc/source/regression/wp.md +++ b/doc/source/regression/wp.md @@ -59,23 +59,23 @@ def format_array(a): ## Create Wavelet Packet structure -Okay, let's create a sample {class}`WaveletPacket` object: +Okay, let's create a sample instance of the `WaveletPacket` class: ```{code-cell} x = [1, 2, 3, 4, 5, 6, 7, 8] wp = pywt.WaveletPacket(data=x, wavelet='db1', mode='symmetric') ``` -The input `data` and decomposition coefficients are stored in the -{attr}`WaveletPacket.data` attribute: +The input data and decomposition coefficients are stored in the +`WaveletPacket.data` attribute: ```{code-cell} print(wp.data) [1, 2, 3, 4, 5, 6, 7, 8] ``` -{class}`Nodes ` are identified by {attr}`paths <~Node.path>`. For the root -node the path is `''` and the decomposition level is `0`. +Nodes `Node` are identified by their paths, i.e., `Node.path`. For the root +node, the path is `''` and the decomposition level is `0`. ```{code-cell} # Should return blank @@ -86,14 +86,14 @@ print(repr(wp.path)) print(wp.level) ``` -The `maxlevel`, if not given as param in the constructor, is automatically -computed: +The `maxlevel` attribute, if not given as param in the constructor, is +automatically computed: ```{code-cell} print(wp['ad'].maxlevel) ``` -## Traversing WP tree +## Traversing the WP tree ### Accessing subnodes @@ -140,8 +140,7 @@ print(wp['aaa'].data) print(wp['aaa'].path) ``` -Ups, we have reached the maximum level of decomposition and got an -{exc}`IndexError`: +Oops, we have reached the maximum level of decomposition and received an `IndexError`: ```{code-cell} --- @@ -159,19 +158,20 @@ tags: [raises-exception] print(wp['ac']) ``` -which just yielded a {exc}`ValueError`. +which just yielded a `ValueError`. -### Accessing Node's attributes +### Accessing `Node`'s attributes -{class}`WaveletPacket` object is a tree data structure, which evaluates to a set -of {class}`Node` objects. {class}`WaveletPacket` is just a special subclass -of the {class}`Node` class (which in turn inherits from the {class}`BaseNode`). +The `WaveletPacket` object is a tree data structure, which evaluates to a set +of `Node` objects. `WaveletPacket` is just a special subclass +of the `Node` class (which in turn inherits from the `BaseNode` class). -Tree nodes can be accessed using the `obj[x]` ({meth}`Node.__getitem__`) +Tree nodes can be accessed using the `obj[x]` (`Node.__getitem__`) operator. -Each tree node has a set of attributes: {attr}`~Node.data`, {attr}`~Node.path`, -{attr}`~Node.node_name`, {attr}`~Node.parent`, {attr}`~Node.level`, -{attr}`~Node.maxlevel` and {attr}`~Node.mode`. + +Each tree node has a set of attributes: `Node.data`, `Node.path`, +`Node.node_name`, `Node.parent`, `Node.level`, +`Node.maxlevel` and `Node.mode`. ```{code-cell} x = [1, 2, 3, 4, 5, 6, 7, 8] @@ -225,7 +225,7 @@ or sorted based on the band frequency (`freq`): print([node.path for node in wp.get_level(3, 'freq')]) ``` -Note that {meth}`WaveletPacket.get_level` also performs automatic decomposition +Note that `WaveletPacket.get_level` also performs automatic decomposition until it reaches the specified `level`. ## Reconstructing data from Wavelet Packets @@ -235,7 +235,7 @@ x = [1, 2, 3, 4, 5, 6, 7, 8] wp = pywt.WaveletPacket(data=x, wavelet='db1', mode='symmetric') ``` -Now, let's create a new {class}`Wavelet Packet ` and set its nodes +Now, let's create a new instance of the `WaveletPacket` class and set its nodes with some data. ```{code-cell} @@ -247,8 +247,7 @@ new_wp['aa'] = wp['aa'].data new_wp['ad'] = [-2., -2.] ``` -For convenience, {attr}`Node.data` gets automatically extracted from the -{class}`Node` object: +For convenience, `Node.data` gets automatically extracted from the `Node` object: ```{code-cell} new_wp['d'] = wp['d'] @@ -261,13 +260,13 @@ print(new_wp.reconstruct(update=False)) ``` If the `update` param in the reconstruct method is set to `False`, the -node's {attr}`~Node.data` will not be updated. +node's `Node.data` will not be updated. ```{code-cell} print(new_wp.data) ``` -Otherwise, the {attr}`~Node.data` attribute will be set to the reconstructed +Otherwise, the `Node.data` attribute will be set to the reconstructed value. ```{code-cell} @@ -308,7 +307,7 @@ node = wp['ad'] print(node) ``` -To remove a node from the WP tree, use Python's `del obj[x]` ({class}`Node.__delitem__`): +To remove a node from the WP tree, use Python's `del obj[x]` (`Node.__delitem__`): ```{code-cell} del wp['ad'] diff --git a/doc/source/regression/wp2d.md b/doc/source/regression/wp2d.md index 45793c9a..98d78d48 100644 --- a/doc/source/regression/wp2d.md +++ b/doc/source/regression/wp2d.md @@ -54,20 +54,20 @@ x = numpy.array([[1, 2, 3, 4, 5, 6, 7, 8]] * 8, 'd') print(x) ``` -Now create a {class}`2D Wavelet Packet ` object: +Now create a 2D Wavelet Packet `pywt.WaveletPacket2D` object: ```{code-cell} wp = pywt.WaveletPacket2D(data=x, wavelet='db1', mode='symmetric') ``` The input `data` and decomposition coefficients are stored in the -{attr}`WaveletPacket2D.data` attribute: +`WaveletPacket2D.data` attribute: ```{code-cell} print(wp.data) ``` -{class}`Nodes ` are identified by paths. For the root node the path is +Nodes (the `Node2D>` class) are identified by paths. For the root node, the path is `''` and the decomposition level is `0`. ```{code-cell} @@ -78,7 +78,7 @@ print(repr(wp.path)) print(wp.level) ``` -The {attr}`WaveletPacket2D.maxlevel`, if not given in the constructor, is +`WaveletPacket2D.maxlevel`, if not given in the constructor, is automatically computed based on the data size: ```{code-cell} @@ -87,10 +87,10 @@ print(wp.maxlevel) ## Traversing WP tree -Wavelet Packet {class}`nodes ` are arranged in a tree. Each node in a WP -tree is uniquely identified and addressed by a {attr}`~Node2D.path` string. +Wavelet Packet nodes (`Node2D`) are arranged in a tree. Each node in a WP +tree is uniquely identified and addressed by a `Node2D.path` string. -In the 1D {class}`WaveletPacket` case nodes were accessed using `'a'` +In the 1D `WaveletPacket` case nodes were accessed using `'a'` (approximation) and `'d'` (details) path names (each node has two 1D children). @@ -103,7 +103,7 @@ to address the WP2D structure: - `v` - HL, high-low coefficients - `d` - HH, high-high coefficients -In other words, subnode naming corresponds to the {func}`dwt2` function output +In other words, subnode naming corresponds to the `dwt2` function output naming convention (as wavelet packet transform is based on the dwt2 transform): ``` @@ -121,7 +121,7 @@ naming convention (as wavelet packet transform is based on the dwt2 transform): ``` Knowing what the nodes names are, we can now access them using the indexing -operator `obj[x]` ({meth}`WaveletPacket2D.__getitem__`): +operator `obj[x]` (`WaveletPacket2D.__getitem__`): ```{code-cell} print(wp['a'].data) @@ -145,8 +145,8 @@ Similarly, a subnode of a subnode can be accessed by: print(wp['aa'].data) ``` -Indexing base {class}`WaveletPacket2D` (as well as 1D {class}`WaveletPacket`) -using compound path is just the same as indexing the WP subnode: +Indexing base 2D (`WaveletPacket2D`) (as well as 1D `WaveletPacket`) +using compound paths is just the same as indexing the WP subnode: ```{code-cell} node = wp['a'] @@ -170,9 +170,7 @@ tags: [raises-exception] print(wp['aaaa'].data) ``` - - -Ups, we have reached the maximum level of decomposition for the `'aaaa'` path, +Oops, we have reached the maximum level of decomposition for the `'aaaa'` path, which, by the way, was: ```{code-cell} @@ -190,10 +188,9 @@ print(wp['f']) ### Accessing Node2D's attributes -{class}`WaveletPacket2D` is a tree data structure, which evaluates to a set -of {class}`Node2D` objects. {class}`WaveletPacket2D` is just a special subclass -of the {class}`Node2D` class (which in turn inherits from a {class}`BaseNode`, -just like with {class}`Node` and {class}`WaveletPacket` for the 1D case.). +`WaveletPacket2D` is a tree data structure, which evaluates to a set +of `Node2D` objects. `WaveletPacket2D` is just a special the `Node2D` class (which in turn inherits from a `BaseNode` class +just like with `Node` and `WaveletPacket` for the 1D case). ```{code-cell} print(wp['av'].data) @@ -230,7 +227,7 @@ print(wp['av'].mode) ### Collecting nodes We can get all nodes on the particular level using the -{meth}`WaveletPacket2D.get_level` method: +`WaveletPacket2D.get_level` method: - 0 level - the root `wp` node: @@ -282,7 +279,7 @@ for i, path in enumerate(paths): print(path, end=' ') ``` -Note that {meth}`WaveletPacket2D.get_level` performs automatic decomposition +Note that `WaveletPacket2D.get_level` performs automatic decomposition until it reaches the given level. ## Reconstructing data from Wavelet Packets @@ -307,8 +304,8 @@ new_wp['d'] = [[0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0]] ``` -For convenience, {attr}`Node2D.data` gets automatically extracted from the -base {class}`Node2D` object: +For convenience, `Node2D.data` gets automatically extracted from the +base `Node2D` object: ```{code-cell} new_wp['h'] = wp['h'] # all zeros @@ -348,14 +345,14 @@ Just restore the node before the next examples: new_wp['va'] = wp['va'].data ``` -If the `update` param in the {meth}`WaveletPacket2D.reconstruct` method is set -to `False`, the node's {attr}`Node2D.data` attribute will not be updated. +If the `update` param in the `WaveletPacket2D.reconstruct` method is set +to `False`, the node's `Node2D.data` attribute will not be updated. ```{code-cell} print(new_wp.data) ``` -Otherwise, the {attr}`WaveletPacket2D.data` attribute will be set to the +Otherwise, the `WaveletPacket2D.data` attribute will be set to the reconstructed value. ```{code-cell} @@ -367,7 +364,7 @@ print(new_wp.data) ``` Since we have an interesting WP structure built, it is a good occasion to -present the {meth}`WaveletPacket2D.get_leaf_nodes` method, which collects +present the `WaveletPacket2D.get_leaf_nodes()` method, which collects non-zero leaf nodes from the WP tree: ```{code-cell} @@ -396,7 +393,7 @@ for i, path in enumerate(paths): ## Lazy evaluation :::{note} -This section is for the demonstration of PyWavelets' internals purposes +This section is for the demonstration of PyWavelets' internals' purposes only. Do not rely on the attribute access to nodes as presented in this example. ::: @@ -406,7 +403,7 @@ x = numpy.array([[1, 2, 3, 4, 5, 6, 7, 8]] * 8) wp = pywt.WaveletPacket2D(data=x, wavelet='db1', mode='symmetric') ``` -1. At first, the wp's attribute `a` is `None` +1. At first, the `wp`'s attribute `a` is `None` ```{code-cell} print(wp.a)