Skip to content

Utilities Module

Utility functions.

Attributes

SOUNDSPEED module-attribute

SOUNDSPEED = 343.0

Speed of sound in air.

Functions

mean_tl

mean_tl(tl, surfaces)

Mean tl.

Source code in acoustic_toolbox/utils.py
def mean_tl(tl, surfaces):
    """Mean tl."""
    try:
        tau_axis = tl.ndim - 1
    except AttributeError:
        tau_axis = 0
    tau = 1.0 / (10.0 ** (tl / 10.0))
    return 10.0 * np.log10(1.0 / np.average(tau, tau_axis, surfaces))

wavelength

wavelength(freq: ndarray, c: float = SOUNDSPEED) -> ndarray

Wavelength for one or more frequencies.

Source code in acoustic_toolbox/utils.py
def wavelength(freq: np.ndarray, c: float = SOUNDSPEED) -> np.ndarray:
    """Wavelength for one or more frequencies."""
    return c / freq

w

w(freq: ndarray) -> ndarray

Angular frequency for one o more frequencies.

Source code in acoustic_toolbox/utils.py
def w(freq: np.ndarray) -> np.ndarray:
    """Angular frequency for one o more frequencies."""
    return 2.0 * np.pi * freq

:::