nbodykit.source.catalog.array

Classes

ArrayCatalog(data[, comm, use_cache]) A CatalogSource initialized from a dictionary or structured ndarray.
class nbodykit.source.catalog.array.ArrayCatalog(data, comm=None, use_cache=False, **kwargs)[source]

A CatalogSource initialized from a dictionary or structured ndarray.

Parameters:
  • data (obj:dict or numpy.ndarray) – a dictionary or structured ndarray; items are interpreted as the columns of the catalog; the length of any item is used as the size of the catalog.
  • comm (MPI Communicator, optional) – the MPI communicator instance; default (None) sets to the current communicator
  • use_cache (bool, optional) – whether to cache data read from disk; default is False
  • **kwargs – additional keywords to store as meta-data in attrs

Attributes

Index The attribute giving the global index rank of each particle in the list.
attrs A dictionary storing relevant meta-data about the CatalogSource.
columns All columns in the CatalogSource, including those hard-coded into the class’s defintion and override columns provided by the user.
csize The total, collective size of the CatalogSource, i.e., summed across all ranks.
hardcolumns The union of the columns in the file and any transformed columns.
size The number of objects in the CatalogSource on the local rank.
use_cache If set to True, use the built-in caching features of dask to cache data in memory.

Methods

Selection() A boolean column that selects a subset slice of the CatalogSource.
Value() When interpolating a CatalogSource on to a mesh, the value of this array is used as the Value that each particle contributes to a given mesh cell.
Weight() The column giving the weight to use for each particle on the mesh.
compute(*args, **kwargs) Our version of dask.compute() that computes multiple delayed dask collections at once.
copy() Return a shallow copy of the object, where each column is a reference of the corresponding column in self.
get_hardcolumn(col) Return a column from the underlying data array/dict.
gslice(start, stop[, end, redistribute]) Execute a global slice of a CatalogSource.
make_column(array) Utility function to convert an array-like object to a dask.array.Array.
read(columns) Return the requested columns as dask arrays.
save(output, columns[, datasets, header]) Save the CatalogSource to a bigfile.BigFile.
sort(keys[, reverse, usecols]) Return a CatalogSource, sorted globally across all MPI ranks in ascending order by the input keys.
to_mesh([Nmesh, BoxSize, dtype, interlaced, …]) Convert the CatalogSource to a MeshSource, using the specified parameters.
view([type]) Return a “view” of the CatalogSource object, with the returned type set by type.
get_hardcolumn(col)[source]

Return a column from the underlying data array/dict.

Columns are returned as dask arrays.

hardcolumns

The union of the columns in the file and any transformed columns.