SpiceyPy package

spiceypy module

The MIT License (MIT)

Copyright (c) [2015-2020] [Andrew Annex]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

spiceypy.spiceypy.appndc(item, cell)[source]

Append an item to a character cell.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/appndc_c.html

Parameters
  • item (Union[str, Iterable[str], ndarray, str_]) – The item to append.

  • cell (Union[Cell_Char, SpiceCell]) – The cell to append to.

Return type

None

spiceypy.spiceypy.appndd(item, cell)[source]

Append an item to a double precision cell.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/appndd_c.html

Parameters
  • item (Union[int, float, Iterable[float]]) – The item to append.

  • cell (Union[SpiceCell, Cell_Double]) – The cell to append to.

Return type

None

spiceypy.spiceypy.appndi(item, cell)[source]

Append an item to an integer cell.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/appndi_c.html

Parameters
  • item (Union[Iterable[int], int]) – The item to append.

  • cell (Union[SpiceCell, Cell_Int]) – The cell to append to.

Return type

None

spiceypy.spiceypy.axisar(axis, angle)[source]

Construct a rotation matrix that rotates vectors by a specified angle about a specified axis.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/axisar_c.html

Parameters
  • axis (Union[ndarray, Iterable[float]]) – Rotation axis.

  • angle (float) – Rotation angle, in radians.

Return type

ndarray

Returns

Rotation matrix corresponding to axis and angle.

spiceypy.spiceypy.b1900()[source]

Return the Julian Date corresponding to Besselian Date 1900.0.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/b1900_c.html

Return type

float

Returns

The Julian Date corresponding to Besselian Date 1900.0.

spiceypy.spiceypy.b1950()[source]

Return the Julian Date corresponding to Besselian Date 1950.0.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/b1950_c.html

Return type

float

Returns

The Julian Date corresponding to Besselian Date 1950.0.

spiceypy.spiceypy.badkpv(caller, name, comp, insize, divby, intype)[source]

Determine if a kernel pool variable is present and if so that it has the correct size and type.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/badkpv_c.html

Parameters
  • caller (str) – Name of the routine calling this routine.

  • name (str) – Name of a kernel pool variable.

  • comp (str) – Comparison operator.

  • insize (int) – Expected size of the kernel pool variable.

  • divby (int) – A divisor of the size of the kernel pool variable.

  • intype (str) – Expected type of the kernel pool variable

Return type

bool

Returns

returns false if the kernel pool variable is OK.

spiceypy.spiceypy.bltfrm(frmcls, out_cell=None)[source]

Return a SPICE set containing the frame IDs of all built-in frames of a specified class.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/bltfrm_c.html

Parameters
  • frmcls (int) – Frame class.

  • out_cell (Optional[SpiceCell]) – Optional SpiceInt Cell that is returned

Return type

SpiceCell

Returns

Set of ID codes of frames of the specified class.

spiceypy.spiceypy.bodc2n(code, lenout=256)[source]

Translate the SPICE integer code of a body into a common name for that body.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/bodc2n_c.html

Parameters
  • code (int) – Integer ID code to be translated into a name.

  • lenout (int) – Maximum length of output name.

Return type

Tuple[str, bool]

Returns

A common name for the body identified by code.

spiceypy.spiceypy.bodc2s(code, lenout=256)[source]

Translate a body ID code to either the corresponding name or if no name to ID code mapping exists, the string representation of the body ID value.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/bodc2s_c.html

Parameters
  • code (int) – Integer ID code to translate to a string.

  • lenout (int) – Maximum length of output name.

Return type

str

Returns

String corresponding to ‘code’.

spiceypy.spiceypy.boddef(name, code)[source]

Define a body name/ID code pair for later translation via bodn2c() or bodc2n().

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/boddef_c.html

Parameters
  • name (str) – Common name of some body.

  • code (int) – Integer code for that body.

Return type

None

spiceypy.spiceypy.bodfnd(body, item)[source]

Determine whether values exist for some item for any body in the kernel pool.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/bodfnd_c.html

Parameters
  • body (int) – ID code of body.

  • item (str) – Item to find (“RADII”, “NUT_AMP_RA”, etc.).

Return type

bool

Returns

True if the item is in the kernel pool, and is False if it is not.

spiceypy.spiceypy.bodn2c(name)[source]

Translate the name of a body or object to the corresponding SPICE integer ID code.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/bodn2c_c.html

Parameters

name (str) – Body name to be translated into a SPICE ID code.

Return type

Tuple[int, bool]

Returns

SPICE integer ID code for the named body.

spiceypy.spiceypy.bods2c(name)[source]

Translate a string containing a body name or ID code to an integer code.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/bods2c_c.html

Parameters

name (str) – String to be translated to an ID code.

Return type

Tuple[int, bool]

Returns

Integer ID code corresponding to name.

spiceypy.spiceypy.bodvar(body, item, dim)[source]

Deprecated: This routine has been superseded by bodvcd() and bodvrd(). This routine is supported for purposes of backward compatibility only.

Return the values of some item for any body in the kernel pool.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/bodvar_c.html

Parameters
  • body (int) – ID code of body.

  • item (str) – Item for which values are desired, (“RADII”, “NUT_PREC_ANGLES”, etc.)

  • dim (int) – Number of values returned.

Return type

ndarray

Returns

values

spiceypy.spiceypy.bodvcd(bodyid, item, maxn)[source]

Fetch from the kernel pool the double precision values of an item associated with a body, where the body is specified by an integer ID code.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/bodvcd_c.html

Parameters
  • bodyid (int) – Body ID code.

  • item (str) – Item for which values are desired, (“RADII”, “NUT_PREC_ANGLES”, etc.)

  • maxn (int) – Maximum number of values that may be returned.

Return type

Tuple[int, ndarray]

Returns

dim, values

spiceypy.spiceypy.bodvrd(bodynm, item, maxn)[source]

Fetch from the kernel pool the double precision values of an item associated with a body.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/bodvrd_c.html

Parameters
  • bodynm (str) – Body name.

  • item (str) – Item for which values are desired, (“RADII”, “NUT_PREC_ANGLES”, etc.)

  • maxn (int) – Maximum number of values that may be returned.

Return type

Tuple[int, ndarray]

Returns

tuple of (dim, values)

spiceypy.spiceypy.brcktd(number, end1, end2)[source]

Bracket a number. That is, given a number and an acceptable interval, make sure that the number is contained in the interval. (If the number is already in the interval, leave it alone. If not, set it to the nearest endpoint of the interval.)

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/brcktd_c.html

Parameters
  • number (float) – Number to be bracketed.

  • end1 (float) – One of the bracketing endpoints for number.

  • end2 (float) – The other bracketing endpoint for number.

Return type

float

Returns

value within an interval

spiceypy.spiceypy.brckti(number, end1, end2)[source]

Bracket a number. That is, given a number and an acceptable interval, make sure that the number is contained in the interval. (If the number is already in the interval, leave it alone. If not, set it to the nearest endpoint of the interval.)

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/brckti_c.html

Parameters
  • number (int) – Number to be bracketed.

  • end1 (int) – One of the bracketing endpoints for number.

  • end2 (int) – The other bracketing endpoint for number.

Return type

int

Returns

value within an interval

spiceypy.spiceypy.bschoc(value, ndim, lenvals, array, order)[source]

Do a binary search for a given value within a character string array, accompanied by an order vector. Return the index of the matching array entry, or -1 if the key value is not found.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/bschoc_c.html

Parameters
  • value (Union[str_, str]) – Key value to be found in array.

  • ndim (int) – Dimension of array.

  • lenvals (int) – String length.

  • array (Union[ndarray, Iterable[str]]) – Character string array to search.

  • order (Iterable[int]) – Order vector.

Return type

int

Returns

index

spiceypy.spiceypy.bschoi(value, ndim, array, order)[source]

Do a binary search for a given value within an integer array, accompanied by an order vector. Return the index of the matching array entry, or -1 if the key value is not found.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/bschoi_c.html

Parameters
  • value (int) – Key value to be found in array.

  • ndim (int) – Dimension of array.

  • array (Iterable[int]) – Integer array to search.

  • order (Iterable[int]) – Order vector.

Return type

int

Returns

index

spiceypy.spiceypy.bsrchc(value, ndim, lenvals, array)[source]

Do a binary earch for a given value within a character string array. Return the index of the first matching array entry, or -1 if the key value was not found.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/bsrchc_c.html

Parameters
  • value (str) – Key value to be found in array.

  • ndim (int) – Dimension of array.

  • lenvals (int) – String length.

  • array (Iterable[str]) – Character string array to search.

Return type

int

Returns

index

spiceypy.spiceypy.bsrchd(value, ndim, array)[source]

Do a binary search for a key value within a double precision array, assumed to be in increasing order. Return the index of the matching array entry, or -1 if the key value is not found.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/bsrchd_c.html

Parameters
  • value (float) – Value to find in array.

  • ndim (int) – Dimension of array.

  • array (ndarray) – Array to be searched.

Return type

int

Returns

index

spiceypy.spiceypy.bsrchi(value, ndim, array)[source]

Do a binary search for a key value within an integer array, assumed to be in increasing order. Return the index of the matching array entry, or -1 if the key value is not found.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/bsrchi_c.html

Parameters
  • value (int) – Value to find in array.

  • ndim (int) – Dimension of array.

  • array (ndarray) – Array to be searched.

Return type

int

Returns

index

spiceypy.spiceypy.card(cell)[source]

Return the cardinality (current number of elements) in a cell of any data type.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/card_c.html

Parameters

cell (SpiceCell) – Input cell.

Return type

int

Returns

the number of elements in a cell of any data type.

spiceypy.spiceypy.ccifrm(frclss, clssid, lenout=256)[source]

Return the frame name, frame ID, and center associated with a given frame class and class ID.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/ccifrm_c.html

Parameters
  • frclss (int) – Class of frame.

  • clssid (int) – Class ID of frame.

  • lenout (int) – Maximum length of output string.

Return type

Tuple[int, str, int, bool]

Returns

the frame name, frame ID, center.

spiceypy.spiceypy.cell_bool(cell_size)[source]
Return type

SpiceCell

spiceypy.spiceypy.cell_char(cell_size, length)[source]
Return type

SpiceCell

spiceypy.spiceypy.cell_double(cell_size)[source]
Return type

SpiceCell

spiceypy.spiceypy.cell_int(cell_size)[source]
Return type

SpiceCell

spiceypy.spiceypy.cell_time(cell_size)[source]
Return type

SpiceCell

spiceypy.spiceypy.cgv2el(center, vec1, vec2)[source]

Form a SPICE ellipse from a center vector and two generating vectors.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/cgv2el_c.html

Parameters
  • center (Iterable[float]) – Center Vector

  • vec1 (Union[ndarray, Iterable[float]]) – Vector 1

  • vec2 (Union[ndarray, Iterable[float]]) – Vector 2

Return type

Ellipse

Returns

Ellipse

spiceypy.spiceypy.chbder(cp, degp, x2s, x, nderiv)[source]

Given the coefficients for the Chebyshev expansion of a polynomial, this returns the value of the polynomial and its first nderiv derivatives evaluated at the input X.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/chbder_c.html

Parameters
  • cp (Iterable[float]) – degp+1 Chebyshev polynomial coefficients.

  • degp (int) – Degree of polynomial.

  • x2s (Iterable[float]) – Transformation parameters of polynomial.

  • x (float) – Value for which the polynomial is to be evaluated

  • nderiv (int) – The number of derivatives to compute

Return type

ndarray

Returns

Array of the derivatives of the polynomial

spiceypy.spiceypy.check_for_spice_error(f)[source]

Internal decorator function to check spice error system for failed calls

Parameters

f (Optional[Callable]) – function

Raises

stypes.SpiceyError

Return type

None

spiceypy.spiceypy.chkin(module)[source]

Inform the SPICE error handling mechanism of entry into a routine.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/chkin_c.html

Parameters

module (str) – The name of the calling routine.

Return type

None

spiceypy.spiceypy.chkout(module)[source]

Inform the SPICE error handling mechanism of exit from a routine.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/chkout_c.html

Parameters

module (str) – The name of the calling routine.

Return type

None

spiceypy.spiceypy.cidfrm(cent, lenout=256)[source]

Retrieve frame ID code and name to associate with a frame center.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/cidfrm_c.html

Parameters
  • cent (int) – An object to associate a frame with.

  • lenout (int) – Available space in output string frname.

Return type

Tuple[int, str, bool]

Returns

frame ID code, name to associate with a frame center.

spiceypy.spiceypy.ckcls(handle)[source]

Close an open CK file.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/ckcls_c.html

Parameters

handle (int) – Handle of the CK file to be closed.

Return type

None

spiceypy.spiceypy.ckcov(ck, idcode, needav, level, tol, timsys, cover=None)[source]

Find the coverage window for a specified object in a specified CK file.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/ckcov_c.html

Parameters
  • ck (str) – Name of CK file.

  • idcode (int) – ID code of object.

  • needav (bool) – Flag indicating whether angular velocity is needed.

  • level (str) – Coverage level: (SEGMENT OR INTERVAL)

  • tol (float) – Tolerance in ticks.

  • timsys (str) – Time system used to represent coverage.

  • cover (Optional[SpiceCell]) – Window giving coverage for idcode.

Return type

SpiceCell

Returns

coverage window for a specified object in a specified CK file

spiceypy.spiceypy.ckfrot(inst, et)[source]

Find the rotation from a C-kernel Id to the native frame at the time requested.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/FORTRAN/spicelib/ckfrot.html

Parameters
  • inst (int) – NAIF instrument ID

  • et (float) – Epoch measured in seconds past J2000

Return type

Tuple[ndarray, int, bool]

Returns

Rotation matrix from the input frame to the returned reference frame, id for the reference frame

spiceypy.spiceypy.ckgp(inst, sclkdp, tol, ref)[source]

Get pointing (attitude) for a specified spacecraft clock time.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/ckgp_c.html

Parameters
  • inst (int) – NAIF ID of instrument, spacecraft, or structure.

  • sclkdp (Union[float, int]) – Encoded spacecraft clock time.

  • tol (int) – Time tolerance.

  • ref (str) – Reference frame.

Return type

Tuple[ndarray, float, bool]

Returns

C-matrix pointing data, Output encoded spacecraft clock time

spiceypy.spiceypy.ckgpav(inst, sclkdp, tol, ref)[source]

Get pointing (attitude) and angular velocity for a specified spacecraft clock time.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/ckgpav_c.html

Parameters
  • inst (int) – NAIF ID of instrument, spacecraft, or structure.

  • sclkdp (float) – Encoded spacecraft clock time.

  • tol (Union[float, int]) – Time tolerance.

  • ref (str) – Reference frame.

Return type

Tuple[ndarray, ndarray, float, bool]

Returns

C-matrix pointing data, Angular velocity vector, Output encoded spacecraft clock time.

spiceypy.spiceypy.cklpf(filename)[source]

Load a CK pointing file for use by the CK readers. Return that file’s handle, to be used by other CK routines to refer to the file.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/cklpf_c.html

Parameters

filename (str) – Name of the CK file to be loaded.

Return type

int

Returns

Loaded file’s handle.

spiceypy.spiceypy.ckobj(ck, out_cell=None)[source]

Find the set of ID codes of all objects in a specified CK file.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/ckobj_c.html

Parameters
  • ck (str) – Name of CK file.

  • out_cell (Optional[SpiceCell]) – Optional user provided Spice Int cell.

Return type

SpiceCell

Returns

Set of ID codes of objects in CK file.

spiceypy.spiceypy.ckopn(filename, ifname, ncomch)[source]

Open a new CK file, returning the handle of the opened file.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/ckopn_c.html

Parameters
  • filename (str) – The name of the CK file to be opened.

  • ifname (str) – The internal filename for the CK.

  • ncomch (int) – The number of characters to reserve for comments.

Return type

int

Returns

The handle of the opened CK file.

spiceypy.spiceypy.ckupf(handle)[source]

Unload a CK pointing file so that it will no longer be searched by the readers.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/ckupf_c.html

Parameters

handle (int) – Handle of CK file to be unloaded

Return type

None

spiceypy.spiceypy.ckw01(handle, begtim, endtim, inst, ref, avflag, segid, nrec, sclkdp, quats, avvs)[source]

Add a type 1 segment to a C-kernel.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/ckw01_c.html

Parameters
  • handle (int) – Handle of an open CK file.

  • begtim (float) – The beginning encoded SCLK of the segment.

  • endtim (float) – The ending encoded SCLK of the segment.

  • inst (int) – The NAIF instrument ID code.

  • ref (str) – The reference frame of the segment.

  • avflag (bool) – True if the segment will contain angular velocity.

  • segid (str) – Segment identifier.

  • nrec (int) – Number of pointing records.

  • sclkdp (Union[ndarray, Iterable[float]]) – Encoded SCLK times.

  • quats (Union[ndarray, Iterable[Iterable[float]]]) – Quaternions representing instrument pointing.

  • avvs (Union[ndarray, Iterable[Iterable[float]]]) – Angular velocity vectors.

Return type

None

spiceypy.spiceypy.ckw02(handle, begtim, endtim, inst, ref, segid, nrec, start, stop, quats, avvs, rates)[source]

Write a type 2 segment to a C-kernel.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/ckw02_c.html

Parameters
  • handle (int) – Handle of an open CK file.

  • begtim (float) – The beginning encoded SCLK of the segment.

  • endtim (float) – The ending encoded SCLK of the segment.

  • inst (int) – The NAIF instrument ID code.

  • ref (str) – The reference frame of the segment.

  • segid (str) – Segment identifier.

  • nrec (int) – Number of pointing records.

  • start (ndarray) – Encoded SCLK interval start times.

  • stop (ndarray) – Encoded SCLK interval stop times.

  • quats (ndarray) – Quaternions representing instrument pointing.

  • avvs (ndarray) – Angular velocity vectors.

  • rates (Iterable[float]) – Number of seconds per tick for each interval.

Return type

None

spiceypy.spiceypy.ckw03(handle, begtim, endtim, inst, ref, avflag, segid, nrec, sclkdp, quats, avvs, nints, starts)[source]

Add a type 3 segment to a C-kernel.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/ckw03_c.html

Parameters
  • handle (int) – Handle of an open CK file.

  • begtim (float) – The beginning encoded SCLK of the segment.

  • endtim (float) – The ending encoded SCLK of the segment.

  • inst (int) – The NAIF instrument ID code.

  • ref (str) – The reference frame of the segment.

  • avflag (bool) – True if the segment will contain angular velocity.

  • segid (str) – Segment identifier.

  • nrec (int) – Number of pointing records.

  • sclkdp (ndarray) – Encoded SCLK times.

  • quats (ndarray) – Quaternions representing instrument pointing.

  • avvs (ndarray) – Angular velocity vectors.

  • nints (int) – Number of intervals.

  • starts (Iterable[float]) – Encoded SCLK interval start times.

Return type

None

spiceypy.spiceypy.ckw05(handle, subtype, degree, begtim, endtim, inst, ref, avflag, segid, sclkdp, packts, rate, nints, starts)[source]

Write a type 5 segment to a CK file.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/ckw05_c.html

Parameters
  • handle (int) – Handle of an open CK file.

  • subtype (int) – CK type 5 subtype code. Can be: 0, 1, 2, 3 see naif docs via link above.

  • degree (int) – Degree of interpolating polynomials.

  • begtim (float) – The beginning encoded SCLK of the segment.

  • endtim (float) – The ending encoded SCLK of the segment.

  • inst (int) – The NAIF instrument ID code.

  • ref (str) – The reference frame of the segment.

  • avflag (bool) – True if the segment will contain angular velocity.

  • segid (str) – Segment identifier.

  • sclkdp (ndarray) – Encoded SCLK times.

  • packts (Sequence[Iterable[float]]) – Array of packets.

  • rate (float) – Nominal SCLK rate in seconds per tick.

  • nints (int) – Number of intervals.

  • starts (ndarray) – Encoded SCLK interval start times.

Return type

None

spiceypy.spiceypy.cleard()[source]
Return type

NotImplementedError

spiceypy.spiceypy.clight()[source]

Return the speed of light in a vacuum (IAU official value, in km/sec).

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/clight_c.html

Return type

float

Returns

The function returns the speed of light in vacuum (km/sec).

spiceypy.spiceypy.clpool()[source]

Remove all variables from the kernel pool. Watches on kernel variables are retained.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/clpool_c.html

Return type

None

spiceypy.spiceypy.cltext(fname)[source]

Internal undocumented command for closing a text file opened by RDTEXT.

No URL available; relevant lines from SPICE source:

FORTRAN SPICE, rdtext.f:

C$Procedure  CLTEXT ( Close a text file opened by RDTEXT)
      ENTRY  CLTEXT ( FILE )
      CHARACTER*(*)       FILE
C     VARIABLE  I/O  DESCRIPTION
C     --------  ---  --------------------------------------------------
C     FILE       I   Text file to be closed.

CSPICE, rdtext.c:

/* $Procedure  CLTEXT ( Close a text file opened by RDTEXT) */
/* Subroutine */ int cltext_(char *file, ftnlen file_len)
Parameters

fname (str) – Text file to be closed.

Return type

None

spiceypy.spiceypy.cmprss(delim, n, instr, lenout=256)[source]

Compress a character string by removing occurrences of more than N consecutive occurrences of a specified character.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/cmprss_c.html

Parameters
  • delim (str) – Delimiter to be compressed.

  • n (int) – Maximum consecutive occurrences of delim.

  • instr (str) – Input string.

  • lenout (int) – Optional available space in output string.

Return type

str

Returns

Compressed string.

spiceypy.spiceypy.cnmfrm(cname, lenout=256)[source]

Retrieve frame ID code and name to associate with an object.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/cnmfrm_c.html

Parameters
  • cname (str) – Name of the object to find a frame for.

  • lenout (int) – Maximum length available for frame name.

Return type

Tuple[int, str, bool]

Returns

The ID code of the frame associated with cname, The name of the frame with ID frcode.

spiceypy.spiceypy.conics(elts, et)[source]

Determine the state (position, velocity) of an orbiting body from a set of elliptic, hyperbolic, or parabolic orbital elements.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/conics_c.html

Parameters
  • elts (ndarray) – Conic elements.

  • et (float) – Input time.

Return type

ndarray

Returns

State of orbiting body at et.

spiceypy.spiceypy.convrt(x, inunit, outunit)[source]

Take a measurement X, the units associated with X, and units to which X should be converted; return Y the value of the measurement in the output units.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/convrt_c.html

Parameters
  • x (Union[float, Iterable[float]]) – Number representing a measurement in some units.

  • inunit (str) – The units in which x is measured.

  • outunit (str) – Desired units for the measurement.

Return type

Union[ndarray, float]

Returns

The measurment in the desired units.

spiceypy.spiceypy.copy(cell)[source]

Copy the contents of a SpiceCell of any data type to another cell of the same type.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/copy_c.html

Parameters

cell (SpiceCell) – Cell to be copied.

Return type

SpiceCell

Returns

New cell

spiceypy.spiceypy.cpos(string, chars, start)[source]

Find the first occurrence in a string of a character belonging to a collection of characters, starting at a specified location, searching forward.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/cpos_c.html

Parameters
  • string (str) – Any character string.

  • chars (str) – A collection of characters.

  • start (int) – Position to begin looking for one of chars.

Return type

int

Returns

The index of the first character of str at or following index start that is in the collection chars.

spiceypy.spiceypy.cposr(string, chars, start)[source]

Find the first occurrence in a string of a character belonging to a collection of characters, starting at a specified location, searching in reverse.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/cposr_c.html

Parameters
  • string (str) – Any character string.

  • chars (str) – A collection of characters.

  • start (int) – Position to begin looking for one of chars.

Return type

int

Returns

The index of the last character of str at or before index start that is in the collection chars.

spiceypy.spiceypy.cvpool(agent)[source]

Indicate whether or not any watched kernel variables that have a specified agent on their notification list have been updated.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/cvpool_c.html

Parameters

agent (str) – Name of the agent to check for notices.

Return type

bool

Returns

True if variables for “agent” have been updated.

spiceypy.spiceypy.cyllat(r, lonc, z)[source]

Convert from cylindrical to latitudinal coordinates.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/cyllat_c.html

Parameters
  • r (float) – Distance of point from z axis.

  • lonc (float) – Cylindrical angle of point from XZ plane(radians).

  • z (float) – Height of point above XY plane.

Return type

Tuple[float, float, float]

Returns

Distance, Longitude (radians), and Latitude of point (radians).

spiceypy.spiceypy.cylrec(r, lon, z)[source]

Convert from cylindrical to rectangular coordinates.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/cylrec_c.html

Parameters
  • r (float) – Distance of a point from z axis.

  • lon (float) – Angle (radians) of a point from xZ plane.

  • z (float) – Height of a point above xY plane.

Return type

ndarray

Returns

Rectangular coordinates of the point.

spiceypy.spiceypy.cylsph(r, lonc, z)[source]

Convert from cylindrical to spherical coordinates.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/cylsph_c.html

Parameters
  • r (float) – Rectangular coordinates of the point.

  • lonc (float) – Angle (radians) of point from XZ plane.

  • z (float) – Height of point above XY plane.

Return type

Tuple[float, float, float]

Returns

Distance of point from origin, Polar angle (co-latitude in radians) of point, Azimuthal angle (longitude) of point (radians).

spiceypy.spiceypy.dafac(handle, buffer)[source]

Add comments from a buffer of character strings to the comment area of a binary DAF file, appending them to any comments which are already present in the file’s comment area.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dafac_c.html

Parameters
  • handle (int) – handle of a DAF opened with write access.

  • buffer (Sequence[str]) – Buffer of comments to put into the comment area.

Return type

None

spiceypy.spiceypy.dafbbs(handle)[source]

Begin a backward search for arrays in a DAF.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dafbbs_c.html

Parameters

handle (int) – Handle of DAF to be searched.

Return type

None

spiceypy.spiceypy.dafbfs(handle)[source]

Begin a forward search for arrays in a DAF.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dafbfs_c.html

Parameters

handle (int) – Handle of file to be searched.

Return type

None

