Skip to content

SAMMY inp module #131

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
May 27, 2025
Merged

SAMMY inp module #131

merged 16 commits into from
May 27, 2025

Conversation

KedoKudo
Copy link
Collaborator

@KedoKudo KedoKudo commented May 14, 2025

This is a work in progress.

EWM item: 11192
#132

This PR introduces the following changes

  • refactor alphanumerics for improved readability
  • add remaining categories
  • add corresponding unit test
  • added tables and yaml extracted from user manual
  • add usage examples in the notebooks

Test Introductions

  • Checkout the feature branch
  • Run the unit test
  • Run the notebooks (pleiades_Si_transmission.ipynb and pleiades_sammy_endf.ipynb)

Summary [AI]

This pull request includes updates to the .pre-commit-config.yaml file and modifications to the examples/Notebooks/pleiades_sammy_endf.ipynb notebook. The changes primarily address pre-commit hook exclusions and updates to SAMMY execution logs and metadata.

Pre-commit Configuration Updates:

  • Updated the exclude pattern for the codespell hook in .pre-commit-config.yaml to include .md, .yaml, and .yml files under src/pleiades/sammy/alphanumerics/ directory.

Notebook Updates:

  • Updated timestamps, UUIDs, and minor execution details in the pleiades_sammy_endf.ipynb notebook to reflect new SAMMY runs. This includes:
    • Adjustments to debug and info log entries for SAMMY execution and backend preparation. [1] [2] [3] [4]
    • Changes to SAMMY version metadata and performance metrics (e.g., total execution time). [1] [2] [3]

KedoKudo added 10 commits May 14, 2025 11:44
…nd multiple scattering corrections

- Implemented `CovarianceMatrixOptions` class for covariance matrix data input control.
- Added `ExperimentalDataInputOptions` class for experimental data input control.
- Created `MultipleScatteringCorrectionsOptions` class for handling multiple scattering corrections.
- Developed unit tests for each of the new options classes to ensure correct behavior and mutual exclusivity.
- Added test cases for valid and invalid combinations of options to validate the functionality.
- Implement CovarianceMatrixOutputOptions class for managing output options related to covariance matrices.
- Introduce validation to ensure mutually exclusive options are handled correctly.
- Create unit tests for CovarianceMatrixOutputOptions to verify default values, valid combinations, and error handling for mutually exclusive options.

Add unit tests for cross section options

- Implement tests for CrossSectionOptions to validate default settings, individual option handling, and mutually exclusive options.
- Ensure comprehensive coverage of all possible configurations and expected behaviors.

Add unit tests for LPT output options

- Create tests for LPTOutputOptions to check default values, valid combinations, and error handling for mutually exclusive options.
- Validate the correct generation of alphanumeric commands based on selected options.

Add unit tests for quantum numbers options

- Implement tests for QuantumNumbersOptions to verify default settings, valid combinations, and mutually exclusive options.
- Ensure accurate command generation based on selected options.

Add unit tests for covariance matrix input options

- Create tests for CovarianceMatrixOptions to validate default values, individual option handling, and mutually exclusive options.
- Ensure comprehensive coverage of all possible configurations and expected behaviors.

Add unit tests for R-matrix options

- Implement tests for RMatrixOptions to verify default settings, valid combinations, and mutually exclusive options.
- Validate the correct generation of alphanumeric commands based on selected options.
- Implemented PlotFileOptions class for managing plot file configurations, including energy units, ODF file options, plot generation, and theoretical uncertainties.
- Added SpecialAnalysisOptions class for special analysis configurations, including cross section reconstruction, uncertainty multipliers, and matrix generation.
- Introduced validation for mutually exclusive options in both classes to ensure correct configurations.
- Developed comprehensive unit tests for both PlotFileOptions and SpecialAnalysisOptions to verify default values, option exclusivity, and command generation.
- Created test cases for physical constants and angular distribution options to ensure functionality and correctness.
@Copilot Copilot AI review requested due to automatic review settings May 14, 2025 17:42
Copy link

@Copilot 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 PR refactors and extends the alphanumerics module for SAMMY by adding new Pydantic models for URR, special analysis, R‐matrix, plot file, physical constants, ENDF, cross section, Bayes solution, averages, and angular distribution options while also incorporating additional documentation and unit test scaffolding.

  • Refactored URR options for improved readability
  • Introduced new models for special analysis, averages, and angular distribution
  • Updated documentation in markdown and YAML files and adjusted pre-commit exclusions

Reviewed Changes

Copilot reviewed 41 out of 41 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/pleiades/sammy/alphanumerics/urr.py New URR options model with mutually exclusive validations
src/pleiades/sammy/alphanumerics/special_analysis.py Added special analysis options model
src/pleiades/sammy/alphanumerics/sammy_table_VIA1.1.md Added markdown table for command categories
src/pleiades/sammy/alphanumerics/r_matrix.py Updated R‑matrix options to include general options
src/pleiades/sammy/alphanumerics/plot_file.py Introduced new plot file options model with validations
src/pleiades/sammy/alphanumerics/physical_constants.py New physical constants options model with exclusivity enforcement
src/pleiades/sammy/alphanumerics/endf.py Added ENDF options model with dependency checks
src/pleiades/sammy/alphanumerics/cross_section.py New cross section options model with mutual exclusivity logic
src/pleiades/sammy/alphanumerics/bayes_solution.py Updated Bayes solution options model; added inversion and special fitting groups
src/pleiades/sammy/alphanumerics/averages.py New averages options model with dependency validation
src/pleiades/sammy/alphanumerics/angular_distribution.py New angular distribution options model enforcing frame selection
.pre-commit-config.yaml Updated codespell exclude regex to ignore documentation file extensions
Comments suppressed due to low confidence (2)

