feat(schema): optical sub-table additions — scintillator/Geant4 (#153)#194
Merged
Conversation
Adds 11 optical fields, mostly scintillator + Geant4 photon transport
data that the schema currently has no slot for.
Scalars:
- scattering_length / rayleigh_length (cm) — Geant4 photon transport
- afterglow_pct_at_3ms / afterglow_pct_at_100ms — count-rate ceiling
- non_proportionality (% deviation 10 keV → 1 MeV)
- intrinsic_resolution_pct_at_662keV (137Cs photopeak FWHM)
- temperature_coefficient_light_yield (%/K) — LYSO ~-0.4
- hygroscopic (bool) — NaI:Tl yes, BGO/LYSO no
Structured (3 — pure data shapes, no new dataclass needed):
- decay_components: list[{tau_ns, fraction}] — multi-component decay
(LYSO has fast ~36 ns + slow ~600 ns; scalar would lose TOF info)
- emission_spectrum: {wavelengths_nm, intensities} — for SiPM PDE
matching
- refractive_index_dispersion: {wavelengths_nm, n} — Sellmeier-style
for Geant4 ray tracing
Loader fix (regression of #149's loader sugar): only route dict-valued
properties through `_parse_value` when their keys overlap with
{nominal, stddev, min, max}. Otherwise pass through verbatim — previously
emission_spectrum / refractive_index_dispersion would be parsed as
uncertainty dicts and crash. Tightens the dict-shape detection to the
ufloat keyword set rather than "any dict".
Pint *_qty accessors for scattering_length / rayleigh_length.
Tests: tests/test_optical_fields.py (11 tests). All 570 tests pass.
Closes #153
This was referenced May 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds 11 optical fields, mostly scintillator + Geant4 photon transport data that the schema currently has no slot for.
Scalars
scattering_length/rayleigh_lengthafterglow_pct_at_3ms/afterglow_pct_at_100msnon_proportionalityintrinsic_resolution_pct_at_662keVtemperature_coefficient_light_yieldhygroscopicStructured (3 — plain dict / list[dict], no new dataclass)
decay_componentslist[{tau_ns, fraction}]emission_spectrum{wavelengths_nm: [...], intensities: [...]}refractive_index_dispersion{wavelengths_nm: [...], n: [...]}Loader bug fix bundled
#149's loader sugar treated every dict-valued property as a
{nominal, stddev}uncertainty dict — which would crash onemission_spectrum = {wavelengths_nm=[...], intensities=[...]}. Tightened the dict-shape detection: only route through_parse_valuewhen the dict's keys overlap with{nominal, stddev, min, max}. Verifiedtests/test_stddev_sugar.pystill passes (no regression on the ufloat path).Test plan
pytest tests/test_optical_fields.py— 11 tests passpytest tests/test_stddev_sugar.py tests/test_temp_curves.py— no regressions on adjacent loader logicruff checkcleanCloses #153