Skip to content

Comments

Fix/213 integration of fitconfig#220

Merged
KedoKudo merged 47 commits intonextfrom
fix/213-integration-of-fitconfig
Feb 19, 2026
Merged

Fix/213 integration of fitconfig#220
KedoKudo merged 47 commits intonextfrom
fix/213-integration-of-fitconfig

Conversation

@along4
Copy link
Collaborator

@along4 along4 commented Jan 21, 2026

This pull request introduces a major refactor and enhancement of the global configuration management for PLEIADES, transitioning from a simple dataclass-based approach to a robust, hierarchical, and extensible Pydantic-based configuration system. The update includes a comprehensive new YAML configuration schema, improved path resolution and normalization, enhanced support for nuclear data and fit routines, and more thorough unit tests.

Key changes include:

Configuration System Overhaul

  • Replaced the previous PleiadesConfig dataclass with a set of Pydantic models (PleiadesConfig, WorkspaceConfig, NuclearConfig, SammyConfig, IsotopeConfig) to provide structured, validated, and extensible configuration management. This enables hierarchical config sections, automatic type coercion, and custom validation logic.
  • Added robust path expansion and normalization logic to support workspace-relative and environment-variable-based paths throughout the configuration.
  • Implemented synchronization and normalization between global and nuclear config fields, ensuring consistent handling of nuclear data cache directories and sources.

YAML Configuration and Documentation

  • Added a detailed draft specification and example for the new PLEIADES YAML config and workflow, including directory layout, schema, and step-by-step usage notes. This serves as both documentation and a working reference for end-to-end operation and reproducibility.

Serialization and Deserialization Improvements

  • Improved the save() and to_dict() methods to use safe YAML dumping and preserve key order, and added a from_dict() method for loading configurations from dictionaries. [1] [2]

Nuclear Data and Fit Routine Handling

  • Added methods for building nuclear parameters, populating fit config isotopes, ensuring ENDF cache files, and creating routine directories, all tightly integrated with the new config structure. [1] [2]

Unit Test Enhancements

  • Updated and extended unit tests to cover the new configuration structure, including checks for correct initialization, path handling, and nuclear config synchronization. [1] [2] [3]

These changes lay the groundwork for more maintainable, reproducible, and user-friendly configuration and workflow management in PLEIADES.


References:

  • Pydantic-based configuration refactor:
  • YAML config documentation/spec:
  • Serialization improvements: [1] [2]
  • Unit test updates: [1] [2] [3]

…flect the card implementation in the SAMMY manual.
Copilot AI review requested due to automatic review settings January 21, 2026 21:19
@along4 along4 linked an issue Jan 21, 2026 that may be closed by this pull request
2 tasks
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request introduces a comprehensive refactor of PLEIADES' configuration system, transitioning from a simple dataclass-based approach to a robust Pydantic-based hierarchical configuration management system. The changes enable structured validation, workspace-relative path expansion, and enhanced support for nuclear data and fit routine configuration.

Changes:

  • Replaced PleiadesConfig dataclass with Pydantic models (PleiadesConfig, WorkspaceConfig, NuclearConfig, SammyConfig, IsotopeConfig) providing automatic validation and type coercion
  • Implemented path expansion logic with workspace variable substitution (e.g., ${workspace.root}) and environment variable support
  • Added new utility methods for building nuclear parameters, ensuring ENDF cache files, and creating timestamped routine directories
  • Enhanced serialization using model_dump and model_validate with YAML safe_dump for improved consistency
  • Updated unit tests to verify synchronization between legacy and new config fields

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 12 comments.

File Description
src/pleiades/utils/config.py Complete refactor from dataclass to Pydantic models with new validation, path expansion, and utility methods
tests/unit/pleiades/utils/test_utils_config.py Updated existing tests with assertions for nuclear config synchronization
docs/Notes/pleiades_config_workflow.md New comprehensive YAML configuration specification and workflow documentation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@along4 along4 marked this pull request as draft January 21, 2026 21:26
along4 and others added 4 commits January 21, 2026 14:27
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…EIADES into fix/213-integration-of-fitconfig
@along4 along4 requested a review from KedoKudo February 4, 2026 22:52
@along4 along4 marked this pull request as ready for review February 4, 2026 22:52
@KedoKudo KedoKudo self-assigned this Feb 5, 2026
Copy link
Collaborator

@KedoKudo KedoKudo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Manual testing passed on analysis cluster for ORNL notebooks as well as the configuration notebook.

In addition to the comments from my review, here are some issues identified by codex during its independent review:

PLEIADES/src/pleiades/sammy/io/inp_manager.py:335-340

  • When InpManager is driven by fit_config (without explicit material_properties), this block builds the Card 5 source dict from broadening parameters but omits broadening.dist. The later fallback logic then uses 25.0 for flight path, so any non-default flight path configured in FitConfig is silently dropped and the generated INP contains incorrect Card 5 values.

PLEIADES/src/pleiades/sammy/io/inp_manager.py:809-812

  • After parsing Card 5, the parser copies temperature and resolution terms into fit_config.physics_params.broadening_parameters but never assigns constants.flight_path_length to dist. This makes parse→reuse/generate flows non-roundtrippable: files with non-default flight path lose that value and can later be regenerated with the default path.

PLEIADES/src/pleiades/utils/config.py:489-491

  • from_dict now always validates with require_fit_routines=True, but save() still permits writing configs with empty fit_routines (including default PleiadesConfig()). That means a config produced by this codepath can fail to load later, and existing legacy config files without fit_routines will also raise on load()/get_config() instead of being migrated or defaulted.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 36 out of 43 changed files in this pull request and generated 9 comments.

Comments suppressed due to low confidence (1)

src/pleiades/sammy/io/card_formats/inp05_broadening.py:83

  • The Card05.from_lines method now accepts a line with only the temperature field (changed from requiring at least 2 fields to requiring at least 1 field). However, the method still has a default value for flight_path_length of 25.0 when the field is missing. This default is not validated and could silently produce incorrect results if users expect validation to catch missing required fields. Consider documenting this default clearly or making the field required if it's essential for SAMMY operation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@KedoKudo KedoKudo merged commit 7894bf3 into next Feb 19, 2026
9 checks passed
@KedoKudo KedoKudo deleted the fix/213-integration-of-fitconfig branch February 19, 2026 20:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Further Integration of FitConfig

3 participants