spiceypy.spiceypy.dafcls(handle)[source]

Close the DAF associated with a given handle.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dafcls_c.html

Parameters

handle (int) – Handle of DAF to be closed.

Return type

None

spiceypy.spiceypy.dafcs(handle)[source]

Select a DAF that already has a search in progress as the one to continue searching.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dafcs_c.html

Parameters

handle (int) – Handle of DAF to continue searching.

Return type

None

spiceypy.spiceypy.dafdc(handle)[source]

Delete the entire comment area of a specified DAF file.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dafdc_c.html

Parameters

handle (int) – The handle of a binary DAF opened for writing.

Return type

None

spiceypy.spiceypy.dafec(handle, bufsiz, lenout=256)[source]

Extract comments from the comment area of a binary DAF.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dafec_c.html

Parameters
  • handle (int) – Handle of binary DAF opened with read access.

  • bufsiz (int) – Maximum size, in lines, of buffer.

  • lenout (int) – Length of strings in output buffer.

Return type

Tuple[int, Iterable[str], bool]

Returns

Number of extracted comment lines, buffer where extracted comment lines are placed, Indicates whether all comments have been extracted.

spiceypy.spiceypy.daffna()[source]

Find the next (forward) array in the current DAF.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/daffna_c.html

Return type

bool

Returns

True if an array was found.

spiceypy.spiceypy.daffpa()[source]

Find the previous (backward) array in the current DAF.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/daffpa_c.html

Return type

bool

Returns

True if an array was found.

spiceypy.spiceypy.dafgda(handle, begin, end)[source]

Read the double precision data bounded by two addresses within a DAF.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dafgda_c.html

Parameters
  • handle (int) – Handle of a DAF.

  • begin (int) – Initial address within file.

  • end (int) – Final address within file.

Return type

ndarray

Returns

Data contained between begin and end.

spiceypy.spiceypy.dafgh()[source]

Return (get) the handle of the DAF currently being searched.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dafgh_c.html

Return type

int

Returns

Handle for current DAF.

spiceypy.spiceypy.dafgn(lenout=256)[source]

Return (get) the name for the current array in the current DAF.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dafgn_c.html

Parameters

lenout (int) – Length of array name string.

Return type

str

Returns

Name of current array.

spiceypy.spiceypy.dafgs(n=125)[source]

Return (get) the summary for the current array in the current DAF.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dafgs_c.html

Parameters

n (int) – Optional length N for result Array.

Return type

ndarray

Returns

Summary for current array.

spiceypy.spiceypy.dafgsr(handle, recno, begin, end)[source]

Read a portion of the contents of (words in) a summary record in a DAF file.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dafgsr_c.html

Parameters
  • handle (int) – Handle of DAF.

  • recno (int) – Record number; word indices are 1-based, 1 to 128 inclusive.

  • begin (int) – Index of first word to read from record, will be clamped > 0.

  • end (int) – Index of last word to read, wll be clamped < 129

Return type

Tuple[ndarray, bool]

Returns

Contents of request sub-record

spiceypy.spiceypy.dafopr(fname)[source]

Open a DAF for subsequent read requests.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dafopr_c.html

Parameters

fname (str) – Name of DAF to be opened.

Return type

int

Returns

Handle assigned to DAF.

spiceypy.spiceypy.dafopw(fname)[source]

Open a DAF for subsequent write requests.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dafopw_c.html

Parameters

fname (str) – Name of DAF to be opened.

Return type

int

Returns

Handle assigned to DAF.

spiceypy.spiceypy.dafps(nd, ni, dc, ic)[source]

Pack (assemble) an array summary from its double precision and integer components.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dafps_c.html

Parameters
  • nd (int) – Number of double precision components.

  • ni (int) – Number of integer components.

  • dc (ndarray) – Double precision components.

  • ic (ndarray) – Integer components.

Return type

ndarray

Returns

Array summary.

spiceypy.spiceypy.dafrda(handle, begin, end)[source]

Read the double precision data bounded by two addresses within a DAF.

Deprecated: This routine has been superseded by dafgda() and dafgsr(). This routine is supported for purposes of backward compatibility only.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dafrda_c.html

Parameters
  • handle (int) – Handle of a DAF.

  • begin (int) – Initial address within file.

  • end (int) – Final address within file.

Return type

ndarray

Returns

Data contained between begin and end.

spiceypy.spiceypy.dafrfr(handle, lenout=256)[source]

Read the contents of the file record of a DAF.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dafrfr_c.html

Parameters
  • handle (int) – Handle of an open DAF file.

  • lenout (int) – Available room in the output string

Return type

Tuple[int, int, str, int, int, int]

Returns

Number of double precision components in summaries, Number of integer components in summaries, Internal file name, Forward list pointer, Backward list pointer, Free address pointer.

spiceypy.spiceypy.dafrs(insum)[source]

Change the summary for the current array in the current DAF.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dafrs_c.html

Parameters

insum (ndarray) – New summary for current array.

Return type

None

spiceypy.spiceypy.dafus(insum, nd, ni)[source]

Unpack an array summary into its double precision and integer components.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dafus_c.html

Parameters
  • insum (ndarray) – Array summary.

  • nd (int) – Number of double precision components.

  • ni (int) – Number of integer components.

Return type

Tuple[ndarray, ndarray]

Returns

Double precision components, Integer components.

spiceypy.spiceypy.dasac(handle, buffer)[source]

Add comments from a buffer of character strings to the comment area of a binary DAS file, appending them to any comments which are already present in the file’s comment area.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dasac_c.html

Parameters
  • handle (int) – DAS handle of a file opened with write access.

  • buffer (Sequence[str]) – Buffer of lines to be put into the comment area.

Return type

None

spiceypy.spiceypy.dascls(handle)[source]

Close a DAS file.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dascls_c.html

Parameters

handle (int) – Handle of an open DAS file.

Return type

None

spiceypy.spiceypy.dasdc(handle)[source]

Delete the entire comment area of a previously opened binary DAS file.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dasdc_c.html

Parameters

handle (int) – The handle of a binary DAS file opened for writing.

Return type

None

spiceypy.spiceypy.dasec(handle, bufsiz=256, buflen=256)[source]

Extract comments from the comment area of a binary DAS file.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dasec_c.html

Parameters
  • handle (int) – Handle of binary DAS file open with read access.

  • bufsiz (int) – Maximum size, in lines, of buffer.

  • buflen (int) – Line length associated with buffer.

Return type

Tuple[int, Iterable[str], int]

Returns

Number of comments extracted from the DAS file, Buffer in which extracted comments are placed, Indicates whether all comments have been extracted.

spiceypy.spiceypy.dashfn(handle, lenout=256)[source]

Return the name of the DAS file associated with a handle.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dashfn_c.html

Parameters
  • handle (int) – Handle of a DAS file.

  • lenout (int) – Length of output file name string.

Return type

str

Returns

Corresponding file name.

spiceypy.spiceypy.dasonw(fname, ftype, ifname, ncomch)[source]

Internal undocumented command for creating a new DAS file

Parameters
  • fname (str) – filename

  • ftype (str) – type

  • ifname (str) – internal file name

  • ncomch (int) – amount of comment area

Return type

int

Returns

Handle to new DAS file

spiceypy.spiceypy.dasopr(fname)[source]

Open a DAS file for reading.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dasopr_c.html

Parameters

fname (str) – Name of a DAS file to be opened.

Return type

int

Returns

Handle assigned to the opened DAS file.

spiceypy.spiceypy.dasopw(fname)[source]

Open a DAS file for writing.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dasopw_c.html :type fname: str :param fname: Name of a DAS file to be opened. :rtype: int :return: Handle assigned to the opened DAS file.

spiceypy.spiceypy.dasrfr(handle, lenout=256)[source]

Return the contents of the file record of a specified DAS file.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dasrfr_c.html

Parameters
  • handle (int) – DAS file handle.

  • lenout (int) – length of output strs

Return type

Tuple[str, str, int, int, int, int]

Returns

ID word, DAS internal file name, Number of reserved records in file, Number of characters in use in reserved rec. area, Number of comment records in file, Number of characters in use in comment area.

spiceypy.spiceypy.datetime2et(dt)[source]

Converts a standard Python datetime to a double precision value representing the number of TDB seconds past the J2000 epoch corresponding to the input epoch.

Timezone-naive datetimes will be assumed to be UTC, timezone-aware datetimes will be handled correctly by converting to UTC before passing them to CSPICE.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/req/time.html#The%20J2000%20Epoch

Parameters

dt (Union[Iterable[datetime], datetime]) – A standard Python datetime

Return type

Union[ndarray, float]

Returns

The equivalent value in seconds past J2000, TDB.

spiceypy.spiceypy.dcyldr(x, y, z)[source]

This routine computes the Jacobian of the transformation from rectangular to cylindrical coordinates.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dcyldr_c.html

Parameters
  • x (float) – X-coordinate of point.

  • y (float) – Y-coordinate of point.

  • z (float) – Z-coordinate of point.

Return type

ndarray

Returns

Matrix of partial derivatives.

spiceypy.spiceypy.deltet(epoch, eptype)[source]

Return the value of Delta ET (ET-UTC) for an input epoch.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/deltet_c.html

Parameters
  • epoch (float) – Input epoch (seconds past J2000).

  • eptype (str) – Type of input epoch (“UTC” or “ET”).

Return type

float

Returns

Delta ET (ET-UTC) at input epoch.

spiceypy.spiceypy.det(m1)[source]

Compute the determinant of a double precision 3x3 matrix.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/det_c.html

Parameters

m1 (ndarray) – Matrix whose determinant is to be found.

Return type

float

Returns

The determinant of the matrix.

spiceypy.spiceypy.dgeodr(x, y, z, re, f)[source]

This routine computes the Jacobian of the transformation from rectangular to geodetic coordinates.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dgeodr_c.html

Parameters
  • x (float) – X-coordinate of point.

  • y (float) – Y-coordinate of point.

  • z (float) – Z-coord

  • re (float) – Equatorial radius of the reference spheroid.

  • f (float) – Flattening coefficient.

Return type

ndarray

Returns

Matrix of partial derivatives.

spiceypy.spiceypy.diags2(symmat)[source]

Diagonalize a symmetric 2x2 matrix.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/diags2_c.html

Parameters

symmat (Iterable[Iterable[float]]) – A symmetric 2x2 matrix.

Return type

Tuple[ndarray, ndarray]

Returns

A diagonal matrix similar to symmat, A rotation used as the similarity transformation.

spiceypy.spiceypy.diff(a, b)[source]

Take the difference of two sets of any data type to form a third set. https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/diff_c.html

Parameters
Return type

SpiceCell

Returns

Difference of a and b.

spiceypy.spiceypy.dlabbs(handle)[source]

Begin a backward segment search in a DLA file.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dlabbs_c.html

Parameters

handle (int) – Handle of open DLA file.

Return type

Tuple[SpiceDLADescr, bool]

Returns

Descriptor of last segment in DLA file

spiceypy.spiceypy.dlabfs(handle)[source]

Begin a forward segment search in a DLA file.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dlabfs_c.html

Parameters

handle (int) – Handle of open DLA file.

Return type

Tuple[SpiceDLADescr, bool]

Returns

Descriptor of next segment in DLA file

spiceypy.spiceypy.dlafns(handle, descr)[source]

Find the segment following a specified segment in a DLA file.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dlafns_c.html

Parameters
  • handle (int) – Handle of open DLA file.

  • descr (SpiceDLADescr) – Descriptor of a DLA segment.

Return type

Tuple[SpiceDLADescr, bool]

Returns

Descriptor of next segment in DLA file

spiceypy.spiceypy.dlafps(handle, descr)[source]

Find the segment preceding a specified segment in a DLA file.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dlafps_c.html

Parameters
  • handle (int) – Handle of open DLA file.

  • descr (SpiceDLADescr) – Descriptor of a segment in DLA file.

Return type

Tuple[SpiceDLADescr, bool]

Returns

Descriptor of previous segment in DLA file

spiceypy.spiceypy.dlatdr(x, y, z)[source]

This routine computes the Jacobian of the transformation from rectangular to latitudinal coordinates.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dlatdr_c.html

Parameters
  • x (float) – X-coordinate of point.

  • y (float) – Y-coordinate of point.

  • z (float) – Z-coord

Return type

ndarray

Returns

Matrix of partial derivatives.

spiceypy.spiceypy.dp2hx(number, lenout=256)[source]

Convert a double precision number to an equivalent character string using base 16 “scientific notation.”

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dp2hx_c.html

Parameters
  • number (float) – D.p. number to be converted.

  • lenout (int) – Available space for output string.

Return type

str

Returns

Equivalent character string, left justified.

spiceypy.spiceypy.dpgrdr(body, x, y, z, re, f)[source]

This routine computes the Jacobian matrix of the transformation from rectangular to planetographic coordinates.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dpgrdr_c.html

Parameters
  • body (str) – Body with which coordinate system is associated.

  • x (float) – X-coordinate of point.

  • y (float) – Y-coordinate of point.

  • z (int) – Z-coordinate of point.

  • re (float) – Equatorial radius of the reference spheroid.

  • f (float) – Flattening coefficient.

Return type

ndarray

Returns

Matrix of partial derivatives.

spiceypy.spiceypy.dpmax()[source]

Return the value of the largest (positive) number representable in a double precision variable.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dpmax_c.html

Return type

float

Returns

The largest (positive) number representable in a double precision variable.

spiceypy.spiceypy.dpmin()[source]

Return the value of the smallest (negative) number representable in a double precision variable.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dpmin_c.html

Return type

float

Returns

The smallest (negative) number that can be represented in a double precision variable.

spiceypy.spiceypy.dpr()[source]

Return the number of degrees per radian.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dpr_c.html

Return type

float

Returns

The number of degrees per radian.

spiceypy.spiceypy.drdcyl(r, lon, z)[source]

This routine computes the Jacobian of the transformation from cylindrical to rectangular coordinates.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/drdcyl_c.html

Parameters
  • r (float) – Distance of a point from the origin.

  • lon (float) – Angle of the point from the xz plane in radians.

  • z (float) – Height of the point above the xy plane.

Return type

ndarray

Returns

Matrix of partial derivatives.

spiceypy.spiceypy.drdgeo(lon, lat, alt, re, f)[source]

This routine computes the Jacobian of the transformation from geodetic to rectangular coordinates.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/drdgeo_c.html

Parameters
  • lon (float) – Geodetic longitude of point (radians).

  • lat (float) – Geodetic latitude of point (radians).

  • alt (float) – Altitude of point above the reference spheroid.

  • re (float) – Equatorial radius of the reference spheroid.

  • f (float) – Flattening coefficient.

Return type

ndarray

Returns

Matrix of partial derivatives.

spiceypy.spiceypy.drdlat(r, lon, lat)[source]

Compute the Jacobian of the transformation from latitudinal to rectangular coordinates.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/drdlat_c.html

Parameters
  • r (float) – Distance of a point from the origin.

  • lon (float) – Angle of the point from the XZ plane in radians.

  • lat (float) – Angle of the point from the XY plane in radians.

Return type

ndarray

Returns

Matrix of partial derivatives.

spiceypy.spiceypy.drdpgr(body, lon, lat, alt, re, f)[source]

This routine computes the Jacobian matrix of the transformation from planetographic to rectangular coordinates.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/drdpgr_c.html

Parameters
  • body (str) – Body with which coordinate system is associated.

  • lon (float) – Planetographic longitude of a point (radians).

  • lat (float) – Planetographic latitude of a point (radians).

  • alt (int) – Altitude of a point above reference spheroid.

  • re (float) – Equatorial radius of the reference spheroid.

  • f (float) – Flattening coefficient.

Return type

ndarray

Returns

Matrix of partial derivatives.

spiceypy.spiceypy.drdsph(r, colat, lon)[source]

This routine computes the Jacobian of the transformation from spherical to rectangular coordinates.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/drdsph_c.html

Parameters
  • r (float) – Distance of a point from the origin.

  • colat (float) – Angle of the point from the positive z-axis.

  • lon (float) – Angle of the point from the xy plane.

Return type

ndarray

Returns

Matrix of partial derivatives.

spiceypy.spiceypy.dskb02(handle, dladsc)[source]

Return bookkeeping data from a DSK type 2 segment.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dskb02_c.html

Parameters
  • handle (int) – DSK file handle

  • dladsc (SpiceDLADescr) – DLA descriptor

Return type

Tuple[int, int, int, ndarray, float, ndarray, ndarray, int, int, int, int]

Returns

bookkeeping data from a DSK type 2 segment

spiceypy.spiceypy.dskcls(handle, optmiz=False)[source]

Close a DSK file.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dskcls_c.html

Parameters
  • handle (int) – Handle assigned to the opened DSK file.

  • optmiz (bool) – Flag indicating whether to segregate the DSK.

Return type

None

Returns

spiceypy.spiceypy.dskd02(handle, dladsc, item, start, room)[source]

Fetch double precision data from a type 2 DSK segment.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dskd02_c.html

Parameters
  • handle (int) – DSK file handle

  • dladsc (SpiceDLADescr) – DLA descriptor

  • item (int) – Keyword identifying item to fetch

  • start (int) – Start index

  • room (int) – Amount of room in output array

Return type

ndarray

Returns

Array containing requested item

spiceypy.spiceypy.dskgd(handle, dladsc)[source]

Return the DSK descriptor from a DSK segment identified by a DAS handle and DLA descriptor.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dskgd_c.html

Parameters
  • handle (int) – Handle assigned to the opened DSK file.

  • dladsc (SpiceDLADescr) – DLA segment descriptor.

Return type

SpiceDSKDescr

Returns

DSK segment descriptor.

spiceypy.spiceypy.dskgtl(keywrd)[source]

Retrieve the value of a specified DSK tolerance or margin parameter.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dskgtl_c.html

Parameters

keywrd (int) – Code specifying parameter to retrieve.

Return type

float

Returns

Value of parameter.

spiceypy.spiceypy.dski02(handle, dladsc, item, start, room)[source]

Fetch integer data from a type 2 DSK segment.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dski02_c.html

Parameters
  • handle (int) – DSK file handle.

  • dladsc (SpiceDLADescr) – DLA descriptor.

  • item (int) – Keyword identifying item to fetch.

  • start (int) – Start index.

  • room (int) – Amount of room in output array.

Return type

ndarray

Returns

Array containing requested item.

spiceypy.spiceypy.dskmi2(vrtces, plates, finscl, corscl, worksz, voxpsz, voxlsz, makvtl, spxisz)[source]

Make spatial index for a DSK type 2 segment. The index is returned as a pair of arrays, one of type int and one of type float. These arrays are suitable for use with the DSK type 2 writer dskw02.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dskmi2_c.html

Parameters
  • vrtces (ndarray) – Vertices

  • plates (ndarray) – Plates

  • finscl (float) – Fine voxel scale

  • corscl (int) – Coarse voxel scale

  • worksz (int) – Workspace size

  • voxpsz (int) – Voxel plate pointer array size

  • voxlsz (int) – Voxel plate list array size

  • makvtl (bool) – Vertex plate list flag

  • spxisz (int) – Spatial index integer component size

Return type

Tuple[ndarray, ndarray]

Returns

double precision and integer components of the spatial index of the segment.

spiceypy.spiceypy.dskn02(handle, dladsc, plid)[source]

Compute the unit normal vector for a specified plate from a type 2 DSK segment.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dskn02_c.html

Parameters
  • handle (int) – DSK file handle.

  • dladsc (SpiceDLADescr) – DLA descriptor.

  • plid (int) – Plate ID.

Return type

ndarray

Returns

late’s unit normal vector.

spiceypy.spiceypy.dskobj(dsk)[source]

Find the set of body ID codes of all objects for which topographic data are provided in a specified DSK file.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dskobj_c.html

Parameters

dsk (str) – Name of DSK file.

Return type

SpiceCell

Returns

Set of ID codes of objects in DSK file.

spiceypy.spiceypy.dskopn(fname, ifname, ncomch)[source]

Open a new DSK file for subsequent write operations.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dskopn_c.html

Parameters
  • fname (str) – Name of a DSK file to be opened.

  • ifname (str) – Internal file name.

  • ncomch (int) – Number of comment characters to allocate.

Return type

int

Returns

Handle assigned to the opened DSK file.

spiceypy.spiceypy.dskp02(handle, dladsc, start, room)[source]

Fetch triangular plates from a type 2 DSK segment.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dskp02_c.html

Parameters
  • handle (int) – DSK file handle.

  • dladsc (SpiceDLADescr) – DLA descriptor.

  • start (int) – Start index.

  • room (int) – Amount of room in output array.

Return type

ndarray

Returns

Array containing plates.

spiceypy.spiceypy.dskrb2(vrtces, plates, corsys, corpar)[source]

Determine range bounds for a set of triangular plates to be stored in a type 2 DSK segment.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dskrb2_c.html

Parameters
  • vrtces (ndarray) – Vertices

  • plates (ndarray) – Plates

  • corsys (int) – DSK coordinate system code

  • corpar (ndarray) – DSK coordinate system parameters

Return type

Tuple[float, float]

Returns

Lower and Upper bound on range of third coordinate

spiceypy.spiceypy.dsksrf(dsk, bodyid)[source]

Find the set of surface ID codes for all surfaces associated with a given body in a specified DSK file.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dsksrf_c.html

Parameters
  • dsk (str) – Name of DSK file.

  • bodyid (int) – Integer body ID code.

Return type

SpiceCell

Returns

Set of ID codes of surfaces in DSK file.

spiceypy.spiceypy.dskstl(keywrd, dpval)[source]

Set the value of a specified DSK tolerance or margin parameter.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dskstl_c.html

Parameters
  • keywrd (int) – Code specifying parameter to set.

  • dpval (float) – Value of parameter.

Return type

None

Returns

spiceypy.spiceypy.dskv02(handle, dladsc, start, room)[source]

Fetch vertices from a type 2 DSK segment.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dskv02_c.html

Parameters
  • handle (int) – DSK file handle.

  • dladsc (SpiceDLADescr) – DLA descriptor.

  • start (int) – Start index.

  • room (int) – Amount of room in output array.

Return type

ndarray

Returns

Array containing vertices.

spiceypy.spiceypy.dskw02(handle, center, surfid, dclass, fname, corsys, corpar, mncor1, mxcor1, mncor2, mxcor2, mncor3, mxcor3, first, last, vrtces, plates, spaixd, spaixi)[source]

Write a type 2 segment to a DSK file.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dskw02_c.html

Parameters
  • handle (int) – Handle assigned to the opened DSK file

  • center (int) – Central body ID code

  • surfid (int) – Surface ID code

  • dclass (int) – Data class

  • fname (str) – Reference frame

  • corsys (int) – Coordinate system code

  • corpar (ndarray) – Coordinate system parameters

  • mncor1 (float) – Minimum value of first coordinate

  • mxcor1 (float) – Maximum value of first coordinate

  • mncor2 (float) – Minimum value of second coordinate

  • mxcor2 (float) – Maximum value of second coordinate

  • mncor3 (float) – Minimum value of third coordinate

  • mxcor3 (float) – Maximum value of third coordinate

  • first (float) – Coverage start time

  • last (float) – Coverage stop time

  • vrtces (ndarray) – Vertices

  • plates (ndarray) – Plates

  • spaixd (ndarray) – Double precision component of spatial index

  • spaixi (ndarray) – Integer component of spatial index

Return type

None

spiceypy.spiceypy.dskx02(handle, dladsc, vertex, raydir)[source]

Determine the plate ID and body-fixed coordinates of the intersection of a specified ray with the surface defined by a type 2 DSK plate model.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dskx02_c.html

Parameters
  • handle (int) – Handle of DSK kernel containing plate model.

  • dladsc (SpiceDLADescr) – DLA descriptor of plate model segment.

  • vertex (ndarray) – Ray’s vertex in the body fixed frame.

  • raydir (ndarray) – Ray direction in the body fixed frame.

Return type

Tuple[int, ndarray, bool]

Returns

ID code of the plate intersected by the ray, Intercept, and Flag indicating whether intercept exists.

spiceypy.spiceypy.dskxsi(pri, target, srflst, et, fixref, vertex, raydir)[source]

Compute a ray-surface intercept using data provided by multiple loaded DSK segments. Return information about the source of the data defining the surface on which the intercept was found: DSK handle, DLA and DSK descriptors, and DSK data type-dependent parameters.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dskxsi_c.html

Parameters
  • pri (bool) – Data prioritization flag.

  • target (str) – Target body name.

  • srflst (Sequence[int]) – Surface ID list.

  • et (float) – Epoch, expressed as seconds past J2000 TDB.

  • fixref (str) – Name of target body-fixed reference frame.

  • vertex (ndarray) – Vertex of ray.

  • raydir (ndarray) – Direction vector of ray.

Return type

Tuple[ndarray, int, SpiceDLADescr, SpiceDSKDescr, ndarray, ndarray, bool]

Returns

Intercept point, Handle of segment contributing surface data, DLADSC, DSKDSC, Double precision component of source info, Integer component of source info

spiceypy.spiceypy.dskxv(pri, target, srflst, et, fixref, vtxarr, dirarr)[source]

Compute ray-surface intercepts for a set of rays, using data provided by multiple loaded DSK segments.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dskxv_c.html

Parameters
  • pri (bool) – Data prioritization flag.

  • target (str) – Target body name.

  • srflst (Sequence[int]) – Surface ID list.

  • et (float) – Epoch, expressed as seconds past J2000 TDB.

  • fixref (str) – Name of target body-fixed reference frame.

  • vtxarr (Sequence[ndarray]) – Array of vertices of rays.

  • dirarr (Sequence[ndarray]) – Array of direction vectors of rays.

Return type

Tuple[ndarray, ndarray]

Returns

Intercept point array and Found flag array.

spiceypy.spiceypy.dskz02(handle, dladsc)[source]

Return plate model size parameters—plate count and vertex count—for a type 2 DSK segment.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dskz02_c.html

Parameters
  • handle (int) – DSK file handle.

  • dladsc (SpiceDLADescr) – DLA descriptor.

Return type

Tuple[int, int]

Returns

Number of vertices, Number of plates.

