Module quantum_inferno.utilities.frequency_scales

Utilities for calculating frequencies for both linear and logarithmic scales.

Functions

def get_band_numbers(sample_rate_hz: float, band_order: float, start_hz: float = None, end_hz: float = None, base: float = 1.9952623149688795, reference_frequency: float = 1) ‑> numpy.ndarray

Get the band numbers with given sample rate, band order, start and end frequency. Default gets band order starting at 1 Hz and ends at Nyquist frequency.

:param sample_rate_hz: sample rate of the signal :param band_order: band order :param start_hz: start frequency in Hz :param end_hz: end frequency in Hz :param base: base for the logarithmic scale (default 10 ** 0.3) :param reference_frequency: reference frequency for the logarithmic scale (default 1) :return: band numbers

def get_linear_frequency_bins_range(sample_rate_hz: float, segment_length: int, start_hz: Optional[float] = None, end_hz: Optional[float] = None) ‑> numpy.ndarray

Get the frequency bins with given sample rate and segment length that matches output from scipy.signal.spectrogram. Default starts at 0 Hz and ends at Nyquist frequency.

:param sample_rate_hz: sample rate of the signal :param segment_length: length of the segment :param start_hz: Optional start frequency in Hz. If None, value is set to 0. Default None :param end_hz: Optional end frequency in Hz. If None, value is set to sample_rate_hz / 2. Default None :return: frequency bins

def get_log_central_frequency_bins_range(sample_rate_hz: float, band_order: float, start_hz: float = None, end_hz: float = None, base: float = 1.9952623149688795, reference_frequency: float = 1) ‑> numpy.ndarray

Get the central frequency bins with given sample rate, band order, start and end frequency. Default starts at 1 Hz and ends at Nyquist frequency.

:param sample_rate_hz: sample rate of the signal :param band_order: band order :param start_hz: start frequency in Hz :param end_hz: end frequency in Hz :param base: base for the logarithmic scale (default 10 ** 0.3) :param reference_frequency: reference frequency for the logarithmic scale (default 1) :return: central frequency bins

def get_log_edge_frequencies(sample_rate_hz: float, band_order: float, start_hz: float = None, end_hz: float = None, base: float = 1.9952623149688795, reference_frequency: float = 1) ‑> numpy.ndarray

Get the edge frequencies with given sample rate, band order, start and end frequency. Default starts at 1 Hz and ends at Nyquist frequency.

:param sample_rate_hz: sample rate of the signal :param band_order: band order :param start_hz: start frequency in Hz :param end_hz: end frequency in Hz :param base: base for the logarithmic scale (default 10 ** 0.3) :param reference_frequency: reference frequency for the logarithmic scale (default 1) :return: edge frequencies

def get_shorttime_fft_frequency_bins(sample_rate_hz: float, segment_length: int) ‑> numpy.ndarray

Get the frequency bins with given sample rate and segment length that matches output from ShortTimeFFT. Starts at 0 Hz and ends at Nyquist frequency.

:param sample_rate_hz: sample rate of the signal :param segment_length: length of the segment :return: frequency bins