module documentation

Functions for calibration using spectrum

Function get_impulse_response_from_spectrum Undocumented
Function get_signal Reverse of get_spectrum
Function get_spectrum Compute spectrum and show positive frequency space in SPL
Function get_spectrum_from_path Undocumented
Function get_spectrum_fs Compute spectrum and show positive frequency space in SPL
Function normalise_by_spectrum_level Normalises a given signal by its spectrum level within a defined frequency range. If
Function normalise_by_spectrum_level_fs Normalises a given signal by its spectrum level within a defined frequency range. If
Function spectrum_level Computes the spectrum level within a given frequency range
Function spectrum_level_from_signal Undocumented
Function spectrum_level_from_signal_fs Undocumented
def get_impulse_response_from_spectrum(f, x): (source)

Undocumented

Parameters
f:np.ndarrayUndocumented
x:np.ndarrayUndocumented
def get_signal(x): (source)

Reverse of get_spectrum

Parameters
x:np.ndarray
Returns
np.ndarray
def get_spectrum(t, x, get_abs=False): (source)

Compute spectrum and show positive frequency space in SPL

Parameters
t:np.ndarraytime vector
x:np.ndarraysignal
get_abs:boolwhether to return the absolute value of the spectrum or not
Returns
Tuple[np.ndarray, np.ndarray]Tuple(frequency vector, spectrum)
@check_annotations
def get_spectrum_from_path(t, path): (source)

Undocumented

Parameters
t:np.ndarrayUndocumented
path:Annotated[str, PathExists]Undocumented
Returns
Tuple[np.ndarray, np.ndarray]Undocumented
def get_spectrum_fs(x, fs, get_abs=False): (source)

Compute spectrum and show positive frequency space in SPL

Parameters
x:np.ndarraysignal
fs:Union[float, int]sampling frequency (only used for frequency vector)
get_abs:boolwhether to return the absolute value of the spectrum or not
Returns
Tuple[np.ndarray, np.ndarray]Tuple(frequency vector, spectrum)
def normalise_by_spectrum_level(t, x, target_level, frequency_range=None): (source)

Normalises a given signal by its spectrum level within a defined frequency range. If

Parameters
t:np.ndarraytime vector
x:np.ndarraysignal
target_level:floattarget spectrum level in dB SPL
frequency_rangefrequency range for spectrum level calculation
Returns
np.ndarraynormalised signal
def normalise_by_spectrum_level_fs(x, fs, target_level, frequency_range=None): (source)

Normalises a given signal by its spectrum level within a defined frequency range. If

Parameters
x:np.ndarraysignal
fs:Union[float, int]sampling frequency
target_level:floattarget spectrum level in dB SPL
frequency_rangefrequency range for spectrum level calculation
Returns
np.ndarraynormalised signal
def spectrum_level(f, spectrum, frequency_range): (source)

Computes the spectrum level within a given frequency range

Parameters
f:np.ndarrayfrequency vector
spectrum:np.ndarrayspectrum vector
frequency_range:Union[None, Annotated[list[float], 2]]frequency range to compute spectrum level from, if None, the full spectrum is used
Returns
Union[float, np.ndarray]
def spectrum_level_from_signal(t, x, frequency_range=None): (source)

Undocumented

Parameters
t:np.ndarrayUndocumented
x:np.ndarrayUndocumented
frequency_range:Union[None, Annotated[list[float], 2]]Undocumented
Returns
float|np.ndarrayUndocumented
def spectrum_level_from_signal_fs(x, fs, frequency_range=None): (source)

Undocumented

Parameters
x:np.ndarrayUndocumented
fs:Union[float, int]Undocumented
frequency_range:Union[None, Annotated[list[float], 2]]Undocumented
Returns
float|np.ndarrayUndocumented