Spice#

class stixcore.ephemeris.manager.Spice(meta_kernel_pathes)[source]#

Bases: SpiceKernelLoader

Wrapper to spice functions.

Convert between spacecraft elapsed times (SCET), UTC strings and datetime objects. Obtain spacecraft position and orientation, convert to and from instrument coordinate system

Examples

>>> from stixcore.ephemeris.manager import Spice
>>> import stixcore.data.test
>>> converted = Spice.instance.scet_to_datetime('625237315:44104')
>>> str(converted)
'2019-10-24 13:01:50.672974+00:00'
>>> from datetime import datetime
>>> from stixcore.ephemeris.manager import Spice
>>> import stixcore.data.test
>>> x, y, z = Spice.instance.get_position(date=datetime(2020, 10, 1), frame='SOLO_HEE')
>>> x, y, z
(<Quantity -92089164.00717261 km>,
<Quantity 1.05385302e+08 km>,
<Quantity 44917232.72028707 km>)

Methods Summary

convert_to_inst(coords)

Convert the given coordinates to the instrument frame

datetime_to_scet(adatetime)

Convert datetime to SCET.

get_auxiliary_positional_data(*, date)

get_fits_headers(*, start_time, average_time)

get_orientation(date, frame)

Get the orientation or roll, pith and yaw of STIX (ILS or OPT).

get_position(*, date, frame)

Get the position of SolarOrbiter at the given date in the given coordinate frame.

get_sun_disc_size(*, date)

scet_to_datetime(scet)

Convert SCET to datetime.

scet_to_utc(scet)

Convert SCET to UTC time string in ISO format.

utc_to_scet(utc)

Convert UTC ISO format to SCET time strings.

Methods Documentation

convert_to_inst(coords)[source]#

Convert the given coordinates to the instrument frame

Parameters:
  • coords (astropy.coordinate.SkyCoord) – The coordinates to transform to the instrument frame

  • frame (str, optional) – The instrument coordinate frame (ILS or OPT)

Returns:

tuple – x and y coordinates

datetime_to_scet(adatetime)[source]#

Convert datetime to SCET.

Parameters:

adatetime (datetime.datetime or astropy.time.Time) – Time to convert to SCET

Returns:

str – SCET of datetime encoded as spacecraft clock string

get_auxiliary_positional_data(*, date)[source]#
get_fits_headers(*, start_time, average_time)[source]#
get_orientation(date, frame)[source]#

Get the orientation or roll, pith and yaw of STIX (ILS or OPT).

Parameters:
  • date (datetime.datetime) – Date at which to obtain orientation information

  • frame (str) – Name of the coordinate frame

Returns:

tuple – Roll, pitch and yaw of the spacecraft

get_position(*, date, frame)[source]#

Get the position of SolarOrbiter at the given date in the given coordinate frame.

Parameters:
  • date (datetime.datetime) – Date at which to obtain position

  • frame (str) – Name of the coordinate frame (‘IAU_SUN’, ‘SOLO_HEE’)

Returns:

tuple – The x, y, and z components of the spacecraft position

get_sun_disc_size(*, date)[source]#
scet_to_datetime(scet)[source]#

Convert SCET to datetime.

Parameters:

scet (str, int, float) – SCET time as number or spacecraft clock string e.g. 1.0 or '625237315:44104'

Returns:

datetime.datetime – Datetime of SCET

scet_to_utc(scet)[source]#

Convert SCET to UTC time string in ISO format.

Parameters:

scet (str, int, float) – SCET time as a number or spacecraft clock string e.g. 1.0 or 625237315:44104

Returns:

str – UTC time string in ISO format

utc_to_scet(utc)[source]#

Convert UTC ISO format to SCET time strings.

Parameters:

utc (str) – UTC time string in ISO format e.g. ‘2019-10-24T13:06:46.682758’

Returns:

str – SCET time string