Ska.astro

class Ska.astro.Equatorial(*args)

Bare-bones class to get between decimal and sexigesimal representations of equatorial coordinates.

Initialize an Equatorial object with any combination of string or numeric arguments that contain a total of either two or six numerical values. Any separators in the list [,:dhms] are converted to <space> before splitting into numerical values.

The following attributes will then be available:

ra, dec Decimal (0 <= ra < 360)
ra0 RA (-180 < ra <= 180)
ra_hms, dec_dms Sexigesimal string
rah, ram, ras RA hour, min, sec
decsign Declination sign (+|-)
decd, decm, decs Declination deg, min, sec

The sexigesimal delimiter is controlled by the delim attribute and is the colon character by default.

Examples:

>>> pos = Ska.astro.Equatorial(123.4, "-34.12")
>>> pos = Ska.astro.Equatorial("12:01:02.34, -34:12:34.11")
>>> pos = Ska.astro.Equatorial("12 01 02.34", "-34d12m34.11s")
>>> print pos
>>> print pos
RA, Dec = 180.25975, -34.2095 = 12:01:02.340, -34:12:34.11
>>> pos.delim = " "
>>> print pos
RA, Dec = 180.25975, -34.2095 = 12 01 02.340, -34 12 34.11
Ska.astro.sph_dist(a1, d1, a2, d2)

Calculate spherical distance between two sky positions. Uses the haversine formula so accuracy degrades at distances near 180 degrees.

The input coordinates can be either native python types (float, int) or numpy arrays. The output will matchin the input type.

>>> Ska.astro.sph_dist(1, 2, 3, 4)
2.8264172166623145
>>> Ska.astro.sph_dist(1, 2, np.array([1,2,3,4]), np.array([4,5,6,7]))
array([ 2.        ,  3.16165191,  4.46977556,  5.82570185])
Parameters:
  • a1 – RA position 1 (deg)
  • d1 – dec position 1 (deg)
  • a2 – RA position 2 (deg)
  • d2 – dec position 2 (deg)
Return type:

spherical distance (deg)

Previous topic

Ska.arc5gl

Next topic

Ska.CIAO