Repository navigation
feat(schema): new [nuclear] sub-table + py-mat[nuclear] extra (#157) - #195
Merged
Merged
Conversation
Per ADR-0003 §1 — semantic recategorization. radiation_length / interaction_length / moliere_radius were misfiled under [optical] but they're nuclear/radiation physics. Moved cleanly (no compat shim — only known consumer is build123d, which doesn't read these fields). New `NuclearProperties` dataclass with: - radiation_length / interaction_length / moliere_radius (cm) — moved from OpticalProperties - Z_eff (dimensionless) - mean_excitation_energy_eV — Geant4 SetMeanExcitationEnergy - intrinsic_activity_Bq_per_g — LYSO 176Lu ≈ 39 Plus `mu_rho(energy_keV=...)` lazy accessor that imports `nucl_parquet` on first call. Without the extra installed, raises `ImportError` with a helpful hint. Optional extra in pyproject.toml: pip install py-materials[nuclear] gated to Python 3.11+ (nucl-parquet's floor); on 3.10 the extra resolves to nothing and `mu_rho()` is unavailable — scalar fields still work. Wires: - AllProperties.nuclear field - Loader dispatch + child-skip whitelist - test_toml_integrity._KNOWN_GROUPS - pymat-mcp _ALL_DOMAINS - src/pymat/data/scintillators.toml — 6 entries migrated from [optical] to [nuclear] (LYSO, BGO, NaI, CsI, LaBr3, PWO) CONTRIBUTING.md: new "Nuclear data (optional extra)" section. Note on backwards compat: `mat.properties.optical.radiation_length` no longer exists. The user-clarified consumer model (build123d only, which uses density+vis only) makes this a safe minor breakage. Tagged as `feat:` (not `feat!:`) per ADR-0003 §6 option (a). Tests: tests/test_nuclear_subtable.py (9 tests). Full suite: 579 passed. Closes #157
Rust crate's OpticalProperties had radiation_length/interaction_length that mirrored the now-removed Python fields. Mirror the schema move to the new NuclearProperties dataclass + extract_nuclear() reader. Updates the integration test to assert radiation_length under .nuclear() instead of .optical().
gerchowl
force-pushed
the
feature/157-nuclear-subtable
branch
from
May 6, 2026 19:55
ec36c2d to
67caacf
Compare
gerchowl
enabled auto-merge (squash)
May 6, 2026 19:55
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
Per ADR-0003 §1 — semantic recategorization.
radiation_length,interaction_length,moliere_radiuswere misfiled under[optical]but they're nuclear/radiation physics. Moved cleanly, no compat shim — the only known consumer (build123d) doesn't read these fields.New
NuclearPropertiesradiation_lengthOpticalPropertiesinteraction_lengthOpticalPropertiesmoliere_radiusOpticalPropertiesZ_effmean_excitation_energy_eVSetMeanExcitationEnergyintrinsic_activity_Bq_per_gPlus
mu_rho(energy_keV=...)lazy accessor.Optional extra
py-mat[nuclear]Wires
nucl-parquet(cross-section tables, decay chains, stopping powers). Lazy-imported inNuclearProperties.mu_rho()so the core install stays dependency-light. Without the extra installed, the call raisesImportErrorwith a helpful hint.Gated to Python 3.11+ (nucl-parquet's floor). On 3.10 the extra resolves to nothing; the scalar fields still work.
Migration
src/pymat/data/scintillators.toml— 6 entries migrated from[optical]to[nuclear]: LYSO, BGO, NaI, CsI, LaBr3, PWO. Values unchanged. Migration script in commit body.Backwards-compat note
mat.properties.optical.radiation_lengthno longer exists. Per ADR-0003 §6 option (a), tagged asfeat:notfeat!:(minor bump). Justification: build123d-only consumer model — those fields aren't read in the documented integration path.Test plan
pytest tests/test_nuclear_subtable.py— 9 tests passtest_lyso_radiation_length_after_migration)ruff checkcleanmu_rho()lazy import path tested without nucl-parquet installedCloses #157
Phase 2 complete with this PR: #151 (merged) → #152 (merged) → #153 (merged) → #154 → #155 → #156 → #157.