pleiades.sammy.io.lpt_manager module

pleiades.sammy.io.lpt_manager.parse_value_and_varied(s: str) tuple[float, bool][source]

Parse a value that may have a parenthesis indicating it was varied. Returns (float_value, varied_flag)

pleiades.sammy.io.lpt_manager.split_lpt_values(line: str) list[str][source]

Splits a line into values, where each value may be followed by a parenthesis group. Example: ‘2.9660E+02( 4) 1.1592E-01( 5)’ -> [‘2.9660E+02( 4)’, ‘1.1592E-01( 5)’]

class pleiades.sammy.io.lpt_manager.LptManager(file_path: str = None, run_results: RunResults = None)[source]

Bases: object

LptManager is a class designed to manage and extract results from SAMMY LPT files. These files typically contain information about nuclear resonance parameters, broadening parameters, normalization parameters, and chi-squared results for various fit iterations. The class provides methods to parse and process these files, extract relevant data, and organize it into structured objects for further analysis. .. attribute:: lpt_delimiters

A list of delimiters used to split the LPT file content into blocks for processing. These delimiters correspond to specific sections in the LPT file, such as initial values, intermediate values, and new values for resonance parameters.

type:

list

__init__(file_path

str = None, run_results: RunResults = None): Initializes the LptManager object. If a file path is provided, the LPT file is processed immediately. If a RunResults object is provided, it is used to store the extracted results.

extract_isotope_info(lines, nuclear_data)[source]

Extracts isotope information, including isotopic abundance, mass, and spin groups, from the LPT file lines. Updates the nuclear_data.isotopes attribute with the extracted data.

extract_radius_info(lines, nuclear_data)[source]

Extracts effective and true radii along with spin group numbers from the LPT file lines. Groups the extracted data by isotopes and stores it in the radius_parameters attribute of each isotope in nuclear_data.isotopes.

extract_broadening_info(lines, physics_data)[source]

Extracts broadening parameters, such as temperature, thickness, and radius, from the LPT file lines. Updates the physics_data.broadening_parameters attribute with the extracted data.

extract_normalization_info(lines, physics_data)[source]

Extracts normalization parameters, including background coefficients, from the LPT file lines. Updates the physics_data.normalization_parameters attribute with the extracted data.

extract_chi_squared_info(lines, chi_squared_results)[source]

Extracts chi-squared, reduced chi-squared, and degrees of freedom (dof) from the LPT file lines. Updates the chi_squared_results object with the extracted data.

extract_results_from_string(lpt_block_string

str) -> FitResults: Processes a block of LPT file content as a string and extracts various results, including isotope, radius, broadening, normalization, and chi-squared information. Returns a FitResults object containing the extracted data.

split_lpt_blocks(lpt_content

str): Splits the LPT file content into blocks based on predefined delimiters. Returns a list of tuples, where each tuple contains the block type and the corresponding block text.

process_lpt_file(file_path

str, run_results: RunResults = None) -> bool: Processes a SAMMY LPT file by reading its content, splitting it into blocks, extracting results from each block, and storing the results in a RunResults object. Returns True if the file was processed successfully, otherwise False.

Usage:

The LptManager class is typically used to parse SAMMY LPT files and extract structured data for further analysis. It can be initialized with a file path to process the file immediately or used with its methods to extract specific types of data from LPT file content.

lpt_delimiters = ['***** INITIAL VALUES FOR PARAMETERS', '***** INTERMEDIATE VALUES FOR RESONANCE PARAMETERS', '***** NEW VALUES FOR RESONANCE PARAMETERS']
extract_isotope_info(lines, nuclear_data)[source]

Extract isotope info and update nuclear_data.isotopes.

extract_radius_info(lines, nuclear_data)[source]

Extracts effective and true radii along with spin group numbers from the LPT file lines. The extracted data is grouped by isotopes and stored in the radius_parameters attribute of each isotope in nuclear_data.isotopes.

The function processes lines containing radius information, identifies spin groups associated with specific radii, and organizes them into RadiusParameters objects.

Parameters:
  • lines (list) – List of strings representing the lines of the LPT file.

  • nuclear_data (nuclearParameters) – Object containing nuclear data, including isotopes.

Updates:

nuclear_data.isotopes: Each isotope’s radius_parameters attribute is populated with a list of RadiusParameters objects, each containing effective_radius, true_radius, and associated spin groups. The spin groups for each radius must be in the isotope spin group.

Returns:

True if radius info is found in string block

False if not

Return type:

bool

extract_broadening_info(lines, physics_data)[source]

Extracts the broadening parameters from an LPT file and stores them in physics_data.broadening_parameters. Also sets .*_varied attributes if present. Handles both cases: with or without RADIUS field.

extract_normalization_info(lines, physics_data)[source]

Extracts normalization parameters from an LPT file and stores them in physics_data.normalization_parameters (NormalizationParameters).

extract_chi_squared_info(lines, chi_squared_results)[source]

Extracts chi-squared, reduced chi-squared, and dof from LPT file lines and fills the ChiSquaredResults object.

extract_results_from_string(lpt_block_string: str) FitResults[source]
split_lpt_blocks(lpt_content: str)[source]

Splits the LPT file content into blocks for each fit iteration. Returns a list of (block_type, block_text) tuples.

process_lpt_file(file_path: str, run_results: RunResults = None) bool[source]

Process a SAMMY LPT file into blocks of iteration results and store them in a RunResults object. This function reads the .LPT file, extracts the results of each fit iteration, stores them in a tempurary FitResults objects, and then appends them to a RunResults object which is returned.

The RunResults object can be used to access the results of all iterations.

Parameters:

file_path (str) – Path to the .LPT file.