Wavelet filter banks and the discrete wavelet transform engine used by fastmath.transform.
A wavelet is a filter bank [dec_lo dec_hi rec_lo rec_hi] in PyWavelets orientation, see wavelet and wavelet-names. The transforms follow PyWavelets: dwt-level / idwt-level is one level of pywt.dwt / pywt.idwt (convolution with the decomposition filters and downsampling), with the signal extended at both ends according to a boundary mode:
:symmetric (default in fastmath.transform), :reflect, :periodic, :zero, :constant, :smooth, :antisymmetric, :antireflect - output length floor((N + L - 1) / 2) for a signal of length N and filters of length L; the extension is done by fastmath.signal.pad:periodization - output length ceil(N / 2), an odd-length signal is extended by its last valueMulti-level transforms, wavelet packets and their inverses are in fastmath.transform (fastmath.transform/dwt, fastmath.transform/wpt).
scaling-function and wavelet-function approximate the functions phi and psi by the cascade algorithm.
Wavelet filter banks and the discrete wavelet transform engine used by `fastmath.transform`. A wavelet is a filter bank `[dec_lo dec_hi rec_lo rec_hi]` in PyWavelets orientation, see [[wavelet]] and [[wavelet-names]]. The transforms follow PyWavelets: [[dwt-level]] / [[idwt-level]] is one level of `pywt.dwt` / `pywt.idwt` (convolution with the decomposition filters and downsampling), with the signal extended at both ends according to a boundary `mode`: * `:symmetric` (default in `fastmath.transform`), `:reflect`, `:periodic`, `:zero`, `:constant`, `:smooth`, `:antisymmetric`, `:antireflect` - output length `floor((N + L - 1) / 2)` for a signal of length `N` and filters of length `L`; the extension is done by `fastmath.signal.pad` * `:periodization` - output length `ceil(N / 2)`, an odd-length signal is extended by its last value Multi-level transforms, wavelet packets and their inverses are in `fastmath.transform` ([[fastmath.transform/dwt]], [[fastmath.transform/wpt]]). [[scaling-function]] and [[wavelet-function]] approximate the functions phi and psi by the cascade algorithm.
(->wavelet nm dec-lo)(->wavelet nm dec-lo dec-hi)(->wavelet nm dec-lo dec-hi rec-lo rec-hi)Creates a wavelet (filter bank) object, PyWavelets orientation.
[name dec-lo] - orthogonal wavelet from its decomposition low-pass filter: rec-lo is dec-lo reversed, rec-hi is (qmf rec-lo), dec-hi is rec-hi reversed[name dec-lo dec-hi] - orthogonal wavelet, reconstruction filters are the reversed decomposition filters[name dec-lo dec-hi rec-lo rec-hi] - general (biorthogonal) filter bankAll filters must have the same length, at least 2. Throws ex-info otherwise.
Creates a wavelet (filter bank) object, PyWavelets orientation. * `[name dec-lo]` - orthogonal wavelet from its decomposition low-pass filter: `rec-lo` is `dec-lo` reversed, `rec-hi` is `(qmf rec-lo)`, `dec-hi` is `rec-hi` reversed * `[name dec-lo dec-hi]` - orthogonal wavelet, reconstruction filters are the reversed decomposition filters * `[name dec-lo dec-hi rec-lo rec-hi]` - general (biorthogonal) filter bank All filters must have the same length, at least 2. Throws `ex-info` otherwise.
(coeffs-length n filter-length mode)Length of the coefficient bands after one level of dwt-level for a signal of length n, filter length filter-length and mode.
Length of the coefficient bands after one level of [[dwt-level]] for a signal of length `n`, filter length `filter-length` and `mode`.
(coeffs-size wv)Returns the filter length of a wavelet.
Returns the filter length of a wavelet.
(dwt-level wv signal mode)One level of the discrete wavelet transform of signal (a double-array), as pywt.dwt.
Returns [cA cD], two double-arrays of length coeffs-length.
One level of the discrete wavelet transform of `signal` (a `double-array`), as `pywt.dwt`. Returns `[cA cD]`, two `double-array`s of length [[coeffs-length]].
(idwt-level wv ca cd mode)One level of the inverse discrete wavelet transform, as pywt.idwt: reconstructs a signal from bands ca and cd (double-arrays of the same length n).
Returns a double-array of length 2n - L + 2 (2n for :periodization), which can be one longer than the original signal; the caller trims it.
One level of the inverse discrete wavelet transform, as `pywt.idwt`: reconstructs a signal from bands `ca` and `cd` (`double-array`s of the same length `n`). Returns a `double-array` of length `2n - L + 2` (`2n` for `:periodization`), which can be one longer than the original signal; the caller trims it.
(max-level n filter-length)Maximum useful decomposition level, as pywt.dwt_max_level: the largest k with (filter-length - 1) * 2^k <= n, 0 when n < filter-length - 1 or filter-length < 2.
Maximum useful decomposition level, as `pywt.dwt_max_level`: the largest `k` with `(filter-length - 1) * 2^k <= n`, 0 when `n < filter-length - 1` or `filter-length < 2`.
Boundary modes accepted by the transforms.
Boundary modes accepted by the transforms.
(phi wv)(phi wv kind)Returns the scaling (low-pass) filter, decomposition by default.
Kind can be:
:deconstruction, :dec, :de or :d - decomposition filter (default):reconstruction, :rec, :re or :r - reconstruction filterReturns the scaling (low-pass) filter, decomposition by default. Kind can be: * `:deconstruction`, `:dec`, `:de` or `:d` - decomposition filter (default) * `:reconstruction`, `:rec`, `:re` or `:r` - reconstruction filter
(psi wv)(psi wv kind)Returns the wavelet (high-pass) filter, decomposition by default.
Kind can be:
:deconstruction, :dec, :de or :d - decomposition filter (default):reconstruction, :rec, :re or :r - reconstruction filterReturns the wavelet (high-pass) filter, decomposition by default. Kind can be: * `:deconstruction`, `:dec`, `:de` or `:d` - decomposition filter (default) * `:reconstruction`, `:rec`, `:re` or `:r` - reconstruction filter
(qmf coeffs)Quadrature mirror filter of coeffs, as pywt.qmf: the filter reversed, with every odd element negated.
For an orthogonal wavelet the reconstruction high-pass filter is (qmf rec-lo).
Quadrature mirror filter of `coeffs`, as `pywt.qmf`: the filter reversed, with every odd element negated. For an orthogonal wavelet the reconstruction high-pass filter is `(qmf rec-lo)`.
(scaling-function wv)(scaling-function wv level)(scaling-function wv level reconstruction?)Returns the scaling function phi of a wavelet, as a function of x, computed as pywt.Wavelet.wavefun(level).
wv - wavelet name or objectlevel - refinement level (default 8): phi is sampled at 2^level points per unit by level reconstruction steps of a single coefficient 2^(level/2) and linearly interpolatedreconstruction? - for biorthogonal wavelets the reconstruction (true) or decomposition (false, default) function; ignored for orthogonal waveletsThe function is 0 outside the PyWavelets grid [0, (M-1)/2^level], M = max((L-1) 2^level, K + 2) for biorthogonal and M = max((L-1) 2^level + 1, K + 2) for orthogonal wavelets (L the filter length, K the length of the reconstructed part, K_0 = 1, K_i = 2 K_(i-1) + L - 2). For L >= 4 (biorthogonal) or L >= 3 (orthogonal) the first term wins: [0, L-1-1/2^level], [0, L-1]; for shorter filters the grid is [0, (K+1)/2^level] (haar: [0, 1 + 1/2^level]). Wavelets named biorX.Y / rbioX.Y are biorthogonal; another wavelet is orthogonal when its reconstruction filters are its reversed decomposition filters.
Throws ex-info for a level smaller than 1.
Returns the scaling function phi of a wavelet, as a function of `x`, computed as `pywt.Wavelet.wavefun(level)`. * `wv` - wavelet name or object * `level` - refinement level (default 8): phi is sampled at `2^level` points per unit by `level` reconstruction steps of a single coefficient `2^(level/2)` and linearly interpolated * `reconstruction?` - for biorthogonal wavelets the reconstruction (`true`) or decomposition (`false`, default) function; ignored for orthogonal wavelets The function is 0 outside the PyWavelets grid `[0, (M-1)/2^level]`, `M = max((L-1) 2^level, K + 2)` for biorthogonal and `M = max((L-1) 2^level + 1, K + 2)` for orthogonal wavelets (`L` the filter length, `K` the length of the reconstructed part, `K_0 = 1`, `K_i = 2 K_(i-1) + L - 2`). For `L >= 4` (biorthogonal) or `L >= 3` (orthogonal) the first term wins: `[0, L-1-1/2^level]`, `[0, L-1]`; for shorter filters the grid is `[0, (K+1)/2^level]` (haar: `[0, 1 + 1/2^level]`). Wavelets named `biorX.Y` / `rbioX.Y` are biorthogonal; another wavelet is orthogonal when its reconstruction filters are its reversed decomposition filters. Throws `ex-info` for a level smaller than 1.
(wavelet wavelet-name)Returns a wavelet (filter bank) object for a name from wavelet-names (string or keyword); a wavelet object is returned as is.
Throws ex-info for an unknown name.
Returns a wavelet (filter bank) object for a name from [[wavelet-names]] (string or keyword); a wavelet object is returned as is. Throws `ex-info` for an unknown name.
(wavelet-function wv)(wavelet-function wv level)(wavelet-function wv level reconstruction?)Returns the wavelet function psi of a wavelet, as a function of x, computed as pywt.Wavelet.wavefun(level).
Arguments as in scaling-function. Like PyWavelets, psi of a biorthogonal wavelet is negated when the number of vanishing moments of psi (X in biorX.Y) modulo 4 is not 1.
Returns the wavelet function psi of a wavelet, as a function of `x`, computed as `pywt.Wavelet.wavefun(level)`. Arguments as in [[scaling-function]]. Like PyWavelets, psi of a biorthogonal wavelet is negated when the number of vanishing moments of psi (`X` in `biorX.Y`) modulo 4 is not 1.
Names of all available wavelets.
Strings are the filter table, in PyWavelets / MATLAB naming:
haar, db1-db38, sym2-sym20, coif1-coif17, bior1.1-bior6.8, rbio1.1-rbio6.8, dmey (62 taps)db39-db45, sym21-sym45 (root choice as in MATLAB)la8-la20 - least asymmetric, equal to sym4-sym10battle3 - cubic Battle-Lemarie scaling filter truncated to 161 symmetric taps and one zero (162 taps)beyl, bl7, bl9, bl10, fk4, fk6, fk8, fk14, fk18, fk22, han2.3, han3.3, han4.5, han5.5, mb4.2, mb8.2, mb8.3, mb8.4, mb10.3, mb12.3, mb14.3, mb16.3, mb18.3, mb24.3, mb32.3, vaidPerfect reconstruction (idwt of dwt, any mode, default level) holds to about 1e-14 for most filters. Measured maximum errors (signals of length 301 and 512) above 1e-10: dmey 1.3e-1 (truncated filter, about 1e-2 except in :smooth mode; the same in PyWavelets), mb14.3 3.9e-4, mb8.2 7.5e-6, mb8.4 5.9e-6, mb4.2 4.1e-6, mb16.3 2.4e-6, mb10.3 2.2e-6, mb12.3 1.4e-6, mb24.3 9.1e-7, mb8.3 5.4e-7, mb32.3 5.2e-7, mb18.3 3.6e-7, vaid 3.6e-8, fk8 2.4e-8, fk22 1.4e-8, bl10 1.4e-8, bl9 5.1e-9, bl7 4.9e-10, sym20 1.6e-10 (PyWavelets table precision). Above the maximum useful level (filters long compared to the signal) reconstruction is not exact, as in PyWavelets.
Keywords are former JWave names, aliases of the strings: :haar, :daubechies-2...:daubechies-20 (dbN), :symlet-2...:symlet-20 (symN), :coiflet-1...:coiflet-5, :biorthogonal-11...:biorthogonal-68 (biorX.Y), :discrete-mayer (dmey), :cdf-53 (bior2.2), :cdf-97 (bior4.4), :battle-23 (battle3), :haar-orthogonal and :legendre-1 (haar).
Names of all available wavelets. Strings are the filter table, in PyWavelets / MATLAB naming: * from PyWavelets (exact copy): `haar`, `db1`-`db38`, `sym2`-`sym20`, `coif1`-`coif17`, `bior1.1`-`bior6.8`, `rbio1.1`-`rbio6.8`, `dmey` (62 taps) * computed by spectral factorisation (double precision): `db39`-`db45`, `sym21`-`sym45` (root choice as in MATLAB) * `la8`-`la20` - least asymmetric, equal to `sym4`-`sym10` * `battle3` - cubic Battle-Lemarie scaling filter truncated to 161 symmetric taps and one zero (162 taps) * MATLAB values copied by hand, lower precision: `beyl`, `bl7`, `bl9`, `bl10`, `fk4`, `fk6`, `fk8`, `fk14`, `fk18`, `fk22`, `han2.3`, `han3.3`, `han4.5`, `han5.5`, `mb4.2`, `mb8.2`, `mb8.3`, `mb8.4`, `mb10.3`, `mb12.3`, `mb14.3`, `mb16.3`, `mb18.3`, `mb24.3`, `mb32.3`, `vaid` Perfect reconstruction (`idwt` of `dwt`, any mode, default level) holds to about `1e-14` for most filters. Measured maximum errors (signals of length 301 and 512) above `1e-10`: `dmey` 1.3e-1 (truncated filter, about 1e-2 except in `:smooth` mode; the same in PyWavelets), `mb14.3` 3.9e-4, `mb8.2` 7.5e-6, `mb8.4` 5.9e-6, `mb4.2` 4.1e-6, `mb16.3` 2.4e-6, `mb10.3` 2.2e-6, `mb12.3` 1.4e-6, `mb24.3` 9.1e-7, `mb8.3` 5.4e-7, `mb32.3` 5.2e-7, `mb18.3` 3.6e-7, `vaid` 3.6e-8, `fk8` 2.4e-8, `fk22` 1.4e-8, `bl10` 1.4e-8, `bl9` 5.1e-9, `bl7` 4.9e-10, `sym20` 1.6e-10 (PyWavelets table precision). Above the maximum useful level (filters long compared to the signal) reconstruction is not exact, as in PyWavelets. Keywords are former JWave names, aliases of the strings: `:haar`, `:daubechies-2`...`:daubechies-20` (`dbN`), `:symlet-2`...`:symlet-20` (`symN`), `:coiflet-1`...`:coiflet-5`, `:biorthogonal-11`...`:biorthogonal-68` (`biorX.Y`), `:discrete-mayer` (`dmey`), `:cdf-53` (`bior2.2`), `:cdf-97` (`bior4.4`), `:battle-23` (`battle3`), `:haar-orthogonal` and `:legendre-1` (`haar`).
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |