Time – ephemerista.time

The time.py module.

This module contains the Time class which is Ephemerista’s representation for points in time (epochs).

pydantic model ephemerista.time.ISOTimestamp

A timestamp modelled as an ISO8601 string in a continuous time scale.

Fields:
field time_type: Literal['iso'] = 'iso' (alias 'type')

The type of the timestamp

field value: str [Required]
pydantic model ephemerista.time.JulianDateTimestamp

A timestamp modelled as a Julian Day Number.

Fields:
field time_type: Literal['jd'] = 'jd' (alias 'type')

The type of the timestamp

field value: float [Required]
pydantic model ephemerista.time.SecondsTimestamp

A timestamp modelled as seconds and subsecond from the J2000 epoch.

Fields:
field seconds: int [Required]
field subsecond: float [Required]
field time_type: Literal['seconds'] = 'seconds' (alias 'type')

The type of the timestamp

pydantic model ephemerista.time.Time

The Time model.

This class models an instant in a continuous time scale based on different timestamp formats.

Fields:
field scale: TypeAliasType = 'TAI'
field timestamp: SecondsTimestamp | UTCTimestamp | ISOTimestamp | JulianDateTimestamp [Required]
classmethod from_components(scale, year, month, day, hour=0, minute=0, seconds=0.0)

Instantiate a Time object from its components in the given time scale.

Parameters:
  • year (int) – The year of the timestamp

  • month (int) – The month of the timestamp

  • day (int) – The day of the timestamp

  • hour (int) – The hour of the timestamp (default 0)

  • minute (int) – The minute of the timestamp (default 0)

  • seconds (float) – The seconds of the timestamp (default 0.0)

  • scale (Scale) – The time scale of the timestamp

Return type:

Self

classmethod from_day_of_year(scale, year, day, hour=0, minute=0, seconds=0.0)

Instantiate a Time object from its components in the given time scale.

Parameters:
  • year (int) – The year of the timestamp

  • month (int) – The month of the timestamp

  • day (int) – The day of the timestamp

  • hour (int) – The hour of the timestamp (default 0)

  • minute (int) – The minute of the timestamp (default 0)

  • seconds (float) – The seconds of the timestamp (default 0.0)

  • scale (Scale) – The time scale of the timestamp

Return type:

Self

classmethod from_iso(scale, iso)

Instantiate a Time object from an ISO8601-formatted string in the given time scale.

Parameters:
  • scale (Scale) – The time scale of the timestamp

  • iso (str) – An ISO8601-formatted timestamp

Return type:

Self

classmethod from_j2000(scale, j2000)

Instantiate a Time object from a Julian Date based on the J2000 epoch in the given time scale.

Parameters:
  • scale (Scale) – The time scale of the timestamp

  • jd (float) – The Julian Date of the timestamp

Return type:

Self

classmethod from_julian_date(scale, jd)

Instantiate a Time object from a Julian Date in the given time scale.

Parameters:
  • scale (Scale) – The time scale of the timestamp

  • jd (float) – The Julian Date of the timestamp

Return type:

Self

classmethod from_two_part_julian_date(scale, jd1, jd2)

Instantiate a Time object from a two-part Julian Date in the given time scale.

Parameters:
  • scale (Scale) – The time scale of the timestamp

  • jd1 (float) – The first part of the Julian Date

  • jd2 (float) – The second part of the Julian Date

Return type:

Self

classmethod from_utc(utc)

Instantiate a Time object from an ISO8601-formatted string in the UTC scale.

The returned Time object will be in the TAI scale.

Parameters:
  • scale (Scale) – The time scale of the timestamp

  • iso (str) – An ISO8601-formatted timestamp

Return type:

Self

isclose(other, atol=1e-09, rtol=1e-08)

Check if two Time objects are equal within a given tolerance.

Return type:

bool

to_scale(scale)

Convert the Time object to a different time scale.

Parameters:

scale (Scale) – The time scale to convert the Time object to

Return type:

Time

to_utc()

Convert the Time object to a UTC-formatted string.

Return type:

str

trange(end, step=1)

Generate a range of Time objects between the current Time object and the end Time object.

Parameters:
  • end (Time) – The end of the range

  • step (float) – The step size in seconds

Return type:

list[Time]

property datetime: datetime

Convert to a datetime.datetime object.

property day: int

The day.

Type:

int

property day_of_year: int

The day of the year (1-366).

Type:

int

property hour: int

The hour.

Type:

int

property j2000: float

The Julian Day number with epoch J2000.

Type:

float

property julian_date: float

The Julian Day number.

Type:

float

property minute: int

The minute.

Type:

int

property month: int

The month.

Type:

int

property second: int

The second.

Type:

int

property seconds: float

Second and subsecond as a decimal number.

Type:

float

property two_part_julian_date: tuple[float, float]

The Julian Day number split into two parts.

Type:

tuple[float, float]

property year: int

The year.

Type:

int

pydantic model ephemerista.time.UTCTimestamp

A timestamp modelled as an ISO8601 string in UTC.

Fields:
field time_type: Literal['utc'] = 'utc' (alias 'type')

The type of the timestamp

field value: str [Required]