petitRADTRANS.slurm_runs.utils#
SLURM run useful functions.
Functions#
|
Split the elements of an array into a given number of entities. |
|
Load a data file. |
Module Contents#
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.