sda.analysis.calibration#
E = k·V² calibration helpers shared across SDA analysis scripts.
Provides a single K_DEFAULT constant (the median k derived from the CH5
campaign) and two functions:
calibrate_k()— fit k per generator from tests that have both energy and voltage columns.infer_energy()— compute E = k·V² using the best available k for a given generator, falling back toK_DEFAULT.
Attributes#
Functions#
|
Fit k = E / V² per generator from tests that have both columns. |
|
Compute E = k · V² using the best available k for the given generator. |
Module Contents#
- sda.analysis.calibration.calibrate_k(tests, voltage_cols=None, energy_cols=None, exclude=frozenset())#
Fit k = E / V² per generator from tests that have both columns.
- Parameters:
tests (
ListofSDA test namestoscan.)voltage_cols (
Column name candidates for voltage. Defaults to) –VOLTAGE_COLS.energy_cols (
Column name candidates for energy. Defaults to) –ENERGY_COLS.exclude (
Test namestoskip (e.g. mixed NRP+DC tests whose k is) – not meaningful).
- Returns:
dict mapping generator name (and ````”default”:py:class:`)` tomedian k (mJ / kV²).Falls backto :py:class:````{"default": K_DEFAULT}:py:class:``` when no calibration data is found.`
- sda.analysis.calibration.infer_energy(voltage_kv, k_map=None, generator='default')#
Compute E = k · V² using the best available k for the given generator.
- Parameters:
voltage_kv (
Voltage in kV.)k_map (
Dict mapping generator namestok values (from) –calibrate_k()). WhenNone, usesK_DEFAULT.generator (
Generator name. Falls backto :py:class:``”default”:py:class:`when not found`) – in k_map.
- Return type:
Energy per pulse in mJ, ornp.nanif voltage_kv is not finite.