WaveletTransformer

class jazzhands.WaveletTransformer(time, data, func_list=None, f1=None, omegas=None, nus=None, scales=None, taus=None, c=0.0125)[source] [edit on github]

Bases: object

Calculate the Weighted Wavelet Transform of the data y, measured at times t, evaluated at a wavelet scale omega and shift tau, for a decay factor of the Gaussian envelope c. Adapted from (5-11) in Foster (1996).

Parameters
timearray-like

Times of observations

dataarray-like

Observed data

func_listarray-like, optional

Array or list containing the basis functions, not yet evaluated. If you are unfamiliar with how these basis functions are derived, be very careful with setting this parameter. Default None [phi1, phi2, phi3]

f1function, optional

First basis function. Should be equivalent to `lambda x: numpy.ones(len(x)). Default None

omegasarray-like, optional

Angular frequency. Default None

nusarray-like, optional

Actual frequency. Corresponds to omegas/2pi. Default None

scalesarray-like, optional

Scales of the wavelet. Corresponds to 2pi/omegas. Default None

tausarray-like

Shift of wavelet; corresponds to a time. Default None

cfloat

Decay rate of Gaussian envelope of wavelet. Default 0.0125

Attributes Summary

c

data

nus

omegas

scales

taus

time

Methods Summary

auto_compute(nu_min, nu_max[, tau_min, …])

Calculate the Weighted Wavelet Transform of the object in a user- specified frequency window.

compute_wavelet([exclude, parallel, n_processes])

Calculate the Weighted Wavelet Transform of the object.

resolution(nu)

Calculates the resolution of the Morlet wavelet in time and frequency as a function of frequency

Attributes Documentation

c
data
nus
omegas
scales
taus
time

Methods Documentation

auto_compute(nu_min, nu_max, tau_min=None, tau_max=None, resolution_factor=3, exclude=True, parallel=False, n_processes=False)[source] [edit on github]

Calculate the Weighted Wavelet Transform of the object in a user- specified frequency window. auto_compute then figures out the frequency and time spacing in order to ensure resolution_factor grid points per resolution element, and sets the omegas, nus, scales, and taus attributes of the WaveletTransformer, and runs the wavelet transformation.

Parameters
nu_minfloat

Minimum frequency to calculate the wavelet on.

nu_maxfloat

Maximum frequency to calculate the wavelet on.

tau_minfloat, optional

Minimum shift to calculate the wavelet on. Defaults to the first data point.

tau_maxfloat, optional

Maximum shift to calculate the wavelet on. Defaults to the last data point.

resolution_factorint, optional

Number of points per resolution element

excludebool, optional

If exclude is True, returns 0 if the nearest data point is more than one cycle away. Default True.

parallelbool, optional

If multiprocessing is to be used. Default False.

n_processesint, optional

If mp is True, sets the processes parameter of multiprocessing.Pool. If not given, sets to multiprocessing.cpu_count()-1

Returns
omegasnumpy.ndarray

Frequencies

tausnumpy.ndarray

Time shifts

WWZnumpy.ndarray

WWZ of the data.

WWAnumpy.ndarray

Corresponding wavelet amplitude

compute_wavelet(exclude=True, parallel=False, n_processes=False)[source] [edit on github]

Calculate the Weighted Wavelet Transform of the object. Note that this can be incredibly slow for a large enough data array and a dense enough grid of omegas and taus, so we include multiprocessing to speed it up. You can update the omega/nu/scale and tau grids if you initialized the WaveletTransformer object with them, or set them now if you didn’t.

Parameters
excludebool, optional

If exclude is True, returns 0 if the nearest data point is more than one cycle away. Default True.

parallelbool, optional

If multiprocessing is to be used. Default False.

n_processesint, optional

If mp is True, sets the processes parameter of multiprocessing.Pool. If not given, sets to multiprocessing.cpu_count()-1

Returns
WWZnumpy.ndarray

WWZ of the data.

WWAnumpy.ndarray

Corresponding wavelet amplitude

resolution(nu)[source] [edit on github]

Calculates the resolution of the Morlet wavelet in time and frequency as a function of frequency