Skip to content

Commit 241121a

Browse files
committed
cleanup
1 parent 8a13014 commit 241121a

File tree

1 file changed

+0
-88
lines changed

1 file changed

+0
-88
lines changed

imkar/scattering/diffuse.py

Lines changed: 0 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -90,91 +90,3 @@ def maximum_baseplate_scattering_coefficient(N: int = 1) -> pf.FrequencyData:
9090
frequencies=np.array(frequencies)/N,
9191
comment="Maximum scattering coefficient of the baseplate",
9292
)
93-
94-
def calculation(
95-
reverberation_times, speed_of_sound,
96-
air_attenuation_coefficient,
97-
volume, surface_sample) -> tuple:
98-
"""
99-
Calculate the diffuse scattering coefficient after ISO 17497-1:2004.
100-
101-
Measurement conditions for the four different reverberation times
102-
and the corresponding speed of sound and air attenuation
103-
coefficients based on Table 2 in ISO 17497-1:2004 [#]_.
104-
105-
+------------------------+-------------+--------------+
106-
| measurement condition | test sample | turntable |
107-
+------------------------+-------------+--------------+
108-
| 1 | not present | not rotating |
109-
+------------------------+-------------+--------------+
110-
| 2 | present | not rotating |
111-
+------------------------+-------------+--------------+
112-
| 3 | not present | rotating |
113-
+------------------------+-------------+--------------+
114-
| 4 | present | rotating |
115-
+------------------------+-------------+--------------+
116-
117-
Parameters
118-
----------
119-
reverberation_times : pf.FrequencyData
120-
The reverberation times in seconds of the measurement conditions of
121-
cshape (..., 4).
122-
speed_of_sound : np.ndarray
123-
is the speed of sound in air, in metres per second (m/s),
124-
during the measurement of each measurement conditions of
125-
shape (..., 4).
126-
air_attenuation_coefficient : pf.FrequencyData
127-
the energy attenuation coefficient of air, in reciprocal metres
128-
(:math:`m^-1`), calculated according to ISO 9613-1,
129-
using the temperature and relative humidity during the measurement
130-
of each measurement conditions of cshape (..., 4).
131-
volume : float
132-
volume of the reverberation room, in cubic metres (:math:`m^3`).
133-
surface_sample : float
134-
is the area of the test sample, in square metres (:math:`m^2`).
135-
136-
Returns
137-
-------
138-
scattering : pf.FrequencyData
139-
The random-incidence scattering coefficient.
140-
s_base : pf.FrequencyData
141-
The base plate scattering coefficient.
142-
alpha_s : pf.FrequencyData
143-
The random-incidence absorption coefficient.
144-
alpha_spec : pf.FrequencyData
145-
The random-incidence specular absorption coefficient.
146-
147-
References
148-
----------
149-
.. [#] ISO 17497-1:2004, Sound-scattering properties of surfaces. Part 1:
150-
Measurement of the random-incidence scattering coefficient in a
151-
reverberation room. Geneva, Switzerland: International Organization
152-
for Standards, 2004.
153-
"""
154-
T_1 = reverberation_times[..., 0]
155-
T_2 = reverberation_times[..., 1]
156-
T_3 = reverberation_times[..., 2]
157-
T_4 = reverberation_times[..., 3]
158-
c_1 = speed_of_sound[..., 0]
159-
c_2 = speed_of_sound[..., 1]
160-
c_3 = speed_of_sound[..., 2]
161-
c_4 = speed_of_sound[..., 3]
162-
m_1 = air_attenuation_coefficient[..., 0]
163-
m_2 = air_attenuation_coefficient[..., 1]
164-
m_3 = air_attenuation_coefficient[..., 2]
165-
m_4 = air_attenuation_coefficient[..., 3]
166-
V = volume
167-
S = surface_sample
168-
169-
# random incident absorption coefficient
170-
alpha_s = 55.3 * V/S * (1/(c_2*T_2) - 1/(c_1*T_1)) - 4*V/S * (m_2-m_1)
171-
172-
# specular absorption coefficient
173-
alpha_spec = 55.3 * V/S * (1/(c_4*T_4) - 1/(c_3*T_3)) - 4*V/S * (m_4-m_3)
174-
175-
# calculate scattering coefficient
176-
scattering = (alpha_spec - alpha_s) / (1 - alpha_s)
177-
178-
s_base = 55.3*V/S*(1/(c_3*T_3) - 1/(c_1*T_1)) - 4*V/S*(m_3-m_1)
179-
180-
return scattering, s_base, alpha_s, alpha_spec

0 commit comments

Comments
 (0)