PowerSpectralDensity#
- class ansys.sound.core.spectral_processing.PowerSpectralDensity(input_signal, fft_size=2048, window_type='HANN', window_length=2048, overlap=0.25)#
Power Spectral Density (PSD) class.
This class allows the calculation of Power Spectral Density (PSD) for a given signal, using Welch’s method.
See also
Examples
Compute and display the Power Spectral Density (PSD) of an acoustic signal (in Pa).
>>> from ansys.sound.core.spectral_processing import PowerSpectralDensity >>> power_spectral_density = PowerSpectralDensity(input_signal=signal) >>> power_spectral_density.process() >>> psd_dB = power_spectral_density.get_PSD_dB(ref_value=2e-5) >>> power_spectral_density.plot(display_in_dB=True, ref_value=2e-5)
Class instantiation takes the following parameters.
- Parameters:
- signal
Field Input signal on which to compute the PSD.
- fft_size
int, default: 2048 Number of FFT points to use for the PSD estimate. Must be a power of 2.
- window_type
str, default: ‘HANN’ Window type used for the PSD computation. Options are
'TRIANGULAR','BLACKMAN','HAMMING','HANN','GAUSS','FLATTOP', and'RECTANGULAR'.- window_length
int, default: 2048 Number of points of the window used for the PSD computation , by default 2048.
- overlap
float, default: 0.25 Overlap value between two successive segments where the FFT is computed. Values range from 0 to 1. For example,
0means no overlap, and0.5means 50% overlap.
- signal
Methods
PowerSpectralDensity.get_PSD_dB([ref_value])Get the PSD in dB/Hz, as a Field.
Get the PSD in dB/Hz as a NumPy array.
Get the PSD in squared linear unit per Hz.
Get the PSD in squared linear unit per Hz, as NumPy arrays.
Get the frequencies associated with the PSD.
Get the PSD data as a DPF field.
Get the PSD data as NumPy arrays.
PowerSpectralDensity.plot([display_in_dB, ...])Plot the PSD.
Calculate the PSD.
Attributes
Number of FFT points.
Input signal.
Window overlap in %.
Number of window points.
Window type.