petitRADTRANS.slurm_runs.utils

petitRADTRANS.slurm_runs.utils#

SLURM run useful functions.

Functions#

fair_share(array, n_entities[, append_within_existing])

Split the elements of an array into a given number of entities.

load_dat(file, **kwargs)

Load a data file.

Module Contents#

petitRADTRANS.slurm_runs.utils.fair_share(array, n_entities, append_within_existing=True)#

Split the elements of an array into a given number of entities.

Examples:

fair_share([1, 2, 3], 2) => [[1, 3], [2]] fair_share([1, 2, 3], 3) => [[1], [2], [3]] fair_share([1, 2, 3, 4], 2) => [[1, 2], [3, 4]] fair_share([1, 2, 3, 4, 5], 2) => [[1, 2, 5], [3, 4]] fair_share([1, 2, 3, 4, 5], 2, False) => [[1, 2], [3, 4], [5]]

Args:

array: a numpy array n_entities: the number of entities append_within_existing: if True, leftover elements will be shared within the entities; otherwise, leftover

elements will be added as an extra entity

Returns:

list with n_entities elements if append_within_existing is True, n_entities + 1 elements otherwise, each sharing elements of the original array.

petitRADTRANS.slurm_runs.utils.load_dat(file, **kwargs)#

Load a data file.

Args:

file: data file **kwargs: keywords arguments for numpy.loadtxt()

Returns:

data_dict: a dictionary containing the data