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
val2 : sequence, str, or number; optional
format : str, optional
scale : str, optional
precision : int, optional
in_subfmt : str, optional
out_subfmt : str, optional
location : EarthLocation or tuple, optional
copy : bool, optional
|
---|
Attributes Summary
FORMATS | |
SCALES | tuple() -> empty tuple |
delta_tdb_tt | |
delta_ut1_utc | Get ERFA DUT arg = UT1 - UTC. |
format | Time format |
in_subfmt | Unix wildcard pattern to select subformats for parsing string input times. |
is_scalar | Deprecated since version 0.3. |
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. |
lat | Deprecated since version 0.4. |
lon | Deprecated since version 0.4. |
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 | Deprecated since version 0.3. |
vals | Deprecated since version 0.3. |
value | Time value(s) in current format |
Methods Summary
copy([format]) | Return a fully independent copy the Time object, optionally changing the format. |
get_delta_ut1_utc([iers_table, return_status]) | Find UT1 - UTC differences by interpolating in IERS Table. |
now() | Creates a new object corresponding to the instant in time this method is called. |
replicate([format, copy]) | Return a replica of the Time object, optionally changing the format. |
sidereal_time(kind[, longitude, model]) | Calculate sidereal time. |
Attributes Documentation
Dict of time formats
List of time scales
TDB - TT time scale offset
UT1 - UTC time scale offset
Time format
Unix wildcard pattern to select subformats for parsing string input times.
Deprecated since version 0.3: The is_scalar attribute is deprecated and may be removed in a future version.
First of the two doubles that internally store time value(s) in JD.
Second of the two doubles that internally store time value(s) in JD.
Deprecated since version 0.4: The lat function is deprecated and may be removed in a future version. Use location.latitude instead.
Deprecated since version 0.4: The lon function is deprecated and may be removed in a future version. Use location.longitude instead.
Unix wildcard pattern to select subformats for outputting times.
Decimal precision when outputting seconds as floating point (int value between 0 and 9 inclusive).
Time scale
Deprecated since version 0.3: The val function is deprecated and may be removed in a future version. Use value instead.
Deprecated since version 0.3: The vals function is deprecated and may be removed in a future version. Use value instead.
Time values in current format as a numpy array.
Time value(s) in current format
Methods Documentation
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
|
---|---|
Returns: | tm: Time object
|
Find UT1 - UTC differences by interpolating in IERS Table.
Parameters: | iers_table : astropy.utils.iers.IERS table, optional
return_status : bool
|
---|---|
Returns: | ut1_utc: float or float array
status: int or int array
|
Notes
In normal usage, UT1-UTC differences are calculated automatically on the first instance ut1 is needed.
Examples
To check in code whether any times are before the IERS table range:
>>> from astropy.utils.iers import TIME_BEFORE_IERS_RANGE
>>> t = Time(['1961-01-01', '2000-01-01'], scale='utc')
>>> delta, status = t.get_delta_ut1_utc(return_status=True)
>>> status == TIME_BEFORE_IERS_RANGE
array([ True, False], dtype=bool)
To use an updated IERS A bulletin to calculate UT1-UTC (see also astropy.utils.iers):
>>> from astropy.utils.iers import IERS_A, IERS_A_URL
>>> from astropy.utils.data import download_file
>>> t = Time(['1974-01-01', '2000-01-01'], scale='utc')
>>> iers_a_file = download_file(IERS_A_URL,
... cache=True)
Downloading ... [Done]
>>> iers_a = IERS_A.open(iers_a_file)
>>> t.delta_ut1_utc = t.get_delta_ut1_utc(iers_a)
The delta_ut1_utc property will be used to calculate t.ut1; raises IndexError if any of the times is out of range.
Creates a new object corresponding to the instant in time this method is called.
Note
“Now” is determined using the utcnow function, so its accuracy and precision is determined by that function. Generally that means it is set by the accuracy of your system clock.
Returns: | nowtime |
---|
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
copy : bool, optional
|
---|---|
Returns: | tm: Time object
|
Calculate sidereal time.
Parameters: | kind : str
longitude : Quantity, str, or None; optional
model : str or None; optional
|
---|---|
Returns: | sidereal time : Longitude
|