pleiades.sammy.parameters.radius module
Card Set 7/7a: Radius Parameters.
This module handles both fixed-width (Card Set 7) and keyword-based (Card Set 7a) formats for radius parameters in SAMMY parameter files.
- class pleiades.sammy.parameters.radius.RadiusFormat(value)[source]
Bases:
EnumSupported formats for radius parameter cards.
- DEFAULT = 'default'
- ALTERNATE = 'alternate'
- KEYWORD = 'keyword'
- class pleiades.sammy.parameters.radius.RadiusParameters(*, effective_radius: Annotated[float, Ge(ge=0)], true_radius: float, channel_mode: Annotated[int, Ge(ge=0), Le(le=1)], vary_effective: VaryFlag = VaryFlag.NO, vary_true: VaryFlag = VaryFlag.NO, spin_groups: List[int] | None, channels: List[int] | None = None)[source]
Bases:
BaseModelContainer for nuclear radius parameters used in SAMMY calculations.
This class represents a set of radius parameters that define both the potential scattering radius and the radius used for penetrabilities and shift calculations. These parameters can be applied globally or to specific spin groups and channels.
- true_radius
The radius (in Fermi) used for penetrabilities and shift calculations. Special values: - If 0: Uses the CRFN value from input file/card set 4 - If negative: Absolute value represents mass ratio to neutron (AWRI),
radius calculated as 1.23(AWRI)^1/3 + 0.8 (ENDF formula)
- Type:
- channel_mode
Determines how channels are specified: - 0: Parameters apply to all channels - 1: Parameters apply only to specified channels in channels list
- Type:
- vary_effective
Flag indicating how effective radius should be treated: - NO (0): Parameter is held fixed - YES (1): Parameter is varied in fitting - PUP (3): Parameter is treated as a propagated uncertainty parameter
- Type:
- vary_true
Flag indicating how true radius should be treated: - USE_FROM_EFFECTIVE (-1): Treated as identical to effective_radius - NO (0): Parameter is held fixed - YES (1): Parameter is varied independently - PUP (3): Parameter is treated as a propagated uncertainty parameter
- Type:
- spin_groups
List of spin group numbers that use these radius parameters. Values > 500 indicate omitted resonances.
- Type:
List[int]
- channels
List of channel numbers when channel_mode=1. When channel_mode=0, this should be None.
- Type:
Optional[List[int]]
Note
This class supports the three different input formats specified in SAMMY: - Default format (card set 7) for <99 spin groups - Alternate format for >99 spin groups - Keyword-based format However, internally it maintains a consistent representation regardless of input format.
- classmethod validate_spin_groups(v: List[int]) List[int][source]
Validate spin group numbers.
- Parameters:
v – List of spin group numbers
- Returns:
Validated spin group numbers
- Return type:
List[int]
- Raises:
ValueError – If any spin group number is invalid
- classmethod validate_vary_true(v: VaryFlag) VaryFlag[source]
Validate vary_true flag has valid values.
For true radius, we allow an additional special value -1 (USE_FROM_PARFILE)
- Parameters:
v – Vary flag value
- Returns:
Validated flag value
- Return type:
- Raises:
ValueError – If flag value is invalid
- validate_channels() RadiusParameters[source]
Validate channel specifications.
Ensures that: 1. If channel_mode=1, channels must be provided 2. If channel_mode=0, channels should be None
- Returns:
Self if validation passes
- Return type:
- Raises:
ValueError – If channel specifications are invalid
- validate_true_radius_consistency() RadiusParameters[source]
Validate consistency between true_radius and vary_true.
Ensures that: 1. If vary_true is USE_FROM_PARFILE, true_radius matches effective_radius 2. If true_radius is 0, vary_true cannot be USE_FROM_PARFILE 3. If true_radius is negative, it represents AWRI and vary_true cannot be USE_FROM_PARFILE
- Returns:
Self if validation passes
- Return type:
- Raises:
ValueError – If radius specifications are inconsistent
- model_config = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pleiades.sammy.parameters.radius.RadiusCardDefault(*, parameters: List[RadiusParameters])[source]
Bases:
BaseModelHandler for default format radius parameter cards (Card Set 7).
This class handles parsing and writing radius parameters in the default fixed-width format used for systems with fewer than 99 spin groups.
The format includes: - Fixed width fields for radii and flags - Support for multiple lines of spin groups with -1 continuation - Optional channel numbers after IX=0 marker when channel_mode=1
Note
This format should only be used when the number of spin groups < 99. For larger systems, use RadiusCardAlternate.
- parameters: List[RadiusParameters]
- classmethod is_header_line(line: str) bool[source]
Check if line is a valid header line.
- Parameters:
line – Input line to check
- Returns:
True if line is a valid header
- Return type:
- classmethod from_lines(lines: List[str]) RadiusCardDefault[source]
Parse radius parameters from fixed-width format lines.
- Parameters:
lines – List of input lines including header
- Returns:
Parsed card
- Return type:
- Raises:
ValueError – If lines are invalid or required data is missing
- to_lines() List[str][source]
Convert the card to fixed-width format lines.
- Returns:
Lines including header
- Return type:
List[str]
- model_config = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pleiades.sammy.parameters.radius.RadiusCardAlternate(*, parameters: RadiusParameters)[source]
Bases:
BaseModelHandler for alternate format radius parameter cards (Card Set 7 alternate).
This class handles parsing and writing radius parameters in the alternate fixed-width format used for systems with more than 99 spin groups.
The format includes: - Fixed width fields for radii and flags (same positions as default) - 5-column width for integer values (instead of 2) - Support for continuation lines with -1 marker - Optional channel numbers after IX=0 marker when channel_mode=1
Note
This format should be used when the number of spin groups >= 99. For smaller systems, use RadiusCardDefault.
- parameters: RadiusParameters
- classmethod is_header_line(line: str) bool[source]
Check if line is a valid header line.
- Parameters:
line – Input line to check
- Returns:
True if line is a valid header
- Return type:
- classmethod from_lines(lines: List[str]) RadiusCardAlternate[source]
Parse radius parameters from fixed-width format lines.
- Parameters:
lines – List of input lines including header
- Returns:
Parsed card
- Return type:
- Raises:
ValueError – If lines are invalid or required data is missing
- to_lines() List[str][source]
Convert the card to fixed-width format lines.
- Returns:
Lines including header
- Return type:
List[str]
- model_config = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pleiades.sammy.parameters.radius.RadiusCardKeyword(*, parameters: RadiusParameters, particle_pair: str | None = None, orbital_momentum: List[str | int] | None = None, relative_uncertainty: float | None = None, absolute_uncertainty: float | None = None)[source]
Bases:
BaseModelHandler for keyword-based radius parameter cards (Card Set 7a).
This class handles parsing and writing radius parameters in the keyword format. The format offers a more readable alternative to fixed-width formats while maintaining compatibility with RadiusParameters.
- parameters
The core radius parameters
- parameters: RadiusParameters
- classmethod from_lines(lines: List[str]) RadiusCardKeyword[source]
Parse radius parameters from keyword format lines.
- Parameters:
lines – List of input lines including header
- Returns:
Parsed card
- Return type:
- Raises:
ValueError – If lines are invalid or required data is missing
- to_lines() List[str][source]
Convert the card to keyword format lines.
- Returns:
Lines in keyword format
- Return type:
List[str]
- model_config = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pleiades.sammy.parameters.radius.RadiusCard(*, parameters: List[RadiusParameters], particle_pair: str | None = None, orbital_momentum: List[str | int] | None = None, relative_uncertainty: float | None = None, absolute_uncertainty: float | None = None)[source]
Bases:
BaseModelMain handler for SAMMY radius parameter cards.
This class provides a simple interface for working with radius parameters regardless of format. Users can create parameters directly or read from template files, then write in any supported format.
Example
# Create new parameters card = RadiusCard(
- parameters=[
- RadiusParameters(
effective_radius=3.2, true_radius=3.2, spin_groups=[1, 2, 3]
)
]
)
# Write in desired format lines = card.to_lines(format=RadiusFormat.KEYWORD)
# Or read from template and modify card = RadiusCard.from_lines(template_lines) card.parameters[0].effective_radius = 3.5 lines = card.to_lines(format=RadiusFormat.DEFAULT)
- parameters: List[RadiusParameters]
- classmethod is_header_line(line: str) bool[source]
Check if line is a valid radius parameter header line.
- Parameters:
line – Input line to check
- Returns:
True if line matches any valid radius header format
- Return type:
- classmethod detect_format(lines: List[str]) RadiusFormat[source]
Detect format from input lines.
- classmethod from_lines(lines: List[str]) RadiusCard[source]
Parse radius card from lines in any format.
- to_lines(radius_format: RadiusFormat = RadiusFormat.DEFAULT) List[str][source]
Write radius card in specified format.
- classmethod from_values(effective_radius: float, true_radius: float | None = None, spin_groups: List[int] = None, channels: List[int] | None = None, particle_pair: str | None = None, orbital_momentum: List[str | int] | None = None, relative_uncertainty: float | None = None, absolute_uncertainty: float | None = None, **kwargs) RadiusCard[source]
Create a new radius card from parameter values.
- Parameters:
effective_radius – Radius for potential scattering
true_radius – Radius for penetrabilities and shifts (defaults to effective_radius)
spin_groups – List of spin group numbers
channels – Optional list of channel numbers
particle_pair – Optional particle pair specification
orbital_momentum – Optional orbital angular momentum values
relative_uncertainty – Optional relative uncertainty for radii
absolute_uncertainty – Optional absolute uncertainty for radii
**kwargs – Additional parameters to pass to RadiusParameters
- Returns:
Created card instance
- Return type:
- model_config = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].