pleiades.sammy.io.par_manager module

class pleiades.sammy.io.par_manager.Cards(value)[source]

Bases: Enum

PAR_CARD_1 = 'Parameter Card 1'
PAR_CARD_2 = 'Parameter Card 2'
PAR_CARD_3 = 'Parameter Card 3'
PAR_CARD_3A = 'Parameter Card 3a'
PAR_CARD_4 = 'Parameter Card 4'
PAR_CARD_5 = 'Parameter Card 5'
PAR_CARD_6 = 'Parameter Card 6'
PAR_CARD_7 = 'Parameter Card 7'
PAR_CARD_7A = 'Parameter Card 7a'
PAR_CARD_8 = 'Parameter Card 8'
PAR_CARD_9 = 'Parameter Card 9'
PAR_CARD_10 = 'Parameter Card 10'
PAR_CARD_11 = 'Parameter Card 11'
PAR_CARD_12 = 'Parameter Card 12'
PAR_CARD_13 = 'Parameter Card 13'
PAR_CARD_14 = 'Parameter Card 14'
PAR_CARD_14A = 'Parameter Card 14a'
PAR_CARD_15 = 'Parameter Card 15'
PAR_CARD_16 = 'Parameter Card 16'
PAR_LAST_B = 'Parameter Card Last B'
PAR_LAST_C = 'Parameter Card Last C'
PAR_LAST_D = 'Parameter Card Last D'
INP_CARD_4 = 'Input Card 4'
INP_CARD_10_2 = 'Input Card 10.2'
class pleiades.sammy.io.par_manager.ParManager(fit_config: FitConfig = None, par_file: Path = None)[source]

Bases: object

__init__(fit_config: FitConfig = None, par_file: Path = None)[source]

Initialize the ParManager class. This may or may not be passed a FitConfig object. If a FitConfig object is None, then a new one is created with default values. :param fit_config: The FitConfig object containing the configuration for the SAMMY fitting process. default=None :type fit_config: FitConfig :param par_file: The path to the SAMMY parameter file. default=None :type par_file: Path

extract_particle_pairs(lines) bool[source]

Extract particle pair definitions from the lines of the SAMMY parameter file (Card 4). Process the particle pair data and update the FitConfig object. :param lines: The lines of the SAMMY parameter file. :type lines: list

Returns:

True if particle pair data was successfully found and processed, False otherwise.

Return type:

bool

extract_broadening_parameters(lines) bool[source]

Extract broadening parameters from the lines of the SAMMY parameter file (Card 4). Process the broadening data and update the FitConfig object. :param lines: The lines of the SAMMY parameter file. :type lines: list

Returns:

True if broadening data was successfully found and processed, False otherwise.

Return type:

bool

extract_normalization_parameters(lines) bool[source]

Extract normalization parameters from the lines of the SAMMY parameter file (Card 6). Process the normalization data and update the FitConfig object. :param lines: The lines of the SAMMY parameter file. :type lines: list

Returns:

True if normalization data was successfully found and processed, False otherwise.

Return type:

bool

extract_radii_parameters(lines) bool[source]

Extract radius parameters from the lines of the SAMMY parameter file (Card 7). Process the radius data and update the FitConfig object. NOTE: There are two formats for the radius parameters. The first is the default format

and the second is the key-word format. In total, there are 3 different headers - “RADIUs parameters follow” - “RADIIs are in KEY-WORD format” - “CHANNel radius parameters follow”

Parameters:

lines (list) – The lines of the SAMMY parameter file.

Returns:

True if radius data was successfully found and processed, False otherwise.

Return type:

bool

extract_isotopes_and_abundances(lines) bool[source]

Search for isotopes in the lines of the SAMMY parameter file. If found, update the FitConfig object with the isotope information. :param lines: The lines of the SAMMY parameter file. :type lines: list

Returns:

True if isotope data was found and processed, False otherwise.

Return type:

bool

extract_resonance_entries(lines) bool[source]

Extract resonance information from the lines of the SAMMY parameter file (Card 1). Process the resonance data and update the FitConfig object.

NOTE: This card will either be the first card in the file (without a header)

or be listed later in the file with a header.

Parameters:

lines (list) – The lines of the SAMMY parameter file.

Returns:

True if resonance data was successfully found and processed, False otherwise.

Return type:

bool

extract_spin_groups(lines) bool[source]

Extract spin group definitions from the lines of the SAMMY parameter file (Input Card 10.2). Process the spin group data and update the FitConfig object. :param lines: The lines of the SAMMY parameter file. :type lines: list

Returns:

True if spin group data was successfully found and processed, False otherwise.

Return type:

bool

detect_par_cards(lines)[source]

Scans a list of lines from a SAMMY parameter file to identify and collect parameter card headers. This method iterates through each line in the provided list, checking for the presence of known parameter card headers as defined in the PAR_HEADER_MAP. When a header is detected at the start of a line (after stripping whitespace), the corresponding card enumeration is added to a set to ensure uniqueness. The set is then sorted and returned as a list. NOTE: By default, there should always be a Card 1 in the file, but there may not be a header line

for Card 1. Therefore, Card 1 will always be included in the detected cards.

Parameters:

lines (list) – The lines of the SAMMY parameter file.

Returns:

A sorted list of detected parameter cards.

Return type:

list

read_par_file(par_file: Path) None[source]

Read the SAMMY parameter file and update the FitConfig object. :param par_file: The path to the SAMMY parameter file. :type par_file: Path

generate_par_card1_section() str[source]

Generate Card 1 (resonance data) section for the parameter file. :returns: Card 1 section as a string. :rtype: str

generate_par_card4_section() str[source]

Generate Card 4 (broadening parameters) section. :returns: Card 4 section as a string. :rtype: str

generate_par_card6_section() str[source]

Generate Card 6 (normalization and background) section. :returns: Card 6 section as a string. :rtype: str

generate_par_card7_section() str[source]

Generate Card 7 (radius parameters) section. :returns: Card 7 section as a string. :rtype: str

generate_par_card7a_section() str[source]

Generate Card 7a (radius parameters in key-word format) section. :returns: Card 7a section as a string. :rtype: str

generate_par_card10_section() str[source]

Generate Card 10 (isotopic abundances and masses) section. :returns: Card 10 section as a string. :rtype: str

generate_inp_card4_section() str[source]

Generate Input Card 4 (particle pair definitions) section. :returns: Input Card 4 section as a string. :rtype: str

generate_inp_card10_section() str[source]

Generate Input Card 10.2 (spin groups) section. :returns: Input Card 10.2 section as a string. :rtype: str

generate_par_content() str[source]

Generate the full content for the SAMMY parameter file. :returns: Complete parameter file content. :rtype: str

write_par_file(file_path: Path) Path[source]

Write the SAMMY parameter file to disk. :param file_path: Path to write the parameter file. :type file_path: Path

Returns:

Path to the created file.

Return type:

Path