Skip to content

Commit 8556971

Browse files
authored
Merge pull request #18 from hakostra/hakostra/check-thirdspec-below-120dB
Check if Zwicker method can be applied and raise ValueError if it can't
2 parents 2d2ae8e + 1cf0056 commit 8556971

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

mosqito/functions/loudness_zwicker/loudness_zwicker_shared.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,15 @@ def calc_main_loudness(spec_third, field_type):
3434
nm : numpy.ndarray
3535
Core loudness
3636
"""
37+
# Ref. ISO 532-1:2017 paragraph A.3
38+
# The table A.3 giving the weights of the 1/3 band levels for
39+
# center freq. below 300 Hz is only specified for levels up to 120 dB
40+
# If one of the first 11 bands (from 25 to 250 Hz) exceed 120 dB the
41+
# Zwicker method cannot be applied.
42+
if np.max(spec_third[0:11]) > 120.0:
43+
raise ValueError("1/3 octave band value exceed 120 dB, for which " +
44+
"the Zwicker method is no longer valid.")
45+
3746
#
3847
# Date tables definition (variable names and description according to
3948
# Zwicker:1991)

0 commit comments

Comments
 (0)