Functions
ConcatenateSources (*sources, **kwargs) |
Concatenate CatalogSource objects together, optionally including only certain columns in the returned source. |
ConstantArray (value, size[, chunks]) |
Return a dask array of the specified size holding a single value. |
HaloConcentration (mass, cosmo, redshift[, mdef]) |
Return halo concentration from halo mass, based on the analytic fitting formulas presented in Dutton and Maccio 2014. |
HaloRadius (mass, cosmo, redshift[, mdef]) |
Return halo radius from halo mass, based on the specified mass definition. |
SkyToCartesian (ra, dec, redshift, cosmo[, …]) |
Convert sky coordinates (ra , dec , redshift ) to a Cartesian Position column. |
SkyToUnitSphere (ra, dec[, degrees]) |
Convert sky coordinates (ra , dec ) to Cartesian coordinates on the unit sphere. |
StackColumns (*cols) |
Stack the input dask arrays vertically, column by column. |
nbodykit.transform.
ConcatenateSources
(*sources, **kwargs)[source]¶Concatenate CatalogSource objects together, optionally including only certain columns in the returned source.
Note
The returned catalog object carries the meta-data from only
the first catalog supplied to this function (in the attrs
dict).
Parameters: |
|
---|---|
Returns: | the concatenated catalog source object |
Return type: |
Examples
>>> from nbodykit.lab import *
>>> source1 = UniformCatalog(nbar=100, BoxSize=1.0)
>>> source2 = UniformCatalog(nbar=100, BoxSize=1.0)
>>> print(source1.csize, source2.csize)
>>> combined = transform.ConcatenateSources(source1, source2, columns=['Position', 'Velocity'])
>>> print(combined.csize)
nbodykit.transform.
ConstantArray
(value, size, chunks=100000)[source]¶Return a dask array of the specified size
holding a single value.
This uses numpy’s “stride tricks” to avoid replicating the data in memory for each element of the array.
Parameters: |
---|
nbodykit.transform.
HaloConcentration
(mass, cosmo, redshift, mdef='vir')[source]¶Return halo concentration from halo mass, based on the analytic fitting formulas presented in Dutton and Maccio 2014.
Note
The units of the input mass are assumed to be \(M_{\odot}/h\)
Parameters: |
|
---|---|
Returns: | concen – a dask array holding the analytic concentration values |
Return type: |
References
Dutton and Maccio, “Cold dark matter haloes in the Planck era: evolution of structural parameters for Einasto and NFW profiles”, 2014, arxiv:1402.7073
nbodykit.transform.
HaloRadius
(mass, cosmo, redshift, mdef='vir')[source]¶Return halo radius from halo mass, based on the specified mass definition. This is independent of halo profile, and simply returns
where \(\Delta\) is the density threshold, which depends on cosmology, redshift, and mass definition
Note
The units of the input mass are assumed to be \(M_{\odot}/h\)
Parameters: |
|
---|---|
Returns: | radius – a dask array holding the halo radius |
Return type: |
nbodykit.transform.
SkyToCartesian
(ra, dec, redshift, cosmo, degrees=True)[source]¶Convert sky coordinates (ra
, dec
, redshift
) to a
Cartesian Position
column.
Warning
The returned Cartesian position is in units of Mpc/h.
Parameters: |
|
---|---|
Returns: | pos – the cartesian position coordinates, where columns represent
|
Return type: |
|
Raises: |
|
nbodykit.transform.
SkyToUnitSphere
(ra, dec, degrees=True)[source]¶Convert sky coordinates (ra
, dec
) to Cartesian coordinates on
the unit sphere.
Parameters: |
|
---|---|
Returns: | pos – the cartesian position coordinates, where columns represent
|
Return type: |
|
Raises: |
|
nbodykit.transform.
StackColumns
(*cols)[source]¶Stack the input dask arrays vertically, column by column.
This uses dask.array.vstack()
.
Parameters: | *cols (dask.array.Array ) – the dask arrays to stack vertically together |
---|---|
Returns: | the dask array where columns correspond to the input arrays |
Return type: | dask.array.Array |
Raises: | TypeError – If the input columns are not dask arrays |