spiceypy.spiceypy.dsphdr(x, y, z)[source]

This routine computes the Jacobian of the transformation from rectangular to spherical coordinates.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dsphdr_c.html

Parameters
  • x (float) – X-coordinate of point.

  • y (float) – Y-coordinate of point.

  • z (float) – Z-coordinate of point.

Return type

ndarray

Returns

Matrix of partial derivatives.

spiceypy.spiceypy.dtpool(name)[source]

Return the data about a kernel pool variable.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dtpool_c.html

Parameters

name (str) – Name of the variable whose value is to be returned.

Return type

Tuple[int, str, bool]

Returns

Number of values returned for name, Type of the variable “C”, “N”, or “X”.

spiceypy.spiceypy.ducrss(s1, s2)[source]

Compute the unit vector parallel to the cross product of two 3-dimensional vectors and the derivative of this unit vector.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/ducrss_c.html

Parameters
  • s1 (ndarray) – Left hand state for cross product and derivative.

  • s2 (ndarray) – Right hand state for cross product and derivative.

Return type

ndarray

Returns

Unit vector and derivative of the cross product.

spiceypy.spiceypy.dvcrss(s1, s2)[source]

Compute the cross product of two 3-dimensional vectors and the derivative of this cross product.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dvcrss_c.html

Parameters
  • s1 (ndarray) – Left hand state for cross product and derivative.

  • s2 (ndarray) – Right hand state for cross product and derivative.

Return type

ndarray

Returns

State associated with cross product of positions.

spiceypy.spiceypy.dvdot(s1, s2)[source]

Compute the derivative of the dot product of two double precision position vectors.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dvdot_c.html

Parameters
  • s1 (Sequence[float]) – First state vector in the dot product.

  • s2 (Sequence[float]) – Second state vector in the dot product.

Return type

float

Returns

The derivative of the dot product.

spiceypy.spiceypy.dvhat(s1)[source]

Find the unit vector corresponding to a state vector and the derivative of the unit vector.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dvhat_c.html

Parameters

s1 (ndarray) – State to be normalized.

Return type

ndarray

Returns

Unit vector s1 / abs(s1), and its time derivative.

spiceypy.spiceypy.dvnorm(state)[source]

Function to calculate the derivative of the norm of a 3-vector.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dvnorm_c.html

Parameters

state (ndarray) – A 6-vector composed of three coordinates and their derivatives.

Return type

float

Returns

The derivative of the norm of a 3-vector.

spiceypy.spiceypy.dvpool(name)[source]

Delete a variable from the kernel pool.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dvpool_c.html

Parameters

name (str) – Name of the kernel variable to be deleted.

Return type

None

spiceypy.spiceypy.dvsep(s1, s2)[source]

Calculate the time derivative of the separation angle between two input states, S1 and S2.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dvsep_c.html

Parameters
  • s1 (ndarray) – State vector of the first body.

  • s2 (ndarray) – State vector of the second body.

Return type

float

Returns

The time derivative of the angular separation between S1 and S2.

spiceypy.spiceypy.edlimb(a, b, c, viewpt)[source]

Find the limb of a triaxial ellipsoid, viewed from a specified point.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/edlimb_c.html

Parameters
  • a (float) – Length of ellipsoid semi-axis lying on the x-axis.

  • b (float) – Length of ellipsoid semi-axis lying on the y-axis.

  • c (float) – Length of ellipsoid semi-axis lying on the z-axis.

  • viewpt (Iterable[float]) – Location of viewing point.

Return type

Ellipse

Returns

Limb of ellipsoid as seen from viewing point.

spiceypy.spiceypy.edterm(trmtyp, source, target, et, fixref, abcorr, obsrvr, npts)[source]

Compute a set of points on the umbral or penumbral terminator of a specified target body, where the target shape is modeled as an ellipsoid.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/edterm_c.html

Parameters
  • trmtyp (str) – Terminator type.

  • source (str) – Light source.

  • target (str) – Target body.

  • et (float) – Observation epoch.

  • fixref (str) – Body-fixed frame associated with target.

  • abcorr (str) – Aberration correction.

  • obsrvr (str) – Observer.

  • npts (int) – Number of points in terminator set.

Return type

Tuple[float, ndarray, ndarray]

Returns

Epoch associated with target center, Position of observer in body-fixed frame, Terminator point set.

spiceypy.spiceypy.ekacec(handle, segno, recno, column, nvals, cvals, isnull)[source]

Add data to a character column in a specified EK record.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/ekacec_c.html

Parameters
  • handle (int) – EK file handle.

  • segno (int) – Index of segment containing record.

  • recno (int) – Record to which data is to be added.

  • column (str) – Column name.

  • nvals (int) – Number of values to add to column.

  • cvals (Iterable[str]) – Character values to add to column.

  • isnull (bool) – Flag indicating whether column entry is null.

Return type

None

spiceypy.spiceypy.ekaced(handle, segno, recno, column, nvals, dvals, isnull)[source]

Add data to an double precision column in a specified EK record.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/ekaced_c.html

Parameters
  • handle (int) – EK file handle.

  • segno (int) – Index of segment containing record.

  • recno (int) – Record to which data is to be added.

  • column (str) – Column name.

  • nvals (int) – Number of values to add to column.

  • dvals (Iterable[float]) – Double precision values to add to column.

  • isnull (bool) – Flag indicating whether column entry is null.

Return type

None

spiceypy.spiceypy.ekacei(handle, segno, recno, column, nvals, ivals, isnull)[source]

Add data to an integer column in a specified EK record.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/ekacei_c.html

Parameters
  • handle (int) – EK file handle.

  • segno (int) – Index of segment containing record.

  • recno (int) – Record to which data is to be added.

  • column (str) – Column name.

  • nvals (int) – Number of values to add to column.

  • ivals (Iterable[int]) – Integer values to add to column.

  • isnull (bool) – Flag indicating whether column entry is null.

Return type

None

spiceypy.spiceypy.ekaclc(handle, segno, column, vallen, cvals, entszs, nlflgs, rcptrs, wkindx)[source]

Add an entire character column to an EK segment.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/ekaclc_c.html

Parameters
  • handle (int) – EK file handle.

  • segno (int) – Number of segment to add column to.

  • column (str) – Column name.

  • vallen (int) – Length of character values.

  • cvals (Iterable[str]) – Character values to add to column.

  • entszs (Iterable[int]) – Array of sizes of column entries.

  • nlflgs (Iterable[bool]) – Array of null flags for column entries.

  • rcptrs (ndarray) – Record pointers for segment.

  • wkindx (Iterable[int]) – Work space for column index.

Return type

ndarray

Returns

Work space for column index.

spiceypy.spiceypy.ekacld(handle, segno, column, dvals, entszs, nlflgs, rcptrs, wkindx)[source]

Add an entire double precision column to an EK segment.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/ekacld_c.html

Parameters
  • handle (int) – EK file handle.

  • segno (int) – Number of segment to add column to.

  • column (str) – Column name.

  • dvals (Iterable[float]) – Double precision values to add to column.

  • entszs (Iterable[int]) – Array of sizes of column entries.

  • nlflgs (Iterable[bool]) – Array of null flags for column entries.

  • rcptrs (ndarray) – Record pointers for segment.

  • wkindx (Iterable[int]) – Work space for column index.

Return type

ndarray

Returns

Work space for column index.

spiceypy.spiceypy.ekacli(handle, segno, column, ivals, entszs, nlflgs, rcptrs, wkindx)[source]

Add an entire integer column to an EK segment.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/ekacli_c.html

Parameters
  • handle (int) – EK file handle.

  • segno (int) – Number of segment to add column to.

  • column (str) – Column name.

  • ivals (Iterable[int]) – Integer values to add to column.

  • entszs (Iterable[int]) – Array of sizes of column entries.

  • nlflgs (Iterable[bool]) – Array of null flags for column entries.

  • rcptrs (ndarray) – Record pointers for segment.

  • wkindx (Iterable[int]) – Work space for column index.

Return type

ndarray

Returns

Work space for column index.

spiceypy.spiceypy.ekappr(handle, segno)[source]

Append a new, empty record at the end of a specified E-kernel segment.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/ekappr_c.html

Parameters
  • handle (int) – File handle.

  • segno (int) – Segment number.

Return type

int

Returns

Number of appended record.

spiceypy.spiceypy.ekbseg(handle, tabnam, cnames, decls)[source]

Start a new segment in an E-kernel.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/ekbseg_c.html

Parameters
  • handle (int) – File handle.

  • tabnam (str) – Table name.

  • cnames (Sequence[str]) – Names of columns.

  • decls (Sequence[str]) – Declarations of columns.

Return type

int

Returns

Segment number.

spiceypy.spiceypy.ekccnt(table)[source]

Return the number of distinct columns in a specified, currently loaded table.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/ekccnt_c.html

Parameters

table (str) – Name of table.

Return type

int

Returns

Count of distinct, currently loaded columns.

spiceypy.spiceypy.ekcii(table, cindex, lenout=256)[source]

Return attribute information about a column belonging to a loaded EK table, specifying the column by table and index.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/ekcii_c.html

Parameters
  • table (str) – Name of table containing column.

  • cindex (int) – Index of column whose attributes are to be found.

  • lenout (int) – Maximum allowed length of column name.

Return type

Tuple[str, SpiceEKAttDsc]

Returns

Name of column, Column attribute descriptor.

spiceypy.spiceypy.ekcls(handle)[source]

Close an E-kernel.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/ekcls_c.html

Parameters

handle (int) – EK file handle.

Return type

None

spiceypy.spiceypy.ekdelr(handle, segno, recno)[source]

Delete a specified record from a specified E-kernel segment.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/ekdelr_c.html

Parameters
  • handle (int) – File handle.

  • segno (int) – Segment number.

  • recno (int) – Record number.

Return type

None

spiceypy.spiceypy.ekffld(handle, segno, rcptrs)[source]

Complete a fast write operation on a new E-kernel segment.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/ekffld_c.html

Parameters
  • handle (int) – File handle.

  • segno (int) – Segment number.

  • rcptrs (ndarray) – Record pointers.

Return type

None

spiceypy.spiceypy.ekfind(query, lenout=256)[source]

Find E-kernel data that satisfy a set of constraints.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/ekfind_c.html

Parameters
  • query (str) – Query specifying data to be found.

  • lenout (int) – Declared length of output error message string.

Return type

Tuple[int, int, str]

Returns

Number of matching rows, Flag indicating whether query parsed correctly, Parse error description.

spiceypy.spiceypy.ekgc(selidx, row, element, lenout=256)[source]

Return an element of an entry in a column of character type in a specified row.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/ekgc_c.html

Parameters
  • selidx (int) – Index of parent column in SELECT clause.

  • row (int) – Row to fetch from.

  • element (int) – Index of element, within column entry, to fetch.

  • lenout (int) – Maximum length of column element.

Return type

Tuple[str, int, bool]

Returns

Character string element of column entry, Flag indicating whether column entry was null.

spiceypy.spiceypy.ekgd(selidx, row, element)[source]

Return an element of an entry in a column of double precision type in a specified row.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/ekgd_c.html

Parameters
  • selidx (int) – Index of parent column in SELECT clause.

  • row (int) – Row to fetch from.

  • element (int) – Index of element, within column entry, to fetch.

Return type

Tuple[float, int, bool]

Returns

Double precision element of column entry, Flag indicating whether column entry was null.

spiceypy.spiceypy.ekgi(selidx, row, element)[source]

Return an element of an entry in a column of integer type in a specified row.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/ekgi_c.html

Parameters
  • selidx (int) – Index of parent column in SELECT clause.

  • row (int) – Row to fetch from.

  • element (int) – Index of element, within column entry, to fetch.

Return type

Tuple[int, int, bool]

Returns

Integer element of column entry, Flag indicating whether column entry was null.

spiceypy.spiceypy.ekifld(handle, tabnam, ncols, nrows, cnmlen, cnames, declen, decls)[source]

Initialize a new E-kernel segment to allow fast writing.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/ekifld_c.html

Parameters
  • handle (int) – File handle.

  • tabnam (str) – Table name.

  • ncols (int) – Number of columns in the segment.

  • nrows (int) – Number of rows in the segment.

  • cnmlen (int) – Length of names in in column name array.

  • cnames (Iterable[str]) – Names of columns.

  • declen (int) – Length of declaration strings in declaration array.

  • decls (Iterable[str]) – Declarations of columns.

Return type

Tuple[int, ndarray]

Returns

Segment number, Array of record pointers.

spiceypy.spiceypy.ekinsr(handle, segno, recno)[source]

Add a new, empty record to a specified E-kernel segment at a specified index.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/ekinsr_c.html

Parameters
  • handle (int) – File handle.

  • segno (int) – Segment number.

  • recno (int) – Record number.

Return type

None

spiceypy.spiceypy.eklef(fname)[source]

Load an EK file, making it accessible to the EK readers.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/eklef_c.html

Parameters

fname (str) – Name of EK file to load.

Return type

int

Returns

File handle of loaded EK file.

spiceypy.spiceypy.eknelt(selidx, row)[source]

Return the number of elements in a specified column entry in the current row.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/eknelt_c.html

Parameters
  • selidx (int) – Index of parent column in SELECT clause.

  • row (int) – Row containing element.

Return type

int

Returns

The number of elements in entry in current row.

spiceypy.spiceypy.eknseg(handle)[source]

Return the number of segments in a specified EK.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/eknseg_c.html

Parameters

handle (int) – EK file handle.

Return type

int

Returns

The number of segments in the specified E-kernel.

spiceypy.spiceypy.ekntab()[source]

Return the number of loaded EK tables.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/ekntab_c.html

Return type

int

Returns

The number of loaded EK tables.

spiceypy.spiceypy.ekopn(fname, ifname, ncomch)[source]

Open a new E-kernel file and prepare the file for writing.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/ekopn_c.html

Parameters
  • fname (str) – Name of EK file.

  • ifname (str) – Internal file name.

  • ncomch (int) – The number of characters to reserve for comments.

Return type

int

Returns

Handle attached to new EK file.

spiceypy.spiceypy.ekopr(fname)[source]

Open an existing E-kernel file for reading.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/ekopr_c.html

Parameters

fname (str) – Name of EK file.

Return type

int

Returns

Handle attached to EK file.

spiceypy.spiceypy.ekops()[source]

Open a scratch (temporary) E-kernel file and prepare the file for writing.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/ekops_c.html

Return type

int

Returns

Handle attached to new EK file.

spiceypy.spiceypy.ekopw(fname)[source]

Open an existing E-kernel file for writing.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/ekopw_c.html

Parameters

fname (str) – Name of EK file.

Return type

int

Returns

Handle attached to EK file.

spiceypy.spiceypy.ekpsel(query, msglen, tablen, collen)[source]

Parse the SELECT clause of an EK query, returning full particulars concerning each selected item.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/ekpsel_c.html note: oddly docs at url are incomplete/incorrect.

Parameters
  • query (str) – EK query.

  • msglen (int) – Available space in the output error message string.

  • tablen (int) – UNKNOWN? Length of Table?

  • collen (int) – UNKOWN? Length of Column?

Return type

Tuple[int, ndarray, ndarray, ndarray, ndarray, Iterable[str], Iterable[str], int, str]

Returns

Number of items in SELECT clause of query, Begin positions of expressions in SELECT clause, End positions of expressions in SELECT clause, Data types of expressions, Classes of expressions, Names of tables qualifying SELECT columns, Names of columns in SELECT clause of query, Error flag, Parse error message.

spiceypy.spiceypy.ekrcec(handle, segno, recno, column, lenout, nelts=100)[source]

Read data from a character column in a specified EK record.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/ekrcec_c.html

Parameters
  • handle (int) – Handle attached to EK file.

  • segno (int) – Index of segment containing record.

  • recno (int) – Record from which data is to be read.

  • column (str) – Column name.

  • lenout (int) – Maximum length of output strings.

  • nelts (int) – Number of elements to allow for (default=100)

Return type

Tuple[int, Iterable[str], bool]

Returns

Number of values in column entry, Character values in column entry, Flag indicating whether column entry is null.

spiceypy.spiceypy.ekrced(handle, segno, recno, column, nelts=100)[source]

Read data from a double precision column in a specified EK record.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/ekrced_c.html

Parameters
  • handle (int) – Handle attached to EK file.

  • segno (int) – Index of segment containing record.

  • recno (int) – Record from which data is to be read.

  • column (str) – Column name.

  • nelts (int) – room for data default 100

Return type

Tuple[int, ndarray, bool]

Returns

Number of values in column entry, Float values in column entry, Flag indicating whether column entry is null.

spiceypy.spiceypy.ekrcei(handle, segno, recno, column, nelts=100)[source]

Read data from an integer column in a specified EK record.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/ekrcei_c.html

Parameters
  • handle (int) – Handle attached to EK file.

  • segno (int) – Index of segment containing record.

  • recno (int) – Record from which data is to be read.

  • column (str) – Column name.

  • nelts (int) – room for data default 100

Return type

Tuple[int, ndarray, bool]

Returns

Number of values in column entry, Integer values in column entry, Flag indicating whether column entry is null.

spiceypy.spiceypy.ekssum(handle, segno)[source]

Return summary information for a specified segment in a specified EK.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/ekssum_c.html

Parameters
  • handle (int) – Handle of EK.

  • segno (int) – Number of segment to be summarized.

Return type

SpiceEKSegSum

Returns

EK segment summary.

spiceypy.spiceypy.ektnam(n, lenout=256)[source]

Return the name of a specified, loaded table.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/ektnam_c.html

Parameters
  • n (int) – Index of table.

  • lenout (int) – Maximum table name length.

Return type

str

Returns

Name of table.

spiceypy.spiceypy.ekucec(handle, segno, recno, column, nvals, cvals, isnull)[source]

Update a character column entry in a specified EK record.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/ekucec_c.html

Parameters
  • handle (int) – EK file handle.

  • segno (int) – Index of segment containing record.

  • recno (int) – Record to which data is to be updated.

  • column (str) – Column name.

  • nvals (int) – Number of values in new column entry.

  • cvals (Iterable[str]) – Character values comprising new column entry.

  • isnull (bool) – Flag indicating whether column entry is null.

Return type

None

spiceypy.spiceypy.ekuced(handle, segno, recno, column, nvals, dvals, isnull)[source]

Update a double precision column entry in a specified EK record.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/ekuced_c.html

Parameters
  • handle (int) – EK file handle.

  • segno (int) – Index of segment containing record.

  • recno (int) – Record to which data is to be updated.

  • column (str) – Column name.

  • nvals (int) – Number of values in new column entry.

  • dvals (Iterable[float]) – Double precision values comprising new column entry.

  • isnull (bool) – Flag indicating whether column entry is null.

Return type

None

spiceypy.spiceypy.ekucei(handle, segno, recno, column, nvals, ivals, isnull)[source]

Update an integer column entry in a specified EK record.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/ekucei_c.html

Parameters
  • handle (int) – EK file handle.

  • segno (int) – Index of segment containing record.

  • recno (int) – Record to which data is to be updated.

  • column (str) – Column name.

  • nvals (int) – Number of values in new column entry.

  • ivals (Iterable[int]) – Integer values comprising new column entry.

  • isnull (bool) – Flag indicating whether column entry is null.

Return type

None

spiceypy.spiceypy.ekuef(handle)[source]

Unload an EK file, making its contents inaccessible to the EK reader routines, and clearing space in order to allow other EK files to be loaded.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/ekuef_c.html

Parameters

handle (int) – Handle of EK file.

Return type

None

spiceypy.spiceypy.el2cgv(ellipse)[source]

Convert an ellipse to a center vector and two generating vectors. The selected generating vectors are semi-axes of the ellipse.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/el2cgv_c.html

Parameters

ellipse (Ellipse) – An Ellipse

Return type

Tuple[ndarray, ndarray, ndarray]

Returns

Center and semi-axes of ellipse.

spiceypy.spiceypy.elemc(item, inset)[source]

Determine whether an item is an element of a character set.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/elemc_c.html

Parameters
  • item (str) – Item to be tested.

  • inset (SpiceCell) – Set to be tested.

Return type

bool

Returns

True if item is an element of set.

spiceypy.spiceypy.elemd(item, inset)[source]

Determine whether an item is an element of a double precision set.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/elemd_c.html

Parameters
  • item (float) – Item to be tested.

  • inset (SpiceCell) – Set to be tested.

Return type

bool

Returns

True if item is an element of set.

spiceypy.spiceypy.elemi(item, inset)[source]

Determine whether an item is an element of an integer set.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/elemi_c.html

Parameters
  • item (int) – Item to be tested.

  • inset (SpiceCell) – Set to be tested.

Return type

bool

Returns

True if item is an element of set.

spiceypy.spiceypy.eqncpv(et, epoch, eqel, rapol, decpol)[source]

Compute the state (position and velocity of an object whose trajectory is described via equinoctial elements relative to some fixed plane (usually the equatorial plane of some planet).

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/eqncpv_c.html

Parameters
  • et (float) – Epoch in seconds past J2000 to find state.

  • epoch (float) – Epoch of elements in seconds past J2000.

  • eqel (Iterable[float]) – Array of equinoctial elements

  • rapol (float) – Right Ascension of the pole of the reference plane.

  • decpol (float) – Declination of the pole of the reference plane.

Return type

ndarray

Returns

State of the object described by eqel.

spiceypy.spiceypy.eqstr(a, b)[source]

Determine whether two strings are equivalent.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/eqstr_c.html

Parameters
  • a (str) – Arbitrary character string.

  • b (str) – Arbitrary character string.

Return type

bool

Returns

True if A and B are equivalent.

spiceypy.spiceypy.erract(op, lenout, action=None)[source]

Retrieve or set the default error action. spiceypy sets the default error action to “report” on init.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/erract_c.html

Parameters
  • op (str) – peration, “GET” or “SET”.

  • lenout (int) – Length of list for output.

  • action (Optional[str]) – Error response action.

Return type

str

Returns

Error response action.

spiceypy.spiceypy.errch(marker, string)[source]

Substitute a character string for the first occurrence of a marker in the current long error message.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/errch_c.html

Parameters
  • marker (str) – A substring of the error message to be replaced.

  • string (str) – The character string to substitute for marker.

Return type

None

spiceypy.spiceypy.errdev(op, lenout, device)[source]

Retrieve or set the name of the current output device for error messages.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/errdev_c.html

Parameters
  • op (str) – The operation, “GET” or “SET”.

  • lenout (int) – Length of device for output.

  • device (str) – The device name.

Return type

str

Returns

The device name.

spiceypy.spiceypy.errdp(marker, number)[source]

Substitute a double precision number for the first occurrence of a marker found in the current long error message.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/errdp_c.html

Parameters
  • marker (str) – A substring of the error message to be replaced.

  • number (float) – The d.p. number to substitute for marker.

Return type

None

spiceypy.spiceypy.errint(marker, number)[source]

Substitute an integer for the first occurrence of a marker found in the current long error message.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/errint_c.html

Parameters
  • marker (str) – A substring of the error message to be replaced.

  • number (int) – The integer to substitute for marker.

Return type

None

spiceypy.spiceypy.errprt(op, lenout, inlist)[source]

Retrieve or set the list of error message items to be output when an error is detected.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/errprt_c.html

Parameters
  • op (str) – The operation, “GET” or “SET”.

  • lenout (int) – Length of list for output.

  • inlist (str) – Specification of error messages to be output.

Return type

str

Returns

A list of error message items.

spiceypy.spiceypy.esrchc(value, array)[source]

Search for a given value within a character string array. Return the index of the first equivalent array entry, or -1 if no equivalent element is found.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/esrchc_c.html

Parameters
  • value (str) – Key value to be found in array.

  • array (Sequence[str]) – Character string array to search.

Return type

int

Returns

The index of the first array entry equivalent to value, or -1 if none is found.

spiceypy.spiceypy.et2datetime(et)[source]

Convert an input time from ephemeris seconds past J2000 to a standard Python datetime.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/req/time.html#The%20J2000%20Epoch

Parameters

et (Union[Iterable[float], float]) – Input epoch, given in ephemeris seconds past J2000.

Return type

Union[ndarray, datetime]

Returns

Output datetime object in UTC

spiceypy.spiceypy.et2lst(et, body, lon, typein, timlen=256, ampmlen=256)[source]

Given an ephemeris epoch, compute the local solar time for an object on the surface of a body at a specified longitude.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/et2lst_c.html

Parameters
  • et (float) – Epoch in seconds past J2000 epoch.

  • body (int) – ID-code of the body of interest.

  • lon (float) – Longitude of surface point (RADIANS).

  • typein (str) – Type of longitude “PLANETOCENTRIC”, etc.

  • timlen (int) – Available room in output time string.

  • ampmlen (int) – Available room in output ampm string.

Return type

Tuple[int, int, int, str, str]

Returns

Local hour on a “24 hour” clock, Minutes past the hour, Seconds past the minute, String giving local time on 24 hour clock, String giving time on A.M. / P.M. scale.

spiceypy.spiceypy.et2utc(et, format_str, prec, lenout=256)[source]

Convert an input time from ephemeris seconds past J2000 to Calendar, Day-of-Year, or Julian Date format, UTC.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/et2utc_c.html

Parameters
  • et (Union[float, Iterable[float]]) – Input epoch, given in ephemeris seconds past J2000.

  • format_str (str) – Format of output epoch.

  • prec (int) – Digits of precision in fractional seconds or days.

  • lenout (int) – The length of the output string plus 1.

Return type

Union[ndarray, str]

Returns

Output time string in UTC

spiceypy.spiceypy.etcal(et, lenout=256)[source]

Convert from an ephemeris epoch measured in seconds past the epoch of J2000 to a calendar string format using a formal calendar free of leapseconds.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/etcal_c.html

Parameters
  • et (Union[float, ndarray]) – Ephemeris time measured in seconds past J2000.

  • lenout (int) – Length of output string.

Return type

Union[str, Iterable[str]]

Returns

A standard calendar representation of et.

spiceypy.spiceypy.eul2m(angle3, angle2, angle1, axis3, axis2, axis1)[source]

Construct a rotation matrix from a set of Euler angles.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/eul2m_c.html

Parameters
  • angle3 (float) – Rotation angle about third rotation axis (radians).

  • angle2 (float) – Rotation angle about second rotation axis (radians).

  • angle1 (float) – Rotation angle about first rotation axis (radians).

  • axis3 (int) – Axis number of third rotation axis.

  • axis2 (int) – Axis number of second rotation axis.

  • axis1 (int) – Axis number of first rotation axis.]

