Atmosphere Module
The atmosphere module contains functions and classes related to atmospheric acoustics and is based on ISO 9613-1:1993.
| CLASS | DESCRIPTION |
|---|---|
Atmosphere |
Class describing atmospheric conditions. |
| FUNCTION | DESCRIPTION |
|---|---|
soundspeed |
Calculate the speed of sound. |
saturation_pressure |
Calculate the saturation pressure. |
molar_concentration_water_vapour |
Calculate the molar concentration of water vapour. |
relaxation_frequency_nitrogen |
Calculate the relaxation frequency of nitrogen. |
relaxation_frequency_oxygen |
Calculate the relaxation frequency of oxygen. |
attenuation_coefficient |
Calculate the attenuation coefficient. |
Attributes
Classes
Atmosphere
Atmosphere(
temperature: float = REFERENCE_TEMPERATURE,
pressure: float = REFERENCE_PRESSURE,
relative_humidity: float = 0.0,
reference_temperature: float = REFERENCE_TEMPERATURE,
reference_pressure: float = REFERENCE_PRESSURE,
triple_temperature: float = TRIPLE_TEMPERATURE,
)
Class describing atmospheric conditions.
| PARAMETER | DESCRIPTION |
|---|---|
temperature
|
Temperature in kelvin.
TYPE:
|
pressure
|
Pressure.
TYPE:
|
relative_humidity
|
Relative humidity.
TYPE:
|
reference_temperature
|
Reference temperature.
TYPE:
|
reference_pressure
|
Reference pressure.
TYPE:
|
triple_temperature
|
Triple temperature.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
|
An instance of the Atmosphere class. |
Source code in acoustic_toolbox/atmosphere.py
Attributes
REF_PRESSURE
class-attribute
instance-attribute
International Standard Atmosphere in kilopascal
TRIPLE_TEMP
class-attribute
instance-attribute
Triple point isotherm temperature.
reference_temperature
instance-attribute
Reference temperature.
soundspeed
property
soundspeed: float
Speed of sound \(c\).
The speed of sound is calculated using standards.iso_9613_1_1993.soundspeed.
| RETURNS | DESCRIPTION |
|---|---|
float
|
The speed of sound.
TYPE:
|
saturation_pressure
property
saturation_pressure: float
Saturation pressure \(p_{sat}\).
The saturation pressure is calculated using standards.iso_9613_1_1993.saturation_pressure.
| RETURNS | DESCRIPTION |
|---|---|
float
|
The saturation pressure.
TYPE:
|
molar_concentration_water_vapour
property
molar_concentration_water_vapour: float
Molar concentration of water vapour \(h\).
The molar concentration of water vapour is calculated using
standards.iso_9613_1_1993.molar_concentration_water_vapour.
| RETURNS | DESCRIPTION |
|---|---|
float
|
The molar concentration of water vapour.
TYPE:
|
relaxation_frequency_nitrogen
property
relaxation_frequency_nitrogen: float
Resonance frequency of nitrogen \(f_{r,N}\).
The resonance frequency is calculated using
standards.iso_9613_1_1993.relaxation_frequency_nitrogen.
| RETURNS | DESCRIPTION |
|---|---|
float
|
The resonance frequency of nitrogen.
TYPE:
|
relaxation_frequency_oxygen
property
relaxation_frequency_oxygen: float
Resonance frequency of oxygen \(f_{r,O}\).
The resonance frequency is calculated using
standards.iso_9613_1_1993.relaxation_frequency_oxygen.
| RETURNS | DESCRIPTION |
|---|---|
float
|
The resonance frequency of oxygen.
TYPE:
|
Functions
attenuation_coefficient
Attenuation coefficient \(\alpha\) describing atmospheric absorption in dB/m.
The attenuation coefficient is calculated using
standards.iso_9613_1_1993.attenuation_coefficient.
| PARAMETER | DESCRIPTION |
|---|---|
frequency
|
Frequencies to be considered. |
| RETURNS | DESCRIPTION |
|---|---|
float
|
The attenuation coefficient. |
Source code in acoustic_toolbox/atmosphere.py
frequency_response
frequency_response(
distance: float,
frequencies: float | NDArray[float64],
inverse: bool = False,
) -> NDArray[float64]
Calculate the frequency response.
| PARAMETER | DESCRIPTION |
|---|---|
distance
|
Distance between source and receiver.
TYPE:
|
frequencies
|
Frequencies for which to compute the response. |
inverse
|
Whether the attenuation should be undone.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
array
|
The frequency response. |
Source code in acoustic_toolbox/atmosphere.py
impulse_response
impulse_response(
distance: float,
fs: float,
ntaps: int,
inverse: bool = False,
) -> NDArray[float64]
Calculate the impulse response of sound travelling through atmosphere.
| PARAMETER | DESCRIPTION |
|---|---|
distance
|
Distance between source and receiver.
TYPE:
|
fs
|
Sample frequency.
TYPE:
|
ntaps
|
Amount of taps.
TYPE:
|
inverse
|
Whether the attenuation should be undone.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
array
|
The impulse response. |
See Also
Source code in acoustic_toolbox/atmosphere.py
plot_attenuation_coefficient
Plot the attenuation coefficient \(\alpha\) as function of frequency.
| PARAMETER | DESCRIPTION |
|---|---|
frequency
|
Frequencies. |
Note
The attenuation coefficient is plotted in dB/km!
| RETURNS | DESCRIPTION |
|---|---|
Figure
|
matplotlib.figure.Figure: The generated figure. |
Source code in acoustic_toolbox/atmosphere.py
Functions
soundspeed
soundspeed(
temperature: float,
reference_temperature: float = REFERENCE_TEMPERATURE,
) -> float
Calculate speed of sound \(c\) in air.
Notes
The speed of sound is calculated using the formula: $$ c = 343.2 \left( \frac{T}{T_0} \right) $$
| PARAMETER | DESCRIPTION |
|---|---|
temperature
|
Ambient temperature \(T_0\).
TYPE:
|
reference_temperature
|
Reference temperature \(T\).
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
float
|
Speed of sound in m/s.
TYPE:
|
Source code in acoustic_toolbox/standards/iso_9613_1_1993.py
saturation_pressure
saturation_pressure(
temperature: float,
reference_pressure: float = REFERENCE_PRESSURE,
triple_temperature: float = TRIPLE_TEMPERATURE,
) -> float
Calculate saturation vapor pressure \(p_{sat}\).
Notes
The saturation vapor pressure is calculated using the formula: $$ p_{sat} = 10^C \cdot p_r $$
with exponent \(C\) given by: $$ C = -6.8346 \cdot \left( \frac{T_{01}}{T} \right)^{1.261} + 4.6151 $$
| PARAMETER | DESCRIPTION |
|---|---|
temperature
|
Ambient temperature \(T\).
TYPE:
|
reference_pressure
|
Reference pressure \(p_r\).
TYPE:
|
triple_temperature
|
Triple point temperature \(T_{01}\).
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
float
|
Saturation vapor pressure
TYPE:
|
Source code in acoustic_toolbox/standards/iso_9613_1_1993.py
molar_concentration_water_vapour
molar_concentration_water_vapour(
relative_humidity: float,
saturation_pressure: float,
pressure: float,
) -> float
Calculate molar concentration of water vapour \(h\).
Notes
The molar concentration of water vapour is calculated using the formula: $$ h = h_r \frac{p_{sat}}{p_a} $$
| PARAMETER | DESCRIPTION |
|---|---|
relative_humidity
|
Relative humidity \(h_r\)
TYPE:
|
saturation_pressure
|
Saturation pressure \(p_{sat}\)
TYPE:
|
pressure
|
Ambient pressure \(p_a\)
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
float
|
Molar concentration of water vapour
TYPE:
|
Source code in acoustic_toolbox/standards/iso_9613_1_1993.py
relaxation_frequency_oxygen
relaxation_frequency_oxygen(
pressure: float,
h: float,
reference_pressure: float = REFERENCE_PRESSURE,
) -> float
Calculate relaxation frequency of oxygen \(f_{r,O}\).
Notes
The relaxation frequency of oxygen is calculated using the formula: $$ f_{r,O} = \frac{p_a}{p_r} \left( 24 + 4.04 \cdot 10^4 h \frac{0.02 + h}{0.391 + h} \right) $$
| PARAMETER | DESCRIPTION |
|---|---|
pressure
|
Ambient pressure \(p_a\)
TYPE:
|
h
|
Molar concentration of water vapour \(h\)
TYPE:
|
reference_pressure
|
Reference pressure \(p_r\).
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
float
|
Relaxation frequency of oxygen in Hz
TYPE:
|
See Also
molar_concentration_water_vapour: Function to calculate molar concentration of water vapour
Source code in acoustic_toolbox/standards/iso_9613_1_1993.py
relaxation_frequency_nitrogen
relaxation_frequency_nitrogen(
pressure: float,
temperature: float,
h: float,
reference_pressure: float = REFERENCE_PRESSURE,
reference_temperature: float = REFERENCE_TEMPERATURE,
) -> float
Calculate relaxation frequency of nitrogen \(f_{r,N}\).
Notes
The relaxation frequency of nitrogen is calculated by: $$ f_{r,N} = \frac{p_a}{p_r} \left( \frac{T}{T_0} \right)^{-½} \cdot \left( 9 + 280 \cdot h \cdot \exp \left( -4.170 \left[ \left(\frac{T}{T_0} \right)^{-⅓} -1 \right] \right) \right) $$
| PARAMETER | DESCRIPTION |
|---|---|
pressure
|
Ambient pressure \(p_a\)
TYPE:
|
temperature
|
Ambient temperature \(T\)
TYPE:
|
h
|
Molar concentration of water vapour \(h\)
TYPE:
|
reference_pressure
|
Reference pressure \(p_{ref}\).
TYPE:
|
reference_temperature
|
Reference temperature \(T_{ref}\).
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
float
|
Relaxation frequency of nitrogen in Hz
TYPE:
|
Source code in acoustic_toolbox/standards/iso_9613_1_1993.py
attenuation_coefficient
attenuation_coefficient(
pressure: float,
temperature: float,
reference_pressure: float,
reference_temperature: float,
relaxation_frequency_nitrogen: float,
relaxation_frequency_oxygen: float,
frequency: float | NDArray[float64],
) -> float | NDArray[float64]
Calculate attenuation coefficient \(\alpha\) describing atmospheric absorption in dB/m for the specified frequency.
| PARAMETER | DESCRIPTION |
|---|---|
pressure
|
Ambient pressure \(p_a\)
TYPE:
|
temperature
|
Ambient temperature \(T\)
TYPE:
|
reference_pressure
|
Reference pressure \(p_{ref}\)
TYPE:
|
reference_temperature
|
Reference temperature \(T_{ref}\)
TYPE:
|
relaxation_frequency_nitrogen
|
Relaxation frequency of nitrogen \(f_{r,N}\)
TYPE:
|
relaxation_frequency_oxygen
|
Relaxation frequency of oxygen \(f_{r,O}\)
TYPE:
|
frequency
|
Frequencies \(f\) to calculate \(\alpha\) for |
| RETURNS | DESCRIPTION |
|---|---|
float | NDArray[float64]
|
float | NDArray[np.float64]: Attenuation coefficient in dB/m |
Source code in acoustic_toolbox/standards/iso_9613_1_1993.py
frequency_response
frequency_response(
atmosphere: Atmosphere,
distance: float,
frequencies: float | NDArray[float64],
inverse: bool = False,
) -> NDArray[float64]
Calculate the single-sided frequency response.
| PARAMETER | DESCRIPTION |
|---|---|
atmosphere
|
Atmosphere instance.
TYPE:
|
distance
|
Distance between source and receiver.
TYPE:
|
frequencies
|
Frequencies for which to compute the response. |
inverse
|
Whether the attenuation should be undone.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
array
|
The frequency response. |
Source code in acoustic_toolbox/atmosphere.py
impulse_response
impulse_response(
atmosphere: Atmosphere,
distance: float,
fs: float,
ntaps: int,
inverse: bool = False,
) -> NDArray[float64]
Calculate the impulse response of sound travelling through atmosphere for a given distance sampled at fs.
The attenuation is calculated for a set of positive frequencies. Because the attenuation is the same for the negative frequencies, we have Hermitian symmetry. The attenuation is entirely real-valued. We like to have a constant group delay and therefore we need a linear-phase filter.
This function creates a zero-phase filter, which is the special case of a linear-phase filter with zero phase slope. The type of filter is non-causal. The impulse response of the filter is made causal by rotating it by M/2 samples and discarding the imaginary parts. A real, even impulse response corresponds to a real, even frequency response.
| PARAMETER | DESCRIPTION |
|---|---|
atmosphere
|
Atmosphere instance.
TYPE:
|
distance
|
Distance between source and receiver.
TYPE:
|
fs
|
Sample frequency.
TYPE:
|
ntaps
|
Amount of taps.
TYPE:
|
inverse
|
Whether the attenuation should be undone.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
array
|
The impulse response. |
Source code in acoustic_toolbox/atmosphere.py
:::