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

Class instantiation takes the following parameters.

Parameters:
signalField

Mono signal as a DPF field on which to compute the PSD.

fft_sizeint, default: 2048

Number of FFT points to use for the PSD estimate. Use a power of 2 for better performance.

window_typestr, default: ‘HANN’

Window type used for the PSD computation. Options are 'BARTLETT', 'BLACKMAN', 'BLACKMANHARRIS', 'HAMMING', 'HANN', 'KAISER', and 'RECTANGULAR'.

window_lengthint, default: 2048

Number of points of the window used for the PSD computation , by default 2048.

overlapfloat, default: 0.25

Overlap value between two successive segments where the FFT is computed. Values range from 0 to 1. For example, 0 means no overlap, and 0.5 means 50% overlap.

Methods

PowerSpectralDensity.convert_fields_container_to_np_array(fc)

Convert a DPF fields container to a NumPy array.

PowerSpectralDensity.get_PSD_dB([ref_value])

Get the PSD in dB/Hz, as a Field.

PowerSpectralDensity.get_PSD_dB_as_nparray([...])

Get the PSD in dB/Hz as a NumPy array.

PowerSpectralDensity.get_PSD_squared_linear()

Get the PSD in squared linear unit, as a DPF field.

PowerSpectralDensity.get_PSD_squared_linear_as_nparray()

Get the PSD in squared linear unit, as NumPy arrays.

PowerSpectralDensity.get_frequencies()

Get the frequencies associated with the PSD.

PowerSpectralDensity.get_output()

Get the PSD data as a DPF field.

PowerSpectralDensity.get_output_as_nparray()

Get the PSD data as NumPy arrays.

PowerSpectralDensity.plot([display_in_dB])

Plot the PSD.

PowerSpectralDensity.process()

Calculate the PSD.

Attributes

PowerSpectralDensity.fft_size

Number of FFT points.

PowerSpectralDensity.input_signal

Input signal as a DPF field.

PowerSpectralDensity.overlap

Window overlap in %.

PowerSpectralDensity.window_length

Number of window points.

PowerSpectralDensity.window_type

Window type.