Module quantum_inferno.scales_dyadic

This module contains constants and functions that help with physical to cyber conversion with preferred quasi-dyadic orders.

Global variables

var M_OVER_N

Standardized scales

Functions

def band_frequency_low_high(frequency_order_input: float, frequency_base_input: float, frequency_ref_input: float, frequency_low_input: float, frequency_high_input: float, frequency_sample_rate_input: float) ‑> Tuple[float, float, numpy.ndarray, float, numpy.ndarray, numpy.ndarray, numpy.ndarray, numpy.ndarray]

Evaluate Standard Logarithmic Interval Time Parameters: ALWAYS USE HZ

:param frequency_order_input: Nth order :param frequency_base_input: G2 or G3 :param frequency_ref_input: reference frequency :param frequency_low_input: the lowest frequency of interest :param frequency_high_input: highest frequency of interest :param frequency_sample_rate_input: sample rate :return: scale_order, scale_base, scale_band_number, reference frequency value, Algebraic center of frequencies, Geometric center of frequencies, frequency_start, frequency_end

def band_intervals_periods(scale_order_input: float, scale_base_input: float, scale_ref_input: float, scale_low_input: float, scale_high_input: float, show_warnings: bool = True) ‑> Tuple[float, float, numpy.ndarray, float, numpy.ndarray, numpy.ndarray, numpy.ndarray, numpy.ndarray]

Evaluate Standard Logarithmic Interval Scale Parameters using time scales in seconds If scales are provided as frequency, previous computations convert to time. Designed to take bappsband to just below Nyquist, within a band edge. ALWAYS CONVERT TO SECONDS Last updated: 20200905

:param scale_order_input: Band order N, for ISO3 use N = 1.0 or 3.0 or 6.0 or 12.0 or 24.0 :param scale_base_input: reference base G; i.e. G3 = 10.**0.3 or G2 = 2.0 :param scale_ref_input: time reference: in seconds :param scale_low_input: Lowest scale. If Nyquist scale, 2 * sample interval in seconds. :param scale_high_input: Highest scale of interest in seconds :param show_warnings: if True, show any warnings encountered. Default True :return: scale_order, scale_base, scale_band_number, scale_ref, scale_center_algebraic, scale_center_geometric, scale_start, scale_end

def base_multiplier(scale_order: float = 3.0, scale_base: float = 1.9952623149688795) ‑> float

:param scale_order: Band order, preferably one of: 1, 3, 6, 12, 24. Must be > 0.75 or reverts to N=0.75 :param scale_base: scale base :return: Dyadic (log2) foundation for arbitrary base

def cycles_from_order(scale_order: float) ‑> float

Compute the number of cycles M for a specified band order N. N is the quantization parameter for the constant Q wavelet filters

:param scale_order: Band order, preferably one of: 1, 3, 6, 12, 24. Must be > 0.75 or reverts to N=0.75 :return: number of cycled per normalized angular frequency

def get_epsilon() ‑> float

Return epsilon for float64, float32, float16 by detecting current interpreter's max size

def log_frequency_hz_from_fft_points(frequency_sample_hz: float, fft_points: int, scale_order: float = 1.9952623149688795, scale_ref_hz: float = 1.0, scale_base: float = 1.9952623149688795) ‑> numpy.ndarray

:param frequency_sample_hz: sample rate of frequency in Hz :param fft_points: number of fft points :param scale_order: Band order, preferably one of: 1, 3, 6, 12, 24. Must be > 0.75 or reverts to N=0.75 :param scale_ref_hz: reference frequency in Hz :param scale_base: scale base :return: array of scaled values

def order_from_cycles(cycles_per_scale: float) ‑> float

Compute the number of cycles M for a specified band order N where N is the quantization parameter for the constant Q wavelet filters

:param cycles_per_scale: Should be greater than or equal than one :return: number of cycled per normalized angular frequency

def scale_from_frequency_hz(scale_order: float, scale_frequency_center_hz: Union[numpy.ndarray, float], frequency_sample_rate_hz: float) ‑> Tuple[Union[numpy.ndarray, float], Union[numpy.ndarray, float]]

