pytimbre.timbre_features.metrics.equivalent_level.EquivalentLevelMetrics

class pytimbre.timbre_features.metrics.equivalent_level.EquivalentLevelMetrics

Bases: object

There are multiple ways to create an equivalent level. This class provides access to the methods through the different PyTimbre objects that represent the acoustic pressures. This includes a Waveform, Spectrum, and TimeHistory.

__init__()

A container class for an equivalent sound pressure level, or acoustic energy averaged over some total duration. Commonly abbreviated Leq. Often includes the spectral weighting and equivalent duration in the abbreviation, e.g., LAeq8hr. Examples:

Represent one half (50%) of a total allowed daily noise exposure >>> import numpy as np >>> from pytimbre.timbre_features.metrics.equivalent_level import EquivalentLevelMetrics >>> leq = EquivalentLevelMetrics(85., datetime.timedelta(hours=4), WeightingFunctions.a_weighted) >>> np.round(leq.leq8hr, decimals=1) 82.0 >>> np.round(leq.noise_dose_pct, decimals=1) 49.9

What is the sound exposure level for a 30-second exposure to an A-weighted SPL of 120 dB? >>> leq = EquivalentLevelMetrics(120., datetime.timedelta(seconds=30), WeightingFunctions.a_weighted) >>> np.round(leq.sel, decimals=1) 134.8

If the logarithmic average SPL of a passing train from a 1-minute recording is 95 dB, what is the SPL for the same noise event averaged over 1 hour? >>> np.round(EquivalentLevelMetrics._convert_duration(95., 60, 60 * 60), decimals=1) 77.2

Methods

__init__()

A container class for an equivalent sound pressure level, or acoustic energy averaged over some total duration.

from_spectrum(s, duration)

from_time_history(th)

from_waveform(wfm)

Attributes

duration

eight_hour_equivalent_level

Eight-hour equivalent level, a common metric for quantifying total daily noise exposure.

exact_equivalent_level

This function will integrate the provided acoustic data to the exact duration of the dataset.

level_time_history

sound_exposure_level

spectrogram

spectrum

waveform

weighting

property eight_hour_equivalent_level

Eight-hour equivalent level, a common metric for quantifying total daily noise exposure. :rtype: float

property exact_equivalent_level

This function will integrate the provided acoustic data to the exact duration of the dataset. :return: the equivalent level of the data :rtype: float or Spectrum