Ir al contenido
Esta documentación describe la versión 4.0.0, todavía sin publicar. La versión actual en PyPI es la 3.3.0 y no incluye todo lo que se describe aquí.

metrology.calibration

La referencia de la API se publica en inglés en los dos idiomas: se genera a partir de los docstrings del código, que son su texto original.

Calibration utilities for mapping digital signals to physical SPL levels.

Auto-generated from the source docstrings by scripts/generate_api_docs.py (make api-docs). Do not edit by hand.

The calibration reference recording looks unreliable.

sensitivity(
ref_signal: SignalInput,
target_spl: float = ...,
reference_pressure_pa: float = ...,
*,
fs: int,
validate: bool = ...,
max_fluctuation_db: float | None = ...,
frequency: float = ...,
calibrator_class: str = ...,
narrowband: Literal[True],
) -> float
sensitivity(
ref_signal: SignalInput,
target_spl: float = ...,
reference_pressure_pa: float = ...,
fs: int | None = ...,
*,
validate: bool = ...,
max_fluctuation_db: float | None = ...,
frequency: float = ...,
calibrator_class: str = ...,
narrowband: Literal[False] = ...,
) -> float

Calculate the calibration factor (multiplier) to convert digital units to Pascals based on a reference recording (e.g., 1kHz @ 94dB).

When fs is provided (and validate is True), the recording’s stability is checked the way IEC 60942:2017 specifies for the calibrator itself (5.3.3): levels are measured with time-weighting F and the short-term level fluctuation (the absolute difference between each of the maximum and minimum levels and the mean level) must not exceed the Table 2 acceptance limit for the calibrator’s class and nominal frequency, read from FLUCTUATION_ACCEPTANCE_LIMITS_DB. For class 1 that is 0.07 dB at and above 160 Hz, relaxed to 0.10 dB above 63 Hz and below 160 Hz, and to 0.20 dB for the 31.5-63 Hz row where the F time-weighting itself ripples; class LS is held to 0.03 dB and class 2 to 0.15 dB. Where Table 2 gives the class no limit (outside 31.5 Hz to 16 kHz for class 1, outside 160 Hz to 1.25 kHz for LS and 2) the strictest limit of the class’s column applies. A larger fluctuation usually means a badly coupled microphone or handling noise in the recording, which would silently corrupt every calibrated level; a CalibrationWarning is emitted.

Parameters

NameDescription
ref_signalRecording of the calibration tone. Accepts a phonometry.io.Signal for its rate; a calibration factor it carries is deliberately not applied, because this function is what produces such a factor and folding an existing one in would calibrate the calibration.
target_splThe known SPL level of the calibrator (default 94 dB).
reference_pressure_paReference pressure (default 20 microPascals).
fsSample rate of the recording in Hz. Required for the stability validation; without it the check is skipped. A Signal supplies it, so a read take gets the validation for free, and an explicit value that disagrees raises.
validateIf True (default) and fs is given, warn when the recording’s short-term level fluctuation exceeds the limit.
max_fluctuation_dbExplicit fluctuation limit in dB. Default (None) resolves the IEC 60942:2017 Table 2 limit for calibrator_class at frequency.
frequencyNominal frequency of the calibration tone in Hz (default 1000.0), used to select the Table 2 row.
calibrator_classThe calibrator’s class designation, "LS", "LS/M", "1" (default), "1/M" or "2" (IEC 60942:2017 Table 1), used to select the Table 2 column.
narrowbandIf True (requires fs), estimate the tone level with a coherent single-frequency (Goertzel) detector locked to the tone near frequency instead of the full-band RMS. This rejects broadband hum/noise in the reference take, which otherwise inflates the RMS and shrinks the factor by (about -0.44 dB at 20 dB SNR), silently biasing every subsequent level. The default (False) keeps the exact legacy broadband-RMS behaviour; enable it for noisy coupler recordings.

Returns: Calibration factor (sensitivity multiplier).