pleiades.utils.helper module

Helper functions for parameter file handling.

class pleiades.utils.helper.VaryFlag(value)[source]

Bases: Enum

NO = 0
YES = 1
PUP = 3
USE_FROM_PARFILE = -1
USE_FROM_OTHERS = -2
pleiades.utils.helper.check_pseudo_scientific(val: str) float[source]

Check for pseudo scientific notation sometimes found in SAMMY files.

Parameters:

val (str) – The input string potentially containing pseudo scientific notation.

Returns:

The fixed string with proper scientific notation.

Return type:

str

Examples:

pleiades.utils.helper.safe_parse(s: str, as_int: bool = False) float | None[source]

Helper function to safely parse numeric values

Parameters:
  • s – String to parse

  • as_int – Flag to parse as integer (default: False)

Returns:

Parsed value or None if parsing failed

pleiades.utils.helper.format_float(value: float | None, width: int = 11) str[source]

Helper to format float values in fixed width with proper spacing

pleiades.utils.helper.format_vary(value: VaryFlag) str[source]

Helper to format vary flags with proper spacing

pleiades.utils.helper.parse_keyword_pairs_to_dict(text: str) dict[source]

Parse an ASCII text into a dictionary of keyword-value pairs.

Parameters:

text (str) – The input text with keyword-value pairs.

Returns:

A dictionary with keywords as keys and parsed values.

Return type:

dict