ggrecow / SQAT

SQAT is an open-source repository of MATLAB codes containing the implementation of key metrics for quantitative sound quality analysis.
Other
40 stars 13 forks source link

Bug: EPNL=-inf if PNLT remains above Decay after PNLT_idx #5

Closed mlotinga closed 3 months ago

mlotinga commented 3 months ago

If the remaining values in PNLT after PNLT(PNLT_idx) do not drop below the value of Decay, idx_t2 returns empty and the duration correction cannot be completed, resulting in EPNL = -inf.

In this case, a reasonable fix is to take the last index of PNLT as idx_t2.

ggrecow commented 3 months ago

Many thanks for your bug report.

Would you be able to share your input sound file so I can reproduce the error ? I imagine there would also be cases on which the PNLT BEFORE PNLT(PNLT_idx) do not drop below the value of Decay either and would be infinite.

Therefore I ask: there is any (formal) recommendations on how to deal in such cases ? In my opinion, the duration correction is important for ensuring comparison between cases with different durations but also serves as a kind of SNR measure. Maybe such low SNR would invalidate the use of the EPNL and the results could be only presented in terms of the time-varying PNLT curve ? or then the duration correction=zero and the EPNL becomes PNLT ?

Kind regards,

Gil.

ggrecow commented 3 months ago

For info: just found this in the DOC 9501, Environmental Technical Report Manual -- Volume I Procedures for the Noise Certification of aircraft. Off course this holds mainly for formal aircraft noise certification purposes, Anyway, if you use any other decay value to compute the duration correction -> EPNL, this value needs to be clearly reported.

Capturar

mlotinga commented 3 months ago

I agree, in terms of aircraft noise certification, it would be necessary to inform the user of this drawback of the input data. Where this may occur in practice for users is where the event being processed is not a certification flight, but a recording of, for example, some other type of flight operation. For the purpose of calculating a value that makes more sense than -inf, the next best option is to use the remaining duration of the input file. An output warning to the user could also be inserted in accordance with the certification requirements.

ggrecow commented 3 months ago

In my opinion, integrating over the entire PNLT curve could make more sense (for comparison reasons) in such cases instead of using an arbitrary decay value. But this may vary depending on the signals to be compared off course...

In this case, the result would not be EPNL though but rather something like the Sound Exposure Level or an Equivalent value from the PNLT instead of SPL.

I will think how to address this on the code for general use. But I would be more inclinated towards just generating an error to the user and abort the calculation if the stipulated decay threshold can not be achieved. For very specific cases, the user is off course free to make any modifications within reasonable assumptions. In such cases, any modifications/assumptions must be clearly reported.

Cheers,

Gil.

mlotinga commented 3 months ago

I amended my previous comment - it's not the whole duration of course, but just the part that follows the t1 index when the threshold is exceeded.