petitRADTRANS.slurm_runs.utils
==============================

.. py:module:: petitRADTRANS.slurm_runs.utils

.. autoapi-nested-parse::

   SLURM run useful functions.



Functions
---------

.. autoapisummary::

   petitRADTRANS.slurm_runs.utils.fair_share
   petitRADTRANS.slurm_runs.utils.load_dat


Module Contents
---------------

.. py:function:: 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.


.. py:function:: 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


