pyrato.dsp#
Signal processing related functions.
Functions:
|
Estimate the noise power of additive noise in impulse responses. |
|
Find the maximum of an impulse response as argmax(h(t)). |
|
Calculate the peak-signal-to-noise-ratio of an impulse response. |
- pyrato.dsp.estimate_noise_energy(data, interval=[0.9, 1.0], is_energy=False)[source]#
Estimate the noise power of additive noise in impulse responses.
The noise power is distributed from an interval in which the additive noise is assumed to be larger than the impulse response data.
- Parameters:
data (pyfar.Signal) – The impulse response.
interval (tuple, float) – Defines the interval of the RIR to be evaluated for the estimation. The interval is relative to the length of the RIR
0 = 0%, 1=100%. By default(0.9, 1.0).is_energy (bool) – Defines if the data is already squared.
- Returns:
noise_energy – The energy of the background noise,shaped according to the channel shape of the input Signal.
- Return type:
numpy.ndarray[float]
- pyrato.dsp.find_impulse_response_maximum(impulse_response, threshold=20, noise_energy='auto')[source]#
Find the maximum of an impulse response as argmax(h(t)).
Performs an initial SNR check according to a defined threshold level in dB.
- Parameters:
impulse_response (ndarray, double) – The impulse response
threshold (double, optional) – Threshold SNR value in dB
noise_energy (float, str, optional) – If
'auto', the noise level is calculated based on the last 10 percent of the RIR. Otherwise specify manually for each channel as array.
- Returns:
max_sample – Sample at which the impulse response starts
- Return type:
int
Note
The function tries to estimate the SNR in the IR based on the signal energy in the last 10 percent of the IR.
- pyrato.dsp.peak_signal_to_noise_ratio(impulse_response, noise_power='auto', is_energy=False)[source]#
Calculate the peak-signal-to-noise-ratio of an impulse response.
- Parameters:
impulse_response (pyfar.Signal) – The impulse response
noise_power (float, str, optional) – The noise power. The default is ‘auto’, in which case the noise power is estimated from the last 10 % of the impulse response.
is_energy (bool, optional) – Defines if the impulse response is already squared. If set to True, the function assumes that the input is already energy data, otherwise it squares the input data. The default is False.
- Returns:
The estimated peak-signal-to-noise-ratio for each channel of the impulse response.
- Return type:
float, array-like