nbodykit.source.catalogmesh.fkp

Classes

FKPCatalogMesh(*args, **kwargs) A subclass of MultipleSpeciesCatalogMesh designed to paint a FKPCatalog to a mesh.
class nbodykit.source.catalogmesh.fkp.FKPCatalogMesh(*args, **kwargs)[source]

A subclass of MultipleSpeciesCatalogMesh designed to paint a FKPCatalog to a mesh.

The multiple species here are data and randoms CatalogSource objects, where randoms is a catalog of randomly distributed objects with no instrinsic clustering that defines the survey volume.

The position of the catalogs are re-centered to the [-L/2, L/2] where L is the size of the Cartesian box.

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
  • selection (str) – column in source that selects the subset of particles to grid to the mesh
  • comp_weight (str) – the completeness weight column name
  • fkp_weight (str) – the FKP weight column name
  • nbar (str) – the n(z) column name
  • 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
RecenteredPosition(name) The Position of the objects, re-centered on the mesh to the range [-BoxSize/2, BoxSize/2].
Selection() A boolean column that selects a subset slice of the CatalogSource.
TotalWeight(name) The total weight for the mesh is the completenes weight times the FKP weight.
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.
recenter_box(BoxSize, BoxCenter) Re-center the box by applying the new box center to the column specified by position.
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() Paint the FKP density field, returning a RealField.
view([type]) Return a “view” of the CatalogSource object, with the returned type set by type.
weighted_total(name) Compute the weighted total number of objects, using either the
RecenteredPosition(name)[source]

The Position of the objects, re-centered on the mesh to the range [-BoxSize/2, BoxSize/2].

This subtracts BoxCenter from attrs from the original position array.

TotalWeight(name)[source]

The total weight for the mesh is the completenes weight times the FKP weight.

recenter_box(BoxSize, BoxCenter)[source]

Re-center the box by applying the new box center to the column specified by position.

This ensures that the position column is always re-centered to [-L/2,L/2] where L is the BoxSize.

to_real_field()[source]

Paint the FKP density field, returning a RealField.

Given the data and randoms catalogs, this paints:

\[F(x) = w_\mathrm{fkp}(x) * [w_\mathrm{comp}(x)*n_\mathrm{data}(x) - \alpha * w_\mathrm{comp}(x)*n_\mathrm{randoms}(x)]\]

This computes the following meta-data attributes in the process of painting, returned in the attrs attributes of the returned RealField object:

  • randoms.W, data.W :
    the weighted sum of randoms and data objects; see weighted_total()
  • alpha : float
    the ratio of data.W to randoms.W
  • randoms.norm, data.norm : float
    the power spectrum normalization; see normalization()
  • randoms.shotnoise, data.shotnoise: float
    the shot noise for each sample; see shotnoise()
  • shotnoise : float
    the total shot noise, equal to the sum of randoms.shotnoise and data.shotnoise
  • randoms.num_per_cell, data.num_per_cell : float
    the mean number of weighted objects per cell for each sample
  • num_per_cell : float
    the mean number of weighted objects per cell

For further details on the meta-data, see the documentation.

Returns:the field object holding the FKP density field in real space
Return type:RealField
weighted_total(name)[source]

Compute the weighted total number of objects, using either the data or randoms source:

This is the sum of the completeness weights:

\[W = \sum w_\mathrm{comp}\]