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.
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
(type=string, float, or integer)
- 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:
- Write tests
- Add math functions! Addition, subtraction.
- Is there a need to support other date specifications? eg FITS-style
dates?
|