Return type

ndarray

Returns

Product of the 3 rotations.

spiceypy.spiceypy.eul2xf(eulang, axisa, axisb, axisc)[source]

This routine computes a state transformation from an Euler angle factorization of a rotation and the derivatives of those Euler angles.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/eul2xf_c.html

Parameters
  • eulang (Sequence[float]) – An array of Euler angles and their derivatives.

  • axisa (int) – Axis A of the Euler angle factorization.

  • axisb (int) – Axis B of the Euler angle factorization.

  • axisc (int) – Axis C of the Euler angle factorization.

Return type

ndarray

Returns

A state transformation matrix.

spiceypy.spiceypy.ev2lin(et, geophs, elems)[source]

This routine evaluates NORAD two-line element data for near-earth orbiting spacecraft (that is spacecraft with orbital periods less than 225 minutes).

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/FORTRAN/spicelib/ev2lin.html

Parameters
  • et (float) – Epoch in seconds past ephemeris epoch J2000.

  • geophs (Sequence[float]) – Geophysical constants

  • elems (Sequence[float]) – Two-line element data

Return type

ndarray

Returns

Evaluated state

spiceypy.spiceypy.exists(fname)[source]

Determine whether a file exists.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/exists_c.html

Parameters

fname (str) – Name of the file in question.

Return type

bool

Returns

True if the file exists, False otherwise.

spiceypy.spiceypy.expool(name)[source]

Confirm the existence of a kernel variable in the kernel pool.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/expool_c.html

Parameters

name (str) – Name of the variable whose value is to be returned.

Return type

bool

Returns

True when the variable is in the pool.

spiceypy.spiceypy.failed()[source]

True if an error condition has been signalled via sigerr_c.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/failed_c.html

Return type

bool

Returns

a boolean

spiceypy.spiceypy.fn2lun(fname)[source]

Internal undocumented command for mapping name of open file to its FORTRAN (F2C) logical unit.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/FORTRAN/spicelib/fn2lun.html

Parameters

fname (str) – name of the file to be mapped to its logical unit.

Return type

int

Returns

the FORTRAN (F2C) logical unit associated with the filename.

spiceypy.spiceypy.found_check()[source]

Temporarily enables spiceypy default behavior which raises exceptions for false found flags for certain spice functions. All spice functions executed within the context manager will check the found flag return parameter and the found flag will be removed from the return for the given function. For Example bodc2n in spiceypy is normally called like:

name = spice.bodc2n(399)

With the possibility that an exception is thrown in the even of a invalid ID:

name = spice.bodc2n(-999991) # throws a SpiceyError

With this function however, we can use it as a context manager to do this:

with spice.found_check():
    found = spice.bodc2n(-999991) # will raise an exception!

Within the context any spice functions called that normally check the found flags will pass through the check without raising an exception if they are false.

Return type

Iterator[None]

spiceypy.spiceypy.found_check_off()[source]

Method that turns off found catching

Return type

None

spiceypy.spiceypy.found_check_on()[source]

Method that turns on found catching

Return type

None

spiceypy.spiceypy.fovray(inst, raydir, rframe, abcorr, observer, et)[source]

Determine if a specified ray is within the field-of-view (FOV) of a specified instrument at a given time.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/fovray_c.html

Parameters
  • inst (str) – Name or ID code string of the instrument.

  • raydir (Iterable[float]) – Ray’s direction vector.

  • rframe (str) – Body-fixed, body-centered frame for target body.

  • abcorr (str) – Aberration correction flag.

  • observer (str) – Name or ID code string of the observer.

  • et (float) – Time of the observation (seconds past J2000).

Return type

bool

Returns

Visibility flag

spiceypy.spiceypy.fovtrg(inst, target, tshape, tframe, abcorr, observer, et)[source]

Determine if a specified ephemeris object is within the field-of-view (FOV) of a specified instrument at a given time.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/fovtrg_c.html

Parameters
  • inst (str) – Name or ID code string of the instrument.

  • target (str) – Name or ID code string of the target.

  • tshape (str) – Type of shape model used for the target.

  • tframe (str) – Body-fixed, body-centered frame for target body.

  • abcorr (str) – Aberration correction flag.

  • observer (str) – Name or ID code string of the observer.

  • et (float) – Time of the observation (seconds past J2000).

Return type

bool

Returns

Visibility flag

spiceypy.spiceypy.frame(x)[source]

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/frame_c.html

Parameters

x (Iterable[float]) – Input vector. A parallel unit vector on output.

Return type

Tuple[ndarray, ndarray, ndarray]

Returns

a tuple of 3 list[3]

spiceypy.spiceypy.frinfo(frcode)[source]

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/frinfo_c.html

Parameters

frcode (int) – the idcode for some frame.

Return type

Tuple[int, int, int, bool]

Returns

a tuple of attributes associated with the frame.

spiceypy.spiceypy.frmnam(frcode, lenout=256)[source]

Retrieve the name of a reference frame associated with a SPICE ID code.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/frmnam_c.html

Parameters
  • frcode (int) – an integer code for a reference frame

  • lenout (int) – Maximum length of output string.

Return type

str

Returns

the name associated with the reference frame.

spiceypy.spiceypy.ftncls(unit)[source]

Close a file designated by a Fortran-style integer logical unit.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/ftncls_c.html

Parameters

unit (int) – Fortran-style logical unit.

Return type

None

spiceypy.spiceypy.furnsh(path)[source]

Load one or more SPICE kernels into a program.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/furnsh_c.html

Parameters

path (Union[str, Iterable[str]]) – one or more paths to kernels

Return type

None

spiceypy.spiceypy.gcpool(name, start, room, lenout=256)[source]

Return the character value of a kernel variable from the kernel pool.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/gcpool_c.html

Parameters
  • name (str) – Name of the variable whose value is to be returned.

  • start (int) – Which component to start retrieving for name.

  • room (int) – The largest number of values to return.

  • lenout (int) – The length of the output string.

Return type

Tuple[Iterable[str], bool]

Returns

Values associated with name.

spiceypy.spiceypy.gdpool(name, start, room)[source]

Return the d.p. value of a kernel variable from the kernel pool.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/gdpool_c.html

Parameters
  • name (str) – Name of the variable whose value is to be returned.

  • start (int) – Which component to start retrieving for name.

  • room (int) – The largest number of values to return.

Return type

Tuple[ndarray, bool]

Returns

Values associated with name.

spiceypy.spiceypy.georec(lon, lat, alt, re, f)[source]

Convert geodetic coordinates to rectangular coordinates.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/georec_c.html

Parameters
  • lon (float) – Geodetic longitude of point (radians).

  • lat (float) – Geodetic latitude of point (radians).

  • alt (float) – Altitude of point above the reference spheroid.

  • re (float) – Equatorial radius of the reference spheroid.

  • f (float) – Flattening coefficient.

Return type

ndarray

Returns

Rectangular coordinates of point.

spiceypy.spiceypy.get_found_catch_state()[source]

Returns the current found catch state

Return type

bool

Returns

spiceypy.spiceypy.getelm(frstyr, lineln, lines)[source]

Given a the “lines” of a two-line element set, parse the lines and return the elements in units suitable for use in SPICE software.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/getelm_c.html

Parameters
  • frstyr (int) – Year of earliest representable two-line elements.

  • lineln (int) – Length of strings in lines array.

  • lines (Iterable[str]) – A pair of “lines” containing two-line elements.

Return type

Tuple[float, ndarray]

Returns

The epoch of the elements in seconds past J2000, The elements converted to SPICE units.

spiceypy.spiceypy.getfat(file)[source]

Determine the file architecture and file type of most SPICE kernel files.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/getfat_c.html

Parameters

file (str) – The name of a file to be examined.

Return type

Tuple[str, str]

Returns

The architecture of the kernel file, The type of the kernel file.

spiceypy.spiceypy.getfov(instid, room, shapelen=256, framelen=256)[source]

This routine returns the field-of-view (FOV) parameters for a specified instrument.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/getfov_c.html

Parameters
  • instid (int) – NAIF ID of an instrument.

  • room (int) – Maximum number of vectors that can be returned.

  • shapelen (int) – Space available in the string shape.

  • framelen (int) – Space available in the string frame.

Return type

Tuple[str, str, ndarray, int, ndarray]

Returns

Instrument FOV shape, Name of the frame in which FOV vectors are defined, Boresight vector, Number of boundary vectors returned, FOV boundary vectors.

spiceypy.spiceypy.getmsg(option, lenout=256)[source]

Retrieve the current short error message, the explanation of the short error message, or the long error message.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/getmsg_c.html

Parameters
  • option (str) – Indicates type of error message.

  • lenout (int) – Available space in the output string msg.

Return type

str

Returns

The error message to be retrieved.

spiceypy.spiceypy.gfbail()[source]

Indicate whether an interrupt signal (SIGINT) has been received.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/gfbail_c.html

Return type

bool

Returns

True if an interrupt signal has been received by the GF handler.

spiceypy.spiceypy.gfclrh()[source]

Clear the interrupt signal handler status, so that future calls to gfbail() will indicate no interrupt was received.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/gfclrh_c.html

Return type

None

spiceypy.spiceypy.gfdist(target, abcorr, obsrvr, relate, refval, adjust, step, nintvls, cnfine, result=None)[source]

Return the time window over which a specified constraint on observer-target distance is met.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/gfdist_c.html

Parameters
  • target (str) – Name of the target body.

  • abcorr (str) – Aberration correction flag.

  • obsrvr (str) – Name of the observing body.

  • relate (str) – Relational operator.

  • refval (int) – Reference value.

  • adjust (float) – Adjustment value for absolute extrema searches.

  • step (float) – Step size used for locating extrema and roots.

  • nintvls (int) – Workspace window interval count.

  • cnfine (SpiceCell) – SPICE window to which the search is confined.

  • result (Optional[SpiceCell]) – Optional SPICE window containing results.

Return type

SpiceCell

spiceypy.spiceypy.gfevnt(udstep, udrefn, gquant, qnpars, lenvals, qpnams, qcpars, qdpars, qipars, qlpars, op, refval, tol, adjust, rpt, udrepi, udrepu, udrepf, nintvls, bail, udbail, cnfine, result=None)[source]

Determine time intervals when a specified geometric quantity satisfies a specified mathematical condition.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/gfevnt_c.html

Parameters
  • udstep (CFunctionType) – Name of the routine that computes and returns a

  • udrefn (CFunctionType) – Name of the routine that computes a refined time

  • gquant (str) – Type of geometric quantity

  • qnpars (int) – Number of quantity definition parameters

  • lenvals (int) – Length of strings in qpnams and qcpars

  • qpnams (Iterable[str]) – Names of quantity definition parameters

  • qcpars (Iterable[str]) – Array of character quantity definition parameters

  • qdpars (Iterable[float]) – Array of double precision quantity definition

  • qipars (Iterable[int]) – Array of integer quantity definition parameters

  • qlpars (Iterable[int]) – Array of logical quantity definition parameters

  • op (str) – Operator that either looks for an extreme value

  • refval (float) – Reference value

  • tol (float) – Convergence tolerance in seconds

  • adjust (float) – Absolute extremum adjustment value

  • rpt (int) – Progress reporter on TRUE or off FALSE

  • udrepi (CFunctionType) – Function that initializes progress reporting

  • udrepu (CFunctionType) – Function that updates the progress report

  • udrepf (CFunctionType) – Function that finalizes progress reporting

  • nintvls (int) – Workspace window interval count

  • bail (int) – Logical indicating program interrupt monitoring

  • udbail (CFunctionType) – Name of a routine that signals a program interrupt

  • cnfine (SpiceCell) – SPICE window to which the search is restricted

  • result (Optional[SpiceCell]) – Optional SPICE window containing results

spiceypy.spiceypy.gffove(inst, tshape, raydir, target, tframe, abcorr, obsrvr, tol, udstep, udrefn, rpt, udrepi, udrepu, udrepf, bail, udbail, cnfine, result=None)[source]

Determine time intervals when a specified target body or ray intersects the space bounded by the field-of-view (FOV) of a specified instrument. Report progress and handle interrupts if so commanded.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/gffove_c.html

Parameters
  • inst (str) – Name of the instrument

  • tshape (str) – Type of shape model used for target body

  • raydir (Iterable[float]) – Ray s direction vector

  • target (str) – Name of the target body

  • tframe (str) – Body fixed body centered frame for target body

  • abcorr (str) – Aberration correction flag

  • obsrvr (str) – Name of the observing body

  • tol (float) – Convergence tolerance in seconds

  • udstep (CFunctionType) – Name of the routine that returns a time step

  • udrefn (CFunctionType) – Name of the routine that computes a refined time

  • rpt (int) – Progress report flag

  • udrepi (CFunctionType) – Function that initializes progress reporting.

  • udrepu (CFunctionType) – Function that updates the progress report

  • udrepf (CFunctionType) – Function that finalizes progress reporting

  • bail (int) – Logical indicating program interrupt monitoring

  • udbail (CFunctionType) – Name of a routine that signals a program interrupt

  • cnfine (SpiceCell) – SPICE window to which the search is restricted

  • result (Optional[SpiceCell]) – Optional SPICE window containing results

spiceypy.spiceypy.gfilum(method, angtyp, target, illumn, fixref, abcorr, obsrvr, spoint, relate, refval, adjust, step, nintvls, cnfine, result=None)[source]

Return the time window over which a specified constraint on the observed phase, solar incidence, or emission angle at a specifed target body surface point is met.

Parameters
  • method (str) – Shape model used to represent the surface of the target body.

  • angtyp (str) – The type of illumination angle for which a search is to be performed.

  • target (str) – Name of a target body.

  • illumn (str) – Name of the illumination source.

  • fixref (str) – Name of the body-fixed, body-centered reference frame associated with the target body.

  • abcorr (str) – The aberration corrections to be applied.

  • obsrvr (str) – Name of an observing body.

  • spoint (Iterable[float]) – Body-fixed coordinates of a target surface point.

  • relate (str) – Relational operator used to define a constraint on a specified illumination angle.

  • refval (float) – Reference value used with ‘relate’ to define an equality or inequality to be satisfied by the specified illumination angle.

  • adjust (float) – Parameter used to modify searches for absolute extrema.

  • step (float) – Step size to be used in the search.

  • nintvls (int) – Number of intervals that can be accommodated by each of the dynamically allocated workspace windows used internally by this routine.

  • cnfine (SpiceCell) – Window that confines the time period over which the specified search is conducted. This can be updated by gfilum

  • result (Optional[SpiceCell]) – Optional SPICE Window of intervals in the confinement window that the illumination angle constraint is satisfied.

Return type

SpiceCell

spiceypy.spiceypy.gfinth(sigcode)[source]

Respond to the interrupt signal SIGINT: save an indication that the signal has been received. This routine restores itself as the handler for SIGINT.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/gfinth_c.html

Parameters

sigcode (int) – Interrupt signal ID code.

Return type

None

spiceypy.spiceypy.gfocce(occtyp, front, fshape, fframe, back, bshape, bframe, abcorr, obsrvr, tol, udstep, udrefn, rpt, udrepi, udrepu, udrepf, bail, udbail, cnfine, result=None)[source]

Determine time intervals when an observer sees one target occulted by another. Report progress and handle interrupts if so commanded.

The surfaces of the target bodies may be represented by triaxial ellipsoids or by topographic data provided by DSK files.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/gfocce_c.html

Parameters
  • occtyp (str) – Type of occultation

  • front (str) – Name of body occulting the other

  • fshape (str) – Type of shape model used for front body

  • fframe (str) – Body fixed body centered frame for front body

  • back (str) – Name of body occulted by the other

  • bshape (str) – Type of shape model used for back body

  • bframe (str) – Body fixed body centered frame for back body

  • abcorr (str) – Aberration correction flag

  • obsrvr (str) – Name of the observing body

  • tol (float) – Convergence tolerance in seconds

  • udstep (CFunctionType) – Name of the routine that returns a time step

  • udrefn (CFunctionType) – Name of the routine that computes a refined time

  • rpt (int) – Progress report flag

  • udrepi (CFunctionType) – Function that initializes progress reporting.

  • udrepu (CFunctionType) – Function that updates the progress report

  • udrepf (CFunctionType) – Function that finalizes progress reporting

  • bail (int) – Logical indicating program interrupt monitoring

  • udbail (CFunctionType) – Name of a routine that signals a program interrupt

  • cnfine (SpiceCell) – SPICE window to which the search is restricted

  • result (Optional[SpiceCell]) – Optional SPICE window containing results.

spiceypy.spiceypy.gfoclt(occtyp, front, fshape, fframe, back, bshape, bframe, abcorr, obsrvr, step, cnfine, result=None)[source]

Determine time intervals when an observer sees one target occulted by, or in transit across, another.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/gfoclt_c.html

Parameters
  • occtyp (str) – Type of occultation.

  • front (str) – Name of body occulting the other.

  • fshape (str) – Type of shape model used for front body.

  • fframe (str) – Body-fixed, body-centered frame for front body.

  • back (str) – Name of body occulted by the other.

  • bshape (str) – Type of shape model used for back body.

  • bframe (str) – Body-fixed, body-centered frame for back body.

  • abcorr (str) – Aberration correction flag.

  • obsrvr (str) – Name of the observing body.

  • step (float) – Step size in seconds for finding occultation events.

  • cnfine (SpiceCell) – SPICE window to which the search is restricted.

  • result (Optional[SpiceCell]) – Optional SPICE window containing results.

Return type

SpiceCell

spiceypy.spiceypy.gfpa(target, illmin, abcorr, obsrvr, relate, refval, adjust, step, nintvals, cnfine, result=None)[source]

Determine time intervals for which a specified constraint on the phase angle between an illumination source, a target, and observer body centers is met.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/gfpa_c.html

Parameters
  • target (str) – Name of the target body.

  • illmin (str) – Name of the illuminating body.

  • abcorr (str) – Aberration correction flag.

  • obsrvr (str) – Name of the observing body.

  • relate (str) – Relational operator.

  • refval (float) – Reference value.

  • adjust (float) – Adjustment value for absolute extrema searches.

  • step (float) – Step size used for locating extrema and roots.

  • nintvals (int) – Workspace window interval count.

  • cnfine (SpiceCell) – SPICE window to which the search is restricted.

  • result (Optional[SpiceCell]) – Optional SPICE window containing results.

Return type

SpiceCell

spiceypy.spiceypy.gfposc(target, inframe, abcorr, obsrvr, crdsys, coord, relate, refval, adjust, step, nintvals, cnfine, result=None)[source]

Determine time intervals for which a coordinate of an observer-target position vector satisfies a numerical constraint.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/gfposc_c.html

Parameters
  • target (str) – Name of the target body.

  • inframe (str) – Name of the reference frame for coordinate calculations.

  • abcorr (str) – Aberration correction flag.

  • obsrvr (str) – Name of the observing body.

  • crdsys (str) – Name of the coordinate system containing COORD

  • coord (str) – Name of the coordinate of interest

  • relate (str) – Relational operator.

  • refval (float) – Reference value.

  • adjust (float) – Adjustment value for absolute extrema searches.

  • step (float) – Step size used for locating extrema and roots.

  • nintvals (int) – Workspace window interval count.

  • cnfine (SpiceCell) – SPICE window to which the search is restricted.

  • result (Optional[SpiceCell]) – Optional SPICE window containing results.

Return type

SpiceCell

spiceypy.spiceypy.gfrefn(t1, t2, s1, s2)[source]

For those times when we can’t do better, we use a bisection method to find the next time at which to test for state change.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/gfrefn_c.html

Parameters
  • t1 (float) – One of two values bracketing a state change.

  • t2 (float) – The other value that brackets a state change.

  • s1 (Union[bool, int]) – State at t1.

  • s2 (Union[bool, int]) – State at t2.

Return type

float

Returns

New value at which to check for transition.

spiceypy.spiceypy.gfrepf()[source]

Finish a GF progress report.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/gfrepf_c.html

Return type

None

spiceypy.spiceypy.gfrepi(window, begmss, endmss)[source]

This entry point initializes a search progress report.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/gfrepi_c.html

Parameters
  • window (Union[SpiceCell, LP_SpiceCell]) – A window over which a job is to be performed.

  • begmss (str) – Beginning of the text portion of the output message.

  • endmss (str) – End of the text portion of the output message.

Return type

None

spiceypy.spiceypy.gfrepu(ivbeg, ivend, time)[source]

This function tells the progress reporting system how far a search has progressed.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/gfrepu_c.html

Parameters
  • ivbeg (float) – Start time of work interval.

  • ivend (float) – End time of work interval.

  • time (float) – Current time being examined in the search process.

Return type

None

spiceypy.spiceypy.gfrfov(inst, raydir, rframe, abcorr, obsrvr, step, cnfine, result=None)[source]

Determine time intervals when a specified ray intersects the space bounded by the field-of-view (FOV) of a specified instrument.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/gfrfov_c.html

Parameters
  • inst (str) – Name of the instrument.

  • raydir (ndarray) – Ray’s direction vector.

  • rframe (str) – Reference frame of ray’s direction vector.

  • abcorr (str) – Aberration correction flag.

  • obsrvr (str) – Name of the observing body.

  • step (float) – Step size in seconds for finding FOV events.

  • cnfine (SpiceCell) – SPICE window to which the search is restricted.

  • result (Optional[SpiceCell]) – Optional SPICE window containing results.

Return type

SpiceCell

spiceypy.spiceypy.gfrr(target, abcorr, obsrvr, relate, refval, adjust, step, nintvals, cnfine, result)[source]

Determine time intervals for which a specified constraint on the observer-target range rate is met.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/gfrr_c.html

Parameters
  • target (str) – Name of the target body.

  • abcorr (str) – Aberration correction flag.

  • obsrvr (str) – Name of the observing body.

  • relate (str) – Relational operator.

  • refval (float) – Reference value.

  • adjust (float) – Adjustment value for absolute extrema searches.

  • step (float) – Step size used for locating extrema and roots.

  • nintvals (int) – Workspace window interval count.

  • cnfine (SpiceCell) – SPICE window to which the search is restricted.

  • result (SpiceCell) – Optional SPICE window containing results.

Return type

SpiceCell

spiceypy.spiceypy.gfsep(targ1, shape1, inframe1, targ2, shape2, inframe2, abcorr, obsrvr, relate, refval, adjust, step, nintvals, cnfine, result=None)[source]

Determine time intervals when the angular separation between the position vectors of two target bodies relative to an observer satisfies a numerical relationship.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/gfsep_c.html

Parameters
  • targ1 (str) – Name of first body.

  • shape1 (str) – Name of shape model describing the first body.

  • inframe1 (str) – The body-fixed reference frame of the first body.

  • targ2 (str) – Name of second body.

  • shape2 (str) – Name of the shape model describing the second body.

  • inframe2 (str) – The body-fixed reference frame of the second body

  • abcorr (str) – Aberration correction flag

  • obsrvr (str) – Name of the observing body.

  • relate (str) – Relational operator.

  • refval (float) – Reference value.

  • adjust (float) – Absolute extremum adjustment value.

  • step (float) – Step size in seconds for finding angular separation events.

  • nintvals (int) – Workspace window interval count.

  • cnfine (SpiceCell) – SPICE window to which the search is restricted.

  • result (Optional[SpiceCell]) – Optional SPICE window containing results.

Return type

SpiceCell

spiceypy.spiceypy.gfsntc(target, fixref, method, abcorr, obsrvr, dref, dvec, crdsys, coord, relate, refval, adjust, step, nintvals, cnfine, result=None)[source]

Determine time intervals for which a coordinate of an surface intercept position vector satisfies a numerical constraint.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/gfsntc_c.html

Parameters
  • target (str) – Name of the target body.

  • fixref (str) – Body fixed frame associated with the target.

  • method (str) – Name of method type for surface intercept calculation.

  • abcorr (str) – Aberration correction flag

  • obsrvr (str) – Name of the observing body.

  • dref (str) – Reference frame of direction vector of dvec.

  • dvec (Iterable[float]) – Pointing direction vector from the observer.

  • crdsys (str) – Name of the coordinate system containing COORD.

  • coord (str) – Name of the coordinate of interest

  • relate (str) – Relational operator.

  • refval (float) – Reference value.

  • adjust (float) – Absolute extremum adjustment value.

  • step (float) – Step size in seconds for finding angular separation events.

  • nintvals (int) – Workspace window interval count.

  • cnfine (SpiceCell) – SPICE window to which the search is restricted.

  • result (Optional[SpiceCell]) – Optional SPICE window containing results.

Return type

SpiceCell

spiceypy.spiceypy.gfsstp(step)[source]

Set the step size to be returned by gfstep().

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/gfsstp_c.html

Parameters

step (float) – Time step to take.

Return type

None

spiceypy.spiceypy.gfstep(time)[source]

Return the time step set by the most recent call to gfsstp().

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/gfstep_c.html

Parameters

time (float) – Ignored ET value.

Return type

float

Returns

Time step to take.

spiceypy.spiceypy.gfstol(value)[source]

Override the default GF convergence value used in the high level GF routines.

Default value is 1.0e-6

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/gfstol_c.html

Parameters

value (float) – Double precision value returned or to store.

Return type

None

spiceypy.spiceypy.gfsubc(target, fixref, method, abcorr, obsrvr, crdsys, coord, relate, refval, adjust, step, nintvals, cnfine, result)[source]

Determine time intervals for which a coordinate of an subpoint position vector satisfies a numerical constraint.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/gfsubc_c.html

Parameters
  • target (str) – Name of the target body.

  • fixref (str) – Body fixed frame associated with the target.

  • method (str) – Name of method type for subpoint calculation.

  • abcorr (str) – Aberration correction flag

  • obsrvr (str) – Name of the observing body.

  • crdsys (str) – Name of the coordinate system containing COORD.

  • coord (str) – Name of the coordinate of interest

  • relate (str) – Relational operator.

  • refval (float) – Reference value.

  • adjust (float) – Adjustment value for absolute extrema searches.

  • step (float) – Step size used for locating extrema and roots.

  • nintvals (int) – Workspace window interval count.

  • cnfine (SpiceCell) – SPICE window to which the search is restricted.

  • result (SpiceCell) – Optional SPICE window containing results.

Return type

SpiceCell

spiceypy.spiceypy.gftfov(inst, target, tshape, tframe, abcorr, obsrvr, step, cnfine, result=None)[source]

Determine time intervals when a specified ephemeris object intersects the space bounded by the field-of-view (FOV) of a specified instrument.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/gftfov_c.html

Parameters
  • inst (str) – Name of the instrument.

  • target (str) – Name of the target body.

  • tshape (str) – Type of shape model used for target body.

  • tframe (str) – Body-fixed, body-centered frame for target body.

  • abcorr (str) – Aberration correction flag.

  • obsrvr (str) – Name of the observing body.

  • step (float) – Step size in seconds for finding FOV events.

  • cnfine (SpiceCell) – SPICE window to which the search is restricted.

  • result (Optional[SpiceCell]) – Optional pass-in SpiceCell for results

Return type

SpiceCell

Returns

SpiceCell containing set of time intervals, within the confinement period, when the target body is visible

spiceypy.spiceypy.gfudb(udfuns, udfunb, step, cnfine, result)[source]

Perform a GF search on a user defined boolean quantity.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/gfudb_c.html

Parameters
  • udfuns (CFunctionType) – Name of the routine that computes a scalar quantity of interest corresponding to an ‘et’.

  • udfunb (CFunctionType) – Name of the routine returning the boolean value corresponding to an ‘et’.

  • step (float) – Step size used for locating extrema and roots.

  • cnfine (SpiceCell) – SPICE window to which the search is restricted.

  • result (SpiceCell) – SPICE window containing results.

Returns

result

spiceypy.spiceypy.gfuds(udfuns, udqdec, relate, refval, adjust, step, nintvls, cnfine, result)[source]

Perform a GF search on a user defined scalar quantity.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/gfuds_c.html

Parameters
  • udfuns (CFunctionType) – Name of the routine that computes the scalar quantity of interest at some time.

  • udqdec (CFunctionType) – Name of the routine that computes whether the scalar quantity is decreasing.

  • relate (str) – Operator that either looks for an extreme value (max, min, local, absolute) or compares the geometric quantity value and a number.

  • refval (float) – Value used as reference for scalar quantity condition.

  • adjust (float) – Allowed variation for absolute extremal geometric conditions.

  • step (float) – Step size used for locating extrema and roots.

  • nintvls (int) – Workspace window interval count.

  • cnfine (SpiceCell) – SPICE window to which the search is restricted.

  • result (SpiceCell) – SPICE window containing results.

Return type

SpiceCell

Returns

result

spiceypy.spiceypy.gipool(name, start, room)[source]

Return the integer value of a kernel variable from the kernel pool.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/gipool_c.html

Parameters
  • name (str) – Name of the variable whose value is to be returned.

  • start (int) – Which component to start retrieving for name.

  • room (int) – The largest number of values to return.

Return type

Tuple[ndarray, bool]

Returns

Values associated with name.

spiceypy.spiceypy.gnpool(name, start, room, lenout=256)[source]

Return names of kernel variables matching a specified template.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/gnpool_c.html

Parameters
  • name (str) – Template that names should match.

  • start (int) – Index of first matching name to retrieve.

  • room (int) – The largest number of values to return.

  • lenout (int) – Length of strings in output array kvars.

Return type

Tuple[Iterable[str], bool]

Returns

Kernel pool variables whose names match name.

spiceypy.spiceypy.halfpi()[source]

Return half the value of pi (the ratio of the circumference of a circle to its diameter).

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/halfpi_c.html

Return type

float

Returns

Half the value of pi.

spiceypy.spiceypy.hrmint(xvals, yvals, x)[source]

Evaluate a Hermite interpolating polynomial at a specified abscissa value.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/hrmint_c.html

Parameters
  • xvals (Sequence[float]) – Abscissa values.

  • yvals (Sequence[float]) – Ordinate and derivative values.

  • x (int) – Point at which to interpolate the polynomial.

Return type

Tuple[float, float]

Returns

Interpolated function value at x and the Interpolated function’s derivative at x

spiceypy.spiceypy.hx2dp(string)[source]

Convert a string representing a double precision number in a base 16 scientific notation into its equivalent double precision number.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/hx2dp_c.html

Parameters

string (str) – Hex form string to convert to double precision.

Return type

Union[float, str]

Returns

Double precision value to be returned, Or Error Message.

spiceypy.spiceypy.ident()[source]

This routine returns the 3x3 identity matrix.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/ident_c.html

Return type

ndarray

Returns

The 3x3 identity matrix.

spiceypy.spiceypy.illum(target, et, abcorr, obsrvr, spoint)[source]

Deprecated: This routine has been superseded by the CSPICE routine ilumin. This routine is supported for purposes of backward compatibility only.

Find the illumination angles at a specified surface point of a target body.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/illum_c.html

Parameters
  • target (str) – Name of target body.

  • et (float) – Epoch in ephemeris seconds past J2000.

  • abcorr (str) – Desired aberration correction.

  • obsrvr (str) – Name of observing body.

  • spoint (ndarray) – Body-fixed coordinates of a target surface point.

Return type

Tuple[float, float, float]

Returns

Phase angle, Solar incidence angle, and Emission angle at the surface point.

spiceypy.spiceypy.illumf(method, target, ilusrc, et, fixref, abcorr, obsrvr, spoint)[source]

Compute the illumination angles—phase, incidence, and emission—at a specified point on a target body. Return logical flags indicating whether the surface point is visible from the observer’s position and whether the surface point is illuminated.

The target body’s surface is represented using topographic data provided by DSK files, or by a reference ellipsoid.

The illumination source is a specified ephemeris object.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/illumf_c.html

Parameters
  • method (str) – Computation method.

  • target (str) – Name of target body.

  • ilusrc (str) – Name of illumination source.

  • et (float) – Epoch in ephemeris seconds past J2000.

  • fixref (str) – Body-fixed, body-centered target body frame.

  • abcorr (str) – Desired aberration correction.

  • obsrvr (str) – Name of observing body.

  • spoint (ndarray) – Body-fixed coordinates of a target surface point.

Return type

Tuple[float, ndarray, float, float, float, bool, bool]

Returns

Target surface point epoch, Vector from observer to target surface point, Phase angle at the surface point, Source incidence angle at the surface point, Emission angle at the surface point, Visibility flag, Illumination flag

spiceypy.spiceypy.illumg(method, target, ilusrc, et, fixref, abcorr, obsrvr, spoint)[source]

Find the illumination angles (phase, incidence, and emission) at a specified surface point of a target body.

The surface of the target body may be represented by a triaxial ellipsoid or by topographic data provided by DSK files.

The illumination source is a specified ephemeris object. param method: Computation method.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/illumg_c.html

Parameters
  • method (str) – Computation method.

  • target (str) – Name of target body.

  • ilusrc (str) – Name of illumination source.

  • et (float) – Epoch in ephemeris seconds past J2000.

  • fixref (str) – Body-fixed, body-centered target body frame.

  • abcorr (str) – Desired aberration correction.

  • obsrvr (str) – Name of observing body.

  • spoint (ndarray) – Body-fixed coordinates of a target surface point.

Return type

Tuple[float, ndarray, float, float, float]

Returns

Target surface point epoch, Vector from observer to target surface point, Phase angle at the surface point, Source incidence angle at the surface point, Emission angle at the surface point,

spiceypy.spiceypy.ilumin(method, target, et, fixref, abcorr, obsrvr, spoint)[source]

Find the illumination angles (phase, solar incidence, and emission) at a specified surface point of a target body.

This routine supersedes illum.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/ilumin_c.html

Parameters
  • method (str) – Computation method.

  • target (str) – Name of target body.

  • et (float) – Epoch in ephemeris seconds past J2000.

  • fixref (str) – Body-fixed, body-centered target body frame.

  • abcorr (str) – Desired aberration correction.

  • obsrvr (str) – Name of observing body.

  • spoint (ndarray) – Body-fixed coordinates of a target surface point.

Return type

Tuple[float, ndarray, float, float, float]

Returns

Target surface point epoch, Vector from observer to target surface point, Phase angle, Solar incidence angle, and Emission angle at the surface point.

spiceypy.spiceypy.inedpl(a, b, c, plane)[source]

Find the intersection of a triaxial ellipsoid and a plane.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/inedpl_c.html

Parameters
  • a (float) – Length of ellipsoid semi-axis lying on the x-axis.

  • b (float) – Length of ellipsoid semi-axis lying on the y-axis.

  • c (float) – Length of ellipsoid semi-axis lying on the z-axis.

  • plane (Plane) – Plane that intersects ellipsoid.

Return type

Tuple[Ellipse, bool]

Returns

Intersection ellipse.

spiceypy.spiceypy.inelpl(ellips, plane)[source]

Find the intersection of an ellipse and a plane.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/inelpl_c.html

Parameters
  • ellips (Ellipse) – A SPICE ellipse.

  • plane (Plane) – A SPICE plane.

Return type

Tuple[int, ndarray, ndarray]

Returns

Number of intersection points of plane and ellipse, Point 1, Point 2.

spiceypy.spiceypy.inrypl(vertex, direct, plane)[source]

Find the intersection of a ray and a plane.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/inrypl_c.html

Parameters
  • vertex (Iterable[float]) – Vertex vector of ray.

  • direct (Iterable[float]) – Direction vector of ray.

  • plane (Plane) – A SPICE plane.

Return type

Tuple[int, ndarray]

Returns

Number of intersection points of ray and plane, Intersection point, if nxpts == 1.

spiceypy.spiceypy.insrtc(item, inset)[source]

Insert an item into a character set.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/insrtc_c.html

Parameters
  • item (Union[str, Iterable[str]]) – Item to be inserted.

  • inset (SpiceCell) – Insertion set.

Return type

None

spiceypy.spiceypy.insrtd(item, inset)[source]

Insert an item into a double precision set.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/insrtd_c.html

Parameters
  • item (Union[float, Iterable[float]]) – Item to be inserted.

  • inset (SpiceCell) – Insertion set.

Return type

None

spiceypy.spiceypy.insrti(item, inset)[source]

Insert an item into an integer set.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/insrti_c.html

Parameters
  • item (Union[Iterable[int], int]) – Item to be inserted.

  • inset (SpiceCell) – Insertion set.

Return type

None

spiceypy.spiceypy.inter(a, b)[source]

Intersect two sets of any data type to form a third set.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/inter_c.html

Parameters
Return type

SpiceCell

Returns

Intersection of a and b.

spiceypy.spiceypy.intmax()[source]

Return the value of the largest (positive) number representable in a int variable.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/intmax_c.html

Return type

int

Returns

The largest (positive) number representablein a Int variable.

spiceypy.spiceypy.intmin()[source]

Return the value of the smallest (negative) number representable in a SpiceInt variable.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/intmin_c.html

Return type

int

Returns

The smallest (negative) number representablein a Int variable.

spiceypy.spiceypy.invert(m)[source]

Generate the inverse of a 3x3 matrix.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/invert_c.html

Parameters

m (ndarray) – Matrix to be inverted.

Return type

ndarray

Returns

Inverted matrix (m1)^-1

spiceypy.spiceypy.invort(m)[source]

Given a matrix, construct the matrix whose rows are the columns of the first divided by the length squared of the the corresponding columns of the input matrix.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/invort_c.html

Parameters

m (ndarray) – A 3x3 Matrix.

Return type

ndarray

Returns

m after transposition and scaling of rows.

spiceypy.spiceypy.irfnam(index)[source]

Return the name of one of the standard inertial reference frames supported by irfrot()

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/FORTRAN/spicelib/irfnam.html

Parameters

index (int) – Index of a standard inertial reference frame.

Return type

str

Returns

is the name of the frame.

spiceypy.spiceypy.irfnum(name)[source]

Return the index of one of the standard inertial reference frames supported by irfrot()

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/FORTRAN/spicelib/irfnum.html

Parameters

name (str) – Name of standard inertial reference frame.

Return type

int

Returns

is the index of the frame.

spiceypy.spiceypy.irfrot(refa, refb)[source]

Compute the matrix needed to rotate vectors between two standard inertial reference frames.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/FORTRAN/spicelib/irfrot.html

Parameters
  • refa (int) – index of first reference frame.

  • refb (int) – index of second reference frame.

Return type

ndarray

Returns

rotation from frame A to frame B.

spiceypy.spiceypy.irftrn(refa, refb)[source]

Return the matrix that transforms vectors from one specified inertial reference frame to another.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/FORTRAN/spicelib/irftrn.html

Parameters
  • refa (str) – Name of reference frame to transform vectors FROM.

  • refb (str) – Name of reference frame to transform vectors TO.

Return type

ndarray

Returns

REFA-to-REFB transformation matrix.

spiceypy.spiceypy.isordv(array, n)[source]

Determine whether an array of n items contains the integers 0 through n-1.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/isordv_c.html

Parameters
  • array (Iterable[int]) – Array of integers.

  • n (int) – Number of integers in array.

Return type

bool

Returns

The function returns True if the array contains the integers 0 through n-1, otherwise it returns False.

spiceypy.spiceypy.isrchc(value, ndim, lenvals, array)[source]

Search for a given value within a character string array. Return the index of the first matching array entry, or -1 if the key value was not found.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/isrchc_c.html

Parameters
  • value (str) – Key value to be found in array.

  • ndim (int) – Dimension of array.

  • lenvals (int) – String length.

  • array (Iterable[str]) – Character string array to search.

Return type

int

Returns

The index of the first matching array element or -1 if the value is not found.

spiceypy.spiceypy.isrchd(value, ndim, array)[source]

Search for a given value within a double precision array. Return the index of the first matching array entry, or -1 if the key value was not found.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/isrchd_c.html

Parameters
  • value (float) – Key value to be found in array.

  • ndim (int) – Dimension of array.

  • array (Iterable[float]) – Double Precision array to search.

Return type

int

Returns

The index of the first matching array element or -1 if the value is not found.

spiceypy.spiceypy.isrchi(value, ndim, array)[source]

Search for a given value within an integer array. Return the index of the first matching array entry, or -1 if the key value was not found.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/isrchi_c.html

Parameters
  • value (int) – Key value to be found in array.

  • ndim (int) – Dimension of array.

  • array (Iterable[int]) – Integer array to search.

Return type

int

Returns

The index of the first matching array element or -1 if the value is not found.

spiceypy.spiceypy.isrot(m, ntol, dtol)[source]

Indicate whether a 3x3 matrix is a rotation matrix.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/isrot_c.html

Parameters
  • m (ndarray) – A matrix to be tested.

  • ntol (float) – Tolerance for the norms of the columns of m.

  • dtol (float) – Tolerance for the determinant of a matrix whose columns are the unitized columns of m.

Return type

bool

Returns

True if and only if m is a rotation matrix.

spiceypy.spiceypy.iswhsp(string)[source]

Return a boolean value indicating whether a string contains only white space characters.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/iswhsp_c.html

Parameters

string (str) – String to be tested.

Return type

bool

Returns

the boolean value True if the string is empty or contains only white space characters; otherwise it returns the value False.

spiceypy.spiceypy.j1900()[source]

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/j1900_c.html

Return type

float

Returns

Julian Date of 1899 DEC 31 12:00:00

spiceypy.spiceypy.j1950()[source]

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/j1950_c.html

Return type

float

Returns

Julian Date of 1950 JAN 01 00:00:00

spiceypy.spiceypy.j2000()[source]

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/j2000_c.html

Return type

float

Returns

Julian Date of 2000 JAN 01 12:00:00

spiceypy.spiceypy.j2100()[source]

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/j2100_c.html

Return type

float

Returns

Julian Date of 2100 JAN 01 12:00:00

spiceypy.spiceypy.jyear()[source]

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/jyear_c.html

Return type

float

Returns

number of seconds in a julian year

spiceypy.spiceypy.kclear()[source]

Clear the KEEPER subsystem: unload all kernels, clear the kernel pool, and re-initialize the subsystem. Existing watches on kernel variables are retained.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/kclear_c.html

Return type

None

spiceypy.spiceypy.kdata(which, kind, fillen=256, typlen=256, srclen=256)[source]

Return data for the nth kernel that is among a list of specified kernel types.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/kdata_c.html

Parameters
  • which (int) – Index of kernel to fetch from the list of kernels.

  • kind (str) – The kind of kernel to which fetches are limited.

  • fillen (int) – Available space in output file string.

  • typlen (int) – Available space in output kernel type string.

  • srclen (int) – Available space in output source string.

Return type

Tuple[str, str, str, int, bool]

Returns

The name of the kernel file, The type of the kernel, Name of the source file used to load file, The handle attached to file.

spiceypy.spiceypy.kepleq(ml, h, k)[source]

This function solves the equinoctial version of Kepler’s equation.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/FORTRAN/spicelib/kepleq.html

Parameters
  • ml (float) – Mean longitude

  • h (float) – h component of equinoctial elements

  • k (float) – k component of equinoctial elements

Return type

float

Returns

the value of F such that ML = F + h*COS(F) - k*SIN(F)

spiceypy.spiceypy.kinfo(file, typlen=256, srclen=256)[source]

Return information about a loaded kernel specified by name.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/kinfo_c.html

Parameters
  • file (str) – Name of a kernel to fetch information for

  • typlen (int) – Available space in output kernel type string.

  • srclen (int) – Available space in output source string.

Return type

Tuple[str, str, int, bool]

Returns

The type of the kernel, Name of the source file used to load file, The handle attached to file.

spiceypy.spiceypy.kplfrm(frmcls, out_cell=None)[source]

Return a SPICE set containing the frame IDs of all reference frames of a given class having specifications in the kernel pool.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/kplfrm_c.html

Parameters
  • frmcls (int) – Frame class.

  • out_cell (Optional[SpiceCell]) – Optional output Spice Int Cell

Return type

SpiceCell

Returns

Set of ID codes of frames of the specified class.

spiceypy.spiceypy.kpsolv(evec)[source]

This routine solves the equation X = < EVEC, U(X) > where U(X) is the unit vector [ Cos(X), SIN(X) ] and < , > denotes the two-dimensional dot product.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/FORTRAN/spicelib/kpsolv.html

Parameters

evec (Tuple[float, float]) – A 2-vector whose magnitude is less than 1.

Return type

float

Returns

the value of X such that X = EVEC(1)COS(X) + EVEC(2)SIN(X).

spiceypy.spiceypy.ktotal(kind)[source]

Return the current number of kernels that have been loaded via the KEEPER interface that are of a specified type.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/ktotal_c.html

Parameters

kind (str) – A list of kinds of kernels to count.

Return type

int

Returns

The number of kernels of type kind.

spiceypy.spiceypy.kxtrct(keywd, terms, nterms, instring, termlen=256, stringlen=256, substrlen=256)[source]

Locate a keyword in a string and extract the substring from the beginning of the first word following the keyword to the beginning of the first subsequent recognized terminator of a list.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/kxtrct_c.html

Parameters
  • keywd (str) – Word that marks the beginning of text of interest.

  • terms (Sequence[str]) – Set of words, any of which marks the end of text.

  • nterms (int) – Number of terms.

  • instring (str) – String containing a sequence of words.

  • termlen (int) – Length of strings in string array term.

  • stringlen (int) – Available space in argument string.

  • substrlen (int) – Available space in output substring.

Return type

Tuple[str, str, bool]

Returns

String containing a sequence of words, String from end of keywd to beginning of first terms item found.

spiceypy.spiceypy.lastnb(string)[source]

Return the zero based index of the last non-blank character in a character string.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/lastnb_c.html

Parameters

string (str) – Input character string.

Return type

int

Returns

spiceypy.spiceypy.latcyl(radius, lon, lat)[source]

Convert from latitudinal coordinates to cylindrical coordinates.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/latcyl_c.html

Parameters
  • radius (float) – Distance of a point from the origin.

  • lon (float) – Angle of the point from the XZ plane in radians.

  • lat (float) – Angle of the point from the XY plane in radians.

Return type

Tuple[float, float, float]

Returns

(r, lonc, z)

spiceypy.spiceypy.latrec(radius, longitude, latitude)[source]

Convert from latitudinal coordinates to rectangular coordinates.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/latrec_c.html

Parameters
  • radius (float) – Distance of a point from the origin.

  • longitude (float) – Longitude of point in radians.

  • latitude (float) – Latitude of point in radians.

Return type

ndarray

Returns

Rectangular coordinates of the point.

spiceypy.spiceypy.latsph(radius, lon, lat)[source]

Convert from latitudinal coordinates to spherical coordinates.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/latsph_c.html

Parameters
  • radius (float) – Distance of a point from the origin.

  • lon (float) – Angle of the point from the XZ plane in radians.

  • lat (float) – Angle of the point from the XY plane in radians.

Return type

Tuple[float, float, float]

Returns

(rho colat, lons)

spiceypy.spiceypy.latsrf(method, target, et, fixref, lonlat)[source]

Map array of planetocentric longitude/latitude coordinate pairs to surface points on a specified target body.

The surface of the target body may be represented by a triaxial ellipsoid or by topographic data provided by DSK files.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/latsrf_c.html

Parameters
  • method (str) – Computation method.

  • target (str) – Name of target body.

  • et (float) – Epoch in TDB seconds past J2000 TDB.

  • fixref (str) – Body-fixed, body-centered target body frame.

  • lonlat (Sequence[Sequence[float]]) – Array of longitude/latitude coordinate pairs.

Return type

ndarray

Returns

Array of surface points.

spiceypy.spiceypy.lcase(instr, lenout=256)[source]

Convert the characters in a string to lowercase.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/lcase_c.html

Parameters
  • instr (str) – Input string.

  • lenout (int) – Maximum length of output string.

Return type

str

Returns

Output string, all lowercase.

spiceypy.spiceypy.ldpool(filename)[source]

Load the variables contained in a NAIF ASCII kernel file into the kernel pool.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/ldpool_c.html

Parameters

filename (str) – Name of the kernel file.

Return type

None

spiceypy.spiceypy.lgrind(xvals, yvals, x)[source]

Evaluate a Lagrange interpolating polynomial for a specified set of coordinate pairs, at a specified abscissa value. Return the value of both polynomial and derivative.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/lgrind_c.html

Parameters
  • xvals (Sequence[float]) – Abscissa values.

  • yvals (Sequence[float]) – Ordinate values.

  • x (float) – Point at which to interpolate the polynomial.

Return type

Tuple[float, float]

Returns

Polynomial value at x, Polynomial derivative at x.

spiceypy.spiceypy.limbpt(method, target, et, fixref, abcorr, corloc, obsrvr, refvec, rolstp, ncuts, schstp, soltol, maxn)[source]

Find limb points on a target body. The limb is the set of points of tangency on the target of rays emanating from the observer. The caller specifies half-planes bounded by the observer-target center vector in which to search for limb points.

The surface of the target body may be represented either by a triaxial ellipsoid or by topographic data.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/limbpt_c.html

Parameters
  • method (str) – Computation method.

  • target (str) – Name of target body.

  • et (float) – Epoch in ephemeris seconds past J2000 TDB.

  • fixref (str) – Body-fixed, body-centered target body frame.

  • abcorr (str) – Aberration correction.

  • corloc (str) – Aberration correction locus.

  • obsrvr (str) – Name of observing body.

  • refvec (Iterable[float]) – Reference vector for cutting half-planes.

  • rolstp (float) – Roll angular step for cutting half-planes.

  • ncuts (int) – Number of cutting half-planes.

  • schstp (float) – Angular step size for searching.

  • soltol (float) – Solution convergence tolerance.

  • maxn (int) – Maximum number of entries in output arrays.

Return type

Tuple[ndarray, ndarray, ndarray, ndarray]

Returns

Counts of limb points corresponding to cuts, Limb points, Times associated with limb points, Tangent vectors emanating from the observer

spiceypy.spiceypy.lmpool(cvals)[source]

Load the variables contained in an internal buffer into the kernel pool.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/lmpool_c.html

Parameters

cvals (Union[ndarray, Iterable[str]]) – list of strings.

Return type

None

spiceypy.spiceypy.lparse(inlist, delim, nmax)[source]

Parse a list of items delimited by a single character.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/lparse_c.html

Parameters
  • inlist (str) – list of items delimited by delim.

  • delim (str) – Single character used to delimit items.

  • nmax (int) – Maximum number of items to return.

Return type

Iterable[str]

Returns

Items in the list, left justified.

spiceypy.spiceypy.lparsm(inlist, delims, nmax, lenout=None)[source]

Parse a list of items separated by multiple delimiters.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/lparsm_c.html

Parameters
  • inlist (str) – list of items delimited by delims.

  • delims (str) – Single characters which delimit items.

  • nmax (int) – Maximum number of items to return.

  • lenout (Optional[int]) – Optional Length of strings in item array.

Return type

Iterable[str]

Returns

Items in the list, left justified.

spiceypy.spiceypy.lparss(inlist, delims, nmax=20, length=50)[source]

Parse a list of items separated by multiple delimiters, placing the resulting items into a set.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/lparss_c.html

Parameters
  • inlist (str) – list of items delimited by delims.

  • delims (str) – Single characters which delimit items.

  • nmax (int) – Optional nmax of spice set.

  • length (int) – Optional length of strings in spice set

Return type

SpiceCell

Returns

Set containing items in the list, left justified.

spiceypy.spiceypy.lspcn(body, et, abcorr)[source]

Compute L_s, the planetocentric longitude of the sun, as seen from a specified body.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/lspcn_c.html

Parameters
  • body (str) – Name of central body.

  • et (float) – Epoch in seconds past J2000 TDB.

  • abcorr (str) – Aberration correction.

Return type

float

Returns

planetocentric longitude of the sun

spiceypy.spiceypy.lstlec(string, n, lenvals, array)[source]

Given a character string and an ordered array of character strings, find the index of the largest array element less than or equal to the given string.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/lstlec_c.html

Parameters
  • string (str) – Upper bound value to search against.

  • n (int) – Number elements in array.

  • lenvals (int) – String length.

  • array (Iterable[str]) – Array of possible lower bounds.

Return type

int

Returns

index of the last element of array that is lexically less than or equal to string.

spiceypy.spiceypy.lstled(x, n, array)[source]

Given a number x and an array of non-decreasing floats find the index of the largest array element less than or equal to x.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/lstled_c.html

Parameters
  • x (float) – Value to search against.

  • n (int) – Number elements in array.

  • array (Iterable[float]) – Array of possible lower bounds

Return type

int

Returns

index of the last element of array that is less than or equal to x.

spiceypy.spiceypy.lstlei(x, n, array)[source]

Given a number x and an array of non-decreasing ints, find the index of the largest array element less than or equal to x.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/lstlei_c.html

Parameters
  • x (int) – Value to search against.

  • n (int) – Number elements in array.

  • array (Iterable[int]) – Array of possible lower bounds

Return type

int

Returns

index of the last element of array that is less than or equal to x.

spiceypy.spiceypy.lstltc(string, n, lenvals, array)[source]

Given a character string and an ordered array of character strings, find the index of the largest array element less than the given string.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/lstltc_c.html

Parameters
  • string (str) – Upper bound value to search against.

  • n (int) – Number elements in array.

  • lenvals (int) – String length.

  • array (Iterable[str]) – Array of possible lower bounds

Return type

int

Returns

index of the last element of array that is lexically less than string.

spiceypy.spiceypy.lstltd(x, n, array)[source]

Given a number x and an array of non-decreasing floats find the index of the largest array element less than x.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/lstltd_c.html

Parameters
  • x (float) – Value to search against

  • n (int) – Number elements in array

  • array (Iterable[float]) – Array of possible lower bounds

Return type

int

Returns

index of the last element of array that is less than x.

spiceypy.spiceypy.lstlti(x, n, array)[source]

Given a number x and an array of non-decreasing int, find the index of the largest array element less than x.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/lstlti_c.html

Parameters
  • x (int) – Value to search against

  • n (int) – Number elements in array

  • array (Iterable[int]) – Array of possible lower bounds

Return type

int

Returns

index of the last element of array that is less than x.

spiceypy.spiceypy.ltime(etobs, obs, direct, targ)[source]

This routine computes the transmit (or receive) time of a signal at a specified target, given the receive (or transmit) time at a specified observer. The elapsed time between transmit and receive is also returned.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/ltime_c.html

Parameters
  • etobs (float) – Epoch of a signal at some observer

  • obs (int) – NAIF ID of some observer

  • direct (str) – Direction the signal travels ( “->” or “<-” )

  • targ (int) – NAIF ID of the target object

Return type

Tuple[float, float]

Returns

epoch and time

spiceypy.spiceypy.lx4dec(string, first)[source]

Scan a string from a specified starting position for the end of a decimal number.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/lx4dec_c.html

Parameters
  • string (str) – Any character string.

  • first (int) – First character to scan from in string.

Return type

Tuple[int, int]

Returns

last and nchar

spiceypy.spiceypy.lx4num(string, first)[source]

Scan a string from a specified starting position for the end of a number.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/lx4num_c.html

Parameters
  • string (str) – Any character string.

  • first (int) – First character to scan from in string.

Return type

Tuple[int, int]

Returns

last and nchar

spiceypy.spiceypy.lx4sgn(string, first)[source]

Scan a string from a specified starting position for the end of a signed integer.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/lx4sgn_c.html

Parameters
  • string (str) – Any character string.

  • first (int) – First character to scan from in string.

Return type

Tuple[int, int]

Returns

last and nchar

spiceypy.spiceypy.lx4uns(string, first)[source]

Scan a string from a specified starting position for the end of an unsigned integer.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/lx4uns_c.html

Parameters
  • string (str) – Any character string.

  • first (int) – First character to scan from in string.

Return type

Tuple[int, int]

Returns

last and nchar

spiceypy.spiceypy.lxqstr(string, qchar, first)[source]

Lex (scan) a quoted string.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/lxqstr_c.html

Parameters
  • string (str) – String to be scanned.

  • qchar (str) – Quote delimiter character.

  • first (int) – Character position at which to start scanning.

Return type

Tuple[int, int]

Returns

last and nchar

spiceypy.spiceypy.m2eul(r, axis3, axis2, axis1)[source]

Factor a rotation matrix as a product of three rotations about specified coordinate axes.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/m2eul_c.html

Parameters
  • r (Iterable[Iterable[float]]) – A rotation matrix to be factored

  • axis3 (int) – third rotation axes.

  • axis2 (int) – second rotation axes.

  • axis1 (int) – first rotation axes.

Return type

Tuple[float, float, float]

Returns

Third, second, and first Euler angles, in radians.

spiceypy.spiceypy.m2q(r)[source]

Find a unit quaternion corresponding to a specified rotation matrix.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/m2q_c.html

Parameters

r (ndarray) – A rotation matrix to be factored

Return type

ndarray

Returns

A unit quaternion representing the rotation matrix

spiceypy.spiceypy.matchi(string, templ, wstr, wchr)[source]

Determine whether a string is matched by a template containing wild cards. The pattern comparison is case-insensitive.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/matchi_c.html

Parameters
  • string (str) – String to be tested.

  • templ (str) – Template (with wild cards) to test against string.

  • wstr (str) – Wild string token.

  • wchr (str) – Wild character token.

Return type

bool

Returns

The function returns True if string matches templ, else False

spiceypy.spiceypy.matchw(string, templ, wstr, wchr)[source]

Determine whether a string is matched by a template containing wild cards.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/matchw_c.html

Parameters
  • string (str) – String to be tested.

  • templ (str) – Template (with wild cards) to test against string.

  • wstr (str) – Wild string token.

  • wchr (str) – Wild character token.

Return type

bool

Returns

The function returns True if string matches templ, else False

spiceypy.spiceypy.mequ(m1)[source]

Set one double precision 3x3 matrix equal to another.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/mequ_c.html

Parameters

m1 (ndarray) – input matrix.

Return type

ndarray

Returns

Output matrix equal to m1.

spiceypy.spiceypy.mequg(m1, nr, nc)[source]

Set one double precision matrix of arbitrary size equal to another.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/mequg_c.html

Parameters
  • m1 (ndarray) – Input matrix.

  • nr (int) – Row dimension of m1.

  • nc (int) – Column dimension of m1.

Return type

ndarray

Returns

Output matrix equal to m1

spiceypy.spiceypy.mtxm(m1, m2)[source]

Multiply the transpose of a 3x3 matrix and a 3x3 matrix.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/mtxm_c.html

Parameters
  • m1 (ndarray) – 3x3 double precision matrix.

  • m2 (ndarray) – 3x3 double precision matrix.

Return type

ndarray

Returns

The produce m1 transpose times m2.

spiceypy.spiceypy.mtxmg(m1, m2, ncol1, nr1r2, ncol2)[source]

Multiply the transpose of a matrix with another matrix, both of arbitrary size.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/mtxmg_c.html

Parameters
  • m1 (ndarray) – nr1r2 X ncol1 double precision matrix.

  • m2 (ndarray) – nr1r2 X ncol2 double precision matrix.

  • ncol1 (int) – Column dimension of m1 and row dimension of mout.

  • nr1r2 (int) – Row dimension of m1 and m2.

  • ncol2 (int) – Column dimension of m2.

Return type

ndarray

Returns

Transpose of m1 times m2.

spiceypy.spiceypy.mtxv(m1, vin)[source]

Multiplies the transpose of a 3x3 matrix on the left with a vector on the right.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/mtxv_c.html

Parameters
  • m1 (ndarray) – 3x3 double precision matrix.

  • vin (ndarray) – 3-dimensional double precision vector.

Return type

ndarray

Returns

3-dimensional double precision vector.

spiceypy.spiceypy.mtxvg(m1, v2, ncol1, nr1r2)[source]

Multiply the transpose of a matrix and a vector of arbitrary size.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/mtxvg_c.html

Parameters
  • m1 (ndarray) – Left-hand matrix to be multiplied.

  • v2 (ndarray) – Right-hand vector to be multiplied.

  • ncol1 (int) – Column dimension of m1 and length of vout.

  • nr1r2 (int) – Row dimension of m1 and length of v2.

Return type

ndarray

Returns

Product vector m1 transpose * v2.

spiceypy.spiceypy.mxm(m1, m2)[source]

Multiply two 3x3 matrices.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/mxm_c.html

Parameters
  • m1 (Iterable[Iterable[float]]) – 3x3 double precision matrix.

  • m2 (Iterable[Iterable[float]]) – 3x3 double precision matrix.

Return type

ndarray

Returns

3x3 double precision matrix.

spiceypy.spiceypy.mxmg(m1, m2, nrow1, ncol1, ncol2)[source]

Multiply two double precision matrices of arbitrary size.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/mxmg_c.html

Parameters
  • m1 (Iterable[Iterable[float]]) – nrow1 X ncol1 double precision matrix.

  • m2 (Iterable[Iterable[float]]) – ncol1 X ncol2 double precision matrix.

  • nrow1 (int) – Row dimension of m1

  • ncol1 (int) – Column dimension of m1 and row dimension of m2.

  • ncol2 (int) – Column dimension of m2

Return type

ndarray

Returns

nrow1 X ncol2 double precision matrix.

spiceypy.spiceypy.mxmt(m1, m2)[source]

Multiply a 3x3 matrix and the transpose of another 3x3 matrix.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/mxmt_c.html

Parameters
  • m1 (Iterable[Iterable[float]]) – 3x3 double precision matrix.

  • m2 (Iterable[Iterable[float]]) – 3x3 double precision matrix.

Return type

ndarray

Returns

The product m1 times m2 transpose.

spiceypy.spiceypy.mxmtg(m1, m2, nrow1, nc1c2, nrow2)[source]

Multiply a matrix and the transpose of a matrix, both of arbitrary size.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/mxmtg_c.html

Parameters
  • m1 (ndarray) – Left-hand matrix to be multiplied.

  • m2 (ndarray) – Right-hand matrix whose transpose is to be multiplied

  • nrow1 (int) – Row dimension of m1 and row dimension of mout.

  • nc1c2 (int) – Column dimension of m1 and column dimension of m2.

  • nrow2 (int) – Row dimension of m2 and column dimension of mout.

Return type

ndarray

Returns

Product matrix.

spiceypy.spiceypy.mxv(m1, vin)[source]

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
  • m1 (ndarray) – 3x3 double precision matrix.

  • vin (ndarray) – 3-dimensional double precision vector.

Return type

ndarray

Returns

3-dimensional double precision vector.

spiceypy.spiceypy.mxvg(m1, v2, nrow1, nc1r2)[source]

Multiply a matrix and a vector of arbitrary size.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/mxvg_c.html

Parameters
  • m1 (ndarray) – Left-hand matrix to be multiplied.

  • v2 (ndarray) – Right-hand vector to be multiplied.

  • nrow1 (int) – Row dimension of m1 and length of vout.

  • nc1r2 (int) – Column dimension of m1 and length of v2.

Return type

ndarray

Returns

Product vector m1*v2

spiceypy.spiceypy.namfrm(frname)[source]

Look up the frame ID code associated with a string.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/namfrm_c.html

Parameters

frname (str) – The name of some reference frame.

Return type

int

Returns

The SPICE ID code of the frame.

spiceypy.spiceypy.ncpos(string, chars, start)[source]

Find the first occurrence in a string of a character NOT belonging to a collection of characters, starting at a specified location searching forward.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/ncpos_c.html

Parameters
  • string (str) – Any character string.

  • chars (str) – A collection of characters.

  • start (int) – Position to begin looking for one not in chars.

Return type

int

Returns

index

spiceypy.spiceypy.ncposr(string, chars, start)[source]

Find the first occurrence in a string of a character NOT belonging to a collection of characters, starting at a specified location, searching in reverse.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/ncposr_c.html

Parameters
  • string (str) – Any character string.

  • chars (str) – A collection of characters.

  • start (int) – Position to begin looking for one of chars.

Return type

int

Returns

index

spiceypy.spiceypy.nearpt(positn, a, b, c)[source]

locates the point on the surface of an ellipsoid that is nearest to a specified position. It also returns the altitude of the position above the ellipsoid.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/nearpt_c.html

Parameters
  • positn (Iterable[float]) – Position of a point in bodyfixed frame.

  • a (float) – Length of semi-axis parallel to x-axis.

  • b (float) – Length of semi-axis parallel to y-axis.

  • c (float) – Length on semi-axis parallel to z-axis.

Return type

Tuple[ndarray, float]

Returns

Point on the ellipsoid closest to positn, Altitude of positn above the ellipsoid.

spiceypy.spiceypy.no_found_check()[source]

Temporarily disables spiceypy default behavior which raises exceptions for false found flags for certain spice functions. All spice functions executed within the context manager will no longer check the found flag return parameter and the found flag will be included in the return for the given function. For Example bodc2n in spiceypy is normally called like:

name = spice.bodc2n(399)

With the possibility that an exception is thrown in the even of a invalid ID:

name = spice.bodc2n(-999991) # throws a SpiceyError

With this function however, we can use it as a context manager to do this:

with spice.no_found_check():
    name, found = spice.bodc2n(-999991) # found is false, no exception raised!

Within the context any spice functions called that normally check the found flags will pass through the check without raising an exception if they are false.

Return type

Iterator[None]

spiceypy.spiceypy.npedln(a, b, c, linept, linedr)[source]

Find nearest point on a triaxial ellipsoid to a specified line and the distance from the ellipsoid to the line.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/npedln_c.html

Parameters
  • a (float) – Length of ellipsoid’s semi-axis in the x direction

  • b (float) – Length of ellipsoid’s semi-axis in the y direction

  • c (float) – Length of ellipsoid’s semi-axis in the z direction

  • linept (Iterable[float]) – Length of ellipsoid’s semi-axis in the z direction

  • linedr (Iterable[float]) – Direction vector of line

Return type

Tuple[ndarray, float]

Returns

Nearest point on ellipsoid to line, Distance of ellipsoid from line

spiceypy.spiceypy.npelpt(point, ellips)[source]

Find the nearest point on an ellipse to a specified point, both in three-dimensional space, and find the distance between the ellipse and the point. https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/npelpt_c.html

Parameters
  • point (Iterable[float]) – Point whose distance to an ellipse is to be found.

  • ellips (Ellipse) – An ellipse.

Return type

Tuple[ndarray, float]

Returns

Nearest point on ellipsoid to line, Distance of ellipsoid from line

spiceypy.spiceypy.nplnpt(linpt, lindir, point)[source]

Find the nearest point on a line to a specified point, and find the distance between the two points.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/nplnpt_c.html

Parameters
  • linpt (Iterable[float]) – Point on a line

  • lindir (Iterable[float]) – line’s direction vector

  • point (Iterable[float]) – A second point.

Return type

Tuple[ndarray, float]

Returns

Nearest point on the line to point, Distance between point and pnear

spiceypy.spiceypy.nvc2pl(normal, constant)[source]

Make a plane from a normal vector and a constant.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/nvc2pl_c.html

Parameters
  • normal (Iterable[float]) – A normal vector defining a plane.

  • constant (float) – A constant defining a plane.

Return type

Plane

Returns

plane

spiceypy.spiceypy.nvp2pl(normal, point)[source]

Make a plane from a normal vector and a point.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/nvp2pl_c.html

Parameters
  • normal (Iterable[float]) – A normal vector defining a plane.

  • point (Iterable[float]) – A point defining a plane.

Return type

Plane

Returns

plane

spiceypy.spiceypy.occult(target1, shape1, frame1, target2, shape2, frame2, abcorr, observer, et)[source]

Determines the occultation condition (not occulted, partially, etc.) of one target relative to another target as seen by an observer at a given time.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/occult_c.html

Parameters
  • target1 (str) – Name or ID of first target.

  • shape1 (str) – Type of shape model used for first target.

  • frame1 (str) – Body-fixed, body-centered frame for first body.

  • target2 (str) – Name or ID of second target.

  • shape2 (str) – Type of shape model used for second target.

  • frame2 (str) – Body-fixed, body-centered frame for second body.

  • abcorr (str) – Aberration correction flag.

  • observer (str) – Name or ID of the observer.

  • et (float) – Time of the observation (seconds past J2000).

Return type

int

Returns

Occultation identification code.

spiceypy.spiceypy.ordc(item, inset)[source]

The function returns the ordinal position of any given item in a character set. If the item does not appear in the set, the function returns -1.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/ordc_c.html

Parameters
  • item (str) – An item to locate within a set.

  • inset (SpiceCell) – A set to search for a given item.

Return type

int

Returns

the ordinal position of item within the set

spiceypy.spiceypy.ordd(item, inset)[source]

The function returns the ordinal position of any given item in a double precision set. If the item does not appear in the set, the function returns -1.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/ordd_c.html

Parameters
  • item (float) – An item to locate within a set.

  • inset (SpiceCell) – A set to search for a given item.

Return type

int

Returns

the ordinal position of item within the set

spiceypy.spiceypy.orderc(array, ndim=None)[source]

Determine the order of elements in an array of character strings.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/orderc_c.html

Parameters
  • array (Sequence[str]) – Input array.

  • ndim (Optional[int]) – Optional Length of input array

Return type

ndarray

Returns

Order vector for array.

spiceypy.spiceypy.orderd(array, ndim=None)[source]

Determine the order of elements in a double precision array.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/orderd_c.html

Parameters
  • array (Sequence[float]) – Input array.

  • ndim (Optional[int]) – Optional Length of input array

Return type

ndarray

Returns

Order vector for array.

spiceypy.spiceypy.orderi(array, ndim=None)[source]

Determine the order of elements in an integer array.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/orderi_c.html

Parameters
  • array (Sequence[int]) – Input array.

  • ndim (Optional[int]) – Optional Length of input array

Return type

ndarray

Returns

Order vector for array.

spiceypy.spiceypy.ordi(item, inset)[source]

The function returns the ordinal position of any given item in an integer set. If the item does not appear in the set, the function returns -1.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/ordi_c.html

Parameters
  • item (int) – An item to locate within a set.

  • inset (SpiceCell) – A set to search for a given item.

Return type

int

Returns

the ordinal position of item within the set

spiceypy.spiceypy.oscelt(state, et, mu)[source]

Determine the set of osculating conic orbital elements that corresponds to the state (position, velocity) of a body at some epoch.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/oscelt_c.html

Parameters
  • state (ndarray) – State of body at epoch of elements.

  • et (float) – Epoch of elements.

  • mu (Union[float, int]) – Gravitational parameter (GM) of primary body.

Return type

ndarray

Returns

Equivalent conic elements

spiceypy.spiceypy.oscltx(state, et, mu)[source]

Determine the set of osculating conic orbital elements that corresponds to the state (position, velocity) of a body at some epoch. In additional to the classical elements, return the true anomaly, semi-major axis, and period, if applicable.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/oscltx_c.html

Parameters
  • state (ndarray) – State of body at epoch of elements.

  • et (float) – Epoch of elements.

  • mu (int) – Gravitational parameter (GM) of primary body.

Return type

ndarray

Returns

Extended set of classical conic elements.

spiceypy.spiceypy.pckcls(handle)[source]

Close an open PCK file.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/pckcls_c.html

Parameters

handle (int) – Handle of the PCK file to be closed.

Return type

None

spiceypy.spiceypy.pckcov(pck, idcode, cover)[source]

Find the coverage window for a specified reference frame in a specified binary PCK file.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/pckcov_c.html

Parameters
  • pck (str) – Name of PCK file.

  • idcode (int) – Class ID code of PCK reference frame.

  • cover (SpiceCell) – Window giving coverage in pck for idcode.

Return type

None

spiceypy.spiceypy.pckfrm(pck, ids)[source]

Find the set of reference frame class ID codes of all frames in a specified binary PCK file.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/pckfrm_c.html

Parameters
  • pck (str) – Name of PCK file.

  • ids (SpiceCell) – Set of frame class ID codes of frames in PCK file.

Return type

None

spiceypy.spiceypy.pcklof(filename)[source]

Load a binary PCK file for use by the readers. Return the handle of the loaded file which is used by other PCK routines to refer to the file.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/pcklof_c.html

Parameters

filename (str) – Name of the file to be loaded.

Return type

int

Returns

Loaded file’s handle.

spiceypy.spiceypy.pckopn(name, ifname, ncomch)[source]

Create a new PCK file, returning the handle of the opened file.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/pckopn_c.html

Parameters
  • name (str) – The name of the PCK file to be opened.

  • ifname (str) – The internal filename for the PCK.

  • ncomch (int) – The number of characters to reserve for comments.

Return type

int

Returns

The handle of the opened PCK file.

spiceypy.spiceypy.pckuof(handle)[source]

Unload a binary PCK file so that it will no longer be searched by the readers.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/pckuof_c.html

Parameters

handle (int) – Handle of PCK file to be unloaded

Return type

None

spiceypy.spiceypy.pckw02(handle, classid, frname, first, last, segid, intlen, n, polydg, cdata, btime)[source]

Write a type 2 segment to a PCK binary file given the file handle, frame class ID, base frame, time range covered by the segment, and the Chebyshev polynomial coefficients.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/pckw02_c.html

Parameters
  • handle (int) – Handle of binary PCK file open for writing.

  • classid (int) – Frame class ID of body-fixed frame.

  • frname (str) – Name of base reference frame.

  • first (float) – Start time of interval covered by segment.

  • last (float) – End time of interval covered by segment.

  • segid (str) – Segment identifier.

  • intlen (float) – Length of time covered by logical record.

  • n (int) – Number of logical records in segment.

  • polydg (int) – Chebyshev polynomial degree.

  • cdata (Iterable[float]) – Array of Chebyshev coefficients.

  • btime (float) – Begin time of first logical record.

Return type

None

spiceypy.spiceypy.pcpool(name, cvals)[source]

This entry point provides toolkit programmers a method for programmatically inserting character data into the kernel pool.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/pcpool_c.html

Parameters
  • name (str) – The kernel pool name to associate with cvals.

  • cvals (Sequence[str]) – An array of strings to insert into the kernel pool.

Return type

None

spiceypy.spiceypy.pdpool(name, dvals)[source]

This entry point provides toolkit programmers a method for programmatically inserting double precision data into the kernel pool.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/pdpool_c.html

Parameters
  • name (str) – The kernel pool name to associate with dvals.

  • dvals (Union[ndarray, Iterable[float]]) – An array of values to insert into the kernel pool.

Return type

None

spiceypy.spiceypy.pgrrec(body, lon, lat, alt, re, f)[source]

Convert planetographic coordinates to rectangular coordinates.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/pgrrec_c.html

Parameters
  • body (str) – Body with which coordinate system is associated.

  • lon (float) – Planetographic longitude of a point (radians).

  • lat (float) – Planetographic latitude of a point (radians).

  • alt (int) – Altitude of a point above reference spheroid.

  • re (float) – Equatorial radius of the reference spheroid.

  • f (float) – Flattening coefficient.

Return type

ndarray

Returns

Rectangular coordinates of the point.

spiceypy.spiceypy.phaseq(et, target, illmn, obsrvr, abcorr)[source]

Compute the apparent phase angle for a target, observer, illuminator set of ephemeris objects.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/phaseq_c.html

Parameters
  • et (float) – Ephemeris seconds past J2000 TDB.

  • target (str) – Target body name.

  • illmn (str) – Illuminating body name.

  • obsrvr (str) – Observer body.

  • abcorr (str) – Aberration correction flag.

Return type

float

Returns

Value of phase angle.

spiceypy.spiceypy.pi()[source]

Return the value of pi (the ratio of the circumference of a circle to its diameter).

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/pi_c.html

Return type

float

Returns

value of pi.

spiceypy.spiceypy.pipool(name, ivals)[source]

This entry point provides toolkit programmers a method for programmatically inserting integer data into the kernel pool.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/pipool_c.html

Parameters
  • name (str) – The kernel pool name to associate with values.

  • ivals (ndarray) – An array of integers to insert into the pool.

Return type

None

spiceypy.spiceypy.pjelpl(elin, plane)[source]

Project an ellipse onto a plane, orthogonally.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/pjelpl_c.html

Parameters
  • elin (Ellipse) – A SPICE ellipse to be projected.

  • plane (Plane) – A plane onto which elin is to be projected.

Return type

Ellipse

Returns

A SPICE ellipse resulting from the projection.

spiceypy.spiceypy.pl2nvc(plane)[source]

Return a unit normal vector and constant that define a specified plane.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/pl2nvc_c.html

Parameters

plane (Plane) – A SPICE plane.

Return type

Tuple[ndarray, float]

Returns

A normal vector and constant defining the geometric plane represented by plane.

spiceypy.spiceypy.pl2nvp(plane)[source]

Return a unit normal vector and point that define a specified plane.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/pl2nvp_c.html

Parameters

plane (Plane) – A SPICE plane.

Return type

Tuple[ndarray, ndarray]

Returns

A unit normal vector and point that define plane.

spiceypy.spiceypy.pl2psv(plane)[source]

Return a point and two orthogonal spanning vectors that generate a specified plane.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/pl2psv_c.html

Parameters

plane (Plane) – A SPICE plane.

Return type

Tuple[ndarray, ndarray, ndarray]

Returns

A point in the input plane and two vectors spanning the input plane.

spiceypy.spiceypy.pltar(vrtces, plates)[source]

Compute the total area of a collection of triangular plates.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/pltar_c.html

Parameters
  • vrtces (Sequence[Iterable[float]]) – Array of vertices.

  • plates (Sequence[Iterable[int]]) – Array of plates.

Return type

float

Returns

total area of the set of plates

spiceypy.spiceypy.pltexp(iverts, delta)[source]

Expand a triangular plate by a specified amount. The expanded plate is co-planar with, and has the same orientation as, the original. The centroids of the two plates coincide.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/pltexp_c.html

Parameters
  • iverts (Iterable[Iterable[float]]) – Vertices of the plate to be expanded.

  • delta (float) – Fraction by which the plate is to be expanded.

Return type

ndarray

Returns

Vertices of the expanded plate.

spiceypy.spiceypy.pltnp(point, v1, v2, v3)[source]

Find the nearest point on a triangular plate to a given point.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/pltnp_c.html

Parameters
  • point (Iterable[float]) – A point in 3-dimensional space.

  • v1 (Iterable[float]) – Vertices of a triangular plate.

  • v2 (Iterable[float]) – Vertices of a triangular plate.

  • v3 (Iterable[float]) – Vertices of a triangular plate.

Return type

Tuple[ndarray, float]

Returns

the nearest point on a triangular plate to a given point and distance

spiceypy.spiceypy.pltnrm(v1, v2, v3)[source]

Compute an outward normal vector of a triangular plate. The vector does not necessarily have unit length.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/pltnrm_c.html

Parameters
  • v1 (Iterable[float]) – Vertices of a plate.

  • v2 (Iterable[float]) – Vertices of a plate.

  • v3 (Iterable[float]) – Vertices of a plate.

Return type

ndarray

Returns

Plate’s outward normal vector.

spiceypy.spiceypy.pltvol(vrtces, plates)[source]

Compute the volume of a three-dimensional region bounded by a collection of triangular plates.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/pltvol_c.html

Parameters
  • vrtces (Sequence[Iterable[float]]) – Array of vertices.

  • plates (Sequence[Iterable[int]]) – Array of plates.

Return type

float

Returns

the volume of the spatial region bounded by the plates.

spiceypy.spiceypy.polyds(coeffs, deg, nderiv, t)[source]

Compute the value of a polynomial and it’s first n derivatives at the value t.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/polyds_c.html

Parameters
  • coeffs (Iterable[float]) – Coefficients of the polynomial to be evaluated.

  • deg (int) – Degree of the polynomial to be evaluated.

  • nderiv (int) – Number of derivatives to compute.

  • t (int) – Point to evaluate the polynomial and derivatives

Return type

ndarray

Returns

Value of polynomial and derivatives.

spiceypy.spiceypy.pos(string, substr, start)[source]

Find the first occurrence in a string of a substring, starting at a specified location, searching forward.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/pos_c.html

Parameters
  • string (str) – Any character string.

  • substr (str) – Substring to locate in the character string.

  • start (int) – Position to begin looking for substr in string.

Return type

int

Returns

The index of the first occurrence of substr in string at or following index start.

spiceypy.spiceypy.posr(string, substr, start)[source]

Find the first occurrence in a string of a substring, starting at a specified location, searching backward.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/posr_c.html

Parameters
  • string (str) – Any character string.

  • substr (str) – Substring to locate in the character string.

  • start (int) – Position to begin looking for substr in string.

Return type

int

Returns

The index of the last occurrence of substr in string at or preceding index start.

spiceypy.spiceypy.prop2b(gm, pvinit, dt)[source]

Given a central mass and the state of massless body at time t_0, this routine determines the state as predicted by a two-body force model at time t_0 + dt.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/prop2b_c.html

Parameters
  • gm (float) – Gravity of the central mass.

  • pvinit (ndarray) – Initial state from which to propagate a state.

  • dt (float) – Time offset from initial state to propagate to.

Return type

ndarray

Returns

The propagated state.

spiceypy.spiceypy.prsdp(string)[source]

Parse a string as a double precision number, encapsulating error handling.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/prsdp_c.html

Parameters

string (str) – String representing a d.p. number.

Return type

float

Returns

D.p. value obtained by parsing string.

spiceypy.spiceypy.prsint(string)[source]

Parse a string as an integer, encapsulating error handling.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/prsint_c.html

Parameters

string (str) – String representing an integer.

Return type

int

Returns

Integer value obtained by parsing string.

spiceypy.spiceypy.psv2pl(point, span1, span2)[source]

Make a CSPICE plane from a point and two spanning vectors.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/psv2pl_c.html

Parameters
  • point (ndarray) – A Point.

  • span1 (ndarray) – First Spanning vector.

  • span2 (ndarray) – Second Spanning vector.

Return type

Plane

Returns

A SPICE plane.

spiceypy.spiceypy.pxform(fromstr, tostr, et)[source]

Return the matrix that transforms position vectors from one specified frame to another at a specified epoch.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/pxform_c.html

Parameters
  • fromstr (str) – Name of the frame to transform from.

  • tostr (str) – Name of the frame to transform to.

  • et (float) – Epoch of the rotation matrix.

Return type

ndarray

Returns

A rotation matrix.

spiceypy.spiceypy.pxfrm2(frame_from, frame_to, etfrom, etto)[source]

Return the 3x3 matrix that transforms position vectors from one specified frame at a specified epoch to another specified frame at another specified epoch.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/pxfrm2_c.html

Parameters
  • frame_from (str) – Name of the frame to transform from.

  • frame_to (str) – Name of the frame to transform to.

  • etfrom (float) – Evaluation time of frame_from.

  • etto (float) – Evaluation time of frame_to.

Return type

ndarray

Returns

A position transformation matrix from frame_from to frame_to

spiceypy.spiceypy.q2m(q)[source]

Find the rotation matrix corresponding to a specified unit quaternion.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/q2m_c.html

Parameters

q (ndarray) – A unit quaternion.

Return type

ndarray

Returns

A rotation matrix corresponding to q

spiceypy.spiceypy.qcktrc(tracelen=256)[source]

Return a string containing a traceback.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/qcktrc_c.html

Parameters

tracelen (int) – Maximum length of output traceback string.

Return type

str

Returns

A traceback string.

spiceypy.spiceypy.qdq2av(q, dq)[source]

Derive angular velocity from a unit quaternion and its derivative with respect to time.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/qdq2av_c.html

Parameters
  • q (ndarray) – Unit SPICE quaternion.

  • dq (Iterable[float]) – Derivative of q with respect to time

Return type

ndarray

Returns

Angular velocity defined by q and dq.

spiceypy.spiceypy.qxq(q1, q2)[source]

Multiply two quaternions.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/qxq_c.html

Parameters
  • q1 (Union[ndarray, Iterable[float]]) – First SPICE quaternion.

  • q2 (Iterable[float]) – Second SPICE quaternion.

Return type

ndarray

Returns

Product of q1 and q2.

spiceypy.spiceypy.radrec(inrange, re, dec)[source]

Convert from range, right ascension, and declination to rectangular coordinates.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/radrec_c.html

Parameters
  • inrange (float) – Distance of a point from the origin.

  • re (float) – Right ascension of point in radians.

  • dec (float) – Declination of point in radians.

Return type

ndarray

Returns

Rectangular coordinates of the point.

spiceypy.spiceypy.rav2xf(rot, av)[source]

This routine determines a state transformation matrix from a rotation matrix and the angular velocity of the rotation.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/rav2xf_c.html

Parameters
  • rot (Iterable[Iterable[float]]) – Rotation matrix.

  • av (Iterable[float]) – Angular velocity vector.

Return type

ndarray

Returns

State transformation associated with rot and av.

spiceypy.spiceypy.raxisa(matrix)[source]

Compute the axis of the rotation given by an input matrix and the angle of the rotation about that axis.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/raxisa_c.html

Parameters

matrix (ndarray) – Rotation matrix.

Return type

Tuple[ndarray, float]

Returns

Axis of the rotation, Angle through which the rotation is performed

spiceypy.spiceypy.rdtext(file, lenout=256)[source]

Read the next line of text from a text file.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/rdtext_c.html

Parameters
  • file (str) – Name of text file.

  • lenout (int) – Available room in output line.

Return type

Tuple[str, bool]

Returns

Next line from the text file, End-of-file indicator

spiceypy.spiceypy.reccyl(rectan)[source]

Convert from rectangular to cylindrical coordinates.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/reccyl_c.html

Parameters

rectan (Iterable[float]) – Rectangular coordinates of a point.

Return type

Tuple[float, float, float]

Returns

Distance from z axis, Angle (radians) from xZ plane, Height above xY plane.

spiceypy.spiceypy.recgeo(rectan, re, f)[source]

Convert from rectangular coordinates to geodetic coordinates.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/recgeo_c.html

Parameters
  • rectan (Iterable[float]) – Rectangular coordinates of a point.

  • re (float) – Equatorial radius of the reference spheroid.

  • f (float) – Flattening coefficient.

Return type

Tuple[float, float, float]

Returns

Geodetic longitude (radians), Geodetic latitude (radians), Altitude above reference spheroid

spiceypy.spiceypy.reclat(rectan)[source]

Convert from rectangular coordinates to latitudinal coordinates.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/reclat_c.html

Parameters

rectan (Union[ndarray, Iterable[float]]) – Rectangular coordinates of a point.

Return type

Tuple[float, float, float]

Returns

Distance from the origin, Longitude in radians, Latitude in radians

spiceypy.spiceypy.recpgr(body, rectan, re, f)[source]

Convert rectangular coordinates to planetographic coordinates.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/recpgr_c.html

Parameters
  • body (str) – Body with which coordinate system is associated.

  • rectan (Union[ndarray, Iterable[float]]) – Rectangular coordinates of a point.

  • re (float) – Equatorial radius of the reference spheroid.

  • f (float) – Flattening coefficient.

Return type

Tuple[float, float, float]

Returns

Planetographic longitude (radians), Planetographic latitude (radians), Altitude above reference spheroid

spiceypy.spiceypy.recrad(rectan)[source]

Convert rectangular coordinates to range, right ascension, and declination.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/recrad_c.html

Parameters

rectan (Union[ndarray, Iterable[float]]) – Rectangular coordinates of a point.

Return type

Tuple[float, float, float]

Returns

Distance of the point from the origin, Right ascension in radians, Declination in radians

spiceypy.spiceypy.recsph(rectan)[source]

Convert from rectangular coordinates to spherical coordinates.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/recrad_c.html

Parameters

rectan (ndarray) – Rectangular coordinates of a point.

Return type

Tuple[float, float, float]

Returns

Distance from the origin, Angle from the positive Z-axis, Longitude in radians.

spiceypy.spiceypy.removc(item, inset)[source]

Remove an item from a character set.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/removc_c.html

Parameters
  • item (str) – Item to be removed.

  • inset (SpiceCell) – Set to be updated.

Return type

None

spiceypy.spiceypy.removd(item, inset)[source]

Remove an item from a double precision set.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/removd_c.html

Parameters
  • item (float) – Item to be removed.

  • inset (SpiceCell) – Set to be updated.

Return type

None

spiceypy.spiceypy.removi(item, inset)[source]

Remove an item from an integer set.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/removi_c.html

Parameters
  • item (int) – Item to be removed.

  • inset (SpiceCell) – Set to be updated.

Return type

None

spiceypy.spiceypy.reordc(iorder, ndim, lenvals, array)[source]

Re-order the elements of an array of character strings according to a given order vector.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/reordc_c.html

Parameters
  • iorder (Iterable[int]) – Order vector to be used to re-order array.

  • ndim (int) – Dimension of array.

  • lenvals (int) – String length.

  • array (Iterable[str]) – Array to be re-ordered.

Return type

Iterable[str]

Returns

Re-ordered Array.

spiceypy.spiceypy.reordd(iorder, ndim, array)[source]

Re-order the elements of a double precision array according to a given order vector.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/reordd_c.html

Parameters
  • iorder (Iterable[int]) – Order vector to be used to re-order array.

  • ndim (int) – Dimension of array.

  • array (Iterable[float]) – Array to be re-ordered.

Return type

ndarray

Returns

Re-ordered Array.

spiceypy.spiceypy.reordi(iorder, ndim, array)[source]

Re-order the elements of an integer array according to a given order vector.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/reordi_c.html

Parameters
  • iorder (Iterable[int]) – Order vector to be used to re-order array.

  • ndim (int) – Dimension of array.

  • array (Iterable[int]) – Array to be re-ordered.

Return type

ndarray

Returns

Re-ordered Array.

spiceypy.spiceypy.reordl(iorder, ndim, array)[source]

Re-order the elements of a logical (Boolean) array according to a given order vector.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/reordl_c.html

Parameters
  • iorder (Iterable[int]) – Order vector to be used to re-order array.

  • ndim (int) – Dimension of array.

  • array (Iterable[bool]) – Array to be re-ordered.

Return type

ndarray

Returns

Re-ordered Array.

spiceypy.spiceypy.repmc(instr, marker, value, lenout=None)[source]

Replace a marker with a character string.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/repmc_c.html

Parameters
  • instr (str) – Input string.

  • marker (str) – Marker to be replaced.

  • value (str) – Replacement value.

  • lenout (Optional[int]) – Optional available space in output string

Return type

str

Returns

Output string.

spiceypy.spiceypy.repmct(instr, marker, value, repcase, lenout=None)[source]

Replace a marker with the text representation of a cardinal number.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/repmc_c.html

Parameters
  • instr (str) – Input string.

  • marker (str) – Marker to be replaced.

  • value (int) – Replacement value.

  • repcase (str) – Case of replacement text.

  • lenout (Optional[int]) – Optional available space in output string

Return type

str

Returns

Output string.

spiceypy.spiceypy.repmd(instr, marker, value, sigdig)[source]

Replace a marker with a double precision number.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/repmd_c.html

Parameters
  • instr (str) – Input string.

  • marker (str) – Marker to be replaced.

  • value (float) – Replacement value.

  • sigdig (int) – Significant digits in replacement text.

Return type

str

Returns

Output string.

spiceypy.spiceypy.repmf(instr, marker, value, sigdig, informat, lenout=None)[source]

Replace a marker in a string with a formatted double precision value.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/repmf_c.html

Parameters
  • instr (str) – Input string.

  • marker (str) – Marker to be replaced.

  • value (float) – Replacement value.

  • sigdig (int) – Significant digits in replacement text.

  • informat (str) – Format ‘E’ or ‘F’.

  • lenout (Optional[int]) – Optional available space in output string.

Return type

str

Returns

Output string.

spiceypy.spiceypy.repmi(instr, marker, value, lenout=None)[source]

Replace a marker with an integer.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/repmi_c.html

Parameters
  • instr (str) – Input string.

  • marker (str) – Marker to be replaced.

  • value (int) – Replacement value.

  • lenout (Optional[int]) – Optional available space in output string.

Return type

str

Returns

Output string.

spiceypy.spiceypy.repmot(instr, marker, value, repcase, lenout=None)[source]

Replace a marker with the text representation of an ordinal number.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/repmot_c.html

Parameters
  • instr (str) – Input string.

  • marker (str) – Marker to be replaced.

  • value (int) – Replacement value.

  • repcase (str) – Case of replacement text.

  • lenout (Optional[int]) – Optional available space in output string.

Return type

str

Returns

Output string.

spiceypy.spiceypy.reset()[source]

Reset the SPICE error status to a value of “no error.” As a result, the status routine, failed, will return a value of False

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/reset_c.html

Return type

None

spiceypy.spiceypy.return_c()[source]

True if SPICE routines should return immediately upon entry.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/return_c.html

Return type

bool

Returns

True if SPICE routines should return immediately upon entry.

spiceypy.spiceypy.rotate(angle, iaxis)[source]

Calculate the 3x3 rotation matrix generated by a rotation of a specified angle about a specified axis. This rotation is thought of as rotating the coordinate system.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/rotate_c.html

Parameters
  • angle (float) – Angle of rotation (radians).

  • iaxis (int) – Axis of rotation X=1, Y=2, Z=3.

Return type

ndarray

Returns

Resulting rotation matrix

spiceypy.spiceypy.rotmat(m1, angle, iaxis)[source]

Rotmat applies a rotation of angle radians about axis iaxis to a matrix. This rotation is thought of as rotating the coordinate system.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/rotmat_c.html

Parameters
  • m1 (ndarray) – Matrix to be rotated.

  • angle (float) – Angle of rotation (radians).

  • iaxis (int) – Axis of rotation X=1, Y=2, Z=3.

Return type

ndarray

Returns

Resulting rotated matrix.

spiceypy.spiceypy.rotvec(v1, angle, iaxis)[source]

Transform a vector to a new coordinate system rotated by angle radians about axis iaxis. This transformation rotates v1 by angle radians about the specified axis.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/rotvec_c.html

Parameters
  • v1 (Iterable[float]) – Vector whose coordinate system is to be rotated.

  • angle (float) – Angle of rotation (radians).

  • iaxis (int) – Axis of rotation X=1, Y=2, Z=3.

Return type

ndarray

Returns

the vector expressed in the new coordinate system.

spiceypy.spiceypy.rpd()[source]

Return the number of radians per degree.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/rpd_c.html

Return type

float

Returns

The number of radians per degree, pi/180.

spiceypy.spiceypy.rquad(a, b, c)[source]

Find the roots of a quadratic equation.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/rquad_c.html

Parameters
  • a (float) – Coefficient of quadratic term.

  • b (float) – Coefficient of linear term.

  • c (float) – Constant.

Return type

Tuple[ndarray, ndarray]

Returns

Root built from positive and negative discriminant term.

spiceypy.spiceypy.saelgv(vec1, vec2)[source]

Find semi-axis vectors of an ellipse generated by two arbitrary three-dimensional vectors.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/saelgv_c.html

Parameters
  • vec1 (Iterable[float]) – First vector used to generate an ellipse.

  • vec2 (Iterable[float]) – Second vector used to generate an ellipse.

Return type

Tuple[ndarray, ndarray]

Returns

Semi-major axis of ellipse, Semi-minor axis of ellipse.

spiceypy.spiceypy.scard(incard, cell)[source]

Set the cardinality of a SPICE cell of any data type.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/scard_c.html

Parameters
  • incard (int) – Cardinality of (number of elements in) the cell.

  • cell (SpiceCell) – The cell.

Return type

SpiceCell

Returns

The updated Cell.

spiceypy.spiceypy.scdecd(sc, sclkdp, lenout=256, mxpart=None)[source]

Convert double precision encoding of spacecraft clock time into a character representation.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/scdecd_c.html

Parameters
  • sc (int) – NAIF spacecraft identification code.

  • sclkdp (float) – Encoded representation of a spacecraft clock count.

  • lenout (int) – Maximum allowed length of output SCLK string.

  • mxpart (Optional[int]) – Maximum number of spacecraft clock partitions.

Return type

str

Returns

Character representation of a clock count.

spiceypy.spiceypy.sce2c(sc, et)[source]

Convert ephemeris seconds past J2000 (ET) to continuous encoded spacecraft clock “ticks”. Non-integral tick values may be returned.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/sce2c_c.html

Parameters
  • sc (int) – NAIF spacecraft ID code.

  • et (float) – Ephemeris time, seconds past J2000.

Return type

float

Returns

SCLK, encoded as ticks since spacecraft clock start. sclkdp need not be integral.

spiceypy.spiceypy.sce2s(sc, et, lenout=256)[source]

Convert an epoch specified as ephemeris seconds past J2000 (ET) to a character string representation of a spacecraft clock value (SCLK).

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/sce2s_c.html

Parameters
  • sc (int) – NAIF spacecraft clock ID code.

  • et (float) – Ephemeris time, specified as seconds past J2000.

  • lenout (int) – Maximum length of output string.

Return type

str

Returns

An SCLK string.

spiceypy.spiceypy.sce2t(sc, et)[source]

Convert ephemeris seconds past J2000 (ET) to integral encoded spacecraft clock (“ticks”). For conversion to fractional ticks, (required for C-kernel production), see the routine sce2c().

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/sce2t_c.html

Parameters
  • sc (int) – NAIF spacecraft ID code.

  • et (float) – Ephemeris time, seconds past J2000.

Return type

float

Returns

SCLK, encoded as ticks since spacecraft clock start.

spiceypy.spiceypy.scencd(sc, sclkch, mxpart=None)[source]

Encode character representation of spacecraft clock time into a double precision number.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/scencd_c.html

Parameters
  • sc (int) – NAIF spacecraft identification code.

  • sclkch (Union[str, Iterable[str]]) – Character representation of a spacecraft clock.

  • mxpart (Optional[int]) – Maximum number of spacecraft clock partitions.

Return type

Union[float, ndarray]

Returns

Encoded representation of the clock count.

spiceypy.spiceypy.scfmt(sc, ticks, lenout=256)[source]

Convert encoded spacecraft clock ticks to character clock format.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/scfmt_c.html

Parameters
  • sc (int) – NAIF spacecraft identification code.

  • ticks (float) – Encoded representation of a spacecraft clock count.

  • lenout (int) – Maximum allowed length of output string.

Return type

str

Returns

Character representation of a clock count.

spiceypy.spiceypy.scpart(sc)[source]

Get spacecraft clock partition information from a spacecraft clock kernel file.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/scpart_c.html

Parameters

sc (int) – NAIF spacecraft identification code.

Return type

Tuple[ndarray, ndarray]

Returns

The number of spacecraft clock partitions, Array of partition start times, Array of partition stop times.

spiceypy.spiceypy.scs2e(sc, sclkch)[source]

Convert a spacecraft clock string to ephemeris seconds past J2000 (ET).

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/scs2e_c.html

Parameters
  • sc (int) – NAIF integer code for a spacecraft.

  • sclkch (str) – An SCLK string.

Return type

float

Returns

Ephemeris time, seconds past J2000.

spiceypy.spiceypy.sct2e(sc, sclkdp)[source]

Convert encoded spacecraft clock (“ticks”) to ephemeris seconds past J2000 (ET).

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/sct2e_c.html

Parameters
  • sc (int) – NAIF spacecraft ID code.

  • sclkdp (Union[float, Iterable[float]]) – SCLK, encoded as ticks since spacecraft clock start.

Return type

Union[float, ndarray]

Returns

Ephemeris time, seconds past J2000.

spiceypy.spiceypy.sctiks(sc, clkstr)[source]

Convert a spacecraft clock format string to number of “ticks”.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/sctiks_c.html

Parameters
  • sc (int) – NAIF spacecraft identification code.

  • clkstr (str) – Character representation of a spacecraft clock.

Return type

float

Returns

Number of ticks represented by the clock string.

spiceypy.spiceypy.sdiff(a, b)[source]

Take the symmetric difference of two sets of any data type to form a third set.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/sdiff_c.html

Parameters
Return type

SpiceCell

Returns

Symmetric difference of a and b.

spiceypy.spiceypy.set_c(a, op, b)[source]

Given a relational operator, compare two sets of any data type.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/set_c.html

Parameters
  • a (SpiceCell) – First set.

  • op (str) – Comparison operator.

  • b (SpiceCell) – Second set.

Return type

bool

Returns

The function returns the result of the comparison.

spiceypy.spiceypy.setmsg(message)[source]

Set the value of the current long error message.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/setmsg_c.html

Parameters

message (str) – A long error message.

Return type

None

spiceypy.spiceypy.shellc(ndim, lenvals, array)[source]

Sort an array of character strings according to the ASCII collating sequence using the Shell Sort algorithm.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/shellc_c.html

Parameters
  • ndim (int) – Dimension of the array.

  • lenvals (int) – String length.

  • array (Iterable[str]) – The array to be sorted.

Return type

Iterable[str]

Returns

The sorted array.

spiceypy.spiceypy.shelld(ndim, array)[source]

Sort a double precision array using the Shell Sort algorithm.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/shelld_c.html

Parameters
  • ndim (int) – Dimension of the array.

  • array (Iterable[float]) – The array to be sorted.

Return type

ndarray

Returns

The sorted array.

spiceypy.spiceypy.shelli(ndim, array)[source]

Sort an integer array using the Shell Sort algorithm.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/shelli_c.html

Parameters
  • ndim (int) – Dimension of the array.

  • array (Iterable[int]) – The array to be sorted.

Return type

ndarray

Returns

The sorted array.

spiceypy.spiceypy.sigerr(message)[source]

Inform the CSPICE error processing mechanism that an error has occurred, and specify the type of error.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/sigerr_c.html

Parameters

message (str) – A short error message.

Return type

None

spiceypy.spiceypy.sincpt(method, target, et, fixref, abcorr, obsrvr, dref, dvec)[source]

Given an observer and a direction vector defining a ray, compute the surface intercept of the ray on a target body at a specified epoch, optionally corrected for light time and stellar aberration.

This routine supersedes srfxpt().

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/sincpt_c.html

Parameters
  • method (str) – Computation method.

  • target (str) – Name of target body.

  • et (float) – Epoch in ephemeris seconds past J2000 TDB.

  • fixref (str) – Body-fixed, body-centered target body frame.

  • abcorr (str) – Aberration correction.

  • obsrvr (str) – Name of observing body.

  • dref (str) – Reference frame of ray’s direction vector.

  • dvec (ndarray) – Ray’s direction vector.

Return type

Tuple[ndarray, float, ndarray, bool]

Returns

Surface intercept point on the target body, Intercept epoch, Vector from observer to intercept point.

spiceypy.spiceypy.size(cell)[source]

Return the size (maximum cardinality) of a SPICE cell of any data type.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/size_c.html

Parameters

cell (SpiceCell) – Input cell.

Return type

int

Returns

The size of the input cell.

spiceypy.spiceypy.spd()[source]

Return the number of seconds in a day.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/spd_c.html

Return type

float

Returns

The number of seconds in a day.

spiceypy.spiceypy.sphcyl(radius, colat, slon)[source]

This routine converts from spherical coordinates to cylindrical coordinates.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/sphcyl_c.html

Parameters
  • radius (float) – Distance of point from origin.

  • colat (float) – Polar angle (co-latitude in radians) of point.

  • slon (float) – Azimuthal angle (longitude) of point (radians).

Return type

Tuple[float, float, float]

Returns

Distance of point from z axis, angle (radians) of point from XZ plane, Height of point above XY plane.

spiceypy.spiceypy.sphlat(r, colat, lons)[source]

Convert from spherical coordinates to latitudinal coordinates.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/sphlat_c.html

Parameters
  • r (float) – Distance of the point from the origin.

  • colat (float) – Angle of the point from positive z axis (radians).

  • lons (float) – Angle of the point from the XZ plane (radians).

Return type

Tuple[float, float, float]

Returns

Distance of a point from the origin, Angle of the point from the XZ plane in radians, Angle of the point from the XY plane in radians.

