From fc38cb2795ef282d2a902bdbdf980206ba0cedd2 Mon Sep 17 00:00:00 2001 From: Anne Heimes <64446926+ahms5@users.noreply.github.com> Date: Tue, 29 Jul 2025 11:17:10 +0200 Subject: [PATCH 1/8] add diffuse iso calculation --- docs/api_reference.rst | 2 +- docs/modules/imkar.scattering.diffuse.rst | 7 + imkar/__init__.py | 6 + imkar/scattering/__init__.py | 8 + imkar/scattering/diffuse.py | 180 ++++++++++++++++++++++ tests/test_scattering_diffuse.py | 76 +++++++++ 6 files changed, 278 insertions(+), 1 deletion(-) create mode 100644 docs/modules/imkar.scattering.diffuse.rst create mode 100644 imkar/scattering/__init__.py create mode 100644 imkar/scattering/diffuse.py create mode 100644 tests/test_scattering_diffuse.py diff --git a/docs/api_reference.rst b/docs/api_reference.rst index 8f0383c..cc25d99 100644 --- a/docs/api_reference.rst +++ b/docs/api_reference.rst @@ -16,7 +16,7 @@ Modules .. toctree:: :maxdepth: 1 - modules/imkar + modules/imkar.scattering.diffuse .. _examples gallery: https://pyfar-gallery.readthedocs.io/en/latest/examples_gallery.html diff --git a/docs/modules/imkar.scattering.diffuse.rst b/docs/modules/imkar.scattering.diffuse.rst new file mode 100644 index 0000000..61c187d --- /dev/null +++ b/docs/modules/imkar.scattering.diffuse.rst @@ -0,0 +1,7 @@ +imkar.scattering.diffuse +======================== + +.. automodule:: imkar.scattering.diffuse + :members: + :undoc-members: + :show-inheritance: \ No newline at end of file diff --git a/imkar/__init__.py b/imkar/__init__.py index 0dcfbd5..c5cd5d6 100644 --- a/imkar/__init__.py +++ b/imkar/__init__.py @@ -5,3 +5,9 @@ __author__ = """The pyfar developers""" __email__ = '' __version__ = '0.1.0' + +from . import scattering + +__all__ = [ + "scattering", +] diff --git a/imkar/scattering/__init__.py b/imkar/scattering/__init__.py new file mode 100644 index 0000000..ec54f2d --- /dev/null +++ b/imkar/scattering/__init__.py @@ -0,0 +1,8 @@ + +"""Imkar scattering module.""" + +from . import diffuse + +__all__ = [ + "diffuse", +] diff --git a/imkar/scattering/diffuse.py b/imkar/scattering/diffuse.py new file mode 100644 index 0000000..007c25d --- /dev/null +++ b/imkar/scattering/diffuse.py @@ -0,0 +1,180 @@ +""" +This module contains functions for diffuse scattering calculations based on +ISO 17497-1:2004. +""" +import numpy as np +import pyfar as pf + + +def maximum_sample_absorption_coefficient(frequencies) -> pf.FrequencyData: + """Maximum absorption coefficient of the test sample. + + Based on section 6.3.4 in ISO 17497-1:2004 [#]_ the absorption coefficient + of the test sample should not exceed a value of :math:`alpha_s=0.5`. + However, if sound absorption is part of the sound-scattering structure, + this absorption shall also be present in the test sample. + + Parameters + ---------- + frequencies : np.ndarray + The frequencies at which the absorption coefficient is calculated. + + Returns + ------- + alpha_s_max : pf.FrequencyData + The maximum sample absorption coefficient. + + References + ---------- + [#] ISO 17497-1:2004, Sound-scattering properties of surfaces. Part 1: + Measurement of the random-incidence scattering coefficient in a + reverberation room. Geneva, Switzerland: International Organization + for Standards, 2004. + + """ + # input checks + try: + frequencies = np.asarray(frequencies, dtype=float) + except ValueError as exc: + raise TypeError( + "frequencies must be convertible to a float array.") from exc + if frequencies.ndim != 1: + raise ValueError("frequencies must be a 1D array.") + + # Calculate the maximum absorption coefficient + return pf.FrequencyData( + data=np.ones_like(frequencies) * 0.5, + frequencies=frequencies, + comment="Maximum absorption coefficient of the test sample", + ) + + +def maximum_baseplate_scattering_coefficient(N:int=1) -> pf.FrequencyData: + """Maximum scattering coefficient for the base plate alone. + + This is based on Table 1 in ISO 17497-1:2004 [#]_. + + Parameters + ---------- + N : int + ratio of any linear dimension in a physical scale model to the + same linear dimension in full scale (1:N). The default is N=1. + + Returns + ------- + s_base_max : pf.Frequency + The maximum baseplate scattering coefficient. + + References + ---------- + [#] ISO 17497-1:2004, Sound-scattering properties of surfaces. Part 1: + Measurement of the random-incidence scattering coefficient in a + reverberation room. Geneva, Switzerland: International Organization + for Standards, 2004. + + """ + if not isinstance(N, int): + raise TypeError("N must be a positive integer.") + if N <= 0: + raise TypeError("N must be a positive integer.") + frequencies = [ + 100, 125, 160, 200, 250, 315, 400, 500, 630, + 800, 1000, 1250, 1600, 2000, 2500, 3150, 4000, 5000, + ] + s_base_max = [ + 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.10, + 0.10, 0.10, 0.15, 0.15, 0.15, 0.20, 0.20, 0.20, 0.25, + ] + return pf.FrequencyData( + data=s_base_max, + frequencies=np.array(frequencies)/N, + comment="Maximum scattering coefficient of the baseplate", + ) + +def calculation( + reverberation_times, speed_of_sound, + air_attenuation_coefficient, + volume, surface_sample) -> tuple: + """ + Calculate the diffuse scattering coefficient after ISO 17497-1:2004. + + Measurement conditions for the four different reverberation times + and the corresponding speed of sound and air attenuation + coefficients based on Table 2 in ISO 17497-1:2004 [#]_. + + +------------------------+-------------+--------------+ + | measurement condition | test sample | turntable | + +------------------------+-------------+--------------+ + | 1 | not present | not rotating | + +------------------------+-------------+--------------+ + | 2 | present | not rotating | + +------------------------+-------------+--------------+ + | 3 | not present | rotating | + +------------------------+-------------+--------------+ + | 4 | present | rotating | + +------------------------+-------------+--------------+ + + Parameters + ---------- + reverberation_times : pf.FrequencyData + The reverberation times in seconds of the measurement conditions of + cshape (..., 4). + speed_of_sound : np.ndarray + is the speed of sound in air, in metres per second (m/s), + during the measurement of each measurement conditions of + shape (..., 4).. + air_attenuation_coefficient : pf.FrequencyData + the energy attenuation coefficient of air, in reciprocal metres + (:math:`m^-1`), calculated according to ISO 9613-1, + using the temperature and relative humidity during the measurement + of each measurement conditions of cshape (..., 4). + volume : float + volume of the reverberation room, in cubic metres (:math:`m^3`). + surface_sample : float + is the area of the test sample, in square metres (:math:`m^2`). + + Returns + ------- + scattering : pf.FrequencyData + The random-incidence scattering coefficient. + s_base : pf.FrequencyData + The base plate scattering coefficient. + alpha_s : pf.FrequencyData + The random-incidence absorption coefficient. + alpha_spec : pf.FrequencyData + The random-incidence specular absorption coefficient. + + References + ---------- + [#] ISO 17497-1:2004, Sound-scattering properties of surfaces. Part 1: + Measurement of the random-incidence scattering coefficient in a + reverberation room. Geneva, Switzerland: International Organization + for Standards, 2004. + """ + T_1 = reverberation_times[..., 0] + T_2 = reverberation_times[..., 1] + T_3 = reverberation_times[..., 2] + T_4 = reverberation_times[..., 3] + c_1 = speed_of_sound[..., 0] + c_2 = speed_of_sound[..., 1] + c_3 = speed_of_sound[..., 2] + c_4 = speed_of_sound[..., 3] + m_1 = air_attenuation_coefficient[..., 0] + m_2 = air_attenuation_coefficient[..., 1] + m_3 = air_attenuation_coefficient[..., 2] + m_4 = air_attenuation_coefficient[..., 3] + V = volume + S = surface_sample + + # random incident absorption coefficient + alpha_s = 55.3 * V/S * (1/(c_2*T_2) - 1/(c_1*T_1)) - 4*V/S * (m_2-m_1) + + # specular absorption coefficient + alpha_spec = 55.3 * V/S * (1/(c_4*T_4) - 1/(c_3*T_3)) - 4*V/S * (m_4-m_3) + + # calculate scattering coefficient + scattering = (alpha_spec - alpha_s) / (1 - alpha_s) + + s_base = 55.3*V/S*(1/(c_3*T_3) - 1/(c_1*T_1)) - 4*V/S*(m_3-m_1) + + return scattering, s_base, alpha_s, alpha_spec diff --git a/tests/test_scattering_diffuse.py b/tests/test_scattering_diffuse.py new file mode 100644 index 0000000..5a136af --- /dev/null +++ b/tests/test_scattering_diffuse.py @@ -0,0 +1,76 @@ +import numpy as np +import pytest +import imkar.scattering.diffuse as isd +import pyfar as pf + + +def test_maximum_sample_absorption_coefficient_basic(): + freqs = np.array([100, 200, 400, 800]) + result = isd.maximum_sample_absorption_coefficient(freqs) + assert isinstance(result, pf.FrequencyData) + np.testing.assert_allclose(result.frequencies, freqs) + np.testing.assert_allclose(result.freq, 0.5) + assert "Maximum absorption coefficient" in result.comment + + +def test_maximum_sample_absorption_coefficient_list_input(): + freqs = [100, 200, 400] + result = isd.maximum_sample_absorption_coefficient(freqs) + np.testing.assert_allclose(result.frequencies, np.array(freqs)) + np.testing.assert_allclose(result.freq, 0.5) + + +def test_maximum_sample_absorption_coefficient_non_1d_input(): + freqs = np.array([[100, 200], [300, 400]]) + with pytest.raises(ValueError, match="frequencies must be a 1D array"): + isd.maximum_sample_absorption_coefficient(freqs) + + +def test_maximum_sample_absorption_coefficient_invalid_type(): + freqs = "not_a_number" + with pytest.raises( + TypeError, + match="frequencies must be convertible to a float array"): + isd.maximum_sample_absorption_coefficient(freqs) + + +def test_maximum_baseplate_scattering_coefficient_default(): + result = isd.maximum_baseplate_scattering_coefficient() + assert isinstance(result, pf.FrequencyData) + expected_freqs = np.array([ + 100, 125, 160, 200, 250, 315, 400, 500, 630, + 800, 1000, 1250, 1600, 2000, 2500, 3150, 4000, 5000, + ]) + expected_data = np.array([[ + 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.10, + 0.10, 0.10, 0.15, 0.15, 0.15, 0.20, 0.20, 0.20, 0.25, + ]]) + np.testing.assert_allclose(result.frequencies, expected_freqs) + np.testing.assert_allclose(result.freq, expected_data) + assert "baseplate" in result.comment + + +def test_maximum_baseplate_scattering_coefficient_with_scale(): + N = 2 + result = isd.maximum_baseplate_scattering_coefficient(N) + expected_freqs = np.array([ + 100, 125, 160, 200, 250, 315, 400, 500, 630, + 800, 1000, 1250, 1600, 2000, 2500, 3150, 4000, 5000, + ]) / N + np.testing.assert_allclose(result.frequencies, expected_freqs) + +def test_maximum_baseplate_scattering_coefficient_invalid_type(): + with pytest.raises(TypeError, match="N must be a positive integer."): + isd.maximum_baseplate_scattering_coefficient(N=1.5) + with pytest.raises(TypeError, match="N must be a positive integer."): + isd.maximum_baseplate_scattering_coefficient(N=-1) + +def test_maximum_baseplate_scattering_coefficient_negative_N(): + # Negative N is technically an integer, but let's check if it works + N = 5 + result = isd.maximum_baseplate_scattering_coefficient(N) + expected_freqs = np.array([ + 100, 125, 160, 200, 250, 315, 400, 500, 630, + 800, 1000, 1250, 1600, 2000, 2500, 3150, 4000, 5000, + ]) / N + np.testing.assert_allclose(result.frequencies, expected_freqs) From 8ce1f04130dc863de472c00bf3323c10d6f88d19 Mon Sep 17 00:00:00 2001 From: Anne Heimes <64446926+ahms5@users.noreply.github.com> Date: Tue, 29 Jul 2025 11:21:28 +0200 Subject: [PATCH 2/8] fix doc --- docs/api_reference.rst | 1 + imkar/scattering/diffuse.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/api_reference.rst b/docs/api_reference.rst index cc25d99..6b6fafd 100644 --- a/docs/api_reference.rst +++ b/docs/api_reference.rst @@ -16,6 +16,7 @@ Modules .. toctree:: :maxdepth: 1 + modules/imkar modules/imkar.scattering.diffuse diff --git a/imkar/scattering/diffuse.py b/imkar/scattering/diffuse.py index 007c25d..eb2fab5 100644 --- a/imkar/scattering/diffuse.py +++ b/imkar/scattering/diffuse.py @@ -122,7 +122,7 @@ def calculation( speed_of_sound : np.ndarray is the speed of sound in air, in metres per second (m/s), during the measurement of each measurement conditions of - shape (..., 4).. + shape (..., 4). air_attenuation_coefficient : pf.FrequencyData the energy attenuation coefficient of air, in reciprocal metres (:math:`m^-1`), calculated according to ISO 9613-1, From 082fdd0fc45f45ef044feb7903e57c6f59c11364 Mon Sep 17 00:00:00 2001 From: Anne Heimes <64446926+ahms5@users.noreply.github.com> Date: Tue, 29 Jul 2025 11:23:28 +0200 Subject: [PATCH 3/8] fix doc --- docs/api_reference.rst | 1 - docs/modules/imkar.rst | 7 ------- imkar/scattering/diffuse.py | 24 ++++++++++++------------ 3 files changed, 12 insertions(+), 20 deletions(-) delete mode 100644 docs/modules/imkar.rst diff --git a/docs/api_reference.rst b/docs/api_reference.rst index 6b6fafd..cc25d99 100644 --- a/docs/api_reference.rst +++ b/docs/api_reference.rst @@ -16,7 +16,6 @@ Modules .. toctree:: :maxdepth: 1 - modules/imkar modules/imkar.scattering.diffuse diff --git a/docs/modules/imkar.rst b/docs/modules/imkar.rst deleted file mode 100644 index 0ea5287..0000000 --- a/docs/modules/imkar.rst +++ /dev/null @@ -1,7 +0,0 @@ -imkar -===== - -.. automodule:: imkar - :members: - :undoc-members: - :show-inheritance: diff --git a/imkar/scattering/diffuse.py b/imkar/scattering/diffuse.py index eb2fab5..c9c536c 100644 --- a/imkar/scattering/diffuse.py +++ b/imkar/scattering/diffuse.py @@ -26,10 +26,10 @@ def maximum_sample_absorption_coefficient(frequencies) -> pf.FrequencyData: References ---------- - [#] ISO 17497-1:2004, Sound-scattering properties of surfaces. Part 1: - Measurement of the random-incidence scattering coefficient in a - reverberation room. Geneva, Switzerland: International Organization - for Standards, 2004. + .. [#] ISO 17497-1:2004, Sound-scattering properties of surfaces. Part 1: + Measurement of the random-incidence scattering coefficient in a + reverberation room. Geneva, Switzerland: International Organization + for Standards, 2004. """ # input checks @@ -67,10 +67,10 @@ def maximum_baseplate_scattering_coefficient(N:int=1) -> pf.FrequencyData: References ---------- - [#] ISO 17497-1:2004, Sound-scattering properties of surfaces. Part 1: - Measurement of the random-incidence scattering coefficient in a - reverberation room. Geneva, Switzerland: International Organization - for Standards, 2004. + .. [#] ISO 17497-1:2004, Sound-scattering properties of surfaces. Part 1: + Measurement of the random-incidence scattering coefficient in a + reverberation room. Geneva, Switzerland: International Organization + for Standards, 2004. """ if not isinstance(N, int): @@ -146,10 +146,10 @@ def calculation( References ---------- - [#] ISO 17497-1:2004, Sound-scattering properties of surfaces. Part 1: - Measurement of the random-incidence scattering coefficient in a - reverberation room. Geneva, Switzerland: International Organization - for Standards, 2004. + .. [#] ISO 17497-1:2004, Sound-scattering properties of surfaces. Part 1: + Measurement of the random-incidence scattering coefficient in a + reverberation room. Geneva, Switzerland: International Organization + for Standards, 2004. """ T_1 = reverberation_times[..., 0] T_2 = reverberation_times[..., 1] From 8a13014c26befc9975386387284fc4534171e428 Mon Sep 17 00:00:00 2001 From: Anne Heimes <64446926+ahms5@users.noreply.github.com> Date: Tue, 29 Jul 2025 11:24:18 +0200 Subject: [PATCH 4/8] Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- imkar/scattering/diffuse.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/imkar/scattering/diffuse.py b/imkar/scattering/diffuse.py index c9c536c..f500b43 100644 --- a/imkar/scattering/diffuse.py +++ b/imkar/scattering/diffuse.py @@ -49,7 +49,7 @@ def maximum_sample_absorption_coefficient(frequencies) -> pf.FrequencyData: ) -def maximum_baseplate_scattering_coefficient(N:int=1) -> pf.FrequencyData: +def maximum_baseplate_scattering_coefficient(N: int = 1) -> pf.FrequencyData: """Maximum scattering coefficient for the base plate alone. This is based on Table 1 in ISO 17497-1:2004 [#]_. @@ -62,7 +62,7 @@ def maximum_baseplate_scattering_coefficient(N:int=1) -> pf.FrequencyData: Returns ------- - s_base_max : pf.Frequency + s_base_max : pf.FrequencyData The maximum baseplate scattering coefficient. References From 241121a0ce217bc0126c6da3cc407bcf30a9973c Mon Sep 17 00:00:00 2001 From: Anne Heimes <64446926+ahms5@users.noreply.github.com> Date: Tue, 29 Jul 2025 11:28:58 +0200 Subject: [PATCH 5/8] cleanup --- imkar/scattering/diffuse.py | 88 ------------------------------------- 1 file changed, 88 deletions(-) diff --git a/imkar/scattering/diffuse.py b/imkar/scattering/diffuse.py index f500b43..bb737b6 100644 --- a/imkar/scattering/diffuse.py +++ b/imkar/scattering/diffuse.py @@ -90,91 +90,3 @@ def maximum_baseplate_scattering_coefficient(N: int = 1) -> pf.FrequencyData: frequencies=np.array(frequencies)/N, comment="Maximum scattering coefficient of the baseplate", ) - -def calculation( - reverberation_times, speed_of_sound, - air_attenuation_coefficient, - volume, surface_sample) -> tuple: - """ - Calculate the diffuse scattering coefficient after ISO 17497-1:2004. - - Measurement conditions for the four different reverberation times - and the corresponding speed of sound and air attenuation - coefficients based on Table 2 in ISO 17497-1:2004 [#]_. - - +------------------------+-------------+--------------+ - | measurement condition | test sample | turntable | - +------------------------+-------------+--------------+ - | 1 | not present | not rotating | - +------------------------+-------------+--------------+ - | 2 | present | not rotating | - +------------------------+-------------+--------------+ - | 3 | not present | rotating | - +------------------------+-------------+--------------+ - | 4 | present | rotating | - +------------------------+-------------+--------------+ - - Parameters - ---------- - reverberation_times : pf.FrequencyData - The reverberation times in seconds of the measurement conditions of - cshape (..., 4). - speed_of_sound : np.ndarray - is the speed of sound in air, in metres per second (m/s), - during the measurement of each measurement conditions of - shape (..., 4). - air_attenuation_coefficient : pf.FrequencyData - the energy attenuation coefficient of air, in reciprocal metres - (:math:`m^-1`), calculated according to ISO 9613-1, - using the temperature and relative humidity during the measurement - of each measurement conditions of cshape (..., 4). - volume : float - volume of the reverberation room, in cubic metres (:math:`m^3`). - surface_sample : float - is the area of the test sample, in square metres (:math:`m^2`). - - Returns - ------- - scattering : pf.FrequencyData - The random-incidence scattering coefficient. - s_base : pf.FrequencyData - The base plate scattering coefficient. - alpha_s : pf.FrequencyData - The random-incidence absorption coefficient. - alpha_spec : pf.FrequencyData - The random-incidence specular absorption coefficient. - - References - ---------- - .. [#] ISO 17497-1:2004, Sound-scattering properties of surfaces. Part 1: - Measurement of the random-incidence scattering coefficient in a - reverberation room. Geneva, Switzerland: International Organization - for Standards, 2004. - """ - T_1 = reverberation_times[..., 0] - T_2 = reverberation_times[..., 1] - T_3 = reverberation_times[..., 2] - T_4 = reverberation_times[..., 3] - c_1 = speed_of_sound[..., 0] - c_2 = speed_of_sound[..., 1] - c_3 = speed_of_sound[..., 2] - c_4 = speed_of_sound[..., 3] - m_1 = air_attenuation_coefficient[..., 0] - m_2 = air_attenuation_coefficient[..., 1] - m_3 = air_attenuation_coefficient[..., 2] - m_4 = air_attenuation_coefficient[..., 3] - V = volume - S = surface_sample - - # random incident absorption coefficient - alpha_s = 55.3 * V/S * (1/(c_2*T_2) - 1/(c_1*T_1)) - 4*V/S * (m_2-m_1) - - # specular absorption coefficient - alpha_spec = 55.3 * V/S * (1/(c_4*T_4) - 1/(c_3*T_3)) - 4*V/S * (m_4-m_3) - - # calculate scattering coefficient - scattering = (alpha_spec - alpha_s) / (1 - alpha_s) - - s_base = 55.3*V/S*(1/(c_3*T_3) - 1/(c_1*T_1)) - 4*V/S*(m_3-m_1) - - return scattering, s_base, alpha_s, alpha_spec From 6d5dae83f06b2f374cdf79b9d618346beaf68409 Mon Sep 17 00:00:00 2001 From: Anne Heimes <64446926+ahms5@users.noreply.github.com> Date: Tue, 29 Jul 2025 12:04:22 +0200 Subject: [PATCH 6/8] make pyfar.FrequencyData link to pyfar doc --- imkar/scattering/diffuse.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/imkar/scattering/diffuse.py b/imkar/scattering/diffuse.py index bb737b6..6b793b1 100644 --- a/imkar/scattering/diffuse.py +++ b/imkar/scattering/diffuse.py @@ -16,12 +16,12 @@ def maximum_sample_absorption_coefficient(frequencies) -> pf.FrequencyData: Parameters ---------- - frequencies : np.ndarray + frequencies : numpy.ndarray The frequencies at which the absorption coefficient is calculated. Returns ------- - alpha_s_max : pf.FrequencyData + alpha_s_max : pyfar.FrequencyData The maximum sample absorption coefficient. References @@ -62,7 +62,7 @@ def maximum_baseplate_scattering_coefficient(N: int = 1) -> pf.FrequencyData: Returns ------- - s_base_max : pf.FrequencyData + s_base_max : pyfar.FrequencyData The maximum baseplate scattering coefficient. References From 2b3e2910aeb88cebc4934757c7bbfea8cc5f58c7 Mon Sep 17 00:00:00 2001 From: Anne Heimes <64446926+ahms5@users.noreply.github.com> Date: Tue, 29 Jul 2025 12:16:42 +0200 Subject: [PATCH 7/8] Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- tests/test_scattering_diffuse.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_scattering_diffuse.py b/tests/test_scattering_diffuse.py index 5a136af..d6df0ee 100644 --- a/tests/test_scattering_diffuse.py +++ b/tests/test_scattering_diffuse.py @@ -66,7 +66,7 @@ def test_maximum_baseplate_scattering_coefficient_invalid_type(): isd.maximum_baseplate_scattering_coefficient(N=-1) def test_maximum_baseplate_scattering_coefficient_negative_N(): - # Negative N is technically an integer, but let's check if it works + # Test with a positive integer N to verify expected behavior N = 5 result = isd.maximum_baseplate_scattering_coefficient(N) expected_freqs = np.array([ From 5bde6c6b38ca1ec364bf44543b262db590115906 Mon Sep 17 00:00:00 2001 From: Anne Heimes <64446926+ahms5@users.noreply.github.com> Date: Thu, 31 Jul 2025 13:00:49 +0200 Subject: [PATCH 8/8] Update tests/test_scattering_diffuse.py --- tests/test_scattering_diffuse.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_scattering_diffuse.py b/tests/test_scattering_diffuse.py index d6df0ee..a91aa42 100644 --- a/tests/test_scattering_diffuse.py +++ b/tests/test_scattering_diffuse.py @@ -65,7 +65,7 @@ def test_maximum_baseplate_scattering_coefficient_invalid_type(): with pytest.raises(TypeError, match="N must be a positive integer."): isd.maximum_baseplate_scattering_coefficient(N=-1) -def test_maximum_baseplate_scattering_coefficient_negative_N(): +def test_maximum_baseplate_scattering_coefficient_N(): # Test with a positive integer N to verify expected behavior N = 5 result = isd.maximum_baseplate_scattering_coefficient(N)