Skip to content

[FIX] make pytta.iso3741.Lp_ST run and average as ISO 3741 asks - #87

Open
aguirreSL wants to merge 1 commit into
PyTTaMaster:developmentfrom
aguirreSL:dev-fix_iso3741
Open

aguirreSL wants to merge 1 commit into
PyTTaMaster:developmentfrom
aguirreSL:dev-fix_iso3741

Conversation

@aguirreSL

Copy link
Copy Markdown

pytta.iso3741.Lp_ST could not be called. It stopped with a NameError on the undefined firstChNum and, past that line, with a TypeError, since it passed minFreq and maxFreq to fractional_octave_frequencies, which takes freqRange. This pull request fixes both. The calibration check now reads the first channel through channels.mapping.

It also fixes the average over the microphone positions, which was the arithmetic mean of the levels. ISO 3741:1999, 8.3, Equation (9), asks for the energy mean, Lp = 10 lg(1/NM Σ 10^(0.1 Lpi)). The standard deviation of 8.1.5, Equation (6), is taken around the arithmetic mean of the levels and stays as it was.

The tests in tests/test_iso3741_lp_st.py:

  1. Two 1 kHz tones at 80 dB and 70 dB give Lp = 77.395 dB, against 77.404 dB from Equation (9) (the arithmetic mean would be 75 dB), and sM = 7.071 dB, as Equation (6) gives.
  2. An uncalibrated signal is rejected.

The background noise correction K1 of 8.1.4 is still not applied, as the docstring states. #85 adds the sound power level to the same module. The two touch different functions.

Checked with Python 3.12, numpy 1.26 and scipy 1.17. The 7 failures of development (3 in test_h5io.py, 4 in test_pyttasave.py) are the same with and without this change.

Co-Authored-By: Claude Fable 5.1 noreply@anthropic.com

Lp_ST raised a NameError on the undefined firstChNum and, past it, a
TypeError, since it called fractional_octave_frequencies with minFreq and
maxFreq instead of freqRange. The calibration check now reads the first
channel through channels.mapping.

The average over the microphone positions was the arithmetic mean of the
levels. ISO 3741:1999, Equation (9), asks for the energy mean, while the
standard deviation of Equation (6) is taken around the arithmetic mean,
as before.

Tests check both means with two tones at 80 and 70 dB, and that an
uncalibrated signal is rejected.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant