4. SpiceManager#
- class SpiceManager#
Bases:
objectWraps many SpiceyPy [1] functions NEED MORE
References
[1]Annex et al., (2020). SpiceyPy: a Pythonic Wrapper for the SPICE Toolkit. Journal of Open Source Software, 5(46), 2050, https://doi.org/10.21105/joss.02050
[2]Acton, C.H.; “Ancillary Data Services of NASA’s Navigation and Ancillary Information Facility;” Planetary and Space Science, Vol. 44, No. 1, pp. 65-70, 1996. DOI 10.1016/0032-0633(95)00107-7
[3]Charles Acton, Nathaniel Bachman, Boris Semenov, Edward Wright; A look toward the future in the handling of space science mission geometry; Planetary and Space Science (2017); 10.1016/j.pss.2017.02.013
Methods
YDS2et(year, doy, sec)Method to convert a year, DOY, seconds into ephemeris times.
check_kernel_status_in_pool(kernel_filename)Check if a Spice kernel is loaded in the kernel pool.
ckbrief(ck_file[, tol, disp])Extracts ID and interval information from a given C-kernel.
Clears all loaded SPICE kernels.
def_new_body(name, spiceId)Define a new celestial body in the SPICE kernel.
et2YDS(et_list)Method to convert a list of ephemeris times into (year, DOY, seconds) format.
frame_id_to_frame_name(frame_id)This method generetes the frame id given its name
frame_name_to_frame_id(frame_name)This method generetes the frame name given its frame id
generate_metakernel(directory[, output_file])List all files in a directory and write them into a SPICE metakernel.
get_STMs(trgt_bdy, epoch_time, ...)Retrieve (or interpolate) the State Transition Matrix (STM) for a given epoch.
get_attitude(trgt_bdy, epoch_time, ...)Get the attitude of a target body at a specified epoch time. Parameters: ----------- trgt_bdy : str or Body The target body for which the attitude is to be determined. Can be an instance of Body or a string representing the body's name. epoch_time : float or EpochArray The epoch time at which the attitude is to be determined. Can be an instance of EpochArray or a float representing the time. reference_frame : str or Frame The reference frame in which the attitude is to be determined. Can be a string or an instance of Frame. tol : int The tolerance value for the attitude determination. Returns: -------- tuple A tuple containing: - ArrayWUnits: The state vector of the target body. - ArrayWUnits: The angular velocity of the target body. - ArrayWUnits: The angular acceleration of the target body.
get_elevation_angle(target, et[, station, ...])Compute the elevation angle of a target body as seen from a DSN ground station using SPICE.
get_frame_w_spice_id(id_number)get frame_code and name associated with the frame_id number
get_id_from_string(name_string)This method generetes the body spice id given its name
get_lighttime(trgt_bdy, epoch_time, ...[, ...])Calculate the light time between a target and an origin at a given epoch time.
get_name_from_id(spice_id)This method generetes the body name given its spice id
Determine the visibility windows between an observer and a target within a specified time range.
get_parameters(trgt_bdy, epoch_time, ...)Retrieve parameters from JSON files based on the given target, epoch_time, reference_frame, and origin.
get_pos(trgt_bdy, epoch_time, ...[, ab_correct])Get the position of a target body relative to an observer body at a given epoch.
get_pos_core(trgt_bdy, epoch_time, ...)Get the position of a target body relative to an origin body at a specified epoch time.
get_propagator_settings(trgt_bdy, ...)Retrieves the propagator settings for a given target, reference frame, and origin from JSON files.
get_sep_angle(target, et[, station, abcorr])Compute the Sun–Earth–Probe (SEP) angle of a target body as seen from a DSN ground station.
get_state(trgt_bdy, epoch_time, ...[, ...])Retrieve the state (position and velocity) of a target body relative to an origin body at a specified epoch time.
get_state_antenna(trgt_bdy, epoch_time, ...)Retrieve the state (position and velocity) of the antenna on a target spacecraft relative to an origin body at a specified epoch time.
get_state_precise(trgt_bdy, epoch_time_high, ...)Retrieve the state (position and velocity) of a target body relative to an origin body at a specified epoch time.
get_vel(trgt_bdy, epoch_time, ...[, ab_correct])Calculates the velocity of a target body relative to an observer body at a specified epoch time and reference frame.
get_vel_core(trgt_bdy, epoch_time, ...[, ...])Get the velocity of a target body relative to an origin at a specified epoch time.
get_xfrm(frame_from, frame_to, epoch)Computes the direction cosine matrix (DCM) to transform coordinates from one reference frame to another at a given epoch.
get_xfrm_core(frame_from, frame_to, epoch)This method returns the DCM rotation matrix between frame_from and frame_to at a given epoch
increase_kernel_priority(kernel_filename)This function increases the priority of kernel to the top of the pool for kernels of the same type by unloading then loading it.
list_all_ck_ids(ck_file)Generates a list of all SPICE ID's in a given C-kernel.
list_all_frames([max_id])This method generate a list of all frames with +- the value between max_id
load_kernel(kernel_filenames)Load SPICE kernels into the SPICE system.
load_kernel_from_mkfile(furnshKernelFilename)Load a SPICE kernel from a given MK file.
matrix_times_vector(matrix, vector)Multiply a 3x3 double precision matrix with a 3-dimensional double precision vector.
name_to_ID(name)Converts a given name to its corresponding ID in the kernel pool.
Prints the list of kernels loaded.
sce2c(sc, et)Convert ET to SCLK.
str2et(s)unload_kernel_from_pool(kernel_filename)Unload a kernel from the pool.
write_ck_type3(ck_path, inst_id, ref_frame, ...)Write a CK type 3 segment (discrete pointing) to a new CK file.
write_spk_metadata_json(SPK_name, body, ...)Write ONLY the JSON sidecars associated with an SPK (parameters/STMs/settings/mass profile).
write_spk_segment_type9(SPK_name, ...[, ...])Write a segment of type 9 to an SPK file.
cal2et
et2cal
et2jd
et2sclk
et2utc
get_intervals
get_pos_callback
get_vel_callback
get_xfrm_callback
jd2et
sclk2et
test
utc2et
utc2tdb
- classmethod ckbrief(ck_file: str, tol: int = 0, disp: bool = False) list[dict]#
Extracts ID and interval information from a given C-kernel.
- Parameters:
- Returns:
brief – A list containing information about each frame in the C-kernel. Each element of the list is a dict containing the following keys:
'ID': the NAIF integer code of the frame.'SCLK_INTERVAL': the interval or intervals for which the frame is defined in the C-kernel, represented as encoded SCLK ticks by floats.'TDB_INTERVAL': the interval or intervals for which the frame is defined in the C-kernel, represented as ephemeris time (TDB) EpochArray objects.
- Return type:
- classmethod clear_kernels()#
Clears all loaded SPICE kernels.
This method calls the spice.kclear() function to clear all loaded SPICE kernels from memory.
- Returns:
None
- classmethod get_STMs(trgt_bdy: str | Body, epoch_time: float, reference_frame: str | Frame, obsvr_bdy: str | Body) ndarray#
Retrieve (or interpolate) the State Transition Matrix (STM) for a given epoch. If epoch_time exactly matches a stored epoch, returns that STM directly. Otherwise, linearly interpolates between the two nearest STMs.
- classmethod get_attitude(trgt_bdy: str | Body, epoch_time: float | EpochArray, reference_frame: str | Frame, tol: int)#
Get the attitude of a target body at a specified epoch time. Parameters: ———– trgt_bdy : str or Body
The target body for which the attitude is to be determined. Can be an instance of Body or a string representing the body’s name.
- epoch_timefloat or EpochArray
The epoch time at which the attitude is to be determined. Can be an instance of EpochArray or a float representing the time.
- reference_framestr or Frame
The reference frame in which the attitude is to be determined. Can be a string or an instance of Frame.
- tolint
The tolerance value for the attitude determination.
4. Returns:#
- tuple
A tuple containing: - ArrayWUnits: The state vector of the target body. - ArrayWUnits: The angular velocity of the target body. - ArrayWUnits: The angular acceleration of the target body.
- classmethod get_elevation_angle(target: str, et, station: str = 'DSS-14', abcorr: str = 'LT+S') float#
Compute the elevation angle of a target body as seen from a DSN ground station using SPICE.
This method uses the SPICE toolkit to calculate the elevation angle of a target relative to a Deep Space Network (DSN) ground station. The calculation is performed in the station’s local topocentric frame (e.g.,
DSS-14_TOPO), where the convention is X = East, Y = North, and Z = Up.- Parameters:
target (
str) – The name or NAIF ID of the target body. Examples:"MRO"or"-74".et (
float) – Ephemeris time at which to compute the elevation angle.station (
str) – The DSN ground station name or NAIF ID used as the observer. Must match the identifiers defined in the loaded SPICE kernels. Defaults to"DSS-14".abcorr (
str, optional) – Aberration correction to apply when computing the geometry. Examples: -"NONE": No corrections. -"LT": Light-time correction only. -"LT+S": Light-time + stellar aberration correction (default).
- Returns:
elevation_angle – The elevation angle of the target relative to the local horizon at the specified DSN station, expressed in radians (or the units defined by
cls._spc_angle_units). Positive values indicate the target is above the horizon, while negative values indicate it is below.- Return type:
Notes
The station’s topocentric frame (e.g.,
DSS-14_TOPO) must be defined in the
loaded SPICE kernels. - The axis convention for topocentric frames is assumed to be: X = East, Y = North, Z = Up. - To obtain azimuth as well, use
atan2(East, North)in the same frame. - Requires SPICE kernels for:DSN station locations and frames.
Target body ephemerides.
Leapseconds (LSK).
- classmethod get_lighttime(trgt_bdy: str | Body, epoch_time: float | EpochArray, reference_frame: str | Frame, obsvr_bdy: str | Body, aberration_correction: str = 'None')#
Calculate the light time between a target and an origin at a given epoch time.
- Parameters:
trgt_bdy (
strorBody) – The target body or its name as a string.epoch_time (
EpochArrayorfloat) – The epoch time at which to calculate the light time.reference_frame (
strorFrame) – The reference frame or its name as a string.origin (
strorBody) – The origin body or its name as a string.aberration_correction (
str, optional) – The aberration correction to apply. Defaults toNone.
- Returns:
light_time – The light time as an array with units.
- Return type:
- classmethod get_parameters(trgt_bdy: str | Body, epoch_time: float | EpochArray, reference_frame: str | Frame, obsvr_bdy: str | Body)#
Retrieve parameters from JSON files based on the given target, epoch_time, reference_frame, and origin.
- classmethod get_pos(trgt_bdy: str | Body, epoch_time: float | EpochArray, reference_frame: str | Frame, obsvr_bdy: str | Body, ab_correct: str = 'None')#
Get the position of a target body relative to an observer body at a given epoch. This method computes the position vector of a target body as observed from an observer body at a specified epoch time, in a given reference frame.
- Parameters:
trgt_bdy (
str | Body) – The target body whose position is to be computed. Can be specified as a string (body name) or a Body object.epoch_time (
float | EpochArray) – The epoch time(s) at which to compute the position. Can be a single float value or an EpochArray for multiple time points.reference_frame (
str | Frame) – The reference frame in which to express the position vector. Can be specified as a string (frame name) or a Frame object.obsvr_bdy (
str | Body) – The observer body from which the target position is measured. Can be specified as a string (body name) or a Body object.ab_correct (
str, optional) – Aberration correction specification. Defaults to “None”. Common values include “NONE”, “LT”, “LT+S”, “CN”, “CN+S”, “XLT”, “XLT+S”, “XCN”, “XCN+S”.
- Returns:
The position vector(s) of the target body relative to the observer body. The exact return type depends on the implementation of get_pos_core.
Note
This method is a wrapper around get_pos_core and delegates the actual computation to that core method.
- classmethod get_pos_callback(trgt_bdy, reference_frame, obsvr_bdy, ab_correct)#
- classmethod get_pos_core(trgt_bdy, epoch_time, reference_frame, obsvr_bdy, ab_correct)#
Get the position of a target body relative to an origin body at a specified epoch time.
- Parameters:
trgt_bdy (
strorBody) – The target body for which the position is to be determined. Can be a string or a Body object.epoch_time (
floatorEpochArray) – The epoch time at which the position is to be determined. Can be a float or an EpochArray object.reference_frame (
strorFrame) – The reference frame in which the position is to be determined. Can be a string or a Frame object.obsvr_bdy (
strorBody) – The observing body from which the position is to be measured. Can be a string or a Body object.ab_correct (
str, optional) – Aberration correction to be applied. Defaults toNone.
- Returns:
pos – The position of the target body relative to the origin body, expressed in units of kilometers.
- Return type:
- classmethod get_propagator_settings(trgt_bdy: str | Body, reference_frame: str | Frame, obsvr_bdy: str | Body)#
Retrieves the propagator settings for a given target, reference frame, and origin from JSON files. :param trgt_bdy: The target body or its name. :type trgt_bdy:
strorBody:param reference_frame: The reference frame or its name. :type reference_frame:strorFrame:param obsvr_bdy: The origin body or its name. :type obsvr_bdy:strorBody- Returns:
The propagator settings data from the corresponding JSON file.
- Return type:
- Raises:
ValueError – If the settings JSON file could not be located.
- classmethod get_sep_angle(target: str, et, station: str = 'DSS-14', abcorr: str = 'LT+S') float#
Compute the Sun–Earth–Probe (SEP) angle of a target body as seen from a DSN ground station.
The SEP angle is defined as the angle at the observer (DSN station) between the vector pointing to the Sun and the vector pointing to the spacecraft (target). This is the standard “solar elongation angle” used in mission operations to assess geometry for radiometric tracking and solar corona effects.
- Parameters:
target (
str) – The name or NAIF ID of the target body. Examples:"OSIRIS-REX"or"-64".et (
float) – Ephemeris Time (seconds past J2000 TDB) at which to compute the SEP angle.station (
str, optional) – DSN ground station name or NAIF ID used as the observer. Must match the identifiers defined in the loaded SPICE kernels. Default is"DSS-14".abcorr (
str, optional) – Aberration correction to apply when computing the geometry. Examples: -"NONE": No corrections. -"LT": Light-time correction only. -"LT+S": Light-time + stellar aberration correction (default).
- Returns:
sep_angle – The SEP angle in radians (or converted via
cls._spc_angle_units). Larger angles correspond to better tracking geometry (target farther from the Sun as seen from Earth).- Return type:
Notes
- Requires SPICE kernels for:
DSN station locations (SPK + topocentric frame definitions).
Target body ephemerides (SPK).
Solar system ephemerides (SPK).
Leapseconds (LSK).
This angle is distinct from elevation angle (target above station horizon). SEP measures angular separation from the Sun, not from the horizon.
Often used to set operational limits during solar conjunctions.
Examples
et = scb.SpiceManager.utc2et("2017-09-22T16:52:00") # OSIRIS-REx EGA sep = MyClass.get_sep_angle("OSIRIS-REX", et, station="DSS-14") print(sep.to("deg"))
- classmethod get_state(trgt_bdy: str | Body, epoch_time: float | EpochArray, reference_frame: str | Frame, obsvr_bdy: str | Body, aberration_correction: str = 'None')#
Retrieve the state (position and velocity) of a target body relative to an origin body at a specified epoch time.
- Parameters:
trgt_bdy (
strorBody) – The target body for which the state is to be retrieved. Can be a string name or a Body object.epoch_time (
floatorEpochArray) – The epoch time at which the state is to be retrieved. Can be an EpochArray object or a float representing the time.reference_frame (
strorFrame) – The reference frame in which the state is to be retrieved. Can be a Frame object or a string name.obsvr_bdy (
strorBody) – The observing body relative to which the state is to be retrieved. Can be a string name or a Body object.aberration_correction (
str, optional) – The aberration correction to be applied. Defaults toNone.
- Returns:
state – An array containing the state (position and velocity) of the target body with associated units.
- Return type:
- classmethod get_state_antenna(trgt_bdy: Body, epoch_time: float, reference_frame: Frame, obsvr_bdy: Body, antenna_offset: ndarray, offset_reference_frame: Frame, ab_correct: str = 'None')#
Retrieve the state (position and velocity) of the antenna on a target spacecraft relative to an origin body at a specified epoch time.
- Parameters:
trgt_bdy (
str) – The target body for which the position is to be determined. Can be a string or a Body object.epoch_time (
float) – The epoch time at which the position is to be determined. Can be a float or an EpochArray object.reference_frame (
Frame) – The reference frame in which the position is to be determined. Can be a string or a Frame object.obsvr_bdy (
str) – The observing body from which the position is to be measured. Can be a string or a Body object.antenna_offset (
np.ndarray) – The antenna-CoM offset vector, expressed in the “spacecraft_body_frame” reference frame.offset_reference_frame (
Frame) – The spaceraft body-fixed reference frame. The origin of this frame is used to account for the antenna offset vector.ab_correct (
str, optional) – Aberration correction to be applied. Defaults toNone.
- Returns:
state – The State of the antenna relative to the origin body, expressed in units of km and km/sec
- Return type:
np.ndarra()
- classmethod get_state_precise(trgt_bdy: str | Body, epoch_time_high: float | EpochArray, reference_frame: str | Frame, obsvr_bdy: str | Body, aberration_correction: str = 'None', epoch_time_low: float | EpochArray = None)#
Retrieve the state (position and velocity) of a target body relative to an origin body at a specified epoch time.
- Parameters:
trgt_bdy (
strorBody) – The target body for which the state is to be retrieved. Can be a string name or a Body object.epoch_time_high (
floatorEpochArray) – The epoch time at which the state is to be retrieved. Can be an EpochArray object or a float representing the time. This is the high componentreference_frame (
strorFrame) – The reference frame in which the state is to be retrieved. Can be a Frame object or a string name.obsvr_bdy (
strorBody) – The observing body relative to which the state is to be retrieved. Can be a string name or a Body object.aberration_correction (
str, optional) – The aberration correction to be applied. Defaults toNone.epoch_time_low (
floatorEpochArray) – The epoch time at which the state is to be retrieved. Can be an EpochArray object or a float representing the time. This is the low component
- Returns:
state – An array containing the state (position and velocity) of the target body with associated units.
- Return type:
- classmethod get_vel(trgt_bdy: str | Body, epoch_time: float | EpochArray, reference_frame: str | Frame, obsvr_bdy: str | Body, ab_correct: str = 'None')#
Calculates the velocity of a target body relative to an observer body at a specified epoch time and reference frame.
- Parameters:
trgt_bdy (
str | Body) – The target body for which the velocity is to be computed. Can be a string identifier or a Body object.epoch_time (
float | EpochArray) – The epoch time(s) at which to compute the velocity. Can be a single float or an array of epochs.reference_frame (
str | Frame) – The reference frame in which the velocity is expressed. Can be a string or a Frame object.obsvr_bdy (
str | Body) – The observer body relative to which the velocity is computed. Can be a string identifier or a Body object.ab_correct (
str, optional) – Aberration correction flag. Defaults to “None”.
- Returns:
The computed velocity of the target body relative to the observer in the specified reference frame.
- Return type:
Velocity or array-like
- classmethod get_vel_callback(trgt_bdy, reference_frame, obsvr_bdy, ab_correct)#
- classmethod get_vel_core(trgt_bdy: str | Body, epoch_time: float | EpochArray, reference_frame: str | Frame, obsvr_bdy: str | Body, ab_correct: str = 'None')#
Get the velocity of a target body relative to an origin at a specified epoch time.
- Parameters:
trgt_bdy (
strorBody) – The target body for which the velocity is to be determined. Can be a string or a Body object.epoch_time (
floatorEpochArray) – The epoch time at which the velocity is to be determined. Can be an EpochArray or a float.reference_frame (
strorFrame) – The reference frame in which the velocity is to be determined. Can be a string or a Frame object.obsvr_bdy (
strorBody) – The origin relative to which the velocity is to be determined. Can be a string or a Body object.ab_correct (
str, optional) – Aberration correction to be applied. Defaults toNone.
- Returns:
vel – The velocity of the target body as an ArrayWUnits object with the appropriate units.
- Return type:
- classmethod get_xfrm(frame_from: str, frame_to: str, epoch)#
Computes the direction cosine matrix (DCM) to transform coordinates from one reference frame to another at a given epoch.
- Parameters:
- Returns:
The direction cosine matrix (DCM) representing the transformation from frame_from to frame_to at the specified epoch.
- Return type:
- classmethod get_xfrm_callback(frame_from, frame_to)#
- classmethod print_kernels()#
Prints the list of kernels loaded.
This method retrieves the list of kernels loaded using the SPICE library and prints each kernel’s source and description.
- Returns:
None
- classmethod write_ck_type3(ck_path: str, inst_id: int, ref_frame: str, sclk_id: int, et_list: list[float] | ndarray, quats: ndarray | None = None, avvs: ndarray | None = None, dcm_cb=None, segid: str = 'SCB GENERATED CK TYPE 3', make_intervals: str = 'per_sample', load_after: bool = True)#
Write a CK type 3 segment (discrete pointing) to a new CK file.
- Parameters:
ck_path (
str) – Output CK file path (.bc or .ck).inst_id (
int) – NAIF instrument/frame ID for the CK segment (the CK “INST” id).ref_frame (
str) – Base/reference frame name (usually ‘J2000’).sclk_id (
int) – NAIF spacecraft clock ID code used by sce2c().et_list (
array-like) – ET (TDB seconds past J2000) sample times.quats (
ndarray, optional) – Quaternions rotating vectors from ref_frame to inst frame. Shape (N,4) or (4,N). If None, must provide dcm_cb.avvs (
ndarray, optional) – Angular velocities expressed in ref_frame. Shape (N,3) or (3,N). If None, AVFLAG=0 and zeros are written (or FD-estimated if dcm_cb provided and you want).dcm_cb (
callable, optional) – Function et -> (3,3) DCM C_ref_to_inst. If provided and quats is None, quats are built via spice.m2q(C). spice.m2q uses SPICE quaternion convention. :contentReference[oaicite:2]{index=2}segid (
str) – Segment ID (<= 40 chars recommended).make_intervals (
{'per_sample','single'}) –‘per_sample’: NINTS=N-1, STARTS=sclkdp[:-1]
’single’ : NINTS=1, STARTS=[sclkdp[0]]
load_after (
bool) – If True, furnsh() the CK after writing.
- Returns:
ck_path – Path to the written CK file.
- Return type:
Notes
CKW03 requirements include monotonically increasing SCLKDP and descriptor times containing the data range. :contentReference[oaicite:3]{index=3}
- classmethod write_spk_metadata_json(SPK_name: str, body: Body, origin_ID: float, ref_frame: Frame, epochs_TDB: list, degree_poly: float, parameters_JSON: list = None, STMs_JSON: list = None, state_definition: list = None, sequence_definition: list = None, leg_data: dict = None, propagator_settings: dict = None, mass_profile: SCBPolynomial = None)#
Write ONLY the JSON sidecars associated with an SPK (parameters/STMs/settings/mass profile).
This avoids writing any additional SPK segments (no dummy segments), and avoids SPICE descriptor-time errors.
Notes: - epochs_TDB is included so JSON has a time reference; for sequences it can be the
concatenated full epochs list or the global seq.total_epochsTDB list.
- For sequence_definition != None, epochs_TDB is not directly used for legs epochs;
_prepare_sequence_data uses sequence_definition.epochs_vec.
- classmethod write_spk_segment_type9(SPK_name: str, SPK_SEG_ID: str, body: Body, origin_ID: float, ref_frame: Frame, epochs_TDB: list, degree_poly: float, state_SPICE: list, parameters_JSON: list = None, STMs_JSON: list = None, state_definition: list = None, sequence_definition: list = None, leg_data: dict = None, propagator_settings: dict = None, mass_profile: SCBPolynomial = None)#
Write a segment of type 9 to an SPK file.
- Parameters:
SPK_name (
str) – The name of the SPK file.SPK_SEG_ID (
str) – The segment ID.body (
object) – The body object.origin_ID (
int) – The ID of the origin.ref_frame (
frame) – The reference frame.epochs_TDB (
list) – The array of epochs in TDB format.degree_poly (
int) – The degree of the polynomial.state_SPICE (
list) – The array of states in SPICE format.parameters_JSON (
list, optional) – The array of parameters in JSON format.STMs_JSON (
list, optional) – The array of state transition matrices in JSON format.state_definition (
list, optional) – The state definition.sequence_definition (
object, optional) – The sequence definition.leg_data (
dict, optional) – The body, origin, and reference frame data for each leg.propagator_settings (
dict, optional) – The propagator settings.mass_profile (
SCBPolynomial, optional) – The mass profile.
- Returns:
None
- static YDS2et(year, doy, sec)#
Method to convert a year, DOY, seconds into ephemeris times.
- static check_kernel_status_in_pool(kernel_filename: str) bool#
Check if a Spice kernel is loaded in the kernel pool.
- static def_new_body(name, spiceId)#
Define a new celestial body in the SPICE kernel.
- static et2YDS(et_list)#
Method to convert a list of ephemeris times into (year, DOY, seconds) format.
- static frame_id_to_frame_name(frame_id: int) str#
This method generetes the frame id given its name
- Parameters:
frame_id (int) – frame id of the reference frame
- Returns:
frame’s spice name
- Return type:
Note
frame_id is different than the usual body_id used in spice
- static frame_name_to_frame_id(frame_name: str) int#
This method generetes the frame name given its frame id
- Parameters:
frame_name (str) – frame name of the reference frame
- Returns:
frame’s spice id
- Return type:
Note
frame_id is different than the usual body_id used in spice
- static generate_metakernel(directory: str, output_file: str = 'output_metakernel.tm')#
List all files in a directory and write them into a SPICE metakernel.
- static get_frame_w_spice_id(id_number: int)#
get frame_code and name associated with the frame_id number
- static get_id_from_string(name_string: str) int#
This method generetes the body spice id given its name
- Parameters:
name_string (str) – Spice name of the body
- Returns:
body’s spice id
- Return type:
id
- static get_intervals(spkFile, objID)#
- static get_observer_target_visibility_windows(obsvr_bdy: str | Body, trgt_bdy: str | Body, epoch_start: float | EpochArray, epoch_end: float | EpochArray, step_size: float = 300.0, angle_limit: float = 10.0, inframe: str = 'obs', abcorr: str = 'None', crdsys: str = 'LATITUDINAL', coord: str = 'LATITUDE', relate: str = '>', adjust: float = 0.0, num_intervals: int = 1000)#
Determine the visibility windows between an observer and a target within a specified time range.
Parameters: obsvr_bdy (Union[str, scb.Body]):
The observer, either as a string name or a scb.Body object.
- trgt_bdy (Union[str, scb.Body]):
The target, either as a string name or a scb.Body object.
- epoch_start (Union[float, scb.EpochArray]):
The start time of the observation window.
- epoch_end (Union[float, scb.EpochArray]):
he end time of the observation window.
- step_size (float, optional):
The step size in seconds for the search. Default is 300.0.
- angle_limit (float, optional):
The angular limit for visibility in degrees. Default is 10.0.
- inframe (str, optional):
The reference frame for the observation. Default is “obs”.
- abcorr (str, optional):
Aberration correction. Default is “None”.
- crdsys (str, optional):
Coordinate system. Default is “LATITUDINAL”.
- coord (str, optional):
Coordinate type. Default is “LATITUDE”.
- relate (str, optional):
Relational operator for the coordinate comparison. Default is “>”.
- adjust (float, optional):
Adjustment value for the search. Default is 0.0.
- num_intervals (int, optional):
Maximum number of intervals for the search. Default is 1000.
Returns: tuple: A tuple containing the number of visibility windows and a list of visibility windows.
- static get_xfrm_core(frame_from: str, frame_to: str, epoch) array#
This method returns the DCM rotation matrix between frame_from and frame_to at a given epoch
- Parameters:
- Returns:
(3,3) rotation matrix to transform between frame_from to frame_to
- Return type:
np.array
Warning
both frame_from and frame_to needs to be spice-defined reference frames
- static increase_kernel_priority(kernel_filename: str)#
This function increases the priority of kernel to the top of the pool for kernels of the same type by unloading then loading it.
Note: this is the method recommended by the Spice documentation.
- Parameters:
kernel_filename (
str) – Filename of the
- static jd2et(jd)#
- static list_all_ck_ids(ck_file: str) list[int]#
Generates a list of all SPICE ID’s in a given C-kernel.
- static list_all_frames(max_id: int = 100000) list#
This method generate a list of all frames with +- the value between max_id
- Parameters:
max_id (int) – maximum frame id to check
- Returns:
list of the reference frames detected in the pool
- Return type:
Note
frame_id is different than the usual body_id used in spice
- static load_kernel(kernel_filenames)#
Load SPICE kernels into the SPICE system.
- static load_kernel_from_mkfile(furnshKernelFilename)#
Load a SPICE kernel from a given MK file.
- Parameters:
furnshKernelFilename (
str) – The filename of the MK file to load.- Returns:
None
- static matrix_times_vector(matrix, vector)#
Multiply a 3x3 double precision matrix with a 3-dimensional double precision vector.
https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/mxv_c.html
- Parameters:
matrix (np.array) – rotation matrix
vector (np.array) – vector
- Returns:
vector
- Return type:
np.array
- static name_to_ID(name)#
Converts a given name to its corresponding ID in the kernel pool.
- static sce2c(sc, et)#
Convert ET to SCLK.
Wrapper for spiceypy.sce2c().
- static test(file)#
- static unload_kernel_from_pool(kernel_filename: str)#
Unload a kernel from the pool. If the kernel is not in the pool then no action is taken. :param kernel_filename: Filename of the Spice kernel being unloaded. :type kernel_filename:
str
- kernel_folder = '/Users/zael5647/scarabaeus/data/kernels/scenario'#
- kernel_list = []#
- poly_interp_deg = 3#
- poly_interp_par_deg = 1#