adam_core.observers package

class adam_core.observers.Observers(table: Table, **kwargs: int | float | str)[source]

Bases: Table

code

A column for storing large strings (over 231 bytes long). Large string data is stored in variable-length chunks.

coordinates

A column which represents an embedded quivr table.

Parameters:
  • table_type – The type of the table to embed.

  • nullable – Whether the column can contain null values.

  • metadata – A dictionary of metadata to attach to the column.

classmethod from_code(code: str | OriginCodes, times: Timestamp) Self[source]

Instantiate an Observers table with a single code and multiple times. Times do not need to be unique. The observer state will be calculated for each time and correctly matched to the input times and replicated for duplicate times.

To load multiple codes, use from_code and then concatenate the tables.

Note that NAIF origin codes may not be supported by ~adam_core.propagator.Propagator classes such as PYOORB.

Parameters:
  • code (Union[str, OriginCodes]) – MPC observatory code or NAIF origin code for which to find the states.

  • times (Timetamp (N)) – Epochs for which to find the observatory locations.

Returns:

observers – The observer and its state at each time.

Return type:

~adam_core.observers.observers.Observers (N)

Examples

>>> import numpy as np
>>> from adam_core.time import Timestamp
>>> from adam_core.observers import Observers
>>> times = Timestamp.from_mjd(np.arange(59000, 59000 + 100), scale="tdb")
>>> observers = Observers.from_code("X05", times)
classmethod from_codes(codes: list | ndarray[tuple[Any, ...], dtype[str_]] | Array, times: Timestamp) Self[source]

Create an Observers table from a list of codes and times. The codes and times do not need to be unique and are assumed to belong to each other in an element-wise fashion. The observer state will be calculated correctly matched to the input times and replicated for duplicate times.

Parameters:
  • codes (Union[list, npt.NDArray[np.str], pa.Array] (N)) – MPC observatory codes for which to find the states.

  • times (Timestamp (N)) – Epochs for which to find the observatory locations.

Returns:

observers – The observer and its state at each time.

Return type:

~adam_core.observers.observers.Observers (N)

iterate_codes()[source]

Iterate over the codes in the Observers table.

Yields:
  • code (str) – The code for observer.

  • observers (~adam_core.observers.observers.Observers) – The Observers table for this observer.

schema: ClassVar[pa.Schema] = code: large_string not null coordinates: struct<x: double, y: double, z: double, vx: double, vy: double, vz: double, time: struct<days: int64 (... 106 chars omitted)   child 0, x: double   child 1, y: double   child 2, z: double   child 3, vx: double   child 4, vy: double   child 5, vz: double   child 6, time: struct<days: int64, nanos: int64>       child 0, days: int64       child 1, nanos: int64   child 7, covariance: struct<values: large_list<item: double>>       child 0, values: large_list<item: double>           child 0, item: double   child 8, origin: struct<code: large_string>       child 0, code: large_string
adam_core.observers.get_observer_state(code: str | OriginCodes, times: Timestamp, frame: Literal['ecliptic', 'equatorial', 'itrf93'] = 'ecliptic', origin: OriginCodes = OriginCodes.SUN) CartesianCoordinates[source]

Find state vectors for an observer at a given time in the given frame and measured from the given origin.

For NAIF Origin Codes this function uses the SPICE kernels to find the state vectors. See ~adam_core.utils.spice.get_perturber_state for more information.

For MPC observatory codes this function currently only supports ground-based observers on Earth. In this case, the Earth body-fixed frame used for calculations is the standard ITRF93, which takes into account:

  • precession (IAU-1976)

  • nutation (IAU-1980 with IERS corrections)

  • polar motion

This frame is retrieved through SPICE.

Parameters:
  • code (Union[str, OriginCodes]) – MPC observatory code as string, custom SPICE kernel NAIF code as string, or NAIF origin code for which to find the states.

  • times (Timestamp (N)) – Epochs for which to find the observatory locations.

  • frame ({'equatorial', 'ecliptic'}) – Return observer state in the equatorial or ecliptic J2000 frames.

  • origin (OriginCodes) – The NAIF ID of the origin.

Returns:

observer_states – The state vectors of the observer in the desired frame and measured from the desired origin.

Return type:

~adam_core.coordinates.cartesian.CartesianCoordinates

Submodules