pleiades.sammy.io.inp_manager module

Module for managing SAMMY input (.inp) files.

This module provides the InpManager class to generate and write SAMMY input files based on FitOptions configurations. It supports different modes (ENDF, fitting, custom) through the refactored FitOptions class and its factory methods.

class pleiades.sammy.io.inp_manager.InpManager(options: FitOptions = None, title: str = None, isotope_info: Dict | None = None, physical_constants: Dict | None = None, reaction_type: str = None)[source]

Bases: object

Manages creation and writing of SAMMY input (.inp) files.

This class takes a FitOptions object and generates a SAMMY input file with the appropriate commands based on the selected options.

options

Configuration options for SAMMY

Type:

FitOptions

title

Title line for the inp file

Type:

str, optional

isotope_info

Dictionary with isotope information

Type:

Dict, optional

physical_constants

Dictionary with physical constants

Type:

Dict, optional

reaction_type

Reaction type (transmission, capture, etc.)

Type:

str, optional

__init__(options: FitOptions = None, title: str = None, isotope_info: Dict | None = None, physical_constants: Dict | None = None, reaction_type: str = None)[source]

Initialize with optional FitOptions and section information.

Parameters:
  • options – FitOptions instance containing SAMMY configuration

  • title – Title/description for the inp file

  • isotope_info – Isotope information (name, mass, energy range)

  • physical_constants – Physical constants (temperature, flight path, etc.)

  • reaction_type – Reaction type (transmission, capture, etc.)

set_options(options: FitOptions) None[source]

Set FitOptions after initialization.

Parameters:

options – FitOptions instance to use

generate_commands() List[str][source]

Generate SAMMY input commands from options.

Returns:

List of SAMMY alphanumeric commands

Return type:

List[str]

generate_title_section() str[source]

Generate the title section of the inp file.

Returns:

Title line (defaults to “SAMMY analysis” if not provided)

Return type:

str

generate_isotope_section() str[source]

Generate the isotope information section of the inp file using Card Set 2 format.

Returns:

Properly formatted Card Set 2 element information line

Return type:

str

generate_physical_constants_section(material_properties: Dict = None) str[source]

Generate the physical constants section for multi-isotope mode.

Parameters:

material_properties – Dict with material properties

Returns:

Physical constants line

Return type:

str

generate_sample_density_section(material_properties: Dict = None) str[source]

Generate the sample density section.

Parameters:

material_properties – Dict with material properties

Returns:

Sample density line with density (g/cm3) and number density (atoms/barn)

Return type:

str

generate_reaction_type_section() str[source]

Generate the reaction type section of the inp file.

Returns:

Reaction type (defaults to “transmission” if not provided)

Return type:

str

generate_card_set_2_element_info(material_properties: Dict = None) str[source]

Generate Card Set 2 (element information) according to SAMMY documentation.

This generates the second line with element name, atomic weight, and energy range according to SAMMY Card Set 2 specification.

Parameters:

material_properties – Dict with material properties including element info

Returns:

Properly formatted Card Set 2 element information line

Return type:

str

generate_broadening_parameters_section(material_properties: Dict = None) str[source]

Generate broadening parameters section for multi-isotope mode.

Parameters:

material_properties – Dict with material properties for calculations

Returns:

Broadening parameters section with required blank line before it

Return type:

str

generate_misc_parameters_section(flight_path_m: float = 25.0) str[source]

Generate miscellaneous parameters (TZERO) section.

Parameters:

flight_path_m – Flight path length in meters (default 25.0 for VENUS)

Returns:

Miscellaneous parameters section

Return type:

str

generate_normalization_parameters_section() str[source]

Generate normalization parameters section.

Returns:

Normalization parameters section with required blank line before it

Return type:

str

generate_resolution_function_section(resolution_file: str = 'venus_resolution.dat') str[source]

Generate user-defined resolution function section.

Parameters:

resolution_file – Name of resolution function file, or None to disable

Returns:

Resolution function section or empty string if disabled

Return type:

str

generate_multi_isotope_inp_content(material_properties: Dict = None, resolution_file_path: Path = None) str[source]

Generate complete multi-isotope INP content with parameter sections.

Parameters:
  • material_properties – Dict with material properties for parameter calculations

  • resolution_file_path – Optional absolute path to resolution function file

Returns:

Complete multi-isotope INP file content

Return type:

str

generate_inp_content() str[source]

Generate full content for SAMMY input file.

Returns:

Complete content for SAMMY input file

Return type:

str

write_inp_file(file_path: Path) Path[source]

Write a SAMMY input file to disk.

Parameters:

file_path – Path where the input file should be written

Returns:

Path to the created file

Return type:

Path

Raises:

IOError – If file cannot be written

classmethod create_endf_inp(output_path: Path, title: str = None) Path[source]

Create input file for ENDF mode.

Parameters:
  • output_path – Path to write the input file

  • title – Optional title for the inp file

Returns:

Path to the created file

Return type:

Path

classmethod create_fitting_inp(output_path: Path, title: str = None) Path[source]

Create input file for fitting mode.

Parameters:
  • output_path – Path to write the input file

  • title – Optional title for the inp file

Returns:

Path to the created file

Return type:

Path

classmethod create_multi_isotope_inp(output_path: Path, title: str = None, material_properties: Dict = None, resolution_file_path: Path = None) Path[source]

Create input file for multi-isotope JSON mode fitting.

This method generates a complete INP file for multi-isotope fitting that includes both static alphanumeric commands and calculated parameter sections.

Parameters:
  • output_path – Path to write the input file

  • title – Optional title for the inp file

  • material_properties – Optional dict with material properties for parameter calculations

  • resolution_file_path – Optional absolute path to resolution function file

Returns:

Path to the created file

Return type:

Path