aspen.processings.modulation_power_spectrum¶
Calculate a modulation power spectrum
Functions
|
Modulation Power Spectrum. |
Classes
Modulation Power Spectrum. |
-
class
aspen.processings.modulation_power_spectrum.
ModulationPowerSpectrum
(modulation_power_spectrum_spec_samp_freq=1000, modulation_power_spectrum_gauss_window_alpha=3, modulation_power_spectrum_spacing_freq=50, modulation_power_spectrum_lower_freq=0, modulation_power_spectrum_upper_freq=8000, modulation_power_spectrum_spec_normalize=True, modulation_power_spectrum_spec_db_range=50, modulation_power_spectrum_fft2_win_duration=100, modulation_power_spectrum_fft2_win_shift=0, modulation_power_spectrum_backend='librosa', samp_freq=16000)[source]¶ Bases:
aspen.interfaces.abs_common_interface.AbsCommonInterface
,aspen.interfaces.abs_processing_interface.AbsProcessingInterface
Modulation Power Spectrum.
This class is heavily inspired by soundsig (https://github.com/theunissenlab/soundsig).
- Parameters
modulation_power_spectrum_spec_samp_freq¶ (
int
) – Sampling frequency in spectrogram space. Defaults to 1000.modulation_power_spectrum_gauss_window_alpha¶ (
float
) – The parameter to generate Gaussian window. The detail is shown in MATLAB gaussian window method (https://www.mathworks.com/help/signal/ref/gausswin.html). Defaults to 3.modulation_power_spectrum_spacing_freq¶ (
float
) – The time-frequency scale for the spectrogram in Hz. This variable determines the width of the gaussian window to calculate the SFTF. Defaults to 50.modulation_power_spectrum_lower_freq¶ (
float
) – Lower frequency in the spectrogram to save space. Defaults to 0.modulation_power_spectrum_upper_freq¶ (
float
) – Upper frequency in the spectrogram to save space. Upper limit is the half of sampling_frequency. Defaults to 8000.modulation_power_spectrum_spec_normalize¶ (
bool
) – The flag of normalizing spectrogram resulted from STFT. Defaults to True.modulation_power_spectrum_spec_db_range¶ (
float
) – The range to narrow down the spectrogram amplitude for making it easier to visualize. Defaults to 50.modulation_power_spectrum_fft2_win_duration¶ (
float
) – The duration of gaussian window for 2D-FFT in millisecond. If the value is 0, fft2 is executed withoud window-shifting. Defaults to 100.modulation_power_spectrum_fft2_win_shift¶ (
int
) – The number of points to shift segments for 2D-FFT. Defaults is 0 that means (wduration - 1) // 6 (wduration is fft2_win_duration in sample).modulation_power_spectrum_backend¶ (
str
) – The library to calculate STFT. The choices are “librosa” or “scipy”. Defaults to “librosa”.
-
classmethod
load_class_kwargs
(args)¶ Return the kwargs dict for class __init__ from parsed arguments
-
raw_mps
()[source]¶ Return the listed result of 2-D discrete Fourier transform.
- Return type
- Returns
the listed result of 2-D discrete Fourier transform.
-
spectral_modulation_freq
()[source]¶ Return the modulation power spectrum sample spectral modulation frequency.
- Return type
- Returns
the modulation power spectrum sample spectral modulation frequency.
-
aspen.processings.modulation_power_spectrum.
modulation_power_spectrum
(x, spec_samp_freq=1000, gauss_window_alpha=3, spacing_freq=50, lower_freq=0, upper_freq=8000, spec_normalize=True, spec_db_range=50, fft2_win_duration=100, fft2_win_shift=0, backend='librosa', samp_freq=16000)[source]¶ Modulation Power Spectrum.
This method is heavily inspired by soundsig (https://github.com/theunissenlab/soundsig).
- Parameters
spec_samp_freq¶ (
int
) – Sampling frequency in spectrogram space. Defaults to 1000.gauss_window_alpha¶ (
float
) – The parameter to generate Gaussian window. The detail is shown in MATLAB gaussian window method (https://www.mathworks.com/help/signal/ref/gausswin.html). Defaults to 3.spacing_freq¶ (
float
) – The time-frequency scale for the spectrogram in Hz. This variable determines the width of the gaussian window to calculate the SFTF. Defaults to 50.lower_freq¶ (
float
) – Lower frequency in the spectrogram to save space. Defaults to 0.upper_freq¶ (
float
) – Upper frequency in the spectrogram to save space. Upper limit is the half of sampling_frequency. Defaults to 8000.spec_normalize¶ (
bool
) – The flag of normalizing spectrogram resulted from STFT. Defaults to True.spec_db_range¶ (
float
) – The range to narrow down the spectrogram amplitude for making it easier to visualize. Defaults to 50.fft2_win_duration¶ (
float
) – The duration of gaussian window for 2D-FFT in millisecond. If the value is 0, fft2 is executed withoud window-shifting. Defaults to 100.fft2_win_shift¶ (
int
) – The number of points to shift segments for 2D-FFT. Defaults is 0 that means (wduration - 1) // 6 (wduration is fft2_win_duration in sample).backend¶ (
str
) – The library to calculate STFT. The choices are “librosa” or “scipy”. Defaults to “librosa”.
- Return type
- Returns
Return the pameters for short-time Fourier transform, the modulation power spectrum sample spectral modulation frequency, the modulation power spectrum sample temporal modulation frequency, the listed result of 2-D discrete Fourier transform and the modulation power spectrum.