dsigma.helpers module

Convenience functions for the dsigma pipeline.

dsigma.helpers.cartesian_to_spherical(x, y, z)[source]

Convert cartesian coordinates to spherical coordinates.

Parameters:
xfloat or numpy.ndarray

x-coordinate.

yfloat or numpy.ndarray

y-coordinate.

zfloat or numpy.ndarray

z-coordinate.

Returns:
ra, decfloat or numpy.ndarray

Spherical coordinates.

dsigma.helpers.interpolate_over_redshift(f, z, *args, **kwargs)[source]

Interpolate a function over redshift.

For many cosmological calculations such as comoving distances performing the precise calculation for all objects in the catalog would be very expensive. Instead, we can perform the calculation on a grid in redshift and then interpolate. For most calculations, this is extremely accurate and much faster.

Parameters:
fcallable()

Function to evaluate over redshift.

znumpy.ndarray

Redshifts to evaluate.

*args

Additional arguments passed to f.

**kwargs

Extra keyword arguments passed to f.

Returns:
f_of_znumpy.ndarray or astropy.units.quantity.Quantity

Interpolated values.

Raises:
ValueError

If redshifts are negative.

dsigma.helpers.spherical_to_cartesian(ra, dec)[source]

Convert spherical coordinates to cartesian coordinates on a unit sphere.

Parameters:
rafloat or numpy.ndarray

Right ascension.

decfloat or numpy.ndarray

Declination.

Returns:
x, y, zfloat or numpy.ndarray

Cartesian coordinates.