rizer.io.experimental_data.load_experiment_data#
Loader for the fixed-schema experiment .npz files under data/experiments/.
Replaces the retired self-describing-CSV-header convention (name [unit] columns, resolved via rizer.misc.simulation.plot_registry.resolve_canonical_name) with three fixed npz-key -> canonical-name tables, one per schema written by rizer.io.experimental_data.preprocess_data. Which schema applies to a given file is inferred from its filename prefix – the same electron_density/electrical_signals/section_diameters prefixes rizer.spice.backend.services.results_discovery.discover_experiments already filters on (imported from here via RECOGNIZED_EXPERIMENT_PREFIXES, so the two modules cannot drift apart on which prefixes are recognized).
Unit contract: every schema’s on-disk npz stores SI units (time in s, d_mean/d_std in m, everything else already SI) – enforced by the writer, not re-validated here. load_experiment_data expands each quantity it reads into every unit variant listed in _UNIT_VARIANTS below, so a caller asks for the exact unit it needs directly (e.g. data[“voltage_kV”], data[“time_ns”], data[“ne_cm-3”]) rather than reading one fixed unit and rescaling it itself. A quantity with no entry in _UNIT_VARIANTS (only “r2”) is dimensionless and keeps its bare key, no unit suffix.
Attributes#
Functions#
|
Return path's arrays' canonical quantity names, without loading values. |
|
Return the family-level quantity names present in a load_experiment_data result. |
|
Load an experiment .npz, keyed by unit-suffixed canonical quantity name. |
Module Contents#
- rizer.io.experimental_data.load_experiment_data.RECOGNIZED_EXPERIMENT_PREFIXES: tuple[str, Ellipsis]#
- rizer.io.experimental_data.load_experiment_data.ELECTRON_DENSITY_NPZ_KEYS: tuple[str, Ellipsis] = ('time', 'ne_mean', 'ne_std', 'r2')#
- rizer.io.experimental_data.load_experiment_data.SECTION_DIAMETERS_NPZ_KEYS: tuple[str, Ellipsis] = ('time', 'd_mean', 'd_std', 'r2')#
- rizer.io.experimental_data.load_experiment_data.ELECTRICAL_SIGNALS_NPZ_KEYS: tuple[str, Ellipsis] = ('time', 'V_mean', 'V_std', 'I_mean', 'I_std', 'E_mean', 'E_std')#
- rizer.io.experimental_data.load_experiment_data.resolve_experiment_columns(path: str | pathlib.Path) list[str]#
Return path’s arrays’ canonical quantity names, without loading values.
- Parameters:
path (
strorpathlib.Path) – Path to an experiment .npz under data/experiments/.- Returns:
Canonical quantity name per array in the file.
- Return type:
- Raises:
ValueError – If path’s filename does not start with a recognized prefix.
KeyError – If the file contains an array name not in that prefix’s schema.
- rizer.io.experimental_data.load_experiment_data.available_quantities(data: dict[str, numpy.ndarray]) set[str]#
Return the family-level quantity names present in a load_experiment_data result.
load_experiment_data expands each quantity it reads into every unit variant in _UNIT_VARIANTS; this recovers which quantity families are present, via each family’s guaranteed-present native-unit key, for compatibility checks like rizer.misc.simulation.plt_simulation.SimulationPlotter._matching_experiment_data and rizer.spice.backend.services.results_plotting._experiment_traces.
- Parameters:
data (
dictofstrtonumpy.ndarray) – A load_experiment_data result.- Returns:
Family-level quantity names present (e.g. “voltage”, “ne”, “r2”).
- Return type:
- rizer.io.experimental_data.load_experiment_data.load_experiment_data(path: str | pathlib.Path) dict[str, numpy.ndarray]#
Load an experiment .npz, keyed by unit-suffixed canonical quantity name.
- Parameters:
path (
strorpathlib.Path) – Path to an experiment .npz under data/experiments/.- Returns:
One entry per unit variant of each array in the file, keyed “{quantity}_{unit}” (e.g. “voltage_V”, “voltage_kV”, “time_ns”, “time_s”) per _UNIT_VARIANTS. “r2” has no unit and keeps its bare key. Use available_quantities to check which quantity families are present without listing every unit variant.
- Return type:
dictofstrtonumpy.ndarray- Raises:
ValueError – If path’s filename does not start with a recognized prefix, or the file is missing an array its schema expects.
KeyError – If the file contains an array name not in that prefix’s schema.