Module quantum_inferno.cwt_atoms
This module contains functions to construct quantized, standardized information packets using binary metrics.
Functions
def chirp_amplitude(scale_atom: float, gamma: float, index_shift: float) ‑> Tuple[float, float]
-
Find chirp amplitude
:param scale_atom: from chirp_scale or chirp_scale_from_order :param gamma: from index_shift, M/(2Q) :param index_shift: index of shift :return: normal_scaling, spectrum_scaling
def chirp_centered_4cwt(band_order_nth: float, sig_or_time: numpy.ndarray, scale_frequency_center_hz: float, frequency_sample_rate_hz: float, index_shift: float = 0, scale_base: float = 2.0, dictionary_type: str = 'norm') ‑> Tuple[numpy.ndarray, numpy.ndarray]
-
Gabor atoms for CWT computation centered on the duration of signal
:param sig_or_time: time or time series, wavelet matches this duration :param band_order_nth: Nth order of constant Q bands :param scale_frequency_center_hz: center frequency fc in Hz :param frequency_sample_rate_hz: sample rate is Hz :param index_shift: index of shift :param scale_base: G2 or G3 :param dictionary_type: Canonical unit-norm ("norm") or unit spectrum ("spect") :return: waveform_complex, time_shifted_s
def chirp_complex(band_order_nth: float, time_s: numpy.ndarray, offset_time_s: float, scale_frequency_center_hz: float, frequency_sample_rate_hz: float, index_shift: float = 0, scale_base: float = 2.0) ‑> Tuple[numpy.ndarray, numpy.ndarray, float, float]
-
Quantum chirp for specified band_order_Nth and arbitrary time duration Unscaled, to be used by both Dictionary 1 and Dictionary 2
:param band_order_nth: Nth order of constant Q bands :param time_s: time in seconds, duration should be greater than or equal to M/fc :param offset_time_s: offset time in seconds, should be between min and max of time_s :param scale_frequency_center_hz: center frequency fc in Hz :param frequency_sample_rate_hz: sample rate on Hz :param index_shift: Redshift = -1, Blueshift = +1, None=0 :param scale_base: G2 or G3 :return: waveform_complex, time_shifted_s, normal_scaling, spectrum_scaling
def chirp_frequency_bands(scale_order_input: float, frequency_low_input: float, frequency_sample_rate_input: float, frequency_high_input: float, index_shift: float = 0, frequency_ref: float = 1.0, scale_base: float = 2.0) ‑> Tuple[float, float, float, float, numpy.ndarray, numpy.ndarray, numpy.ndarray]
-
Calculate frequency bands for chirp
:param scale_order_input: Nth order specification :param frequency_low_input: lowest frequency of interest :param frequency_sample_rate_input: sample rate :param frequency_high_input: highest frequency of interest :param index_shift: index of shift :param frequency_ref: reference frequency :param scale_base: positive reference Base G > 1. Default is G2 :return: Nth order, cycles M, quality factor Q, gamma, geometric center of frequencies, start frequency, end frequency
def chirp_mqg_from_n(band_order_nth: float, index_shift: float = 0, scale_base: float = 2.0) ‑> Tuple[float, float, float]
-
Compute the quality factor Q and multiplier M for a specified band order N. N is THE quantization parameter for the binary constant Q wavelet filters.
:param band_order_nth: Band order, must be > 0.75 or reverts to N=3 :param index_shift: index of shift. Default is 0. :param scale_base: positive reference Base G > 1. Default is G2 :return: cycles M, quality factor Q, gamma
def chirp_p_complex(scale_atom: float, gamma: float, index_shift: float) ‑> complex
-
Fundamental chirp variable
:param scale_atom: from chirp_scale or chirp_scale_from_order :param gamma: from index_shift, M/(2Q) :param index_shift: index of shift :return: p_complex
def chirp_scale(cycles_m: float, scale_frequency_center_hz: Union[numpy.ndarray, float], frequency_sample_rate_hz: float) ‑> float
-
Non-dimensional scale for canonical Morlet wavelet
:param cycles_m: number of cycles per band period :param scale_frequency_center_hz: scale frequency in hz :param frequency_sample_rate_hz: sample rate in hz :return: scale atom
def chirp_scale_from_order(band_order_nth: float, scale_frequency_center_hz: float, frequency_sample_rate_hz: float, index_shift: float = 0, scale_base: float = 2.0) ‑> float
-
Non-dimensional scale for canonical Morlet wavelet
:param band_order_nth: Band order, must be > 0.75 or reverts to N=3 :param scale_frequency_center_hz: scale frequency in hz :param frequency_sample_rate_hz: sample rate in hz :param index_shift: index fo shift. Default is 0.0 :param scale_base: positive reference Base G > 1. Default is G2 :return: scale atom
def chirp_scales_from_duration(band_order_nth: float, sig_duration_s: float, index_shift: float = 0.0, scale_base: float = 2.0) ‑> Tuple[float, float]
-
Calculate scale factor for time and frequency from chirp duration
:param band_order_nth: Band order :param sig_duration_s: signal duration in seconds :param index_shift: index fo shift. Default is 0.0 :param scale_base: positive reference Base G > 1. Default is G2 :return: time in seconds and frequency in Hz scale factors
def chirp_spectrum(frequency_hz: numpy.ndarray, offset_time_s: float, band_order_nth: float, frequency_center_hz: float, frequency_sample_rate_hz: float, index_shift: float = 0, scale_base: float = 2.0) ‑> Tuple[Union[complex, float, numpy.ndarray], numpy.ndarray]
-
Spectrum of quantum wavelet for specified band_order_Nth and arbitrary time duration
:param frequency_hz: frequency range below Nyquist :param offset_time_s: time of wavelet centroid :param band_order_nth: Nth order of constant Q bands :param frequency_center_hz: band center frequency in Hz :param frequency_sample_rate_hz: sample rate on Hz :param index_shift: index of shift. Default is 0.0 :param scale_base: positive reference Base G > 1. Default is G2 :return: Fourier transform of the Gabor atom and shifted frequency in hz
def chirp_spectrum_centered(band_order_nth: float, scale_frequency_center_hz: float, frequency_sample_rate_hz: float, index_shift: float = 0, scale_base: float = 2.0) ‑> Tuple[Union[complex, float, numpy.ndarray], numpy.ndarray]
-
Spectrum of quantum wavelet for specified band_order_Nth and arbitrary time duration
:param band_order_nth: Nth order of constant Q-bands :param scale_frequency_center_hz: band center frequency in Hz :param frequency_sample_rate_hz: sample rate on Hz :param index_shift: index of shift. Default is 0.0 :param scale_base: positive reference Base G > 1. Default is G2 :return: Fourier transform of the Gabor atom and shifted frequency in hz
def chirp_time(time_s: numpy.ndarray, offset_time_s: float, frequency_sample_rate_hz: float) ‑> numpy.ndarray
-
Scaled time-shifted time
:param time_s: array with time :param offset_time_s: offset time in seconds :param frequency_sample_rate_hz: sample rate in Hz :return: numpy array with time-shifted time
def chirp_uncertainty(scale_atom: float, frequency_sample_rate_hz: float, gamma: float, index_shift: float) ‑> Tuple[float, float, float]
-
Calculate the uncertainty of chirp
:param scale_atom: from chirp_scale or chirp_scale_from_order :param frequency_sample_rate_hz: sample rate in hz :param gamma: from index_shift, M/(2Q) :param index_shift: index of shift :return: time std in seconds, frequency std in Hz, angular frequency std in Hz
def cwt_chirp_complex(band_order_nth: float, sig_wf: numpy.ndarray, frequency_low_hz: float, frequency_sample_rate_hz: float, frequency_high_hz: float = 1e+42, cwt_type: str = 'fft', index_shift: float = 0, frequency_ref: float = 1.0, scale_base: float = 2.0, dictionary_type: str = 'norm') ‑> Tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray, numpy.ndarray]
-
Calculate CWT for chirp
:param band_order_nth: Nth order of constant Q bands :param sig_wf: array with input signal :param frequency_low_hz: lowest frequency in Hz :param frequency_sample_rate_hz: sample rate in Hz :param frequency_high_hz: highest frequency in Hz :param cwt_type: one of "conv", "fft", or "morlet2". Default is "fft" Address ghost folding in "fft", compared to "conv" :param index_shift: index of shift. Default is 0.0 :param frequency_ref: reference frequency in Hz. Default is F1HZ :param scale_base: G2 or G3. Default is G2 :param dictionary_type: Canonical unit-norm ("norm") or unit spectrum ("spect"). Default is "norm" :return: cwt, cwt_bits, time_s, frequency_cwt_hz
def cwt_chirp_from_sig(sig_wf: numpy.ndarray, frequency_sample_rate_hz: float, band_order_nth: float = 3, cwt_type: str = 'fft', index_shift: float = 0, frequency_ref: float = 1.0, scale_base: float = 2.0, dictionary_type: str = 'norm') ‑> Tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray, numpy.ndarray]
-
Calculate CWT for chirp
:param sig_wf: array with input signal :param frequency_sample_rate_hz: sample rate in Hz :param band_order_nth: Nth order of constant Q bands :param cwt_type: one of "conv", "fft", or "morlet2". Default is "fft" :param index_shift: index of shift. Default is 0.0 :param frequency_ref: reference frequency in Hz. Default is F1HZ :param scale_base: G2 or G3. Default is G2 :param dictionary_type: Canonical unit-norm ("norm") or unit spectrum ("spect"). Default is "norm" :return: cwt, cwt_bits, time_s, frequency_cwt_hz