Skip to content

pyssage.wavelets.wavelet_analysis

Michael Rosenberg edited this page Oct 22, 2021 · 1 revision

pyssage » pyssage.wavelets » pyssage.wavelets.wavelet_analysis

Wavelet Analysis

This function allows one to perform a one-dimensional wavelet analysis. Currently five wavelet template functions (kernels) are available:

  • haar_wavelet
  • french_tophat_wavelet
  • mexican_hat_wavelet
  • morlet_wavelet
  • sine_wavelet
For our purposes, a wavelet function g(r) is a scalable windowing function whose integral over all r equals zero. One way to think of this is that the wavelet function describes a template that can be scaled to a desired size, then slid along the transect. When the template fits the observed data well, the value of the wavelet transform at that position is high; when it does not, the value is low. The wavelet transform at position px for scale bk is equal to:

,

where d(p) is the value of the data at position p and f(px,pi) is the displacement between positions px and pi (the displacement is the signed distance, i.e., it can be negative).

The overall variance for a given scale is

,

or the average of the squared wavelet transforms at all positions, while the overall variance for a given position is

,

or the average of the squared wavelet transform over all scales (m is the total number of measured scales).

Wavelet results can be plotted using draw_wavelet_result

Usage

wavelet_analysis(transect: numpy.ndarray, wavelet=haar_wavelet, min_block_size: int = 1, max_block_size: int = 0,
                 block_step: int = 1, wrap: bool = False, unit_scale: Number = 1, npermutations: int = 0,
                 alpha: float = 0.05)
Parameters: transect: a single dimensional numpy array containing the transect data
wavelet: a wavelet function. Valid options include: haar_wavelet (default), french_tophat_wavelet, mexican_hat_wavelet, morlet_wavelet, and sine_wavelet
min_block_size: the smallest block size of the analysis (default = 1)
max_block_size: the largest block size of the analysis (default = 0, indicating 50% of the transect length)
block_step: the incremental size increase of each block size (default = 1)
wrap: treat the transect as a circle where the ends meet (default = False); only applies to 1D analyses
unit_scale: represents the unit scale of a single block (default = 1). Can be used to rescale the units of the output, e.g., if the blocks are measured in centimeters, you could use a scale of 0.01 to have the output expressed in meters.
npermutations: the number of replicate permutations for the analysis
alpha: the alpha value to report the confidence limit at (default = 0.05)
Returns: w_output: A numpy.ndarray containing scale x position variances
v_output: A two-column numpy.ndarray containing variances by scale
p_output: A two-column numpy.ndarray containing variances by position
w_all: A numpy.ndarray containing the raw randomization outputs of the w-matrix if permutations were performed, None otherwise.
v_all: A numpy.ndarray containing the raw randomization outputs of the v-matrix if permutations were performed, None otherwise.
p_all: A numpy.ndarray containing the raw randomization outputs of the p-matrix if permutations were performed, None otherwise.

Clone this wiki locally