From 98564db8612fa1f60a824144b1de50c0fe73d47e Mon Sep 17 00:00:00 2001 From: "simon.buechner22" Date: Sat, 28 Feb 2026 16:51:04 +0100 Subject: [PATCH 01/11] lateral level dummy function --- pyrato/parameters.py | 77 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) diff --git a/pyrato/parameters.py b/pyrato/parameters.py index 3b6c96ce..ad87be3b 100644 --- a/pyrato/parameters.py +++ b/pyrato/parameters.py @@ -509,6 +509,83 @@ def _energy_ratio(limits, energy_decay_curve1, energy_decay_curve2): return energy_ratio +def lateral_level(energy_decay_curve_omni, + energy_decay_curve_lateral): + r""" + Calculate the lateral level. + + The early lateral energy fraction :math:`G` + according to [#isoStrength]_ is defined as the ratio between the + lateral sound energy captured with a figure of eight microphone + arriving between 5 ms and 80 ms and the total sound energy + captured with an omnidirectional microphone arriving within + the first 80 ms after the direct sound. It is a measure of the + apparent source width. + + The parameter is defined as + + .. math:: + + J_\mathrm{LF} = + 10 \log_{10} + \frac{ + \displaystyle \int_{0.005}^{0.08} p_\mathrm{L}^2(t)\,\mathrm{d}t + }{ + \displaystyle \int_{0}^{0.08} p^2(t)\,\mathrm{d}t + } + + where :math:`p_\mathrm{L}(t)` is the lateral sound pressure measured with a + figure-eight microphone whose zero axis is oriented towards the source, + and :math:`p(t)` is the sound pressure measured at the same position + with an omnidirectional microphone. + + Using the energy decay curves of the omnidirectional response + :math:`e(t)` and the lateral response :math:`e_\mathrm{L}(t)`, the + parameter can be computed efficiently as + + .. math:: + + J_\mathrm{LF} = + 10 \log_{10} + \frac{ + e_\mathrm{L}(0.005) - e_\mathrm{L}(0.08) + }{ + e(0) - e(0.08) + }. + + Parameters + ---------- + energy_decay_curve_omni : pyfar.TimeData + Energy decay curve of the room impulse response measured with an + omnidirectional microphone. The EDC must start at time zero. + + energy_decay_curve_lateral : pyfar.TimeData + Energy decay curve of the room impulse response measured with a + figure-eight microphone oriented according to [#isoStrength]_ + (zero axis pointing towards the source). The EDC must start at + time zero. + + Both EDCs must have identical ``signal.cshape``. + + Returns + ------- + Strength: numpy.ndarray + Strength (:math:`G`) in decibels. + The output array follows the channel shape (``signal.cshape``) of + the input EDCs. + + References + ---------- + .. [#isoStrength] ISO 3382, Acoustics — Measurement of the reverberation + time of rooms with reference to other acoustical parameters. + """ + + limits = np.array([0.0, 0.08, 0.005, 0.08]) + + return 10*np.log10(_energy_ratio(limits, + energy_decay_curve_omni, + energy_decay_curve_lateral)) + def sound_strength(energy_decay_curve_room, energy_decay_curve_free_field): r""" From e87bfb5546260ada67d6b8734ec4045bc837a3e8 Mon Sep 17 00:00:00 2001 From: "simon.buechner22" Date: Sat, 28 Feb 2026 17:16:05 +0100 Subject: [PATCH 02/11] implementation of late_lateral_level function --- pyrato/parameters.py | 65 ++++++++++++++++++++++---------------------- 1 file changed, 33 insertions(+), 32 deletions(-) diff --git a/pyrato/parameters.py b/pyrato/parameters.py index ad87be3b..9e8abcaa 100644 --- a/pyrato/parameters.py +++ b/pyrato/parameters.py @@ -509,59 +509,60 @@ def _energy_ratio(limits, energy_decay_curve1, energy_decay_curve2): return energy_ratio -def lateral_level(energy_decay_curve_omni, - energy_decay_curve_lateral): +def late_lateral_level(energy_decay_curve_ref_10m, + energy_decay_curve_lateral): r""" - Calculate the lateral level. + Calculate the late lateral level. - The early lateral energy fraction :math:`G` - according to [#isoStrength]_ is defined as the ratio between the + The late lateral level :math:`LJ` + according to [#isoLLJ]_ is defined as the ratio between the lateral sound energy captured with a figure of eight microphone - arriving between 5 ms and 80 ms and the total sound energy - captured with an omnidirectional microphone arriving within - the first 80 ms after the direct sound. It is a measure of the - apparent source width. + arriving after 80 ms and the total sound energy of a reference + impulse response measured with an omnidirectional microphone + at a distance of 10 m in the free field. The parameter is defined as .. math:: - J_\mathrm{LF} = + LJ = 10 \log_{10} \frac{ - \displaystyle \int_{0.005}^{0.08} p_\mathrm{L}^2(t)\,\mathrm{d}t + \displaystyle \int_{0.08}^{\infty} p_\mathrm{L}^2(t)\,\mathrm{d}t }{ - \displaystyle \int_{0}^{0.08} p^2(t)\,\mathrm{d}t + \displaystyle \int_{0}^{\infty} p_{10}^2(t)\,\mathrm{d}t } where :math:`p_\mathrm{L}(t)` is the lateral sound pressure measured with a figure-eight microphone whose zero axis is oriented towards the source, - and :math:`p(t)` is the sound pressure measured at the same position - with an omnidirectional microphone. + and :math:`p_{10}(t)` is the instantaneous sound pressure of the + impulse response measured with an omnidirectional microphone + at 10 m distance in the free field. - Using the energy decay curves of the omnidirectional response - :math:`e(t)` and the lateral response :math:`e_\mathrm{L}(t)`, the - parameter can be computed efficiently as + Using the energy decay curves of the reference response + :math:`e_{10}(t)` and the lateral response :math:`e_\mathrm{L}(t)`, + the parameter can be computed efficiently as .. math:: - J_\mathrm{LF} = + LJ = 10 \log_{10} \frac{ - e_\mathrm{L}(0.005) - e_\mathrm{L}(0.08) + e_\mathrm{L}(0.08) }{ - e(0) - e(0.08) + e_{10}(0) }. Parameters ---------- - energy_decay_curve_omni : pyfar.TimeData - Energy decay curve of the room impulse response measured with an - omnidirectional microphone. The EDC must start at time zero. + energy_decay_curve_ref_10m : pyfar.TimeData + Energy decay curve of the reference impulse response measured + with an omnidirectional microphone at 10 m distance in the + free field. The EDC must start at time zero. energy_decay_curve_lateral : pyfar.TimeData Energy decay curve of the room impulse response measured with a - figure-eight microphone oriented according to [#isoStrength]_ + figure-eight microphone oriented according to [#isoLLJ]_ (zero axis pointing towards the source). The EDC must start at time zero. @@ -569,22 +570,22 @@ def lateral_level(energy_decay_curve_omni, Returns ------- - Strength: numpy.ndarray - Strength (:math:`G`) in decibels. + Late Lateral Level : numpy.ndarray + Late lateral level (:math:`LJ`) in decibels. The output array follows the channel shape (``signal.cshape``) of the input EDCs. References ---------- - .. [#isoStrength] ISO 3382, Acoustics — Measurement of the reverberation - time of rooms with reference to other acoustical parameters. + .. [#isoLLJ] ISO 3382-1, ISO 3382, Acoustics — Measurement of the + reverberation time of rooms with reference to other acoustical parameters. """ - limits = np.array([0.0, 0.08, 0.005, 0.08]) + limits = np.array([0.0, np.inf, 0.08, np.inf]) - return 10*np.log10(_energy_ratio(limits, - energy_decay_curve_omni, - energy_decay_curve_lateral)) + return 10 * np.log10(_energy_ratio(limits, + energy_decay_curve_ref_10m, + energy_decay_curve_lateral)) def sound_strength(energy_decay_curve_room, energy_decay_curve_free_field): From 141274c8088742f2b36789c50928400ddeba213f Mon Sep 17 00:00:00 2001 From: "simon.buechner22" Date: Sat, 28 Feb 2026 17:20:05 +0100 Subject: [PATCH 03/11] docstring changes --- pyrato/parameters.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pyrato/parameters.py b/pyrato/parameters.py index 9e8abcaa..8cd3c0f3 100644 --- a/pyrato/parameters.py +++ b/pyrato/parameters.py @@ -514,7 +514,8 @@ def late_lateral_level(energy_decay_curve_ref_10m, r""" Calculate the late lateral level. - The late lateral level :math:`LJ` + The late lateral level :math:`L_\mathrm{J}` is a measure of the strength + of late-arriving lateral sound according to [#isoLLJ]_ is defined as the ratio between the lateral sound energy captured with a figure of eight microphone arriving after 80 ms and the total sound energy of a reference @@ -525,7 +526,7 @@ def late_lateral_level(energy_decay_curve_ref_10m, .. math:: - LJ = + L_\mathrm{J} = 10 \log_{10} \frac{ \displaystyle \int_{0.08}^{\infty} p_\mathrm{L}^2(t)\,\mathrm{d}t @@ -545,7 +546,7 @@ def late_lateral_level(energy_decay_curve_ref_10m, .. math:: - LJ = + L_\mathrm{J} = 10 \log_{10} \frac{ e_\mathrm{L}(0.08) @@ -571,7 +572,7 @@ def late_lateral_level(energy_decay_curve_ref_10m, Returns ------- Late Lateral Level : numpy.ndarray - Late lateral level (:math:`LJ`) in decibels. + Late lateral level (:math:`L_\mathrm{J}`) in decibels. The output array follows the channel shape (``signal.cshape``) of the input EDCs. From b7750c9c9621243d372a1c13254e82ca3a7326f0 Mon Sep 17 00:00:00 2001 From: "simon.buechner22" Date: Sat, 28 Feb 2026 17:39:39 +0100 Subject: [PATCH 04/11] lateral level tests added --- tests/test_parameters.py | 124 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 124 insertions(+) diff --git a/tests/test_parameters.py b/tests/test_parameters.py index a67ab3d4..6adb758b 100644 --- a/tests/test_parameters.py +++ b/tests/test_parameters.py @@ -10,6 +10,7 @@ from pyrato.parameters import definition from pyrato.parameters import early_lateral_energy_fraction from pyrato.parameters import _energy_ratio +from pyrato.parameters import late_lateral_level # parameter clarity tests @pytest.mark.parametrize( @@ -724,3 +725,126 @@ def test_JLF_for_exponential_decay_analytical(make_edc): expected = expected_lateral / expected_omni np.testing.assert_allclose(result, expected, atol=1e-5) + + +# late_lateral_level tests +@pytest.mark.parametrize( + ("energy", "expected_shape"), + [ + (np.linspace(1, 0, 1000), (1,)), + (np.linspace((1, 0.5), (0, 0), 1000).T, (2,)), + (np.arange(2 * 3 * 1000).reshape(2, 3, 1000), (2, 3)), + ], +) +def test_LJ_accepts_timedata_and_returns_correct_shape( + energy, expected_shape, make_edc, +): + """Return type and shape of pyfar.TimeData input for identical edcs.""" + edc = make_edc(energy=energy, sampling_rate=1000) + result = late_lateral_level(edc, edc) + + assert isinstance(result, (float, np.ndarray)) + assert result.shape == expected_shape + assert result.shape == edc.cshape + +def test_LJ_returns_nan_for_zero_denominator_signal(): + """Correct return of NaN for division by zero signal.""" + edc_ref = pf.TimeData(np.zeros((1, 128)), np.arange(128) / 1000) + edc_lat = pf.TimeData(np.ones((1, 128)), np.arange(128) / 1000) + + result = late_lateral_level(edc_ref, edc_lat) + assert np.isnan(result) + +def test_LJ_calculates_known_reference_value(make_edc): + """ + Construct simple deterministic EDCs: + e_10(0) = 1 + e_L(0.08) = 0.5 + Expected: + LJ = 10*log10(0.5) = -3.0103 dB. + """ + + pad = np.zeros(200) + + edc_ref = np.concatenate(([1.0], pad)) + + # 80 ms at 1 kHz sampling rate -> index 80 + edc_lateral = np.concatenate(( + np.zeros(80), + np.array([0.5]), + pad, + )) + + edc_ref = make_edc(energy=edc_ref, sampling_rate=1000) + edc_lateral = make_edc(energy=edc_lateral, + sampling_rate=1000, normalize=False) + + result = late_lateral_level(edc_ref, edc_lateral) + + expected = 10 * np.log10(0.5) + np.testing.assert_allclose(result, expected, atol=1e-5) + +def test_LJ_is_within_ISO3382_range(make_edc): + """ + Smoke test: LJ must fall within the empirically observed range + reported in ISO 3382-1 for concert halls: + approximately -14 dB to +1 dB. + """ + + sampling_rate = 44100 + total_samples = 200000 + onset_samples = int(0.003 * sampling_rate) + + t = np.arange(total_samples - onset_samples) / sampling_rate + + decay_ref = np.exp(-13.8155 / 2.0 * t) + decay_lat = 0.2 * np.exp(-13.8155 / 2.2 * t) + + zeros = np.zeros(onset_samples) + + energy_ref = make_edc( + energy=np.concatenate([zeros, decay_ref]), + sampling_rate=sampling_rate, + normalize=False, + ) + energy_lat = make_edc( + energy=np.concatenate([zeros, decay_lat]), + sampling_rate=sampling_rate, + normalize=False, + ) + + edc_ref = ra.edc.schroeder_integration(energy_ref, is_energy=True) + edc_lat = ra.edc.schroeder_integration(energy_lat, is_energy=True) + + result = late_lateral_level(edc_ref, edc_lat).item() + + assert -14 <= result <= 1, ( + f"LJ = {result:.2f} dB is outside the ISO 3382-1 typical range " + f"[-14 dB, +1 dB]" + ) + +def test_LJ_for_exponential_decay_analytical(make_edc): + """ + LJ validation for analytical exponential decay: + e(t) = exp(-a*t) + LJ = 10*log10(e_L(0.08) / e_10(0)). + """ + + sampling_rate = 1000 + total_samples = 2000 + + edc_ref = make_edc(rt=2.0, + sampling_rate=sampling_rate, + total_samples=total_samples) + + edc_lat = make_edc(rt=2.2, + sampling_rate=sampling_rate, + total_samples=total_samples) + + result = late_lateral_level(edc_ref, edc_lat) + + a_lat = 13.8155 / 2.2 + + expected = 10 * np.log10(np.exp(-a_lat * 0.08)) + + np.testing.assert_allclose(result, expected, atol=1e-5) From 004fdb3cd8dce9798b20a62b20326f93bb2f4551 Mon Sep 17 00:00:00 2001 From: "simon.buechner22" Date: Sat, 28 Feb 2026 17:44:42 +0100 Subject: [PATCH 05/11] doc blank line added --- pyrato/parameters.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pyrato/parameters.py b/pyrato/parameters.py index 8cd3c0f3..16e847ae 100644 --- a/pyrato/parameters.py +++ b/pyrato/parameters.py @@ -580,6 +580,7 @@ def late_lateral_level(energy_decay_curve_ref_10m, ---------- .. [#isoLLJ] ISO 3382-1, ISO 3382, Acoustics — Measurement of the reverberation time of rooms with reference to other acoustical parameters. + """ limits = np.array([0.0, np.inf, 0.08, np.inf]) From 0e5d61c4e0f99f3a4fbc88f7b798f3d22b0cb9b4 Mon Sep 17 00:00:00 2001 From: "simon.buechner22" Date: Sat, 28 Feb 2026 17:51:05 +0100 Subject: [PATCH 06/11] docs minor changes --- pyrato/parameters.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyrato/parameters.py b/pyrato/parameters.py index 16e847ae..d64b96b2 100644 --- a/pyrato/parameters.py +++ b/pyrato/parameters.py @@ -579,8 +579,8 @@ def late_lateral_level(energy_decay_curve_ref_10m, References ---------- .. [#isoLLJ] ISO 3382-1, ISO 3382, Acoustics — Measurement of the - reverberation time of rooms with reference to other acoustical parameters. - + reverberation time of rooms with reference to other acoustical + parameters. """ limits = np.array([0.0, np.inf, 0.08, np.inf]) From c9a052b287d8ef406060b45392c6ef53a177d584 Mon Sep 17 00:00:00 2001 From: "simon.buechner22" Date: Sun, 1 Mar 2026 12:56:34 +0100 Subject: [PATCH 07/11] doc consistency --- pyrato/parameters.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pyrato/parameters.py b/pyrato/parameters.py index d64b96b2..fd31a1da 100644 --- a/pyrato/parameters.py +++ b/pyrato/parameters.py @@ -572,9 +572,8 @@ def late_lateral_level(energy_decay_curve_ref_10m, Returns ------- Late Lateral Level : numpy.ndarray - Late lateral level (:math:`L_\mathrm{J}`) in decibels. - The output array follows the channel shape (``signal.cshape``) of - the input EDCs. + Late lateral level (:math:`L_\mathrm{J}`) in decibels, + shaped according to the channel shape of the input EDCs. References ---------- From a83c2eccbfafa571ac40179b3922fd84bfe72872 Mon Sep 17 00:00:00 2001 From: "simon.buechner22" Date: Mon, 2 Mar 2026 15:23:26 +0100 Subject: [PATCH 08/11] Removed smoke test as it makes no sense --- tests/test_parameters.py | 42 ++-------------------------------------- 1 file changed, 2 insertions(+), 40 deletions(-) diff --git a/tests/test_parameters.py b/tests/test_parameters.py index 6adb758b..81aa07a5 100644 --- a/tests/test_parameters.py +++ b/tests/test_parameters.py @@ -784,45 +784,6 @@ def test_LJ_calculates_known_reference_value(make_edc): expected = 10 * np.log10(0.5) np.testing.assert_allclose(result, expected, atol=1e-5) -def test_LJ_is_within_ISO3382_range(make_edc): - """ - Smoke test: LJ must fall within the empirically observed range - reported in ISO 3382-1 for concert halls: - approximately -14 dB to +1 dB. - """ - - sampling_rate = 44100 - total_samples = 200000 - onset_samples = int(0.003 * sampling_rate) - - t = np.arange(total_samples - onset_samples) / sampling_rate - - decay_ref = np.exp(-13.8155 / 2.0 * t) - decay_lat = 0.2 * np.exp(-13.8155 / 2.2 * t) - - zeros = np.zeros(onset_samples) - - energy_ref = make_edc( - energy=np.concatenate([zeros, decay_ref]), - sampling_rate=sampling_rate, - normalize=False, - ) - energy_lat = make_edc( - energy=np.concatenate([zeros, decay_lat]), - sampling_rate=sampling_rate, - normalize=False, - ) - - edc_ref = ra.edc.schroeder_integration(energy_ref, is_energy=True) - edc_lat = ra.edc.schroeder_integration(energy_lat, is_energy=True) - - result = late_lateral_level(edc_ref, edc_lat).item() - - assert -14 <= result <= 1, ( - f"LJ = {result:.2f} dB is outside the ISO 3382-1 typical range " - f"[-14 dB, +1 dB]" - ) - def test_LJ_for_exponential_decay_analytical(make_edc): """ LJ validation for analytical exponential decay: @@ -833,7 +794,8 @@ def test_LJ_for_exponential_decay_analytical(make_edc): sampling_rate = 1000 total_samples = 2000 - edc_ref = make_edc(rt=2.0, + # emulating free field impulse response + edc_ref = make_edc(rt=0.01, sampling_rate=sampling_rate, total_samples=total_samples) From 9977fa312f4b16e5a9eeec529889d333cff74f1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20B=C3=BCchner?= <50335952+SimonBuechner@users.noreply.github.com> Date: Tue, 3 Mar 2026 09:47:39 +0100 Subject: [PATCH 09/11] Update pyrato/parameters.py Co-authored-by: Fabian Brinkmann --- pyrato/parameters.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyrato/parameters.py b/pyrato/parameters.py index fd31a1da..425b6bb3 100644 --- a/pyrato/parameters.py +++ b/pyrato/parameters.py @@ -515,8 +515,8 @@ def late_lateral_level(energy_decay_curve_ref_10m, Calculate the late lateral level. The late lateral level :math:`L_\mathrm{J}` is a measure of the strength - of late-arriving lateral sound - according to [#isoLLJ]_ is defined as the ratio between the + of late-arriving lateral sound. + According to [#isoLLJ]_, it is defined as the ratio between the lateral sound energy captured with a figure of eight microphone arriving after 80 ms and the total sound energy of a reference impulse response measured with an omnidirectional microphone From e67b83b3d5db9e91944549899e3eaa1f63a163e6 Mon Sep 17 00:00:00 2001 From: "simon.buechner22" Date: Tue, 3 Mar 2026 11:23:07 +0100 Subject: [PATCH 10/11] adjusted function name to late_lateral_sound_level --- pyrato/parameters.py | 14 +++++++------- tests/test_parameters.py | 10 +++++----- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/pyrato/parameters.py b/pyrato/parameters.py index 425b6bb3..a149a239 100644 --- a/pyrato/parameters.py +++ b/pyrato/parameters.py @@ -509,14 +509,14 @@ def _energy_ratio(limits, energy_decay_curve1, energy_decay_curve2): return energy_ratio -def late_lateral_level(energy_decay_curve_ref_10m, +def late_lateral_sound_level(energy_decay_curve_ref_10m, energy_decay_curve_lateral): r""" - Calculate the late lateral level. + Calculate the late lateral sound level. - The late lateral level :math:`L_\mathrm{J}` is a measure of the strength - of late-arriving lateral sound. - According to [#isoLLJ]_, it is defined as the ratio between the + The late lateral sound level :math:`L_\mathrm{J}` is a measure of the + strength of late-arriving lateral sound. + According to [#isoLLJ]_, it is defined as the level ratio between the lateral sound energy captured with a figure of eight microphone arriving after 80 ms and the total sound energy of a reference impulse response measured with an omnidirectional microphone @@ -571,8 +571,8 @@ def late_lateral_level(energy_decay_curve_ref_10m, Returns ------- - Late Lateral Level : numpy.ndarray - Late lateral level (:math:`L_\mathrm{J}`) in decibels, + Late Lateral Sound Level : numpy.ndarray + Late lateral sound level (:math:`L_\mathrm{J}`) in decibels, shaped according to the channel shape of the input EDCs. References diff --git a/tests/test_parameters.py b/tests/test_parameters.py index 81aa07a5..b1856488 100644 --- a/tests/test_parameters.py +++ b/tests/test_parameters.py @@ -10,7 +10,7 @@ from pyrato.parameters import definition from pyrato.parameters import early_lateral_energy_fraction from pyrato.parameters import _energy_ratio -from pyrato.parameters import late_lateral_level +from pyrato.parameters import late_lateral_sound_level # parameter clarity tests @pytest.mark.parametrize( @@ -741,7 +741,7 @@ def test_LJ_accepts_timedata_and_returns_correct_shape( ): """Return type and shape of pyfar.TimeData input for identical edcs.""" edc = make_edc(energy=energy, sampling_rate=1000) - result = late_lateral_level(edc, edc) + result = late_lateral_sound_level(edc, edc) assert isinstance(result, (float, np.ndarray)) assert result.shape == expected_shape @@ -752,7 +752,7 @@ def test_LJ_returns_nan_for_zero_denominator_signal(): edc_ref = pf.TimeData(np.zeros((1, 128)), np.arange(128) / 1000) edc_lat = pf.TimeData(np.ones((1, 128)), np.arange(128) / 1000) - result = late_lateral_level(edc_ref, edc_lat) + result = late_lateral_sound_level(edc_ref, edc_lat) assert np.isnan(result) def test_LJ_calculates_known_reference_value(make_edc): @@ -779,7 +779,7 @@ def test_LJ_calculates_known_reference_value(make_edc): edc_lateral = make_edc(energy=edc_lateral, sampling_rate=1000, normalize=False) - result = late_lateral_level(edc_ref, edc_lateral) + result = late_lateral_sound_level(edc_ref, edc_lateral) expected = 10 * np.log10(0.5) np.testing.assert_allclose(result, expected, atol=1e-5) @@ -803,7 +803,7 @@ def test_LJ_for_exponential_decay_analytical(make_edc): sampling_rate=sampling_rate, total_samples=total_samples) - result = late_lateral_level(edc_ref, edc_lat) + result = late_lateral_sound_level(edc_ref, edc_lat) a_lat = 13.8155 / 2.2 From 80b7521e4f09882fc9b81da4cfa163557795184d Mon Sep 17 00:00:00 2001 From: "simon.buechner22" Date: Fri, 6 Mar 2026 13:24:38 +0100 Subject: [PATCH 11/11] EDC input variable names changed to be in accordance with strength. Docstring adjustment --- pyrato/parameters.py | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/pyrato/parameters.py b/pyrato/parameters.py index a149a239..1e07725b 100644 --- a/pyrato/parameters.py +++ b/pyrato/parameters.py @@ -509,18 +509,18 @@ def _energy_ratio(limits, energy_decay_curve1, energy_decay_curve2): return energy_ratio -def late_lateral_sound_level(energy_decay_curve_ref_10m, - energy_decay_curve_lateral): +def late_lateral_sound_level(energy_decay_curve_free_field, + energy_decay_curve_room_lateral): r""" Calculate the late lateral sound level. - The late lateral sound level :math:`L_\mathrm{J}` is a measure of the - strength of late-arriving lateral sound. - According to [#isoLLJ]_, it is defined as the level ratio between the - lateral sound energy captured with a figure of eight microphone - arriving after 80 ms and the total sound energy of a reference - impulse response measured with an omnidirectional microphone - at a distance of 10 m in the free field. + The late lateral sound level :math:`L_\mathrm{J}` quantifies the strength + of late-arriving lateral sound energy. According to ISO 3382-1 [#isoLLJ]_, + it is defined as the level ratio between the late lateral sound energy + captured with a figure-of-eight microphone and the total sound energy of a + reference impulse response measured with an omnidirectional microphone at + a distance of 10 m in the free field. It is a measure of listener + envelopment. The parameter is defined as @@ -556,12 +556,12 @@ def late_lateral_sound_level(energy_decay_curve_ref_10m, Parameters ---------- - energy_decay_curve_ref_10m : pyfar.TimeData - Energy decay curve of the reference impulse response measured - with an omnidirectional microphone at 10 m distance in the + energy_decay_curve_free_field : pyfar.TimeData + Energy decay curve of the reference free field impulse response + measured vwith an omnidirectional microphone at 10 m distance in the free field. The EDC must start at time zero. - energy_decay_curve_lateral : pyfar.TimeData + energy_decay_curve_room_lateral : pyfar.TimeData Energy decay curve of the room impulse response measured with a figure-eight microphone oriented according to [#isoLLJ]_ (zero axis pointing towards the source). The EDC must start at @@ -585,8 +585,8 @@ def late_lateral_sound_level(energy_decay_curve_ref_10m, limits = np.array([0.0, np.inf, 0.08, np.inf]) return 10 * np.log10(_energy_ratio(limits, - energy_decay_curve_ref_10m, - energy_decay_curve_lateral)) + energy_decay_curve_free_field, + energy_decay_curve_room_lateral)) def sound_strength(energy_decay_curve_room, energy_decay_curve_free_field):