Skip to content

Commit ca554db

Browse files
committed
extend docs.
1 parent 588733c commit ca554db

File tree

4 files changed

+32
-6
lines changed

4 files changed

+32
-6
lines changed

docs/intro.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ The matrix nature of these operators explains the capital boldface notation.
5959
Coefficient subscripts record the path that leads to a particular coefficient.
6060
:py:meth:`ptwt.packets.WaveletPacket` provides this functionality for single dimensional inputs.
6161

62+
.. _sec-fwt-2d:
63+
64+
The two-dimensional transform
65+
-----------------------------
6266

6367
This toolbox provides two dimensional input processing functionality.
6468
We construct filter quadruples from the original filter pairs to process two-dimensional inputs.

docs/intro_cwt.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.. _sec-cwt:
2+
13
Introduction to continuous wavelet transforms
24
=============================================
35

src/ptwt/conv_transform.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,7 @@ def wavedec(
279279
the convolution filter, with :math:`k \in {A, D}`, where :math:`A` for
280280
approximation and :math:`D` for detail. The processes uses approximation
281281
coefficients as inputs for higher scales.
282+
Set the `level` argument to choose the largest scale.
282283
283284
Args:
284285
data (torch.Tensor): The input time series,
@@ -299,7 +300,7 @@ def wavedec(
299300
Returns:
300301
list: A list::
301302
302-
[cA_n, cD_n, cD_n-1, …, cD2, cD1]
303+
[cA_s, cD_s, cD_s-1, …, cD2, cD1]
303304
304305
containing the wavelet coefficients. A denotes
305306
approximation and D detail coefficients.

src/ptwt/conv_transform_2.py

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,25 @@ def wavedec2(
132132
level: Optional[int] = None,
133133
axes: Tuple[int, int] = (-2, -1),
134134
) -> List[Union[torch.Tensor, Tuple[torch.Tensor, torch.Tensor, torch.Tensor]]]:
135-
"""Run a two-dimensional wavelet transformation.
135+
r"""Run a two-dimensional wavelet transformation.
136136
137137
This function relies on two-dimensional convolutions.
138-
We transform the last two axes by default.
138+
Outer products allow the construction of 2D-filters from 1D filter arrays
139+
:ref:`(see fwt-intro) <sec-fwt-2d>`.
140+
It transforms the last two axes by default.
141+
This function computes
142+
143+
.. math::
144+
\mathbf{x}_s *_2 \mathbf{h}_k = \mathbf{c}_{k, s+1}
145+
146+
with :math:`k \in [a, h, v, d]` and
147+
:math:`s \in \mathbb{N}_0` the set of natural numbers,
148+
where :math:`\mathbf{x}_0` is equal to
149+
the original input image :math:`\mathbf{X}`.
150+
:math:`*_2` indicates two dimensional-convolution.
151+
Computations at subsequent scales work exclusively with
152+
approximation coefficients :math:`c_{a, s}`
153+
as inputs. Setting the `level` argument allows choosing the largest scale.
139154
140155
Args:
141156
data (torch.Tensor): The input data tensor with any number of dimensions.
@@ -158,7 +173,7 @@ def wavedec2(
158173
list: A list containing the wavelet coefficients.
159174
The coefficients are in pywt order. That is::
160175
161-
[cAn, (cHn, cVn, cDn), … (cH1, cV1, cD1)] .
176+
[cAs, (cHs, cVs, cDs), … (cH1, cV1, cD1)] .
162177
163178
A denotes approximation, H horizontal, V vertical
164179
and D diagonal coefficients.
@@ -230,11 +245,14 @@ def waverec2(
230245
) -> torch.Tensor:
231246
"""Reconstruct a signal from wavelet coefficients.
232247
248+
This function undoes the effect of the analysis
249+
or forward transform by running transposed convolutions.
250+
233251
Args:
234252
coeffs (list): The wavelet coefficient list produced by wavedec2.
235253
The coefficients must be in pywt order. That is::
236254
237-
[cAn, (cHn, cVn, cDn), … (cH1, cV1, cD1)] .
255+
[cAs, (cHs, cVs, cDs), … (cH1, cV1, cD1)] .
238256
239257
A denotes approximation, H horizontal, V vertical,
240258
and D diagonal coefficients.
@@ -244,7 +262,8 @@ def waverec2(
244262
last two. Defaults to (-2, -1).
245263
246264
Returns:
247-
torch.Tensor: The reconstructed signal of shape ``[batch, height, width]`` or
265+
torch.Tensor:
266+
The reconstructed signal of shape ``[batch, height, width]`` or
248267
``[batch, channel, height, width]`` depending on the input to `wavedec2`.
249268
250269
Raises:

0 commit comments

Comments
 (0)