lenspack.geometry.measures module

lenspack.geometry.measures.angular_distance(ra1, dec1, ra2, dec2)[source]

Determine the angular distance between points on the unit sphere.

This function is vectorized, so the inputs can be given as arrays (of the same length), and the distances between each pair of corresponding points is computed.

Parameters
  • ra[i] (float or array_like) – Coordinates of point [i] on the sphere, where ra[i] is the longitudinal angle, and dec[i] is the latitudinal angle in degrees.

  • dec[i] (float or array_like) – Coordinates of point [i] on the sphere, where ra[i] is the longitudinal angle, and dec[i] is the latitudinal angle in degrees.

Returns

Central angle(s) between points [1] and [2] in degrees.

Return type

float or numpy array

Raises

Exception – For inputs of different length.

Notes

The geodesic distance between points on a sphere of radius R can be obtained by multiplying the result of angular_distance by R.

Examples

lenspack.geometry.measures.spherical_polar_angle(ra1, dec1, ra2, dec2)[source]

Determine the polar angle between two points on the sphere.

The angle returned is the one subtended between the great circle arc joining the two points and the local ‘horizontal’ axis through the first point (ra1, dec1), i.e. dec = dec1.

Parameters
  • ra[i] (float or array_like) – Coordinates of point [i] on the sphere, where ra[i] is the longitudinal angle, and dec[i] is the latitudinal angle in degrees.

  • dec[i] (float or array_like) – Coordinates of point [i] on the sphere, where ra[i] is the longitudinal angle, and dec[i] is the latitudinal angle in degrees.

Returns

Polar angle measured in radians between the dec = dec1 axis and the great circle arc joining points [1] and [2].

Return type

float or numpy array

Raises

Exception – For inputs of different length.

Notes

The output angle lies within [0, 2 * pi). Multiple second points specified by ra2 and dec2 arrays can be given. In that case, the angle of each point 2 relative to the single reference point 1 is returned.

Examples

>>> ra1, dec1 = 0, 0  # [deg]
>>> ra2, dec2 = -1, -1
>>> angle = spherical_polar_angle(ra1, dec1, ra2, dec2)
>>> print(np.rad2deg(angle))
225.00436354465515

# Deviations from the flat geometric result increase as the points move # farther from the equator and their separation gets larger >>> ra1, dec1 = 0, 0 # [deg] >>> ra2, dec2 = -30, -30 >>> angle = spherical_polar_angle(ra1, dec1, ra2, dec2) >>> print(np.rad2deg(angle)) 229.10660535086907

lenspack.geometry.measures.solid_angle(extent)[source]

Compute the solid angle subtended by a rectangle in RA/Dec space.

Parameters

extent (array_like) – Field extent as [ra_min, ra_max, dec_min, dec_max] in degrees, where ra_min <= ra_max and dec_min <= dec_max.

Returns

Solid angle in square degrees.

Return type

float

Raises

Exception – For inputs not in the correct format.

Examples