Library interface

A simple example program

The following example program shows the typical usage of the Python interface.

Other examples using the Python interface can be found in the directory examples of the library sources.

from calcephpy import *
peph = CalcephBin.open("example1.dat")
AU = peph.getconstant("AU")
jd0 = 2451542
dt = 0.5
PV = peph.compute_unit(jd0, dt, NaifId.MOON, NaifId.EARTH,
                       Constants.UNIT_KM+Constants.UNIT_SEC+Constants.USE_NAIFID)
print(PV)
peph.close()

Types

calcephpy.CalcephBin

This type contains all information to access a single ephemeris file or a set of ephemeris files to be used together.

calcephpy.NaifId

This type contains the NAIF identification numbers.

calcephpy.Constants

This type contains all constants defined in the library, except the NAIF identification numbers.

Constants

The following constants are defined in the class Constants (or calcephpy.Constants).

VERSION_MAJOR

This integer constant defines the major revision of this library. It can be used to distinguish different releases of this library.

VERSION_MINOR

This integer constant defines the minor revision of this library. It can be used to distinguish different releases of this library.

VERSION_PATCH

This integer constant defines the patch level revision of this library. It can be used to distinguish different releases of this library.

VERSION_STRING

This string is the version of the library, which can be compared to the result of calceph_getversion to check at run time if the header file and library used match:

Note: Obtaining different strings is not necessarily an error, as in general, a program compiled with some old CALCEPH version can be dynamically linked with a newer CALCEPH library version (if allowed by the operating system).

ASTEROID

This integer defines the offset value for the asteroids that must be used as target or center for the computation functions, such as calcephpy.CalcephBin.compute().

The following constants specify in which units are expressed the output of the computation functions, such as calcephpy.CalcephBin.compute_unit() :

UNIT_AU

This integer defines that the unit of the positions and velocities is expressed in astronomical unit.

UNIT_KM

This integer defines that the unit of the positions and velocities is expressed in kilometer.

UNIT_DAY

This integer defines that the unit of the velocities or the quantity TT-TDB or TCG-TCB is expressed in day (one day=86400 seconds).

UNIT_SEC

This integer defines that the unit of the velocities or the quantity TT-TDB or TCG-TCB is expressed in second.

UNIT_RAD

This integer defines that the unit of the angles is expressed in radian.

OUTPUT_EULERANGLES

This integer defines that the output array contains the euler angles.

OUTPUT_NUTATIONANGLES

This integer defines that the output array contains the nutation angles.

USE_NAIFID

This integer defines that the NAIF identification numbers are used as target or center for the computation functions, such as calcephpy.CalcephBin.compute_unit().

The following constants specify the type of segments for the functions, such as calcephpy.getmaxsupportedorder() :

SEGTYPE_ORIG_0

This integer defines the type of segment for the original INPOP/JPL DE file format.

SEGTYPE_SPK_1
SEGTYPE_SPK_2
SEGTYPE_SPK_3
SEGTYPE_SPK_5
SEGTYPE_SPK_8
SEGTYPE_SPK_9
SEGTYPE_SPK_12
SEGTYPE_SPK_13
SEGTYPE_SPK_14
SEGTYPE_SPK_17
SEGTYPE_SPK_18
SEGTYPE_SPK_19
SEGTYPE_SPK_20
SEGTYPE_SPK_21
SEGTYPE_SPK_102
SEGTYPE_SPK_103
SEGTYPE_SPK_120

This integer defines the type of segments (1, 2, 3, 5, 8, 9, 12, 13, 14, 17, 18, 20, 21, 102, 103 and 120) for the SPICE Kernel files.