sora.observer

The Observer Class

class sora.Observer(**kwargs)[source]

Defines the observer object.

Parameters:
  • name (str, optional) – Name for the observer. Observer is uniquely defined and the name must be different for each observer.

  • code (str, optional) – IAU code used to search for the observer coordinates in the MPC database.

  • site (astropy.coordinates.EarthLocation, optional) – Observer location as an EarthLocation object.

  • lon (str, float, optional) – The Longitude of the site in degrees. Positive to East. Range (0 to 360) or (-180 to +180). User can provide in degrees (float) or sexagesimal (string).

  • lat (str, float, optional) – The Latitude of the site in degrees. Positive North. Range (-90 to +90). User can provide in degrees (float) or sexagesimal (string).

  • height (int, float, optional, default=0.0) – The height of the site in meters above sea level.

  • ephem (str, list, optional, default=’horizons’) – The ephemeris used to locate the observer in space. It can be 'horizons' to use JPL Horizons or a list of SPICE kernels.

Examples

User can provide one of the following to define an observer:

  • If user will use the MPC name for the site:

>>> Observer(code='I11')
  • If user wants to use a different name from the MPC database:

>>> Observer(name='Site name', code='I11')
  • If user wants to use an EarthLocation value:

>>> from astropy.coordinates import EarthLocation
>>> site = EarthLocation(lon=lon, lat=lat, height=height)
>>> Observer(name='Site name', site=site)
  • If user wants to give site coordinates directly:

>>> Observer(name='Site name', lon=lon, lat=lat, height=height)
altaz(time, coord)[source]

Calculates altitude and azimuth at a reference time for a coordinate.

Parameters:
  • time (str, astropy.time.Time) – Reference time to calculate altitude and azimuth. It can be a string in the ISO format (yyyy-mm-dd hh:mm:ss.s) or an astropy Time object.

  • coord (str, astropy.coordinates.SkyCoord) – ICRS coordinate of the target.

Returns:

  • altitude (float) – Object altitude in degrees.

  • azimuth (float) – Object azimuth in degrees.

get_ksi_eta(time, star)[source]

Calculates relative position to star in the orthographic projection.

Parameters:
  • time (str, astropy.time.Time) – Reference time to calculate the position. It can be a string in the format 'yyyy-mm-dd hh:mm:ss.s' or an astropy Time object.

  • star (str, astropy.coordinates.SkyCoord) – The coordinate of the star in the same reference frame as the ephemeris. It can be a string in the format 'hh mm ss.s +dd mm ss.ss' or an astropy SkyCoord object.

Returns:

ksi, eta – On-sky orthographic projection of the observer relative to a star. ksi is in the East-West direction (East positive). eta is in the North-South direction (North positive).

Return type:

float

get_vector(time, origin='barycenter')[source]

Returns the vector from the origin to the observer in the ICRS.

Parameters:
  • time (str, astropy.time.Time) – Reference time to calculate the object position. It can be a string in the ISO format (yyyy-mm-dd hh:mm:ss.s) or an astropy Time object.

  • origin (str, optional, default=’barycenter’) – Origin of the vector. It can be 'barycenter' or 'geocenter'.

Returns:

coord – Astropy SkyCoord object with the vector from origin to observer at the given time.

Return type:

astropy.coordinates.SkyCoord

sidereal_time(time, mode='local')[source]

Calculates the apparent sidereal time at a reference time.

Parameters:
  • time (str, astropy.time.Time) – Reference time to calculate sidereal time. It can be a string in the ISO format (yyyy-mm-dd hh:mm:ss.s) or an astropy Time object.

  • mode (str, optional, default=’local’) – Local or Greenwich time. If mode is 'local', calculates the sidereal time for the coordinates of this object. If mode is 'greenwich', calculates the Greenwich apparent Sidereal Time.

Returns:

sidereal_time – Sidereal time as an Astropy Longitude object.

Return type:

astropy.coordinates.Longitude

to_log(namefile)[source]

Saves the observer log to a file.

Parameters:

namefile (str) – Filename to save the log.

The Spacecraft Class

class sora.Spacecraft(name, spkid, ephem='horizons')[source]

Defines a spacecraft observer object.

Parameters:
  • name (str) – Name for the spacecraft observer. Spacecraft is uniquely defined and the name must be different for each observer.

  • spkid (str) – SPK-ID of the spacecraft.

  • ephem (str, list, optional, default=’horizons’) – The ephemeris used to locate the observer in space. It can be 'horizons' to use JPL Horizons or a list of SPICE kernels.

get_vector(time, origin='barycenter')[source]

Returns the vector from the origin to the spacecraft in the ICRS.

Parameters:
  • time (str, astropy.time.Time) – Reference time to calculate the object position. It can be a string in the ISO format (yyyy-mm-dd hh:mm:ss.s) or an astropy Time object.

  • origin (str, optional, default=’barycenter’) – Origin of the vector. It can be 'barycenter' or 'geocenter'.

Returns:

coord – Astropy SkyCoord object with the vector from origin to spacecraft at the given time.

Return type:

astropy.coordinates.SkyCoord

to_log(namefile)[source]

Saves the spacecraft log to a file.

Parameters:

namefile (str) – Filename to save the log.

Complementary functions

sora.observer.utils.search_code_mpc(code)[source]

Queries the Minor Planet Center (MPC) Observer codes SBN mirror.

Parameters:

code (str, int) – MPC observatory code.

Returns:

  • name (str) – Observatory name from the MPC database.

  • site (astropy.coordinates.EarthLocation) – Observatory site as an Astropy EarthLocation object.

Raises:

ValueError – Raised when the MPC code is not found in the database.

Notes

Query results are cached in memory by MPC code.