Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions pyrato/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
__version__ = '0.4.1'


from .parametric import (
air_attenuation_coefficient,
)

from . import edc
from . import parameters
from . import dsp
Expand All @@ -23,5 +19,4 @@
'dsp',
'analytic',
'parametric',
'air_attenuation_coefficient',
]
72 changes: 0 additions & 72 deletions pyrato/parametric.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,78 +96,6 @@ def energy_decay_curve(
return pf.TimeData(np.reshape(edc, (*matching_shape, times.size)), times)


def air_attenuation_coefficient(
frequency,
temperature=20,
humidity=50,
atmospheric_pressure=101325):
"""Calculate the attenuation coefficient m for the absorption caused
by friction with the surrounding air.

Parameters
----------
frequency : double
The frequency for which the attenuation coefficient is calculated.
When processing in fractional octave bands use the center frequency.
temperature : double
Temperature in degrees Celsius.
humidity : double
Humidity in percent.
atmospheric_pressure : double
Atmospheric pressure.

Returns
-------
attenuation_coefficient : double
The resulting attenuation coefficient.

"""
from pyfar.classes.warnings import PyfarDeprecationWarning
import warnings

warnings.warn(
'Will be replaced by respective function in pyfar before v1.0.0',
PyfarDeprecationWarning, stacklevel=2)

# room temperature in Kelvin
t_K = temperature + 273.16
p_ref_kPa = 101.325
p_kPa = atmospheric_pressure/1000.0

# determine molar concentration of water vapor
tmp = (
(10.79586 * (1.0 - (273.16/t_K))) -
(5.02808 * np.log10((t_K/273.16))) +
(1.50474 * 0.0001 * (1.0 - 10.0 ** (-8.29692*((t_K/273.16) - 1.0)))) +
(0.42873 * 0.001 * (-1.0 + 10.0 ** (-4.76955*(1.0 - (273.16/t_K))))) -
2.2195983)

# molar concentration water vapor in percent
molar_water_vapor = (humidity * 10.0 ** tmp) / (p_kPa/p_ref_kPa)

# determine relaxation frequencies of oxygen and nitrogen
relax_oxygen = ((p_kPa/p_ref_kPa) * (24.0 + (
4.04 * 10000.0 * molar_water_vapor * (
(0.02 + molar_water_vapor) / (0.391 + molar_water_vapor)))))

relax_nitrogen = ((p_kPa/p_ref_kPa) * (
(t_K / 293.16) ** (-0.5)) *
(9.0 + 280.0 * molar_water_vapor * np.exp(
-4.17 * (((t_K / 293.16) ** (-0.3333333)) - 1.0))))

# Neper/m -> dB/m
air_abs_coeff = ((frequency**2 * (
(1.84 * 10.0**(-11.0) * (p_ref_kPa / p_kPa) * (t_K/293.16)**0.5) +
((t_K/293.16)**(-2.5) * (
(1.278 * 0.01 * np.exp(-2239.1/t_K) / (
relax_oxygen + (frequency**2)/relax_oxygen)) +
(1.068 * 0.1 * np.exp((-3352.0/t_K) / (
relax_nitrogen + (frequency**2)/relax_nitrogen))))))
) * 20.0 / np.log(10.0) / (np.log10(np.exp(1.0)) * 10.0))

return air_abs_coeff


def critical_distance(
volume,
reverberation_time):
Expand Down