Functions
GatherArray(data, comm[, root]) |
Gather the input data array from all ranks to the specified root. |
ScatterArray(data, comm[, root, counts]) |
Scatter the input data array across all ranks, assuming data is initially only on root (and None on other ranks). |
attrs_to_dict(obj, prefix) |
|
captured_output(comm[, root]) |
Re-direct stdout and stderr to null for every rank but root |
deprecate(name, alternative[, alt_name]) |
This is a decorator which can be used to mark functions as deprecated. |
get_data_bounds(data, comm) |
Return the global minimum/maximum of a numpy array along the first axis. |
split_size_3d(s) |
Split s into three integers, a, b, c, such |
timer(start, end) |
Utility function to return a string representing the elapsed time, |
Classes
JSONDecoder(*args, **kwargs) |
A subclass of json.JSONDecoder that can also handle numpy arrays, complex values, and astropy.units.Quantity objects. |
JSONEncoder(*[, skipkeys, ensure_ascii, …]) |
A subclass of json.JSONEncoder that can also handle numpy arrays, complex values, and astropy.units.Quantity objects. |
nbodykit.utils.GatherArray(data, comm, root=0)[source]¶Gather the input data array from all ranks to the specified root.
This uses Gatherv, which avoids mpi4py pickling, and also avoids the 2 GB mpi4py limit for bytes using a custom datatype
| Parameters: |
|
|---|---|
| Returns: | recvbuffer – the gathered data on root, and None otherwise |
| Return type: | array_like, None |
nbodykit.utils.JSONDecoder(*args, **kwargs)[source]¶A subclass of json.JSONDecoder that can also handle numpy arrays,
complex values, and astropy.units.Quantity objects.
Methods
decode(s[, _w]) |
Return the Python representation of s (a str instance containing a JSON document). |
hook(value) |
|
raw_decode(s[, idx]) |
Decode a JSON document from s (a str beginning with a JSON document) and return a 2-tuple of the Python representation and the index in s where the document ended. |
nbodykit.utils.JSONEncoder(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None)[source]¶A subclass of json.JSONEncoder that can also handle numpy arrays,
complex values, and astropy.units.Quantity objects.
Methods
default(obj) |
|
encode(o) |
Return a JSON string representation of a Python data structure. |
iterencode(o[, _one_shot]) |
Encode the given object and yield each string representation as available. |
nbodykit.utils.ScatterArray(data, comm, root=0, counts=None)[source]¶Scatter the input data array across all ranks, assuming data is initially only on root (and None on other ranks).
This uses Scatterv, which avoids mpi4py pickling, and also
avoids the 2 GB mpi4py limit for bytes using a custom datatype
| Parameters: | |
|---|---|
| Returns: | recvbuffer – the chunk of data that each rank gets |
| Return type: | array_like |
nbodykit.utils.captured_output(comm, root=0)[source]¶Re-direct stdout and stderr to null for every rank but root
nbodykit.utils.deprecate(name, alternative, alt_name=None)[source]¶This is a decorator which can be used to mark functions as deprecated. It will result in a warning being emmitted when the function is used.
nbodykit.utils.get_data_bounds(data, comm)[source]¶Return the global minimum/maximum of a numpy array along the first axis.
| Parameters: |
|
|---|---|
| Returns: | the min/max of |
| Return type: |
nbodykit.utils.split_size_3d(s)[source]¶Split s into three integers, a, b, c, such that a * b * c == s and a <= b <= c
| Parameters: | s (int) – integer to split |
|---|---|
| Returns: | a, b, c – integers such that a * b * c == s and a <= b <= c |
| Return type: | int |