rizer.kin.load_cross_sections#

Classes#

CrossSectionData

Dataclass to handle cross section information for each reaction.

Functions#

load_cross_sections_summary_yaml() → dict[str, ...)

Load the yaml file containing the link between equation and alias for each database.

raise_type_error_on_isinstance(variable_to_test, ...)

filter_cross_sections_to_load(→ dict[str, dict[str, ...)

Filter the cross section to load, after a deepcopy.

load_cross_sections_data(→ list[CrossSectionData])

Load cross section data.

group_cross_sections_by_equation(→ dict[str, ...)

Group cross sections from various sources by equation.

Module Contents#

class rizer.kin.load_cross_sections.CrossSectionData#

Dataclass to handle cross section information for each reaction.

species_name: str#
equation: str#
database: str#
equation_alias: str#
df: rizer.io.lxcat.Collision#
rizer.kin.load_cross_sections.load_cross_sections_summary_yaml(path_to_cross_sections_yaml: pathlib.Path = get_path_to_data('kin', 'cross_section', 'cross_sections_summary.yaml')) dict[str, dict[str, dict[str, str]]]#

Load the yaml file containing the link between equation and alias for each database.

Parameters:

path_to_cross_sections_yaml (pathlib.Path, optional) – Path to yaml file. See ./data/kin/cross_section/cross_sections_summary.yaml for more.

Returns:

Example given:

# Name of the species, and the folder as well. {“H2”: # The reaction as it will appear in the kinetic scheme. {“e- + H2 => e- + e- + H2+”: # The name of the file/database, with the corresponding process name in that file. {“Biagi.txt”: “H2 -> +ionized H2”}}}

Return type:

dict of str to dict of str to dict of str to str

rizer.kin.load_cross_sections.raise_type_error_on_isinstance(variable_to_test, expected_type, name_of_variable)#
rizer.kin.load_cross_sections.filter_cross_sections_to_load(data: dict[str, dict[str, dict[str, str]]], species_to_keep: str | list[str] | None = None, species_to_remove: str | list[str] | None = None, equations_to_keep: str | list[str] | None = None, equations_to_remove: str | list[str] | None = None) dict[str, dict[str, dict[str, str]]]#

Filter the cross section to load, after a deepcopy.

Can be useful, to avoid loading all the data if only a subsection is required.

Parameters:
  • data (dict of str to dict of str to dict of str to str) – See load_cross_sections_summary_yaml.

  • species_to_keep (str or list of str or None, optional) – Keep only the species provided, by default None. If None, keep all. If not None, cannot be set at the same time as species_to_remove.

  • species_to_remove (str or list of str or None, optional) – Remove the species provided, by default None. If None, no species are removed. If not None, cannot be set at the same time as species_to_keep.

  • equations_to_keep (str or list of str or None, optional) – Keep only the equation provided, by default None. If None, keep all. If not None, cannot be set at the same time as equations_to_remove.

  • equations_to_remove (str or list of str or None, optional) – Remove the equation provided, by default None. If None, no equation are removed If not None, cannot be set at the same time as equations_to_keep.

Returns:

See load_cross_sections_summary_yaml.

Return type:

dict of str to dict of str to dict of str to str

rizer.kin.load_cross_sections.load_cross_sections_data(data: dict[str, dict[str, dict[str, str]]]) list[CrossSectionData]#

Load cross section data.

Parsing is done using rizer.io.lxcat.LXCat class.

Parameters:

data (dict of str to dict of str to dict of str to str) – See load_cross_sections_summary_yaml.

Returns:

Loaded cross section information.

Return type:

list of CrossSectionData

rizer.kin.load_cross_sections.group_cross_sections_by_equation(cross_section_list: list[CrossSectionData]) dict[str, list[CrossSectionData]]#

Group cross sections from various sources by equation.

Parameters:

cross_section_list (list of CrossSectionData) – List containing CrossSectionData. Typically generated by load_cross_sections_data.

Returns:

Dictionnary where equation are mapped to corresponding list of CrossSectionData.

Return type:

dict of str to list of CrossSectionData