ToneToNoiseRatio#
- class ansys.sound.core.psychoacoustics.ToneToNoiseRatio(psd=None, frequency_list=None)#
Computes the ECMA 418-1/ISO 7779 tone-to-noise ratio (TNR).
This class computes the TNR on a power spectral density (PSD) following the ECMA 418-1 and ISO 7779 standards.
Class instantiation takes the following parameters.
- Parameters:
- psd
Field
PSD of the signal to compute TNR on as a DPF field. The PSD field has the following characteristics:
num_entities
= 1location
= “TimeFreq_sets”data
: Vector of amplitude values in unit^2/Hztime_freq_support
: Vector of regularly spaced frequencies in Hz associated withamplitude values (from 0 Hz to the maximum frequency)
unit
= “<unit>^2/Hz” (where <unit> is Pa for example).
You can use the
ansys.dpf.core.fields_factory.create_scalar_field()
function to create the field.- frequency_list
list
, default:None
List of the frequencies in Hz of the tones (peaks in the spectrum) for which to calculate the TNR. The default is
None
, in which case a peak detection method is applied to automatically find the tones in the input spectrum. Then, the TNR is calculated for each detected tone.
- psd
Methods
Convert a DPF fields container to a NumPy array.
Get the vector of the peaks' TNR values in dB.
Get the maximum TNR value in dB.
Get the number of tones.
Get TNR data as a generic data container.
Get TNR data in a tuple as a NumPy array.
Get the vector of the peaks' frequencies in Hz.
Get the vector of the peaks' higher-frequency limits in Hz.
Get the vector of the peaks' level values in dB SPL.
Get the vector of the peaks' lower-frequency limits in Hz.
Get a reference curve to compare the TNR with.
ToneToNoiseRatio.get_single_tone_info
(tone_index)Get the TNR information for a tone.
Plot the TNR for all identified peaks, along with the reference curve.
Compute the TNR.
Attributes
Tone frequency list in Hz.
Input power spectral density (PSD) as a DPF field.