Classes
CatalogMesh (*args, **kwargs) |
A view of a CatalogSource object which knows how to create a MeshSource object from itself. |
nbodykit.base.catalogmesh.
CatalogMesh
(*args, **kwargs)[source]¶A view of a CatalogSource object which knows how to create a MeshSource object from itself.
The original CatalogSource object is stored as the base
attribute.
Parameters: |
|
---|
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 ([out, normalize]) |
Paint the density field, by interpolating the position column on to the mesh. |
view ([type]) |
Return a “view” of the CatalogSource object, with the returned type set by type . |
CompensateCIC
(w, v)[source]¶Return the Fourier-space kernel that accounts for the convolution of the gridded field with the CIC window function in configuration space
Note
see equation 18 (with p=2) of Jing et al 2005
Parameters: |
|
---|
CompensateCICAliasing
(w, v)[source]¶Return the Fourier-space kernel that accounts for the convolution of the gridded field with the CIC window function in configuration space, as well as the approximate aliasing correction
Note
see equation 20 of Jing et al 2005
Parameters: |
|
---|
CompensateTSC
(w, v)[source]¶Return the Fourier-space kernel that accounts for the convolution of the gridded field with the TSC window function in configuration space.
Note
see equation 18 (with p=3) of Jing et al 2005
Parameters: |
|
---|
CompensateTSCAliasing
(w, v)[source]¶Return the Fourier-space kernel that accounts for the convolution of the gridded field with the TSC window function in configuration space, as well as the approximate aliasing correction
Note
see equation 20 of Jing et al 2005
Parameters: |
|
---|
__finalize__
(other)[source]¶Finalize the creation of a CatalogMesh object by copying over attributes from a second CatalogMesh.
This also copies over the relevant MeshSource attributes via a
call to MeshSource.__finalize__()
.
Parameters: | obj (CatalogMesh) – the second CatalogMesh to copy over attributes from |
---|
__slice__
(index)[source]¶Return a slice of a CatalogMesh object.
This slices the CatalogSource object stored as the base
attribute, and then views that sliced object as a CatalogMesh.
Parameters: | index (array_like) – either a dask or numpy boolean array; this determines which rows are included in the returned object |
---|---|
Returns: | the particle source with the same meta-data as self , and
with the sliced data arrays |
Return type: | subset |
actions
¶The actions to apply to the interpolated density field, optionally included the compensation correction.
compensated
¶Boolean flag to indicate whether to correct for the windowing kernel introduced when interpolating the discrete particles to a continuous field.
See the documentation for further details.
copy
()[source]¶Return a shallow copy of self
.
Note
No copy of data is made.
Returns: | a new CatalogMesh that holds all of the data columns of self |
---|---|
Return type: | CatalogMesh |
gslice
(start, stop, end=1, redistribute=True)[source]¶Execute a global slice of a CatalogMesh.
Note
After the global slice is performed, the data is scattered evenly across all ranks.
As CatalogMesh objects are views of a CatalogSource, this simply globally slices the underlying CatalogSource.
Parameters: |
|
---|
interlaced
¶Whether to use interlacing when interpolating the density field. See the documentation for further details.
See also: Section 3.1 of Sefusatti et al. 2015
save
(output, dataset='Field', mode='real')[source]¶Save the mesh as a BigFileMesh
on disk, either in real or complex space.
Parameters: |
---|
sort
(keys, reverse=False, usecols=None)[source]¶Sort the CatalogMesh object globally across all MPI ranks in ascending order by the input keys.
Sort columns must be floating or integer type.
As CatalogMesh objects are views of a CatalogSource, this simply sorts the underlying CatalogSource.
Parameters: |
|
---|
to_real_field
(out=None, normalize=True)[source]¶Paint the density field, by interpolating the position column on to the mesh.
This computes the following meta-data attributes in the process of
painting, returned in the attrs
attributes of the returned
RealField object:
N
Note
The density field on the mesh is normalized as \(1+\delta\), such that the collective mean of the field is unity.
See the documentation on painting for more details on painting catalogs to a mesh.
Returns: | real – the painted real field; this has a attrs dict storing meta-data |
---|---|
Return type: | pmesh.pm.RealField |
window
¶String specifying the name of the interpolation kernel when gridding the density field.
See the documentation for further details.
Note
Valid values must be in pmesh.window.methods