spiceypy.spiceypy.sphrec(r, colat, lon)[source]

Convert from spherical coordinates to rectangular coordinates.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/sphrec_c.html

Parameters
  • r (float) – Distance of a point from the origin.

  • colat (float) – Angle of the point from the positive Z-axis.

  • lon (float) – Angle of the point from the XZ plane in radians.

Return type

ndarray

Returns

Rectangular coordinates of the point.

spiceypy.spiceypy.spice_error_check(f)[source]

Decorator for spiceypy hooking into spice error system. If an error is detected, an output similar to outmsg

Returns

spiceypy.spiceypy.spice_found_exception_thrower(f)[source]

Decorator for wrapping functions that use status codes

Return type

Callable

spiceypy.spiceypy.spk14a(handle, ncsets, coeffs, epochs)[source]

Add data to a type 14 SPK segment associated with handle. See also spk14b() and spk14e().

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/spk14a_c.html

Parameters
  • handle (int) – The handle of an SPK file open for writing.

  • ncsets (int) – The number of coefficient sets and epochs.

  • coeffs (Iterable[float]) – The collection of coefficient sets.

  • epochs (Iterable[float]) – The epochs associated with the coefficient sets.

Return type

None

spiceypy.spiceypy.spk14b(handle, segid, body, center, framename, first, last, chbdeg)[source]

Begin a type 14 SPK segment in the SPK file associated with handle. See also spk14a() and spk14e().

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/spk14b_c.html

Parameters
  • handle (int) – The handle of an SPK file open for writing.

  • segid (str) – The string to use for segment identifier.

  • body (int) – The NAIF ID code for the body of the segment.

  • center (int) – The center of motion for body.

  • framename (str) – The reference frame for this segment.

  • first (float) – The first epoch for which the segment is valid.

  • last (float) – The last epoch for which the segment is valid.

  • chbdeg (int) – The degree of the Chebyshev Polynomial used.

Return type

None

spiceypy.spiceypy.spk14e(handle)[source]

End the type 14 SPK segment currently being written to the SPK file associated with handle. See also spk14a() and spk14b().

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/spk14e_c.html

Parameters

handle (int) – The handle of an SPK file open for writing.

Return type

None

spiceypy.spiceypy.spkacs(targ, et, ref, abcorr, obs)[source]

Return the state (position and velocity) of a target body relative to an observer, optionally corrected for light time and stellar aberration, expressed relative to an inertial reference frame.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/spkacs_c.html

Parameters
  • targ (int) – Target body.

  • et (float) – Observer epoch.

  • ref (str) – Inertial reference frame of output state.

  • abcorr (str) – Aberration correction flag.

  • obs (int) – Observer.

Return type

Tuple[ndarray, float, float]

Returns

State of target, One way light time between observer and target, Derivative of light time with respect to time.

spiceypy.spiceypy.spkapo(targ, et, ref, sobs, abcorr)[source]

Return the position of a target body relative to an observer, optionally corrected for light time and stellar aberration.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/spkapo_c.html

Parameters
  • targ (int) – Target body.

  • et (float) – Observer epoch.

  • ref (str) – Inertial reference frame of observer’s state.

  • sobs (ndarray) – State of observer wrt. solar system barycenter.

  • abcorr (str) – Aberration correction flag.

Return type

Tuple[ndarray, float]

Returns

Position of target, One way light time between observer and target.

spiceypy.spiceypy.spkapp(targ, et, ref, sobs, abcorr)[source]

Deprecated: This routine has been superseded by spkaps(). This routine is supported for purposes of backward compatibility only.

Return the state (position and velocity) of a target body relative to an observer, optionally corrected for light time and stellar aberration.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/spkapp_c.html

Parameters
  • targ (int) – Target body.

  • et (float) – Observer epoch.

  • ref (str) – Inertial reference frame of observer’s state.

  • sobs (ndarray) – State of observer wrt. solar system barycenter.

  • abcorr (str) – Aberration correction flag.

Return type

Tuple[ndarray, float]

Returns

State of target, One way light time between observer and target.

spiceypy.spiceypy.spkaps(targ, et, ref, abcorr, stobs, accobs)[source]

Given the state and acceleration of an observer relative to the solar system barycenter, return the state (position and velocity) of a target body relative to the observer, optionally corrected for light time and stellar aberration. All input and output vectors are expressed relative to an inertial reference frame.

This routine supersedes spkapp().

SPICE users normally should call the high-level API routines spkezr() or spkez() rather than this routine. https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/spkaps_c.html

Parameters
  • targ (int) – Target body.

  • et (float) – Observer epoch.

  • ref (str) – Inertial reference frame of output state.

  • abcorr (str) – Aberration correction flag.

  • stobs (ndarray) – State of the observer relative to the SSB.

  • accobs (Iterable[float]) – Acceleration of the observer relative to the SSB.

Return type

Tuple[ndarray, float, float]

Returns

State of target, One way light time between observer and target, Derivative of light time with respect to time.

spiceypy.spiceypy.spkcls(handle)[source]

Close an open SPK file.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/spkcls_c.html

Parameters

handle (int) – Handle of the SPK file to be closed.

Return type

None

spiceypy.spiceypy.spkcov(spk, idcode, cover=None)[source]

Find the coverage window for a specified ephemeris object in a specified SPK file.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/spkcov_c.html

Parameters
  • spk (str) – Name of SPK file.

  • idcode (int) – ID code of ephemeris object.

  • cover (Optional[SpiceCell]) – Optional SPICE Window giving coverage in “spk” for “idcode”.

Return type

SpiceCell

spiceypy.spiceypy.spkcpo(target, et, outref, refloc, abcorr, obspos, obsctr, obsref)[source]

Return the state of a specified target relative to an “observer,” where the observer has constant position in a specified reference frame. The observer’s position is provided by the calling program rather than by loaded SPK files.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/spkcpo_c.html

Parameters
  • target (str) – Name of target ephemeris object.

  • et (float) – Observation epoch.

  • outref (str) – Reference frame of output state.

  • refloc (str) – Output reference frame evaluation locus.

  • abcorr (str) – Aberration correction.

  • obspos (Iterable[float]) – Observer position relative to center of motion.

  • obsctr (str) – Center of motion of observer.

  • obsref (str) – Frame of observer position.

Return type

Tuple[ndarray, float]

Returns

State of target with respect to observer, One way light time between target and observer.

spiceypy.spiceypy.spkcpt(trgpos, trgctr, trgref, et, outref, refloc, abcorr, obsrvr)[source]

Return the state, relative to a specified observer, of a target having constant position in a specified reference frame. The target’s position is provided by the calling program rather than by loaded SPK files.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/spkcpt_c.html

Parameters
  • trgpos (Iterable[float]) – Target position relative to center of motion.

  • trgctr (str) – Center of motion of target.

  • trgref (str) – Observation epoch.

  • et (float) – Observation epoch.

  • outref (str) – Reference frame of output state.

  • refloc (str) – Output reference frame evaluation locus.

  • abcorr (str) – Aberration correction.

  • obsrvr (str) – Name of observing ephemeris object.

Return type

Tuple[ndarray, float]

Returns

State of target with respect to observer, One way light time between target and observer.

spiceypy.spiceypy.spkcvo(target, et, outref, refloc, abcorr, obssta, obsepc, obsctr, obsref)[source]

Return the state of a specified target relative to an “observer,” where the observer has constant velocity in a specified reference frame. The observer’s state is provided by the calling program rather than by loaded SPK files.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/spkcvo_c.html

Parameters
  • target (str) – Name of target ephemeris object.

  • et (float) – Observation epoch.

  • outref (str) – Reference frame of output state.

  • refloc (str) – Output reference frame evaluation locus.

  • abcorr (str) – Aberration correction.

  • obssta (Iterable[float]) – Observer state relative to center of motion.

  • obsepc (float) – Epoch of observer state.

  • obsctr (str) – Center of motion of observer.

  • obsref (str) – Frame of observer state.

Return type

Tuple[ndarray, float]

Returns

State of target with respect to observer, One way light time between target and observer.

spiceypy.spiceypy.spkcvt(trgsta, trgepc, trgctr, trgref, et, outref, refloc, abcorr, obsrvr)[source]

Return the state, relative to a specified observer, of a target having constant velocity in a specified reference frame. The target’s state is provided by the calling program rather than by loaded SPK files.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/spkcvt_c.html

Parameters
  • trgsta (Iterable[float]) – Target state relative to center of motion.

  • trgepc (float) – Epoch of target state.

  • trgctr (str) – Center of motion of target.

  • trgref (str) – Frame of target state.

  • et (float) – Observation epoch.

  • outref (str) – Reference frame of output state.

  • refloc (str) – Output reference frame evaluation locus.

  • abcorr (str) – Aberration correction.

  • obsrvr (str) – Name of observing ephemeris object.

Return type

Tuple[ndarray, float]

Returns

State of target with respect to observer, One way light time between target and observer.

spiceypy.spiceypy.spkez(targ, et, ref, abcorr, obs)[source]

Return the state (position and velocity) of a target body relative to an observing body, optionally corrected for light time (planetary aberration) and stellar aberration.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/spkez_c.html

Parameters
  • targ (int) – Target body.

  • et (float) – Observer epoch.

  • ref (str) – Reference frame of output state vector.

  • abcorr (str) – Aberration correction flag.

  • obs (int) – Observing body.

Return type

Tuple[ndarray, float]

Returns

State of target, One way light time between observer and target.

spiceypy.spiceypy.spkezp(targ, et, ref, abcorr, obs)[source]

Return the position of a target body relative to an observing body, optionally corrected for light time (planetary aberration) and stellar aberration.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/spkezp_c.html

Parameters
  • targ (int) – Target body NAIF ID code.

  • et (float) – Observer epoch.

  • ref (str) – Reference frame of output position vector.

  • abcorr (str) – Aberration correction flag.

  • obs (int) – Observing body NAIF ID code.

Return type

Tuple[ndarray, float]

Returns

Position of target, One way light time between observer and target.

spiceypy.spiceypy.spkezr(targ, et, ref, abcorr, obs)[source]

Return the state (position and velocity) of a target body relative to an observing body, optionally corrected for light time (planetary aberration) and stellar aberration.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/spkezr_c.html

Parameters
  • targ (str) – Target body name.

  • et (Union[ndarray, float]) – Observer epoch.

  • ref (str) – Reference frame of output state vector.

  • abcorr (str) – Aberration correction flag.

  • obs (str) – Observing body name.

Return type

Union[Tuple[ndarray, float], Tuple[Iterable[ndarray], Iterable[float]]]

Returns

State of target, One way light time between observer and target.

spiceypy.spiceypy.spkgeo(targ, et, ref, obs)[source]

Compute the geometric state (position and velocity) of a target body relative to an observing body.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/spkgeo_c.html

Parameters
  • targ (int) – Target body.

  • et (float) – Target epoch.

  • ref (str) – Target reference frame.

  • obs (int) – Observing body.

Return type

Tuple[ndarray, float]

Returns

State of target, Light time.

spiceypy.spiceypy.spkgps(targ, et, ref, obs)[source]

Compute the geometric position of a target body relative to an observing body.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/spkgps_c.html

Parameters
  • targ (int) – Target body.

  • et (float) – Target epoch.

  • ref (str) – Target reference frame.

  • obs (int) – Observing body.

Return type

Tuple[ndarray, float]

Returns

Position of target, Light time.

spiceypy.spiceypy.spklef(filename)[source]

Load an ephemeris file for use by the readers. Return that file’s handle, to be used by other SPK routines to refer to the file.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/spklef_c.html

Parameters

filename (str) – Name of the file to be loaded.

Return type

int

Returns

Loaded file’s handle.

spiceypy.spiceypy.spkltc(targ, et, ref, abcorr, stobs)[source]

Return the state (position and velocity) of a target body relative to an observer, optionally corrected for light time, expressed relative to an inertial reference frame.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/spkltc_c.html

Parameters
  • targ (int) – Target body.

  • et (float) – Observer epoch.

  • ref (str) – Inertial reference frame of output state.

  • abcorr (str) – Aberration correction flag.

  • stobs (ndarray) – State of the observer relative to the SSB.

Return type

Tuple[ndarray, float, float]

Returns

One way light time between observer and target, Derivative of light time with respect to time

spiceypy.spiceypy.spkobj(spk, out_cell=None)[source]

Find the set of ID codes of all objects in a specified SPK file.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/spkobj_c.html

Parameters
  • spk (str) – Name of SPK file.

  • out_cell (Optional[SpiceCell]) – Optional Spice Int Cell.

Return type

SpiceCell

spiceypy.spiceypy.spkopa(filename)[source]

Open an existing SPK file for subsequent write.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/spkopa_c.html

Parameters

filename (str) – The name of an existing SPK file.

Return type

int

Returns

A handle attached to the SPK file opened to append.

spiceypy.spiceypy.spkopn(filename, ifname, ncomch)[source]

Create a new SPK file, returning the handle of the opened file.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/spkopn_c.html

Parameters
  • filename (str) – The name of the new SPK file to be created.

  • ifname (str) – The internal filename for the SPK file.

  • ncomch (int) – The number of characters to reserve for comments.

Return type

int

Returns

The handle of the opened SPK file.

spiceypy.spiceypy.spkpds(body, center, framestr, typenum, first, last)[source]

Perform routine error checks and if all check pass, pack the descriptor for an SPK segment

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/spkpds_c.html

Parameters
  • body (int) – The NAIF ID code for the body of the segment.

  • center (int) – The center of motion for body.

  • framestr (str) – The frame for this segment.

  • typenum (int) – The type of SPK segment to create.

  • first (float) – The first epoch for which the segment is valid.

  • last (float) – The last epoch for which the segment is valid.

Return type

ndarray

Returns

An SPK segment descriptor.

spiceypy.spiceypy.spkpos(targ, et, ref, abcorr, obs)[source]

Return the position of a target body relative to an observing body, optionally corrected for light time (planetary aberration) and stellar aberration.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/spkpos_c.html

Parameters
  • targ (str) – Target body name.

  • et (Union[float, ndarray]) – Observer epoch.

  • ref (str) – Reference frame of output position vector.

  • abcorr (str) – Aberration correction flag.

  • obs (str) – Observing body name.

Return type

Union[Tuple[ndarray, float], Tuple[ndarray, ndarray]]

Returns

Position of target, One way light time between observer and target.

spiceypy.spiceypy.spkpvn(handle, descr, et)[source]

For a specified SPK segment and time, return the state (position and velocity) of the segment’s target body relative to its center of motion.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/spkpvn_c.html

Parameters
  • handle (int) – File handle.

  • descr (ndarray) – Segment descriptor.

  • et (float) – Evaluation epoch.

Return type

Tuple[int, ndarray, int]

Returns

Segment reference frame ID code, Output state vector, Center of state.

spiceypy.spiceypy.spksfs(body, et, idlen)[source]

Search through loaded SPK files to find the highest-priority segment applicable to the body and time specified.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/spksfs_c.html

Parameters
  • body (int) – Body ID.

  • et (float) – Ephemeris time.

  • idlen (int) – Length of output segment ID string.

Return type

Tuple[int, ndarray, str, bool]

Returns

Handle of file containing the applicable segment, Descriptor of the applicable segment, Identifier of the applicable segment.

spiceypy.spiceypy.spkssb(targ, et, ref)[source]

Return the state (position and velocity) of a target body relative to the solar system barycenter.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/spkssb_c.html

Parameters
  • targ (int) – Target body.

  • et (float) – Target epoch.

  • ref (str) – Target reference frame.

Return type

ndarray

Returns

State of target.

spiceypy.spiceypy.spksub(handle, descr, identin, begin, end, newh)[source]

Extract a subset of the data in an SPK segment into a separate segment.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/spksub_c.html

Parameters
  • handle (int) – Handle of source segment.

  • descr (ndarray) – Descriptor of source segment.

  • identin (str) – Indentifier of source segment.

  • begin (float) – Beginning (initial epoch) of subset.

  • end (float) – End (fincal epoch) of subset.

  • newh (int) – Handle of new segment.

Return type

None

spiceypy.spiceypy.spkuds(descr)[source]

Unpack the contents of an SPK segment descriptor.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/spkuds_c.html

Parameters

descr (ndarray) – An SPK segment descriptor.

Return type

Tuple[int, int, int, int, float, float, int, int]

Returns

The NAIF ID code for the body of the segment, The center of motion for body, The ID code for the frame of this segment, The type of SPK segment, The first epoch for which the segment is valid, The last epoch for which the segment is valid, Beginning DAF address of the segment, Ending DAF address of the segment.

spiceypy.spiceypy.spkuef(handle)[source]

Unload an ephemeris file so that it will no longer be searched by the readers.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/spkuef_c.html

Parameters

handle (int) – Handle of file to be unloaded

Return type

None

spiceypy.spiceypy.spkw02(handle, body, center, inframe, first, last, segid, intlen, n, polydg, cdata, btime)[source]

Write a type 2 segment to an SPK file.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/spkw02_c.html

Parameters
  • handle (int) – Handle of an SPK file open for writing.

  • body (int) – Body code for ephemeris object.

  • center (int) – Body code for the center of motion of the body.

  • inframe (str) – The reference frame of the states.

  • first (float) – First valid time for which states can be computed.

  • last (float) – Last valid time for which states can be computed.

  • segid (str) – Segment identifier.

  • intlen (float) – Length of time covered by logical record.

  • n (int) – Number of coefficient sets.

  • polydg (int) – Chebyshev polynomial degree.

  • cdata (Iterable[float]) – Array of Chebyshev coefficients.

  • btime (float) – Begin time of first logical record.

Return type

None

spiceypy.spiceypy.spkw03(handle, body, center, inframe, first, last, segid, intlen, n, polydg, cdata, btime)[source]

Write a type 3 segment to an SPK file.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/spkw03_c.html

Parameters
  • handle (int) – Handle of SPK file open for writing.

  • body (int) – NAIF code for ephemeris object.

  • center (int) – NAIF code for the center of motion of the body.

  • inframe (str) – Reference frame name.

  • first (float) – Start time of interval covered by segment.

  • last (float) – End time of interval covered by segment.

  • segid (str) – Segment identifier.

  • intlen (float) – Length of time covered by record.

  • n (int) – Number of records in segment.

  • polydg (int) – Chebyshev polynomial degree.

  • cdata (Iterable[float]) – Array of Chebyshev coefficients.

  • btime (float) – Begin time of first record.

Return type

None

spiceypy.spiceypy.spkw05(handle, body, center, inframe, first, last, segid, gm, n, states, epochs)[source]

Write an SPK segment of type 5 given a time-ordered set of discrete states and epochs, and the gravitational parameter of a central body.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/spkw05_c.html

Parameters
  • handle (int) – Handle of an SPK file open for writing.

  • body (int) – Body code for ephemeris object.

  • center (int) – Body code for the center of motion of the body.

  • inframe (str) – The reference frame of the states.

  • first (float) – First valid time for which states can be computed.

  • last (float) – Last valid time for which states can be computed.

  • segid (str) – Segment identifier.

  • gm (float) – Gravitational parameter of central body.

  • n (int) – Number of states and epochs.

  • states (Iterable[Iterable[float]]) – States.

  • epochs (Iterable[float]) – Epochs.

Return type

None

spiceypy.spiceypy.spkw08(handle, body, center, inframe, first, last, segid, degree, n, states, epoch1, step)[source]

Write a type 8 segment to an SPK file.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/spkw08_c.html

Parameters
  • handle (int) – Handle of an SPK file open for writing.

  • body (int) – NAIF code for an ephemeris object.

  • center (int) – NAIF code for center of motion of “body”.

  • inframe (str) – Reference frame name.

  • first (float) – Start time of interval covered by segment.

  • last (float) – End time of interval covered by segment.

  • segid (str) – Segment identifier.

  • degree (int) – Degree of interpolating polynomials.

  • n (int) – Number of states.

  • states (Iterable[Iterable[float]]) – Array of states.

  • epoch1 (float) – Epoch of first state in states array.

  • step (float) – Time step separating epochs of states.

Return type

None

spiceypy.spiceypy.spkw09(handle, body, center, inframe, first, last, segid, degree, n, states, epochs)[source]

Write a type 9 segment to an SPK file.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/spkw09_c.html

Parameters
  • handle (int) – Handle of an SPK file open for writing.

  • body (int) – NAIF code for an ephemeris object.

  • center (int) – NAIF code for center of motion of “body”.

  • inframe (str) – Reference frame name.

  • first (float) – Start time of interval covered by segment.

  • last (float) – End time of interval covered by segment.

  • segid (str) – Segment identifier.

  • degree (int) – Degree of interpolating polynomials.

  • n (int) – Number of states.

  • states (Iterable[Iterable[float]]) – Array of states.

  • epochs (Iterable[float]) – Array of epochs corresponding to states.

Return type

None

spiceypy.spiceypy.spkw10(handle, body, center, inframe, first, last, segid, consts, n, elems, epochs)[source]

Write an SPK type 10 segment to the DAF open and attached to the input handle.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/spkw10_c.html

Parameters
  • handle (int) – The handle of a DAF file open for writing.

  • body (int) – The NAIF ID code for the body of the segment.

  • center (int) – The center of motion for body.

  • inframe (str) – The reference frame for this segment.

  • first (float) – The first epoch for which the segment is valid.

  • last (float) – The last epoch for which the segment is valid.

  • segid (str) – The string to use for segment identifier.

  • consts (Iterable[float]) – The array of geophysical constants for the segment.

  • n (int) – The number of element/epoch pairs to be stored.

  • elems (Iterable[float]) – The collection of “two-line” element sets.

  • epochs (Iterable[float]) – The epochs associated with the element sets.

Return type

None

spiceypy.spiceypy.spkw12(handle, body, center, inframe, first, last, segid, degree, n, states, epoch0, step)[source]

Write a type 12 segment to an SPK file.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/spkw12_c.html

Parameters
  • handle (int) – Handle of an SPK file open for writing.

  • body (int) – NAIF code for an ephemeris object.

  • center (int) – NAIF code for center of motion of body.

  • inframe (str) – Reference frame name.

  • first (float) – Start time of interval covered by segment.

  • last (float) – End time of interval covered by segment.

  • segid (str) – Segment identifier.

  • degree (int) – Degree of interpolating polynomials.

  • n (int) – Number of states.

  • states (Iterable[Iterable[float]]) – Array of states.

  • epoch0 (float) – Epoch of first state in states array.

  • step (float) – Time step separating epochs of states.

Return type

None

spiceypy.spiceypy.spkw13(handle, body, center, inframe, first, last, segid, degree, n, states, epochs)[source]

Write a type 13 segment to an SPK file.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/spkw13_c.html

Parameters
  • handle (int) – Handle of an SPK file open for writing.

  • body (int) – NAIF code for an ephemeris object.

  • center (int) – NAIF code for center of motion of body.

  • inframe (str) – Reference frame name.

  • first (float) – Start time of interval covered by segment.

  • last (float) – End time of interval covered by segment.

  • segid (str) – Segment identifier.

  • degree (int) – Degree of interpolating polynomials.

  • n (int) – Number of states.

  • states (Iterable[Iterable[float]]) – Array of states.

  • epochs (Iterable[float]) – Array of epochs corresponding to states.

Return type

None

spiceypy.spiceypy.spkw15(handle, body, center, inframe, first, last, segid, epoch, tp, pa, p, ecc, j2flg, pv, gm, j2, radius)[source]

Write an SPK segment of type 15 given a type 15 data record.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/spkw15_c.html

Parameters
  • handle (int) – Handle of an SPK file open for writing.

  • body (int) – Body code for ephemeris object.

  • center (int) – Body code for the center of motion of the body.

  • inframe (str) – The reference frame of the states.

  • first (float) – First valid time for which states can be computed.

  • last (float) – Last valid time for which states can be computed.

  • segid (str) – Segment identifier.

  • epoch (float) – Epoch of the periapse.

  • tp (ndarray) – Trajectory pole vector.

  • pa (ndarray) – Periapsis vector.

  • p (float) – Semi-latus rectum.

  • ecc (float) – Eccentricity.

  • j2flg (float) – J2 processing flag.

  • pv (Iterable[float]) – Central body pole vector.

  • gm (float) – Central body GM.

  • j2 (float) – Central body J2.

  • radius (float) – Equatorial radius of central body.

Return type

None

spiceypy.spiceypy.spkw17(handle, body, center, inframe, first, last, segid, epoch, eqel, rapol, decpol)[source]

Write an SPK segment of type 17 given a type 17 data record.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/spkw17_c.html

Parameters
  • handle (int) – Handle of an SPK file open for writing.

  • body (int) – Body code for ephemeris object.

  • center (int) – Body code for the center of motion of the body.

  • inframe (str) – The reference frame of the states.

  • first (float) – First valid time for which states can be computed.

  • last (float) – Last valid time for which states can be computed.

  • segid (str) – Segment identifier.

  • epoch (float) – Epoch of elements in seconds past J2000.

  • eqel (Iterable[float]) – Array of equinoctial elements.

  • rapol (float) – Right Ascension of the pole of the reference plane.

  • decpol (float) – Declination of the pole of the reference plane.

Return type

None

spiceypy.spiceypy.spkw18(handle, subtyp, body, center, inframe, first, last, segid, degree, packts, epochs)[source]

Write a type 18 segment to an SPK file.

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/spkw18_c.html

Parameters
  • handle (int) – Handle of an SPK file open for writing.

  • subtyp (int) – SPK type 18 subtype code.

  • body (int) – Body code for ephemeris object.

  • center (int) – Body code for the center of motion of the body.

  • inframe (str) – The reference frame of the states.

  • first (float) – First valid time for which states can be computed.

  • last (float) – Last valid time for which states can be computed.

  • segid (str) – Segment identifier.

  • degree (int) – Degree of interpolating polynomials.

  • packts (Sequence[Iterable[float]]) – data packets

  • epochs (Sequence[float]) – Array of epochs corresponding to states.

Return type

None

spiceypy.spiceypy.spkw20(handle, body, center, inframe, first, last, segid, intlen, n, polydg, cdata, dscale, tscale, initjd, initfr)[source]

Write a type 20 segment to an SPK file.