MCPcopy Create free account
hub / github.com/PyWavelets/pywt / swtn

Function swtn

pywt/_swt.py:540–677  ·  view source on GitHub ↗

n-dimensional stationary wavelet transform. Parameters ---------- data : array_like n-dimensional array with input data. wavelet : Wavelet object or name string, or tuple of wavelets Wavelet to use. This can also be a tuple of wavelets to apply per axis

(data, wavelet, level, start_level=0, axes=None, trim_approx=False,
         norm=False)

Source from the content-addressed store, hash-verified

538
539
540def swtn(data, wavelet, level, start_level=0, axes=None, trim_approx=False,
541 norm=False):
542 """
543 n-dimensional stationary wavelet transform.
544
545 Parameters
546 ----------
547 data : array_like
548 n-dimensional array with input data.
549 wavelet : Wavelet object or name string, or tuple of wavelets
550 Wavelet to use. This can also be a tuple of wavelets to apply per
551 axis in ``axes``.
552 level : int
553 The number of decomposition steps to perform.
554 start_level : int, optional
555 The level at which the decomposition will start (default: 0)
556 axes : sequence of ints, optional
557 Axes over which to compute the SWT. A value of ``None`` (the
558 default) selects all axes. Axes may not be repeated.
559 trim_approx : bool, optional
560 If True, approximation coefficients at the final level are retained.
561 norm : bool, optional
562 If True, transform is normalized so that the energy of the coefficients
563 will be equal to the energy of ``data``. In other words,
564 ``np.linalg.norm(data.ravel())`` will equal the norm of the
565 concatenated transform coefficients when ``trim_approx`` is True.
566
567 Returns
568 -------
569 [{coeffs_level_n}, ..., {coeffs_level_1}]: list of dict
570 Results for each level are arranged in a dictionary, where the key
571 specifies the transform type on each dimension and value is a
572 n-dimensional coefficients array.
573
574 For example, for a 2D case the result at a given level will look
575 something like this::
576
577 {'aa': <coeffs> # A(LL) - approx. on 1st dim, approx. on 2nd dim
578 'ad': <coeffs> # V(LH) - approx. on 1st dim, det. on 2nd dim
579 'da': <coeffs> # H(HL) - det. on 1st dim, approx. on 2nd dim
580 'dd': <coeffs> # D(HH) - det. on 1st dim, det. on 2nd dim
581 }
582
583 For user-specified ``axes``, the order of the characters in the
584 dictionary keys map to the specified ``axes``.
585
586 If ``trim_approx`` is ``True``, the first element of the list contains
587 the array of approximation coefficients from the final level of
588 decomposition, while the remaining coefficient dictionaries contain
589 only detail coefficients. This matches the behavior of `pywt.wavedecn`.
590
591 Notes
592 -----
593 The implementation here follows the "algorithm a-trous" and requires that
594 the signal length along the transformed axes be a multiple of ``2**level``.
595 If this is not the case, the user should pad up to an appropriate size
596 using a function such as ``numpy.pad``.
597

Callers 1

swt2Function · 0.85

Calls 2

_wavelets_per_axisFunction · 0.85

Tested by

no test coverage detected