ra_dec_z

halotools.mock_observables.ra_dec_z(x, v, cosmo=None)[source]

Calculate the ra, dec, and redshift assuming an observer placed at (0,0,0).

Parameters:
x: array_like

Npts x 3 numpy array containing 3-d positions in Mpc/h

v: array_like

Npts x 3 numpy array containing 3-d velocities in km/s

cosmoobject, optional

Instance of an Astropy cosmology object. The default is FlatLambdaCDM(H0=0.7, Om0=0.3)

Returns:
ranp.array

right accession in radians

decnp.array

declination in radians

redshiftnp.array

“observed” redshift

Examples

For demonstration purposes we create a randomly distributed set of points within a periodic unit cube.

>>> Npts = 1000
>>> Lbox = 1.0
>>> period = np.array([Lbox,Lbox,Lbox])
>>> x = np.random.random(Npts)
>>> y = np.random.random(Npts)
>>> z = np.random.random(Npts)

We transform our x, y, z points into the array shape used by the pair-counter by taking the transpose of the result of numpy.vstack. This boilerplate transformation is used throughout the mock_observables sub-package:

>>> coords = np.vstack((x,y,z)).T

We do the same thing to assign random peculiar velocities:

>>> vx,vy,vz = (np.random.random(Npts),np.random.random(Npts),np.random.random(Npts))
>>> vels = np.vstack((vx,vy,vz)).T
>>> from astropy.cosmology import WMAP9 as cosmo
>>> ra, dec, redshift = ra_dec_z(coords, vels, cosmo = cosmo)