Functions
check_species_metadata(name, attrs, species) |
Check to see if there is a single value for |
split_column(col, species) |
Split the column name of the form ‘species/name’ |
Classes
MultipleSpeciesCatalog(names, *species, **kwargs) |
A CatalogSource interface for handling multiples species of particles. |
nbodykit.source.catalog.species.MultipleSpeciesCatalog(names, *species, **kwargs)[source]¶A CatalogSource interface for handling multiples species of particles.
This CatalogSource stores a copy of the original CatalogSource objects
for each species, providing access to the columns via the format
species/ where “species” is one of the species names provided.
| Parameters: |
|
|---|
Examples
Initialization:
>>> data = UniformCatalog(nbar=3e-5, BoxSize=512., seed=42)
>>> randoms = UniformCatalog(nbar=3e-5, BoxSize=512., seed=84)
>>> cat = MultipleSpeciesCatalog(['data', 'randoms'], data, randoms)
Accessing the Catalogs for individual species:
>>> data = cat["data"] # a copy of the original "data" object
Accessing individual columns:
>>> data_pos = cat["data/Position"]
Setting new columns:
>>> cat["data"]["new_column"] = 1.0
>>> assert "data/new_column" in cat
Attributes
attrs |
A dictionary storing relevant meta-data about the CatalogSource. |
columns |
Columns for individual species can be accessed using a species/ prefix and the column name, i.e., data/Position. |
hardcolumns |
Hardcolumn of the form species/name |
species |
List of species names |
use_cache |
If set to True, use the built-in caching features of dask to cache data in memory. |
Methods
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) |
Construct and return a hard-coded column. |
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. |
to_mesh([Nmesh, BoxSize, dtype, interlaced, …]) |
Convert the catalog to a mesh, which knows how to “paint” the the combined density field, summed over all particle species. |
view([type]) |
Return a “view” of the CatalogSource object, with the returned type set by type. |
__getitem__(key)[source]¶This provides access to the underlying data in two ways:
key
is a species name.species/column.__setitem__(col, value)[source]¶Add columns to any of the species catalogs.
Note
New column names should be prefixed by ‘species/’ where
‘species’ is a name in the species attribute.
columns¶Columns for individual species can be accessed using a species/
prefix and the column name, i.e., data/Position.
hardcolumns¶Hardcolumn of the form species/name
species¶List of species names
to_mesh(Nmesh=None, BoxSize=None, dtype='f4', interlaced=False, compensated=False, window='cic', weight='Weight', selection='Selection', value='Value', position='Position')[source]¶Convert the catalog to a mesh, which knows how to “paint” the the combined density field, summed over all particle species.
| Parameters: |
|
|---|