Signal padding (boundary extension).
Every padding function takes a signal as a double-array, a target length N and a side, and returns a new double-array of length N. The original signal is placed according to side:
:left - padding added before the signal (signal ends at the last position):right - padding added after the signal (signal starts at position 0):both - padding split between both ends; when the padding length is odd, the extra sample goes to the leftAvailable methods (names of the corresponding PyWavelets / NumPy modes in brackets):
zero - zeros (zero, constant with 0)edge - repeated edge value (constant in PyWavelets, edge in NumPy)periodic - periodic copies (periodic, wrap)symmetric - mirrored copies including the edge sample (symmetric)reflect - mirrored copies excluding the edge sample (reflect)antisymmetric - mirrored and negated copies (antisymmetric)antireflect - point reflection around the edge sample (antireflect, NumPy reflect with reflect_type='odd')linear - linear extrapolation of the two edge samples (smooth)The padding can be longer than the signal, in which case the extension pattern repeats. A one-sample signal is padded with copies of that sample in every method except zero and antisymmetric (alternating sign), as in PyWavelets.
Every method throws ex-info when the signal is empty, when N is smaller than the signal length or when side is unknown.
Signal padding (boundary extension). Every padding function takes a signal as a `double-array`, a target length `N` and a `side`, and returns a new `double-array` of length `N`. The original signal is placed according to `side`: * `:left` - padding added before the signal (signal ends at the last position) * `:right` - padding added after the signal (signal starts at position 0) * `:both` - padding split between both ends; when the padding length is odd, the extra sample goes to the left Available methods (names of the corresponding PyWavelets / NumPy modes in brackets): * [[zero]] - zeros (`zero`, `constant` with 0) * [[edge]] - repeated edge value (`constant` in PyWavelets, `edge` in NumPy) * [[periodic]] - periodic copies (`periodic`, `wrap`) * [[symmetric]] - mirrored copies including the edge sample (`symmetric`) * [[reflect]] - mirrored copies excluding the edge sample (`reflect`) * [[antisymmetric]] - mirrored and negated copies (`antisymmetric`) * [[antireflect]] - point reflection around the edge sample (`antireflect`, NumPy `reflect` with `reflect_type='odd'`) * [[linear]] - linear extrapolation of the two edge samples (`smooth`) The padding can be longer than the signal, in which case the extension pattern repeats. A one-sample signal is padded with copies of that sample in every method except [[zero]] and [[antisymmetric]] (alternating sign), as in PyWavelets. Every method throws `ex-info` when the signal is empty, when `N` is smaller than the signal length or when `side` is unknown.
(antireflect signal N side)Returns signal reflected anti-symmetrically (point reflection) around the edge samples.
... 2s1-s3 2s1-s2 | s1 s2 ... sn-1 sn | 2sn-sn-1 2sn-sn-2 ...
Longer paddings continue the pattern around the newly created edge sample. A one-sample signal is padded with its value.
Returns signal reflected anti-symmetrically (point reflection) around the edge samples. ... 2s1-s3 2s1-s2 | s1 s2 ... sn-1 sn | 2sn-sn-1 2sn-sn-2 ... Longer paddings continue the pattern around the newly created edge sample. A one-sample signal is padded with its value.
(antisymmetric signal N side)Returns signal padded with mirrored and negated copies of the original signal.
... sn -sn ... -s1 | s1 ... sn | -sn ... -s1 s1 ....
Returns signal padded with mirrored and negated copies of the original signal. ... sn -sn ... -s1 | s1 ... sn | -sn ... -s1 s1 ....
(edge signal N side)Returns signal padded with edge values.
s1 ... s1 | s1 ... sn | sn ... sn
Returns signal padded with edge values. s1 ... s1 | s1 ... sn | sn ... sn
(linear signal N side)Returns signal padded with a linear extrapolation of the two edge samples on each side.
... s1-2d1 s1-d1 | s1 s2 ... sn-1 sn | sn+dn sn+2dn ...
where d1 = s2 - s1 and dn = sn - sn-1. A one-sample signal is padded with its value.
Returns signal padded with a linear extrapolation of the two edge samples on each side. ... s1-2d1 s1-d1 | s1 s2 ... sn-1 sn | sn+dn sn+2dn ... where `d1 = s2 - s1` and `dn = sn - sn-1`. A one-sample signal is padded with its value.
(out-len-pos signal N side)Returns a zero-padded copy of signal together with its placement: [out len start end].
out - new double-array of length N with signal copied into it, zeros elsewherelen - signal lengthstart - index of the first signal sample in out (see pad-position)end - index just after the last signal sampleThis is the building block of all padding methods. Throws ex-info when signal is empty, N is smaller than the signal length or side is unknown.
Returns a zero-padded copy of `signal` together with its placement: `[out len start end]`. * `out` - new `double-array` of length `N` with `signal` copied into it, zeros elsewhere * `len` - signal length * `start` - index of the first signal sample in `out` (see [[pad-position]]) * `end` - index just after the last signal sample This is the building block of all padding methods. Throws `ex-info` when `signal` is empty, `N` is smaller than the signal length or `side` is unknown.
(pad-position side N len)Returns the index at which the original signal starts in the padded one.
side - :left, :right or :both (for :both an odd padding length puts the extra sample on the left)N - target (padded) lengthlen - signal lengthThrows ex-info for an unknown side.
Returns the index at which the original signal starts in the padded one. * `side` - `:left`, `:right` or `:both` (for `:both` an odd padding length puts the extra sample on the left) * `N` - target (padded) length * `len` - signal length Throws `ex-info` for an unknown `side`.
(periodic signal N side)Returns signal padded with copies of the original signal.
... sn s1 ... sn | s1 ... sn | s1 ... sn s1 ...
Returns signal padded with copies of the original signal. ... sn s1 ... sn | s1 ... sn | s1 ... sn s1 ...
(reflect signal N side)Returns signal padded with reflected copies of the original signal, the edge sample is not repeated.
... s3 s2 | s1 s2 ... sn-1 sn | sn-1 sn-2 ...
A one-sample signal is padded with its value.
Returns signal padded with reflected copies of the original signal, the edge sample is not repeated. ... s3 s2 | s1 s2 ... sn-1 sn | sn-1 sn-2 ... A one-sample signal is padded with its value.
(symmetric signal N side)Returns signal padded with mirrored copies of the original signal.
... sn sn ... s1 | s1 ... sn | sn ... s1 s1 ...
Returns signal padded with mirrored copies of the original signal. ... sn sn ... s1 | s1 ... sn | sn ... s1 s1 ...
(zero signal N side)Returns zero-padded signal.
0 ... 0 | s1 ... sn | 0 ... 0
Returns zero-padded signal. 0 ... 0 | s1 ... sn | 0 ... 0
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 |