- class craftutils.observation.epoch.Time(astropy.time.core.TimeBase)
Represent and manipulate times and dates for astronomy.
A Time object is initialized with one or more times in the
valargument. The input times invalmust conform to the specifiedformatand must correspond to the specified timescale. The optionalval2time input should be supplied only for numeric input formats (e.g. JD) where very high precision (better than 64-bit precision) is required.The allowed values for
formatcan be listed with:>>> list(Time.FORMATS) ['jd', 'mjd', 'decimalyear', 'unix', 'unix_tai', 'cxcsec', 'gps', 'plot_date', 'stardate', 'datetime', 'ymdhms', 'iso', 'isot', 'yday', 'datetime64', 'fits', 'byear', 'jyear', 'byear_str', 'jyear_str']See also: http://docs.astropy.org/en/stable/time/
Parameters¶
- valsequence, ndarray, number, str, bytes, or ~astropy.time.Time object
Value(s) to initialize the time or times. Bytes are decoded as ascii.
- val2sequence, ndarray, or number; optional
Value(s) to initialize the time or times. Only used for numerical input, to help preserve precision.
- formatstr, optional
Format of input value(s)
- scalestr, optional
Time scale of input value(s), must be one of the following: (‘tai’, ‘tcb’, ‘tcg’, ‘tdb’, ‘tt’, ‘ut1’, ‘utc’)
- precisionint, optional
Digits of precision in string representation of time
- in_subfmtstr, optional
Unix glob to select subformats for parsing input times
- out_subfmtstr, optional
Unix glob to select subformat for outputting times
- location~astropy.coordinates.EarthLocation or tuple, optional
If given as an tuple, it should be able to initialize an an EarthLocation instance, i.e., either contain 3 items with units of length for geocentric coordinates, or contain a longitude, latitude, and an optional height for geodetic coordinates. Can be a single location, or one for each input time. If not given, assumed to be the center of the Earth for time scale transformations to and from the solar-system barycenter.
- copybool, optional
Make a copy of the input values
Public members¶
-
SCALES =
('tai', 'tcb', 'tcg', 'tdb', 'tt', 'ut1', 'utc', 'local') List of time scales
-
FORMATS =
{'byear': <class 'astropy.time.formats.TimeBesselianEpoch'>, 'byear_str': <class 'astropy.time.formats.TimeBesselianEpochString'>, 'cxcsec': <class 'astropy.time.formats.TimeCxcSec'>, 'datetime': <class 'astropy.time.formats.TimeDatetime'>, 'datetime64': <class 'astropy.time.formats.TimeDatetime64'>, 'decimalyear': <class 'astropy.time.formats.TimeDecimalYear'>, 'fits': <class 'astropy.time.formats.TimeFITS'>, 'gps': <class 'astropy.time.formats.TimeGPS'>, 'iso': <class 'astropy.time.formats.TimeISO'>, 'isot': <class 'astropy.time.formats.TimeISOT'>, 'jd': <class 'astropy.time.formats.TimeJD'>, 'jyear': <class 'astropy.time.formats.TimeJulianEpoch'>, 'jyear_str': <class 'astropy.time.formats.TimeJulianEpochString'>, 'mjd': <class 'astropy.time.formats.TimeMJD'>, 'plot_date': <class 'astropy.time.formats.TimePlotDate'>, 'stardate': <class 'astropy.time.formats.TimeStardate'>, 'unix': <class 'astropy.time.formats.TimeUnix'>, 'unix_tai': <class 'astropy.time.formats.TimeUnixTai'>, 'yday': <class 'astropy.time.formats.TimeYearDayTime'>, 'ymdhms': <class 'astropy.time.formats.TimeYMDHMS'>} Dict of time formats
-
static Time(cls, val, val2=
None, format=None, scale=None, ...) Create and return a new object. See help(type) for accurate signature.
-
Time(val, val2=
None, format=None, scale=None, precision=None, ...) Initialize self. See help(type(self)) for accurate signature.
- classmethod now()
Creates a new object corresponding to the instant in time this method is called.
- info
Container for meta information like name, description, format. This is required when the object is used as a mixin column within a table, but can be used as a general way to store meta information.
- classmethod strptime(time_string, format_string, **kwargs)
Parse a string to a Time according to a format specification. See time.strptime documentation for format specification.
- strftime(format_spec)
Convert Time to a string or a numpy.array of strings according to a format specification. See time.strftime documentation for format specification.
-
light_travel_time(skycoord, kind=
'barycentric', location=None, ...) Light travel time correction to the barycentre or heliocentre.
-
earth_rotation_angle(longitude=
None) Calculate local Earth rotation angle.
-
sidereal_time(kind, longitude=
None, model=None) Calculate sidereal time.
-
get_delta_ut1_utc(iers_table=
None, return_status=False) Find UT1 - UTC differences by interpolating in IERS Table.
-
mean(axis=
None, dtype=None, out=None, keepdims=False, *, where=True) Mean along a given axis.
- __array_function__(function, types, args, kwargs)
Wrap numpy functions.
-
to_datetime(timezone=
None) Convert to (potentially timezone-aware) ~datetime.datetime object.
- to_string()
Output a string representation of the Time or TimeDelta object.
- __repr__()
Return repr(self).
- __str__()
Return str(self).
- __hash__()
Return hash(self).
-
to_value(format, subfmt=
'*') Get time values expressed in specified output format.
-
insert(obj, values, axis=
0) Insert values before the given indices in the column and return a new ~astropy.time.Time or ~astropy.time.TimeDelta object.
- __setitem__(item, value)
-
isclose(other, atol=
None) Returns a boolean or boolean array where two Time objects are element-wise equal within a time tolerance.
-
copy(format=
None) Return a fully independent copy the Time object, optionally changing the format.
-
replicate(format=
None, copy=False, cls=None) Return a replica of the Time object, optionally changing the format.
- __copy__()
Overrides the default behavior of the copy.copy function in the python stdlib to behave like Time.copy. Does not make a copy of the JD arrays - only copies by reference.
- __deepcopy__(memo)
Overrides the default behavior of the copy.deepcopy function in the python stdlib to behave like Time.copy. Does make a copy of the JD arrays.
-
argmin(axis=
None, out=None) Return indices of the minimum values along the given axis.
-
argmax(axis=
None, out=None) Return indices of the maximum values along the given axis.
-
argsort(axis=
- 1) Returns the indices that would sort the time array.
-
min(axis=
None, out=None, keepdims=False) Minimum along a given axis.
-
max(axis=
None, out=None, keepdims=False) Maximum along a given axis.
-
ptp(axis=
None, out=None, keepdims=False) Peak to peak (maximum - minimum) along a given axis.
-
sort(axis=
- 1) Return a copy sorted along the specified axis.
- __getattr__(attr)
Get dynamic attributes to output format or do timescale conversion.
- __dir__()
Default dir() implementation.
- __lt__(other)
Return self<value.
- __le__(other)
Return self<=value.
- __eq__(other)
If other is an incompatible object for comparison, return False. Otherwise, return True if the time difference between self and other is zero.
- __ne__(other)
If other is an incompatible object for comparison, return True. Otherwise, return False if the time difference between self and other is zero.
- __gt__(other)
Return self>value.
- __ge__(other)
Return self>=value.
- __bool__()
Any instance should evaluate to True, except when it is empty.
- __getitem__(item)
- reshape(*args, **kwargs)
Returns an instance containing the same data with a new shape.
- ravel(*args, **kwargs)
Return an instance with the array collapsed into one dimension.
- flatten(*args, **kwargs)
Return a copy with the array collapsed into one dimension.
- transpose(*args, **kwargs)
Return an instance with the data transposed.
- swapaxes(*args, **kwargs)
Return an instance with the given axes interchanged.
- diagonal(*args, **kwargs)
Return an instance with the specified diagonals.
- squeeze(*args, **kwargs)
Return an instance with single-dimensional shape entries removed
-
take(indices, axis=
None, out=None, mode='raise') Return a new instance formed from the elements at the given indices.
Properties¶
- property delta_ut1_utc
UT1 - UTC time scale offset
- property delta_tdb_tt
TDB - TT time scale offset
- property writeable
- property format
Get or set time format.
- property scale
Time scale
- property precision
Decimal precision when outputting seconds as floating point (int value between 0 and 9 inclusive).
- property in_subfmt
Unix wildcard pattern to select subformats for parsing string input times.
- property out_subfmt
Unix wildcard pattern to select subformats for outputting times.
- property shape
The shape of the time instances.
- property jd1
First of the two doubles that internally store time value(s) in JD.
- property jd2
Second of the two doubles that internally store time value(s) in JD.
- property value
Time value(s) in current format
- property masked
- property mask
- property cache
Return the cache associated with this instance.
- property ndim
The number of dimensions of the instance and underlying arrays.
- property size
The size of the object, as calculated from its shape.
- property isscalar
- property T
Return an instance with the data transposed.