src/pleiades/sammy/alphanumerics/bayes_solution.py:137

  • The field 'take_baby_steps_with_least_squares_method' is referenced in the get_alphanumeric_commands method but is not defined in the BayesSolutionOptions model. Please add a Field definition for this option or remove its usage if not required.
if self.take_baby_steps_with_least_squares_method:

src/pleiades/sammy/alphanumerics/bayes_solution.py:138

  • The field 'use_remembered_original_parameter_values' is referenced in the get_alphanumeric_commands method but is not defined in the BayesSolutionOptions model. Please add its definition or update the mutually exclusive groups and command generation code accordingly.
if self.use_remembered_original_parameter_values:

@KedoKudo KedoKudo self-assigned this May 14, 2025
@KedoKudo KedoKudo added the v2.0 label May 14, 2025
@KedoKudo KedoKudo marked this pull request as draft May 15, 2025 12:37
KedoKudo added 5 commits May 15, 2025 14:02
…nce validation; update tests for default and custom configurations
…ntegration; include tests for initialization, command generation, and file writing
…e corresponding sections; update tests for initialization and content generation
@KedoKudo KedoKudo changed the title [WIP] SAMMT inp module SAMMY inp module May 19, 2025
@KedoKudo KedoKudo marked this pull request as ready for review May 19, 2025 19:07
@KedoKudo KedoKudo requested review from along4 and Copilot May 19, 2025 19:08
Copy link

@Copilot 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 PR introduces a new SAMMY input module by refactoring and completing the set of alphanumeric command categories, providing Pydantic models for each category, and adding corresponding tables, unit tests, and usage examples.

  • Add a markdown table (sammy_table_VIA1.1.md) listing all alphanumeric categories and abbreviations.
  • Implement Pydantic models for each SAMMY option group (e.g., R-matrix, plot file, physical constants, ENDF, cross section, Bayes solution, averages, angular distribution) with validation and command generation.
  • Update project configuration (pyproject.toml, .pre-commit-config.yaml) and notebooks with new dependency and example usages.

Reviewed Changes

Copilot reviewed 50 out of 50 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/pleiades/sammy/alphanumerics/sammy_table_VIA1.1.md Add markdown table of alphanumeric categories and abbreviations.
src/pleiades/sammy/alphanumerics/r_matrix.py Add RMatrixOptions model with R-matrix and general options.
src/pleiades/sammy/alphanumerics/plot_file.py Add PlotFileOptions model with mutually exclusive validation and command generation.
src/pleiades/sammy/alphanumerics/physical_constants.py Add PhysicalConstantsOptions model enforcing one-of validation.
src/pleiades/sammy/alphanumerics/endf.py Add ENDFOptions model with dependency validation.
src/pleiades/sammy/alphanumerics/cross_section.py Add CrossSectionOptions model with complex exclusivity logic.
src/pleiades/sammy/alphanumerics/bayes_solution.py Add BayesSolutionOptions model with grouped exclusivity.
src/pleiades/sammy/alphanumerics/averages.py Add AveragesOptions model with dependency and exclusivity checks.
src/pleiades/sammy/alphanumerics/angular_distribution.py Add AngularDistributionOptions model with exclusive frame selection.
src/pleiades/sammy/alphanumerics/init.py Export all new alphanumeric option models in package.
pyproject.toml Add viztracer dependency.
examples/Notebooks/pleiades_sammy_endf.ipynb Update notebook outputs and add INP‐generation example.
.pre-commit-config.yaml Extend codespell exclusion to include new alphanumeric files.
Comments suppressed due to low confidence (3)

src/pleiades/sammy/alphanumerics/cross_section.py:50

  • Capitalization inconsistency: "DErivatives" should be "DERIVATIVES".
use_no_cutoffs_for_derivatives: bool = Field(default=False, description="USE NO CUTOFFS FOR DErivatives or cross sections")

src/pleiades/sammy/alphanumerics/init.py:26

  • [nitpick] Import name CovarianceMatrixOptions collides conceptually with the parameter‐covariance import alias PCovarianceMatrixInOptions; consider renaming this export to DataCovarianceMatrixOptions for clarity.
from pleiades.sammy.alphanumerics.covariance_matrix_data import CovarianceMatrixOptions

src/pleiades/sammy/alphanumerics/cross_section.py:55

  • [nitpick] Inconsistent capitalization: the word "functions" should be uppercase to match the all‐caps style used elsewhere.
use_alternative_coulomb_functions: bool = Field(default=False, description="USE ALTERNATIVE COULOMB functions")

@along4
Copy link
Collaborator

along4 commented May 27, 2025

I was able to review the pull request. Everything looks good to me. I think after I pull in the parfile branch I can start adding to the InpManager functionality. Specifically I think we need to initiate it with a FitConfig object instead of just a FitOptions. FitConfig has a FitOptions class called options_and_routines. Also I could start working on the generate functionality for the other parts of the input file.

Copy link
Collaborator

@along4 along4 left a comment

Choose a reason for hiding this comment

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

Already left a comment.

@KedoKudo KedoKudo merged commit 64abf2d into v2.0 May 27, 2025
2 checks passed
@KedoKudo KedoKudo deleted the sammy_inp_interface branch May 27, 2025 21:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants