astro py:docs

- Index
- Modules

### Navigation

- next »
- « previous |
- Astropy v1.1.1 »
- Time and Dates (`astropy.time`) »
- TimeDelta

# TimeDelta

class `astropy.time.``TimeDelta`(val, val2=None, format=None, scale=None, copy=False)

  Bases: `astropy.time.Time`

  Represent the time difference between two times.

  A TimeDelta object is initialized with one or more times in the `val` argument. The input times in `val` must conform to the specified `format`. 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.

  The allowed values for `format` can be listed with:

      >>> list(TimeDelta.FORMATS)
      ['sec', 'jd']

  Note that for time differences, the scale can be among three groups: geocentric (‘tai’, ‘tt’, ‘tcg’), barycentric (‘tcb’, ‘tdb’), and rotational (‘ut1’). Within each of these, the scales for time differences are the same. Conversion between geocentric and barycentric is possible, as there is only a scale factor change, but one cannot convert to or from ‘ut1’, as this requires knowledge of the actual times, not just their difference. For a similar reason, ‘utc’ is not a valid scale for a time difference: a UTC day is not always 86400 seconds.

  Parameters:

  val : numpy ndarray, list, str, number, or `TimeDelta` object

  > Data to initialize table.

  val2 : numpy ndarray, list, str, or number; optional

  > Data to initialize table.

  format : str, optional

  > Format of input value(s)

  scale : str, optional

  > Time scale of input value(s), must be one of the following values: (‘tdb’, ‘tt’, ‘ut1’, ‘tcg’, ‘tcb’, ‘tai’). If not given (or `None`), the scale is arbitrary; when added or subtracted from a `Time` instance, it will be used without conversion.

  copy : bool, optional

  > Make a copy of the input values

  Attributes Summary

  `FORMATS` | Dict of time delta formats.
  `SCALES` | List of time delta scales.

  Methods Summary

  `replicate`(*args, **kwargs) |
  `to`(*args, **kwargs) |

  Attributes Documentation

  `FORMATS` = OrderedDict([(u'sec', <class 'astropy.time.formats.TimeDeltaSec'>), (u'jd', <class 'astropy.time.formats.TimeDeltaJD'>)])

    Dict of time delta formats.

  `SCALES` = [u'tdb', u'tt', u'ut1', u'tcg', u'tcb', u'tai']

    List of time delta scales.

  Methods Documentation

  `replicate`(*args, **kwargs)
  `to`(*args, **kwargs)