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 to K_DEFAULT.

Attributes#

Functions#

calibrate_k(tests[, voltage_cols, energy_cols, exclude])

Fit k = E / V² per generator from tests that have both columns.

infer_energy(voltage_kv[, k_map, generator])

Compute E = k · V² using the best available k for the given generator.

Module Contents#

sda.analysis.calibration.K_DEFAULT: float = 0.07#
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 (List of SDA test names to scan.)

  • voltage_cols (Column name candidates for voltage.  Defaults to) – VOLTAGE_COLS.

  • energy_cols (Column name candidates for energy.  Defaults to) – ENERGY_COLS.

  • exclude (Test names to skip (e.g. mixed NRP+DC tests whose k is) – not meaningful).

Returns:

  • dict mapping generator name (and ````”default”:py:class:`)` to median k (mJ / kV²).

  • Falls back to :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 names to k values (from) – calibrate_k()). When None, uses K_DEFAULT.

  • generator (Generator name.  Falls back to :py:class:``”default”:py:class:` when not found`) – in k_map.

Return type:

Energy per pulse in mJ, or np.nan if voltage_kv is not finite.