Time

class astropy.time.core.Time(val, val2=None, format=None, scale=None, precision=None, in_subfmt=None, out_subfmt=None, lat=0.0, lon=0.0, copy=False)[source] [edit on github]

Bases: object

Represent and manipulate times and dates for astronomy.

A Time object is initialized with one or more times in the val argument. The input times in val must conform to the specified format and must correspond to the specified time scale. The optional val2 time input should be supplied only for numeric input formats (e.g. JD) where very high precision (better than 64-bit precision) is required.

Parameters :

val : sequence, str, number, or Time object

Value(s) to initialize the time or times.

val2 : sequence, str, or number; optional

Value(s) to initialize the time or times

format : str, optional

Format of input value(s)

scale : str, optional

Time scale of input value(s)

opt : dict, optional

options

lat : float, optional

Earth latitude of observer (decimal degrees)

lon : float, optional

Earth longitude of observer (decimal degrees)

copy : bool, optional

Make a copy of the input values

Attributes Summary

FORMATS
SCALES tuple() -> empty tuple
delta_tdb_tt
delta_ut1_utc Get SOFA DUT arg = UT1 - UTC.
format Time format
in_subfmt Unix wildcard pattern to select subformats for parsing string input
jd1 First of the two doubles that internally store time value(s) in JD
jd2 Second of the two doubles that internally store time value(s) in JD
out_subfmt Unix wildcard pattern to select subformats for outputting times
precision Decimal precision when outputting seconds as floating point (int value between 0 and 9 inclusive).
scale Time scale
val Time value(s) in current format
vals Time values in current format as a numpy array

Methods Summary

copy([format]) Return a fully independent copy the Time object, optionally changing the format.
replicate([format, copy]) Return a replica of the Time object, optionally changing the format.

Attributes Documentation

FORMATS = {'mjd': <class 'astropy.time.core.TimeMJD'>, 'cxcsec': <class 'astropy.time.core.TimeCxcSec'>, 'jyear': <class 'astropy.time.core.TimeJulianEpoch'>, 'byear': <class 'astropy.time.core.TimeBesselianEpoch'>, 'unix': <class 'astropy.time.core.TimeUnix'>, 'jd': <class 'astropy.time.core.TimeJD'>, 'byear_str': <class 'astropy.time.core.TimeBesselianEpochString'>, 'iso': <class 'astropy.time.core.TimeISO'>, 'isot': <class 'astropy.time.core.TimeISOT'>, 'jyear_str': <class 'astropy.time.core.TimeJulianEpochString'>, 'yday': <class 'astropy.time.core.TimeYearDayTime'>}

Dict of time formats

SCALES = ('tai', 'tcb', 'tcg', 'tdb', 'tt', 'ut1', 'utc')

List of time scales

delta_tdb_tt

TDB - TT time scale offset

delta_ut1_utc

UT1 - UTC time scale offset

format[source]

Time format

in_subfmt[source]

Unix wildcard pattern to select subformats for parsing string input times

jd1[source]

First of the two doubles that internally store time value(s) in JD

jd2[source]

Second of the two doubles that internally store time value(s) in JD

out_subfmt[source]

Unix wildcard pattern to select subformats for outputting times

precision[source]

Decimal precision when outputting seconds as floating point (int value between 0 and 9 inclusive).

scale[source]

Time scale

val[source]

Time value(s) in current format

vals[source]

Time values in current format as a numpy array

Methods Documentation

copy(format=None)[source] [edit on github]

Return a fully independent copy the Time object, optionally changing the format.

If format is supplied then the time format of the returned Time object will be set accordingly, otherwise it will be unchanged from the original.

In this method a full copy of the internal time arrays will be made. The internal time arrays are normally not changeable by the user so in most cases the replicate() method should be used.

Parameters :

format : str, optional

Time format of the copy.

Returns :

tm: Time object :

Copy of this object

replicate(format=None, copy=False)[source] [edit on github]

Return a replica of the Time object, optionally changing the format.

If format is supplied then the time format of the returned Time object will be set accordingly, otherwise it will be unchanged from the original.

If copy is set to True then a full copy of the internal time arrays will be made. By default the replica will use a reference to the original arrays when possible to save memory. The internal time arrays are normally not changeable by the user so in most cases it should not be necessary to set copy to True.

The convenience method copy() is available in which copy is True by default.

Parameters :

format : str, optional

Time format of the replica.

copy : bool, optional

Return a true copy instead of using references where possible.

Returns :

tm: Time object :

Replica of this object

Page Contents