dsigma.helpers module

Convenience functions for the dsigma pipeline.

dsigma.helpers.in_degrees(angle)[source]

Add a degree unit to an angle if it doesn’t have a unit, yet.

Parameters:
angleastropy.units.quantity.Quantity

Angle with or without units.

Returns:
angleastropy.units.quantity.Quantity

Angle with units.

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.

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

Convert spherical coordinates to Cartesian coordinates on a unit sphere.

Parameters:
raastropy.units.quantity.Quantity

Right ascension.

decastropy.units.quantity.Quantity

Declination.

Returns:
x, y, zfloat or numpy.ndarray

Cartesian coordinates.