nbodykit.source.catalogmesh.species

Classes

MultipleSpeciesCatalogMesh(*args, **kwargs) A subclass of CatalogMesh designed to paint the density field from a sum of multiple types of particles.
class nbodykit.source.catalogmesh.species.MultipleSpeciesCatalogMesh(*args, **kwargs)[source]

A subclass of CatalogMesh designed to paint the density field from a sum of multiple types of particles.

The paint() function paints the density field summed over all particle species.

Parameters:
  • source (CatalogSource) – the input catalog that we wish to interpolate to a mesh
  • BoxSize – the size of the box
  • Nmesh (int, 3-vector) – the number of cells per mesh side
  • dtype (str) – the data type of the values stored on mesh
  • weight (str) – column in source that specifies the weight value for each particle in the source to use when gridding
  • value (str) – column in source that specifies the field value for each particle; the mesh stores a weighted average of this column
  • selection (str) – column in source that selects the subset of particles to grid
  • position (str, optional) – column in source specifying the position coordinates; default is Position

Attributes

Index The attribute giving the global index rank of each particle in the list.
actions The actions to apply to the interpolated density field, optionally included the compensation correction.
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.
compensated Boolean flag to indicate whether to correct for the windowing kernel introduced when interpolating the discrete particles to a continuous field.
csize The total, collective size of the CatalogSource, i.e., summed across all ranks.
hardcolumns A list of the hard-coded columns in the CatalogSource.
interlaced Whether to use interlacing when interpolating the density field.
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.
window String specifying the name of the interpolation kernel when gridding the density field.

Methods

CompensateCIC(w, v) Return the Fourier-space kernel that accounts for the convolution of
CompensateCICAliasing(w, v) Return the Fourier-space kernel that accounts for the convolution of
CompensateTSC(w, v) Return the Fourier-space kernel that accounts for the convolution of the gridded field with the TSC window function in configuration space.
CompensateTSCAliasing(w, v) Return the Fourier-space kernel that accounts for the convolution of
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.
apply(func[, kind, mode]) Return a view of the mesh, with actions updated to
compute(*args, **kwargs) Our version of dask.compute() that computes multiple delayed dask collections at once.
copy() Return a shallow copy of self.
get_hardcolumn(col) Construct and return a hard-coded column.
gslice(start, stop[, end, redistribute]) Execute a global slice of a CatalogMesh.
make_column(array) Utility function to convert an array-like object to a dask.array.Array.
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.
read(columns) Return the requested columns as dask arrays.
save(output[, dataset, mode]) Save the mesh as a BigFileMesh on disk, either in real or complex space.
sort(keys[, reverse, usecols]) Sort the CatalogMesh object globally across all MPI ranks in ascending order by the input keys.
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_mesh([Nmesh, BoxSize, dtype, interlaced, …]) Convert the CatalogSource to a MeshSource, using the specified parameters.
to_real_field([normalize]) Paint the density field holding the sum of all particle species, returning a RealField object.
view([type]) Return a “view” of the CatalogSource object, with the returned type set by type.
__getitem__(key)[source]

If indexed by a species name, return a CatalogMesh object holding only the data columns for that species with the same parameters as the current object.

If not a species name, this has the same behavior as CatalogSource.__getitem__().

to_real_field(normalize=True)[source]

Paint the density field holding the sum of all particle species, returning a RealField object.

Meta-data computed for each particle is stored in the attrs attribute of the returned RealField, with keys that are prefixed by the species name. In particular, the total shot noise for the mesh is defined as:

\[P_\mathrm{shot} = \sum_i (W_i/W_\mathrm{tot})^2 P_{\mathrm{shot},i},\]

where the sum is over all species in the catalog, W_i is the sum of the Weight column for the \(i^\mathrm{th}\) species, and \(W_\mathrm{tot}\) is the sum of \(W_i\) across all species.

Parameters:normalize (bool, optional) – if True, normalize the density field as \(1+\delta\), dividing by the total mean number of objects per cell, as given by the num_per_cell meta-data value in attrs
Returns:the RealField holding the painted density field, with a attrs dictionary attribute holding the meta-data
Return type:RealField