nbodykit.source.mesh.array

Classes

ArrayMesh(array, BoxSize[, comm, root]) A MeshSource initalized from an in-memory numpy array.
class nbodykit.source.mesh.array.ArrayMesh(array, BoxSize, comm=None, root=0, **kwargs)[source]

A MeshSource initalized from an in-memory numpy array.

Note

The in-memory array must be fully hosted by the root rank.

Parameters:
  • array (numpy.ndarray) – the numpy array holding the field data; this must be fully hosted by the rank specified by root
  • BoxSize (float, 3-vector) – the size of the box
  • root (int, optional) – the root rank holding the array data
  • **kwargs – additional meta-data to store

Attributes

actions A list of actions to apply to the density field when interpolating to the mesh.
attrs A dictionary storing relevant meta-data about the CatalogSource.

Methods

apply(func[, kind, mode]) Return a view of the mesh, with actions updated to
paint([mode, Nmesh]) Paint the density on the mesh and apply any transformation functions specified in actions.
preview([axes, Nmesh, root]) Gather the mesh into as a numpy array, with (reduced) resolution.
save(output[, dataset, mode]) Save the mesh as a BigFileMesh on disk, either in real or complex space.
to_complex_field([out]) Convert the mesh source to the Fourier-space field, returning a pmesh.pm.ComplexField object.
to_field([mode, out]) Return the mesh as a pmesh Field object, either in Fourier space or configuration space, based on mode.
to_real_field()
view() Return a “view” of the MeshSource, in the spirit of numpy’s ndarray view.