Bodies¶
A body represents an object in space.
API¶
-
class
spiceminer.
Body
(body)¶ Base class for representing ephimeres objects.
Parameters: body: str or int or Body
The name or ID of the requested body.
Raises: ValueError
If the provided name/ID doesn’t reference a loaded body.
TypeError
If body has the wrong type.
Attributes
classattribute LOADED: set of body All available bodies. id: int The reference id of the body for the backend. Guaranteed to be unique. name: str The name of the body. times_pos: list of tuple of Time Start-end-tuples of all time frames where the position of the body is available. times_rot: list of tuple of Time Start-end-tuples of all time frames where the rotation of the body is available. Methods
-
state
(times, observer='SUN', frame='ECLIPJ2000', abcorr=None)¶ Get the position and speed of this body relative to the observer in a specific reference frame.
Parameters: times: floator iterable of float
The time(s) for which to get the state.
observer: str or Body, optional
Position and speed are measured relative to this body. The rotation of the bodies is ignored, see the frame keyword.
frame: Body or {‘ECLIPJ2000’, ‘J2000’}, optional
The rotational reference frame. ECLIPJ2000: The earths ecliptic plane is used as the x-y-plane. J2000: The earths equatorial plane is used as the x-y-plane.
abcorr: {‘LT’, ‘LT+S’, ‘CN’, ‘CN+S’, ‘XLT’, ‘XLT+S’, ‘XCN’, ‘XCN+S’}, optional
Aberration correction to be applied. For explanation see here.
Returns: state: array_like
The nx7 array where the rows are time, position x, y, z and speed x, y, z. Positions are in km and speeds in km/sec.
Raises: TypeError
If an argument doesn’t conform to the type requirements.
SpiceError
If necessary information is missing.
-
position
(times, observer='SUN', frame='ECLIPJ2000', abcorr=None)¶ Get the position of this body relative to the observer in a specific reference frame.
Parameters: times: float or iterable of float
The time(s) for which to get the position.
observer: str or Body, optional
Position is measured relative to this body. The rotation of the bodies is ignored, see the frame keyword.
frame: Body or {‘ECLIPJ2000’, ‘J2000’}, optional
The rotational reference frame. ECLIPJ2000: The earths ecliptic plane is used as the x-y-plane. J2000: The earths equatorial plane is used as the x-y-plane.
abcorr: {‘LT’, ‘LT+S’, ‘CN’, ‘CN+S’, ‘XLT’, ‘XLT+S’, ‘XCN’, ‘XCN+S’}, optional
Aberration correction to be applied. For explanation see here.
Returns: position: array_like
The nx4 array where the rows are time, position x, y, z. Positions are in km.
Raises: TypeError
If an argument doesn’t conform to the type requirements.
SpiceError
If necessary information is missing.
-
speed
(times, observer='SUN', frame='ECLIPJ2000', abcorr=None)¶ Get the speed of this body relative to the observer in a specific reference frame.
Parameters: times: float or iterable of float
The time(s) for which to get the speed.
observer: str or Body, optional
Position is measured relative to this body. The rotation of the bodies is ignored, see the frame keyword.
frame: Body or {‘ECLIPJ2000’, ‘J2000’}, optional
The rotational reference frame. ECLIPJ2000: The earths ecliptic plane is used as the x-y-plane. J2000: The earths equatorial plane is used as the x-y-plane.
abcorr: {‘LT’, ‘LT+S’, ‘CN’, ‘CN+S’, ‘XLT’, ‘XLT+S’, ‘XCN’, ‘XCN+S’}, optional
Aberration correction to be applied. For explanation see here.
Returns: speed: array_like
The nx4 array where the rows are time, speed x, y, z. Speeds in km/sec.
Raises: TypeError
If an argument doesn’t conform to the type requirements.
SpiceError
If necessary information is missing.
-
rotation
(times, target='ECLIPJ2000')¶ Get the rotation matrix for transforming the rotating of this body from its own reference frame to that of the target.
Parameters: times: float or iterable of float
The time(s) for which to get the matrix.
target: Body or {‘ECLIPJ2000’, ‘J2000’}, optional
Reference frame to transform to.
Returns: times: array_like
The times for which rotation matrices where generated.
matrices: list of array_like
List of 3x3 rotation matrices.
Raises: TypeError
If an argument doesn’t conform to the type requirements.
SpiceError
If necessary information is missing.
-
proximity
(time, distance, classes=None)¶ Get other bodies at most distance km away from this body.
Parameters: time: float
The time to look at.
distance: float
The maximum distance in km at which bodies are included in the results.
classes: type
Filter to select certain types of bodies to look for.
Raises: SpiceError
If necessary information is missing.
-
-
class
spiceminer.
Asteroid
(body)¶ Bodies representing asteroids.
Asteroids are ephimeris objects with IDs > 200000.
Attributes
Methods
-
class
spiceminer.
Barycenter
(body)¶ Bodies representing a barycenter of an ephimeris object and all of its satellites (moons).
Barycenters are ephimeris objects with IDs between 0 and 9.
Attributes
Methods
-
class
spiceminer.
Comet
(body)¶ Bodies representing comets.
Comets are ephimeris objects with IDs between 100000 and 200000.
Attributes
Methods
-
class
spiceminer.
Instrument
(body)¶ Bodies representing instruments mounted on spacecraft (including rovers and their instruments).
Instruments are ephimeris objects with IDs between -1001 and -10000.
Attributes
Methods
-
class
spiceminer.
Planet
(body)¶ Bodies representing planets.
Planets are ephimeris objects with IDs between 199 and 999 with pattern [1-9]99.
Attributes
Methods
-
class
spiceminer.
Satellite
(body)¶ Bodies representing satellites (natural bodies orbiting a planet e.g. moons).
Satellites are ephimeris objects with IDs between 101 and 998 with pattern [1-9][0-9][1-8].
Attributes
Methods
-
class
spiceminer.
Spacecraft
(body)¶ Bodies representing spacecraftand rovers.
Spacecraft are ephimeris objects with IDs between -1 and -999 or < -99999.
Attributes
Methods
-
class
spiceminer.
Star
(body)¶ Body representing the sun.
Only used for the sun (ID 10) at the moment.
Attributes
Methods