opsimsummary.trig module¶
Module for trigonometric utilities such as conversion between different conventions and units, as well as calculating angular separations between points on a sphere.
-
opsimsummary.trig.
angSep
(ra1, dec1, ra2, dec2)[source]¶ Angular separation in radians between to points on a sphere with coordinates ra, dec in radians.
Parameters: - ra1 : np.ndarray /float, radians
ra of the first point
- dec1 : np.ndarray /float, radians
dec of the first point
- ra2 : np.ndarray /float, radians
ra of the second point
- dec2 : np.ndarray /float, radians
dec of the first point
Returns: - Angular separation in units of radians
-
opsimsummary.trig.
overlapSummary
(ra, dec, df, sep=1.75, raCol='fieldRA', decCol='fieldDec')[source]¶
-
opsimsummary.trig.
convertToSphericalCoordinates
(ra, dec, unit='degrees')[source]¶ Convert ra, dec coordinates to usual spherical coordinates theta, phi. The ra, dec coordinates have the ranges (0., 2pi), (-pi/2.0, pi/2.0)
Parameters: - ra : sequence of floats or scalar float, mandatory
ra coordinates in units of degrees or radians
- dec : sequence of floats or scalar float, mandatory
dec coordinates in units of degrees or radians
- unit : string, optional, defaults to ‘degrees’
‘degrees’ or ‘radians’
Returns: - tuple of `numpy.ndarray` (theta, phi) of spherical coordinates in
- radians. If scalars were supplied the return is a tuple of two scalars.
- .. note:: The units of ra, dec must be the same. They should have
- consistent lengths
-
opsimsummary.trig.
convertToCelestialCoordinates
(theta, phi, input_unit='radians', output_unit='degrees')[source]¶ Convert theta, phi in usual spherical coordinates to ra, dec values.
Parameters: - theta : np.ndarray or float
co-latitude
- phi :`np.ndarray` or float
co longitude
- input_unit : {‘degrees’, ‘radians’}, defautls to radians
- output_unit : {‘degrees’, ‘radians’}, defaults to degrees
-
opsimsummary.trig.
angToVec
(lon, lat, convention, unit)[source]¶ Compute an array of unit vectors corresponding to the array of longitude and latitude in either celestial conventions (ra, dec) or usual spherical coordinate system conventions.
Parameters: - lon : scalar or numpy.ndarray of floats
co-longitude which may be ra, or phi depending on the convention
- lat : scalar or numpy.ndarray of floats
co-latitude which may be dec, or theta depending on the convention
- convention : {‘celestial’|’spherical’}
whether the input angular positions are in spherical or celestial coordinates.
- unit : string
{‘degrees’| ‘radians’}