nessai.utils.structures
=======================

.. py:module:: nessai.utils.structures

.. autoapi-nested-parse::

   Utilities for manipulating python structures such as lists and dictionaries.

   ..
       !! processed by numpydoc !!


Functions
---------

.. autoapisummary::

   nessai.utils.structures.replace_in_list
   nessai.utils.structures.get_subset_arrays
   nessai.utils.structures.isfinite_struct
   nessai.utils.structures.array_split_chunksize
   nessai.utils.structures.get_inverse_indices


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

.. py:function:: replace_in_list(target_list, targets, replacements)

   
   Replace (in place) an entry in a list with a given element.


   :Parameters:

       **target_list** : list
           List to update

       **targets** : list
           List of items to update

       **replacements** : list
           List of replacement items














   ..
       !! processed by numpydoc !!

.. py:function:: get_subset_arrays(indices, *args)

   
   Return a subset of a set of arrays.

   Assumes all arrays are the same length.

   :Parameters:

       **indices** : array
           Array of indices or boolean array of same length as input arrays

       **args** : arrays
           Set of arrays to index.



   :Returns:

       tuple
           A tuple contain the corresponding array for each input array. The order
           is preserved.











   ..
       !! processed by numpydoc !!

.. py:function:: isfinite_struct(x, names=None)

   
   Check for +/- infinity and NaNs in a structured array.

   Returns a boolean per entry not per field (name).

   :Parameters:

       **x** : np.ndarray
           Structured array

       **names** : list[str]
           Names of the fields to include. If not specified, the names from the
           dtype of the structured array are used.



   :Returns:

       np.ndarray
           Array of booleans indicating if each entry in the array is finite
           (True) or not (False).











   ..
       !! processed by numpydoc !!

.. py:function:: array_split_chunksize(x, chunksize)

   
   Split an array into multiple sub-arrays of a specified chunksize.


   :Parameters:

       **x** : numpy.ndarray
           Input array.

       **chunksize** : int
           Chunksize into which to split the array.



   :Returns:

       list
           List of numpy arrays each with a maximum length given by the chunksize.











   ..
       !! processed by numpydoc !!

.. py:function:: get_inverse_indices(n, indices)

   
   Return the indices that are not in input array given a size n
















   ..
       !! processed by numpydoc !!

