rxn_network.utils#
rxn_network.utils.funcs#
Utility functions used throughout the reaction-network package.
- rxn_network.utils.funcs.limited_powerset(iterable, max_size)[source]#
Helper method for generating subsets ranging from singular length to maximum length specified by max_size.
- Parameters:
iterable (Iterable) – all objects to consider.
max_size (int) – upper limit for size of combination subsets.
- Returns:
All combination sets up to maximum size
- Return type:
Iterable
- rxn_network.utils.funcs.grouper(iterable, n, fillvalue=None)[source]#
Collects data into fixed-length chunks or blocks.
- Parameters:
iterable (Iterable) – An iterable object to group.
n (int) – The number of items to include in each group.
fillvalue (Any) – The value to use for the last group, if the length of the group is less than n.
- Return type:
Iterable
- rxn_network.utils.funcs.get_project_root()[source]#
Gets a Path object for the reaction-network project root directory.
Note
This is specific to this file and project.
- Returns:
Path object for the project root directory.
- Return type:
rxn_network.utils.ray#
Functions for working with Ray (parallelization library).
- rxn_network.utils.ray.initialize_ray(quiet=False)[source]#
Simple function to initialize ray. Basic support for running ray on multiple nodes. Currently supports SLURM and PBS job schedulers.
- SLURM:
Checks enviornment for existence of “ip_head” for situations where the user is running on multiple nodes. Automatically creats a new ray cluster if it has not been initialized. See https://github.com/NERSC/slurm-ray-cluster/
- PBS:
Checks environment for PBS_NNODES > 1.
- Parameters:
quiet (bool) –