Non-dimensional scale and angular frequency for canonical Gabor/Morlet wavelet

:param scale_order: Band order, preferably one of: 1, 3, 6, 12, 24. Must be > 0.75 or reverts to N=0.75 :param scale_frequency_center_hz: scale frequency in hz :param frequency_sample_rate_hz: sample rate in hz :return: scale_atom, scaled angular frequency

def scale_multiplier(scale_order: float = 3.0) ‑> float

:param scale_order: Band order, preferably one of: 1, 3, 6, 12, 24. Must be > 0.75 or reverts to N=0.75 :return: Scale multiplier for scale bands of order N > 0.75

def scale_order_check(scale_order: float = 3.0, show_warning: bool = True) ‑> float

Ensure no negative, complex, or unreasonably small orders are passed; override to 1/3 octave band Standard orders are one of: 1, 3, 6, 12, 24. If order < 0.75 it reverts to order = 3

:param scale_order: Band order, preferably one of: 1, 3, 6, 12, 24. Must be > 0.75 or reverts to N=0.75 :param show_warning: if True, prints warning of invalid scale_order. Default True :return: sanitized scale order

Classes

class Slice

Constants for slice calculations, supersedes inferno/slice

Expand source code
class Slice:
    """
    Constants for slice calculations, supersedes inferno/slice
    """
    # Preferred Orders
    ORD1 = 1.0  # Octaves; repeats nearly every three decades (1mHz, 1Hz, 1kHz)
    ORD3 = 3.0  # 1/3 octaves; reduced temporal uncertainty for sharp transients and good for decade cycles
    ORD6 = 6.0  # 1/6 octaves, good compromise for time-frequency resolution
    ORD12 = 12.0  # Musical tones, continuous waves, long duration sweeps
    ORD24 = 24.0  # High resolution; long duration window, 24 bands per octave
    ORD48 = 48.0  # Ultra-high spectral resolution for blowing minds and interstellar communications
    # Constant Q Base
    G2 = 2.0  # Base two for perfect octaves and fractional octaves
    G3 = 10.0 ** 0.3  # Reconciles base2 and base10
    # Time
    T_PLANCK = 5.4e-44  # 2.**(-144)   Planck time in seconds
    T0S = 1e-42  # Universal Scale in S
    T1S = 1.0  # 1 second
    T100S = 100.0  # 1 hectosecond, IMS low band edge
    T1000S = 1000.0  # 1 kiloseconds = 1 mHz
    T1M = 60.0  # 1 minute in seconds
    T1H = T1M * 60.0  # 1 hour in seconds
    T1D = T1H * 24.0  # 1 day in seconds
    TU = 2.0 ** 58  # Estimated age of the known universe in seconds
    # Frequency
    F1HZ = 1.0  # 1 Hz
    F1KHZ = 1_000.0  # 1 kHz
    F0HZ = 1.0e42  # 1/Universal Scale
    FU = 2.0 ** -58  # 1/Estimated age of the known universe in s

    # NOMINAL SAMPLE RATES (REDVOX API M, 2022)
    FS1HZ = 1.0  # SOH
    FS10HZ = 10.0  # iOS Barometer
    FS30HZ = 30.0  # Android barometer
    FS80HZ = 80.0  # Infrasound
    FS200HZ = 200.0  # Android Magnetometer, Fast
    FS400HZ = 400.0  # Android Accelerometer and Gyroscope, Fast
    FS800HZ = 800.0  # Infrasound and Low Audio
    FS8KHZ = 8_000.0  # Speech Audio
    FS16KHZ = 16_000.0  # ML Audio
    FS48KHZ = 48_000.0  # Audio to Ultrasound

Class variables

var F0HZ
var F1HZ
var F1KHZ
var FS10HZ
var FS16KHZ
var FS1HZ
var FS200HZ
var FS30HZ
var FS400HZ
var FS48KHZ
var FS800HZ
var FS80HZ
var FS8KHZ
var FU
var G2
var G3
var ORD1
var ORD12
var ORD24
var ORD3
var ORD48
var ORD6
var T0S
var T1000S
var T100S
var T1D
var T1H
var T1M
var T1S
var TU
var T_PLANCK