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:
objectCalculate the Weighted Wavelet Transform of the data
y, measured at timest, evaluated at a wavelet scale omega and shift tau, for a decay factor of the Gaussian envelopec. 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
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_computethen figures out the frequency and time spacing in order to ensureresolution_factorgrid points per resolution element, and sets theomegas,nus,scales, andtausattributes of theWaveletTransformer, 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
mpis True, sets theprocessesparameter ofmultiprocessing.Pool. If not given, sets tomultiprocessing.cpu_count()-1
- Returns
- omegas
numpy.ndarray Frequencies
- taus
numpy.ndarray Time shifts
- WWZ
numpy.ndarray WWZ of the data.
- WWA
numpy.ndarray Corresponding wavelet amplitude
- omegas
- 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
WaveletTransformerobject 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
mpis True, sets theprocessesparameter ofmultiprocessing.Pool. If not given, sets tomultiprocessing.cpu_count()-1
- Returns
- WWZ
numpy.ndarray WWZ of the data.
- WWA
numpy.ndarray Corresponding wavelet amplitude
- WWZ
- resolution(nu)[source] [edit on github]¶
Calculates the resolution of the Morlet wavelet in time and frequency as a function of frequency