API#
The main functionality of pywavelet is to help transform/inverse transform data from the time/frequency domains to the WDM-wavelet domain.
Transform Functions#
- pywavelet.transforms.from_time_to_wavelet(timeseries: TimeSeries, Nf: int | None = None, Nt: int | None = None, nx: float = 4.0, mult: int = 32) Wavelet #
Transform time-domain data to wavelet-domain data.
This function performs a forward wavelet transform, converting a time-domain signal into a wavelet-domain representation.
Parameters#
- timeseriesTimeSeries
Input time-domain data, represented as a TimeSeries object.
- Nfint, optional
Number of frequency bins for the wavelet transform. Default is None.
- Ntint, optional
Number of time bins for the wavelet transform. Default is None.
- nxfloat, optional
Number of standard deviations for the phi_vec, controlling the width of the wavelets. Default is 4.0.
- multint, optional
Number of time bins to use for the wavelet transform. Ensure mult is not larger than half the number of time bins (Nt). Default is 32.
Returns#
- Wavelet
A Wavelet object representing the transformed wavelet-domain data.
Warnings#
There can be significant leakage if mult is too small. The transform is only approximately exact if mult = Nt / 2.
Notes#
The function warns when the mult value is too large, potentially leading to inaccurate results.
- pywavelet.transforms.from_freq_to_wavelet(freqseries: FrequencySeries, Nf: int | None = None, Nt: int | None = None, nx: float = 4.0) Wavelet #
Transform frequency-domain data to wavelet-domain data.
This function performs a forward wavelet transform, converting a frequency-domain signal into a wavelet-domain representation.
Parameters#
- freqseriesFrequencySeries
Input frequency-domain data, represented as a FrequencySeries object.
- Nfint, optional
Number of frequency bins for the wavelet transform. Default is None.
- Ntint, optional
Number of time bins for the wavelet transform. Default is None.
- nxfloat, optional
Number of standard deviations for the phi_vec, controlling the width of the wavelets. Default is 4.0.
Returns#
- Wavelet
A Wavelet object representing the transformed wavelet-domain data.
Notes#
The function normalizes the wavelet-domain data to ensure consistency during the transformation process.
- pywavelet.transforms.from_wavelet_to_freq(wave_in: Wavelet, dt: float, nx: float = 4.0) FrequencySeries #
Perform an inverse wavelet transform to the frequency domain.
This function converts a wavelet-domain signal into a frequency-domain signal using the inverse wavelet transform algorithm.
Parameters#
- wave_inWavelet
Input wavelet, represented by a Wavelet object.
- dtfloat
Time step of the wavelet data.
- nxfloat, optional
Scaling parameter for the phi vector used in the transformation. Default is 4.0.
Returns#
- FrequencySeries
A FrequencySeries object containing the signal transformed into the frequency domain.
Notes#
The transformation involves normalizing the output by the square root of 2 to ensure the proper backwards transformation.
- pywavelet.transforms.from_wavelet_to_time(wave_in: Wavelet, dt: float, nx: float = 4.0, mult: int = 32) TimeSeries #
Perform an inverse wavelet transform to the time domain.
This function converts a wavelet-domain signal to a time-domain signal using the inverse wavelet transform algorithm.
Parameters#
- wave_inWavelet
Input wavelet, represented by a Wavelet object.
- dtfloat
Time step of the wavelet data.
- nxfloat, optional
Scaling parameter for the phi vector used in the transformation. Default is 4.0.
- multint, optional
Multiplier parameter for the phi vector. Ensures that the mult value is not larger than half the number of time bins (wave_in.Nt). Default is 32.
Returns#
- TimeSeries
A TimeSeries object containing the signal transformed into the time domain.
Notes#
The transformation involves normalizing the output by the square root of 2 to ensure the proper backwards transformation.