Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(3)  |  Call(2)  |  Derive(0)  |  Import(1)
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(more...)

        def 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.

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

    Parameters
    ----------
    datespec : string, float, integer, :py:class:`datetime.datetime`, or `None`

    Returns
    -------
    value : `~astrolib.coords.astrodate.JulianDate` or `~astrolib.coords.astrodate.BesselDate`
        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'
                * Return a JulianDate
            * :py:class:`datetime.datetime` object
                * Assume input time is UTC
                * Return a JulianDate
            * `None`
                * Return the current time as a JulianDate

    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).

    """
    if datespec is None:
        return JulianDate(datetime.datetime.utcnow())
    
    try:
        dstring=datespec.upper()
        if dstring.startswith('B'):
            #it's a Besselian date
            return BesselDate(datespec)
        elif ( dstring.startswith('JD') or
               dstring.startswith('MJD') or
               dstring.startswith('J') ):
            #it's Julian, one way or another
            return JulianDate(datespec)
        elif dstring[0].isalpha():
            raise ValueError, "Invalid system specification: must be B, J, JD, or MJD"
        else: #it must be a numeric string: assume Julian
            return JulianDate(datespec)
        
    except AttributeError:
        #if no letter is specified, assume julian
        return JulianDate(datespec)
        


src/a/s/astrolib.coords-0.39.5/lib/astrolib/coords/pytpm_wrapper.py   astrolib.coords(Download)
    """
    if timetag == None:
        timetag=astrodate.AstroDate()
    try:
        r,d=pytpm.blackbox(x,y,instate,outstate,epoch,equinox,timetag.jd)
    except AttributeError: #support forgetful users
        astrotag=astrodate.AstroDate(timetag)

src/a/s/astrolib.coords-0.39.5/lib/astrolib/coords/__init__.py   astrolib.coords(Download)
"""Package: AstroLib Coords"""
from position import Position
from angsep import AngSep
from astrodate import AstroDate