nifty8.utilities module#
- check_MPI_equality(obj, comm, hash=False)[source]#
Check that object is the same on all MPI tasks associated to a given communicator.
Raises a RuntimeError if it differs.
- Parameters:
obj – Any Python object that implements __eq__.
comm (MPI communicator or None) – If comm is None, no check will be performed
- check_MPI_synced_random_state(comm)[source]#
Check that random state is the same on all MPI tasks associated to a given communicator.
Raises a RuntimeError if it differs.
- Parameters:
comm (MPI communicator or None) – If comm is None, no check will be performed
- check_object_identity(obj0, obj1)[source]#
Check if two objects are the same and throw ValueError if not.
- class frozendict(*args, **kwargs)[source]#
Bases:
Mapping
An immutable wrapper around dictionaries that implements the complete
collections.Mapping
interface. It can be used as a drop-in replacement for dictionaries where immutability is desired.- dict_cls#
alias of
dict
- get_slice_list(shape, axes)[source]#
Helper function which generates slice list(s) to traverse over all combinations of axes, other than the selected axes.
- Parameters:
shape (tuple) – Shape of the data array to traverse over.
axes (tuple) – Axes which should not be iterated over.
- Yields:
list – The next list of indices and/or slice objects for each dimension.
- Raises:
ValueError – If shape is empty. If axes(axis) does not match shape.