infobs.util package
Submodules
infobs.util.ism_lines_helpers module
Implements helpers to process spectral lines formatted according to Meudon PDR code standards.
- class infobs.util.ism_lines_helpers.Settings[source]
Bases:
object- ignore_electronic: bool = False
- ignore_litterals: bool = False
- ignored_transitions: List[str] = []
- math_mode: bool = False
- only_rotational: bool = False
- infobs.util.ism_lines_helpers.filter_molecules(names: List[str], mols: str | List[str] | None) List[str][source]
Returns a sublist of names with only lines of molecules contained in mols.
- Parameters:
names (list of str) – List of formatted lines.
mols (str or List of str or None) – Molecule or list of molecules that you want to select. If None, the function just returns the input list names.
- Returns:
Sublist of names.
- Return type:
List of str
- infobs.util.ism_lines_helpers.is_hyperfine(line: str, other: str | None = None) bool[source]
Returns whether the formatted line line contains hyperfine levels. If other is not None, returns whether the two lines correspond to the same hyperfine structure. If line and other are the exact same line, returns True.
- Parameters:
line (str) – Formatted line.
other (str, optional) – Other formatted line. Default: None.
- Returns:
Whether line contains hyperfine levels or whether line and other belongs to the same hyperfine structure.
- Return type:
bool
- infobs.util.ism_lines_helpers.is_line_of(name: str, mol: str) bool[source]
Returns True if name is a line of the chemical species mol, else False.
- Parameters:
name (str) – Formatted line.
mol (str) – Molecule.
- Returns:
Whether name is a line of mol.
- Return type:
bool
- infobs.util.ism_lines_helpers.line_to_latex(line_name: str) str[source]
Returns a well displayed version of the formatted line line_name.
- Parameters:
line_name (str) – Formatted line.
- Returns:
LaTeX string representing line_name.
- Return type:
str
- infobs.util.ism_lines_helpers.molecule(line_name: str) str[source]
Returns the raw strings of the molecule name.
- Parameters:
line_name (str) – Formatted line.
- Returns:
Raw string representing the molecule.
- Return type:
str
- infobs.util.ism_lines_helpers.molecule_and_transition(line_name: str) Tuple[str, str][source]
Returns the raw strings of the molecule name and the transition.
- Parameters:
line_name (str) – Formatted line.
- Returns:
str – Raw string representing the molecule.
str – Raw string representing the transition.
- infobs.util.ism_lines_helpers.molecule_to_latex(molecule: str) str[source]
Returns a well displayed version of the formatted molecule or radical molecule.
- Parameters:
molecule (str) – Formatted molecule or radical.
- Returns:
LaTeX string representing molecule.
- Return type:
str
- infobs.util.ism_lines_helpers.molecules_among_lines(names: List[str]) List[str][source]
Returns the list of molecules (without duplicates) of lines in names.
- Parameters:
names (list of str) – List of formatted lines.
- Returns:
List of formatted molecules without duplicates.
- Return type:
List of str
- infobs.util.ism_lines_helpers.remove_hyperfine(line_name: str) str[source]
Returns the formatted line line_name without the degenerate energy levels. If there is no such levels, this function returns a copy of the input.
- Parameters:
line_name (str) – Formatted line.
- Returns:
New formatted line name without degenerate energy levels.
- Return type:
str
infobs.util.util module
- infobs.util.util.erg_to_kelvin(I: float | ndarray, nu: float) float | ndarray[source]
Conversion of integrated intensity from physics [erg cm-2 s-1 sr-1] to radio astronomy [K.km.s^-1] conventions.
[I]: erg cm-2 s-1 sr-1 [nu]: Hz
- infobs.util.util.g0_to_radm(g0: float | ndarray) float | ndarray[source]
converts G0 to radm
- Parameters:
G0 (float | ndarray) – G0 factor
- Returns:
input parameter of the Meudon PDR code, radm
- Return type:
float | ndarray
- infobs.util.util.integrate_noise(rms: float | ndarray, n: int, dv: float | None = None) float | ndarray[source]
Integrate noise intensity of RMS value rms over n velocity channels of width dv. The intensity is assumed to be independent of the velocity, which is generally appropriate in the case of small frequency excursions.
If dv is omitted, we assume that rms is already integrated over a single velocity channel [K.km.s^-1].
rsm: intensity [K] or integrated intensity [K.km.s^-1] n: number of velocity channel to integrate dv: velocity channel width [km.s] (optional)