2.1.4.1.1. sf_tools.math.angle module

ANGLE HANDLING ROUTINES

This module contains methods for handing angles and trigonometry.

Author:Samuel Farrens <samuel.farrens@gmail.com>
Version:1.1
Date:20/10/2017
sf_tools.math.angle.deg2rad(angle)[source]

Degrees to radians

This method converts the angle from degrees to radians.

Parameters:angle (float or np.ndarray) – Input angle in degrees
Returns:
Return type:float angle in radians or np.ndarray of angles

Examples

>>> from sf_tools.math.angle import deg2rad
>>> deg2rad(45.)
0.7853981633974483

Notes

Implements the following equation:

\[\mathrm{radians} = \mathrm{degrees} \times \frac{\pi}{180}\]
sf_tools.math.angle.rad2deg(angle)[source]

Radians to degrees

This method converts the angle from radians to degrees.

Parameters:angle (float or np.ndarray) – Input angle in radians
Returns:
Return type:float angle in degrees or np.ndarray of angles

Examples

>>> from sf_tools.math.angle import deg2rad
>>> rad2deg(1.)
57.29577951308232

Notes

Implements the following equation:

\[\mathrm{degrees} = \mathrm{radians} \times \frac{180}{\pi}\]
sf_tools.math.angle.ang_sep(point1, point2)[source]

Angular separation

This method calculates the angular separation in degrees between two points.

Parameters:
  • point1 (tuple) – Angular position of point 1 in degrees
  • point1 – Angular position of point 2 in degrees
Returns:

Return type:

float angular separation in degrees

Examples

>>> from sf_tools.math.angle import ang_sep
>>> ang_sep((30.0, 0.0), (47.0, 10.0))
19.647958606833164

Notes

Implements the following equation:

\[\theta = \cos^{-1}[\sin(\delta_1)\sin(\delta_2)+ \cos(\delta_1)\cos(\delta_2)\cos(\alpha_1-\alpha_2)]\]

See https://en.wikipedia.org/wiki/Angular_distance