Skip to content

Add validation constraints to FitConfig Card 2 integer fields #236

@KedoKudo

Description

@KedoKudo

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions