Package coords :: Module astrodate
[show private | hide private]
[frames | no frames]

Module coords.astrodate

For more information about astronomical date specifications, consult a reference source such as this page provided by the US Naval Observatory.

Constants and formulae in this module were taken from the times.h include file of the tpm package by Jeff Percival, to ensure compatibility.
Classes
BesselDate  
JulianDate  

Function Summary
JulianDate or BesselDate AstroDate(datespec)
AstroDate can be used as a class for managing astronomical date specifications (despite the fact that it was implemented as a factory function) that returns either a BesselDate or a JulianDate, depending on the properties of the datespec.
float byear2jd(byear)
Return julian date
float jd2jyear(jd)
Return decimal Julian year
float jyear2jd(jyear)
Return julian date
float utc2jd(utc)
Convert UTC to Julian date.

Function Details

AstroDate(datespec=None)

AstroDate can be used as a class for managing astronomical date specifications (despite the fact that it was implemented as a factory function) that returns either a BesselDate or a JulianDate, depending on the properties of the datespec.

AstroDate was originally conceived as a Helper class for the Position function for use with pytpm functionality, but also as a generally useful class for managing astronomical date specifications.

The philosophy is the same as Position: to enable the user to specify the date once and for all, and access it in a variety of styles.
Parameters:
datespec - Date specification as entered by the user. Permissible specifications include:
  • Julian year: 'J1997', 'J1997.325', 1997.325: return a JulianDate
  • Besselian year: 'B1950','B1958.432': return a BesselDate
  • Julian date: 'JD2437241.81', '2437241.81', 2437241.81: return a JulianDate
  • Modified Julian date: 'MJD37241.31': returns a JulianDate
  • A datetime object: return a JulianDate (assumes input time is UTC)
  • None: returns the current time as a JulianDate

           (type=string, float, integer, datetime, or None)
Returns:
JulianDate or BesselDate
Raises:
ValueError - Raises an exception if the date specification is a string, but begins with a letter that is not 'B','J','JD', or 'MJD' (case insensitive).

To Do:

  • Add math functions! Addition, subtraction.
  • Is there a need to support other date specifications? eg FITS-style dates?

byear2jd(byear)

Parameters:
byear - decimal Besselian year
           (type=float)
Returns:
Julian date
           (type=float)

jd2jyear(jd)

Parameters:
jd - Julian date
           (type=float)
Returns:
decimal Julian year
           (type=float)

jyear2jd(jyear)

Parameters:
jyear - decimal Julian year
           (type=float)
Returns:
Julian date
           (type=float)

utc2jd(utc)

Convert UTC to Julian date.

Conversion translated from TPM modules utcnow.c and gcal2j.c, which notes that the algorithm to convert from a gregorian proleptic calendar date onto a julian day number is taken from The Explanatory Supplement to the Astronomical Almanac (1992), section 12.92, equation 12.92-1, page 604.
Parameters:
utc - UTC (Universal Civil Time)
           (type=datetime object)
Returns:
Julian date (to the nearest second)
           (type=float)

Generated by Epydoc 2.1 on Mon Feb 12 15:01:04 2007 http://epydoc.sf.net