sora.ephem
The EphemPlanete Class
- class sora.EphemPlanete(ephem, name=None, spkid=None, **kwargs)[source]
Class used to simulate former Fortran programs ephem_planete and fit_d2_ksi_eta.
- ephem
Input file with JD (UTC), geocentric RA (deg), DEC (deg), and distance (AU).
- Type
file, required
- name
Name of the object to search in the JPL database.
- Type
str, optional, default=None
- radius
Object radius, in km.
- Type
int, float, optional, default: online database
- error_ra
Ephemeris RA*cosDEC error, in arcsec.
- Type
int, float, optional, default: online database
- error_dec
Ephemeris DEC error, in arcsec.
- Type
int, float, optional, default: online database
- mass
Object mass, in kg.
- Type
int, float, optional. default=0
- H
Object absolute magnitude.
- Type
int, float, optional, default=NaN
- G
Object phase slope.
- Type
int, float, optional, default=NaN
- fit_d2_ksi_eta(star, verbose=True)[source]
Fits the projected position (orthographic projection) of the object in the tangent sky plane relative to a star.
- Parameters
star (str, astropy.coordinates.SkyCoord) – The coordinate of the star in the same reference frame as the ephemeris.
verbose (bool, optional, default=True) – Enable log printing.
- get_ksi_eta(time, star=None)[source]
Returns the projected position (orthographic projection) of the object in the tangent sky plane relative to a star.
- Parameters
time (str, astropy.time.Time, required) – Reference time to calculate the position. It can be a string in the ISO format (yyyy-mm-dd hh:mm:ss.s) or an astropy Time object.
star (str, astropy.coordinates.SkyCoord, optional, default=None) – The coordinate of the star in the same reference frame as the ephemeris.
- Returns
ksi, eta – Projected position (orthographic projection) of the object in the tangent sky plane relative to a star.
ksi
is in the North-South direction (North positive).eta
is in the East-West direction (East positive).- Return type
float array
- get_position(time, observer='geocenter')[source]
Returns the object’s geocentric position.
- Parameters
time (str, astropy.time.Time) – Reference time to calculate the object position. It can be a string in the ISO format (yyyy-mm-dd hh:mm:ss.s) or an astropy Time object.
observer (any) – This parameter is present in EphemPlanete for compatibility with the remaining ephem classes. The returned positions are based on the given ephemeris despite the observer.
- Returns
coord – Astropy SkyCoord object with the object coordinates at the given time.
- Return type
astropy.coordinates.SkyCoord
The EphemHorizons Class
- class sora.EphemHorizons(name, id_type='smallbody', spkid=None, **kwargs)[source]
Obtains the ephemeris from Horizons/JPL service.
Note
Web tool URL: https://ssd.jpl.nasa.gov/horizons.cgi
- name
Name of the object to search in the JPL database.
- Type
str, required
- id_type
Type of object options:
smallbody
,majorbody
(planets but also anything that is not a small body),designation
,name
,asteroid_name
,comet_name
,id
(Horizons id number), orsmallbody
(find the closest match under any id_type).- Type
str, default=’smallbody’
- radius
Object radius, in km.
- Type
int, float, default: online database
- error_ra
Ephemeris RA*cosDEC error, in arcsec.
- Type
int, float, default: online database
- error_dec
Ephemeris DEC error, in arcsec.
- Type
int, float, default: online database
- mass
Object mass, in kg.
- Type
int, float, default=0
- H
Object absolute magnitude.
- Type
int, float, default=NaN
- G
Object phase slope.
- Type
int, float, default=NaN
- get_position(time, observer='geocenter')[source]
Returns the ICRS position of the object for observer.
- Parameters
time (str, astropy.time.Time) – Reference time to calculate the object position. It can be a string in the ISO format (yyyy-mm-dd hh:mm:ss.s) or an astropy Time object.
observer (str, sora.Observer, sora.Spacecraft) – IAU code of the observer (must be present in given list of kernels), a SORA observer object or a string: [‘geocenter’, ‘barycenter’]
- Returns
coord – Astropy SkyCoord object with the object coordinates at the given time.
- Return type
astropy.coordinates.SkyCoord
The EphemKernel Class
- class sora.EphemKernel(kernels, spkid, name=None, **kwargs)[source]
Gets the ephemeris from BSP kernels.
- Parameters
name (str, optional, default=None) – Name of the object to search in the JPL database.
spkid (str, required) – spkid of the targeting object. Former ‘code’ (v0.1).
kernels (list, required) – List of paths for kernels files.
radius (int, float, optional, default: online database) – Object radius, in km.
error_ra (int, float, optional, default: online database) – Ephemeris RA*cosDEC error, in arcsec .
error_dec (int, float, optional, default: online database) – Ephemeris DEC error, in arcsec.
mass (int, float, optional, default=0) – Object Mass, in kg.
H (int, float, optional, default=NaN) – Object Absolute Magnitude.
G (int, float, optional, default=NaN) – Object Phase slope.
- get_position(time, observer='geocenter')[source]
Returns the object geocentric position.
- Parameters
time (str, astropy.time.Time) – Reference time to calculate the object position. It can be a string in the ISO format (yyyy-mm-dd hh:mm:ss.s) or an astropy Time object.
observer (str, sora.Observer, sora.Spacecraft) – IAU code of the observer (must be present in given list of kernels), a SORA observer object or a string: [‘geocenter’, ‘barycenter’]
- Returns
coord – Astropy SkyCoord object with the object coordinates at the given time.
- Return type
astropy.coordinates.SkyCoord
Complementary functions
- sora.ephem.utils.ephem_horizons(time, target, observer, id_type='smallbody', output='ephemeris')[source]
Calculates the ephemeris from Horizons.
- Parameters
time (str, astropy.time.Time) – Reference instant to calculate ephemeris. It can be a string in the ISO format (yyyy-mm-dd hh:mm:ss.s) or an astropy Time object.
target (str) – IAU (kernel) code of the target.
observer (str) – IAU (kernel) code of the observer.
id_type (str) – Type of target object options:
smallbody
,majorbody
(planets but also anything that is not a small body),designation
,name
,asteroid_name
,comet_name
,id
(Horizons id number), orsmallbody
(find the closest match under any id_type).output (str) – The output of data.
ephemeris
will output the observed position, whilevector
will output the Cartesian state vector, without light time correction.
- Returns
coord – ICRS coordinate of the target.
- Return type
astropy.coordinates.SkyCoord
Notes
If the interval of time is larger than 30 days or so, a timeout error may be raised. The maximum interval will depend on the user connection.
- sora.ephem.utils.ephem_kernel(time, target, observer, kernels, output='ephemeris')[source]
Calculates the ephemeris from kernel files.
- Parameters
time (str, astropy.time.Time) – Reference instant to calculate ephemeris. It can be a string in the ISO format (yyyy-mm-dd hh:mm:ss.s) or an astropy Time object.
target (str) – IAU (kernel) code of the target.
observer (str) – IAU (kernel) code of the observer.
kernels (list, str) – List of paths for all the kernels.
output (str) – The output of data.
ephemeris
will output the observed position, whilevector
will output the Cartesian state vector, without light time correction.
- Returns
coord – ICRS coordinate of the target.
- Return type
astropy.coordinates.SkyCoord
- sora.ephem.utils.getBSPfromJPL(identifier, initial_date, final_date, email, directory='./')[source]
Downloads BSP files from JPL database.
BSP files, which have information to generate the ephemeris of the objects, will be downloaded and named as (without spaces): ‘[identifier].bsp’.
Important
It is not possible to download BSP files for Planets or Satellites.
- Parameters
identifier (str, list) –
Identifier of the object(s). It can be the name, number or SPK ID. It can also be a list of objects.
Examples:
'2137295'
,'1999 RB216'
,'137295'
,['2137295', '136199', '1999 RC216', 'Chariklo']
.initial_date (str) –
Date the bsp file is to begin, within span 1900-2100.
Examples:
'2003-02-01'
,'2003-3-5'
.final_date (str) –
Date the bsp file is to end, within span [1900-2100]. Must be more than 32 days later than initial_date.
Examples:
'2006-01-12'
,'2006-1-12'
.email (str) –
User’s e-mail contact address. Required by JPL web service.
Example:
username@user.domain.name
.directory (str) – Directory path to save the bsp files.