Add validation constraints to FitConfig Card 2 integer fields

Open
#236 0 comments 0 reactions 1 assignee View on GitHub

@along4 is already working on this.

Since Feb 19, 2026.

Assessment

This issue has not been assessed yet.

Description

Summary

FitConfig defines six optional integer fields that map to SAMMY Card Set 2 parameters, but none have validation constraints:

iptdop: Optional[int] = Field(default=None, description="Grid enhancement for Doppler broadening")
iptwid: Optional[int] = Field(default=None, description="Grid enhancement for resonance tails")
ixxchn: Optional[int] = Field(default=None, description="Special channel skip or ENDF ZA")
ndigit: Optional[int] = Field(default=None, description="Digits for compact covariance output")
idropp: Optional[int] = Field(default=None, description="Percent threshold for zeroing covariances")
matnum: Optional[int] = Field(default=None, description="ENDF material number")

Currently any integer value is accepted. Invalid values are only caught when SAMMY runs, which gives poor error messages and wastes compute time.

Suggested Approach

  • Cross-reference the SAMMY manual for each field's valid range and semantics
  • Add appropriate Pydantic constraints (e.g., ge=0, le=100, Literal for enumerated values)
  • Add unit tests verifying that out-of-range values are rejected at config construction time

Location

src/pleiades/sammy/fitting/config.py, lines 31-40

Context

Identified during review of PR #220. Not a blocker — None defaults mean SAMMY's own defaults are used, and SAMMY will reject truly invalid values at runtime. But early validation would improve the user experience.

Related

  • PR #220 (Fix/213 integration of fitconfig)
  • SAMMY manual Card Set 2 specification
Dominant language
Python
Stars
7
Forks
5
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from lanl/PLEIADES

All issues in lanl/PLEIADES

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.