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.
- Parameters:
ephem (file, required) – Input file with JD (UTC), geocentric RA (deg), DEC (deg), and distance (AU).
name (str, optional, default=None) – Name of the object.
spkid (str, int, optional) – SPK identifier of the object.
radius (int, float, optional) – Object radius, in km.
error_ra (int, float, optional, default=0) – Ephemeris RA*cosDEC error, in arcsec.
error_dec (int, float, optional, default=0) – Ephemeris DEC error, in arcsec.
mass (int, float, optional, default=0) – Object mass, in kg.
H (int, float, optional) – Object absolute magnitude.
G (int, float, optional) – Object phase slope.
- 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.
ksiis in the East-West direction (East positive).etais in the North-South direction (North positive).- Return type:
float array
- get_position(time, observer='geocenter')[source]
Returns the object’s ICRS position from the fitted ephemeris.
The fit must be initialized with fit_d2_ksi_eta before this method is called.
- 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 local ephemeris regardless of 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
- Parameters:
name (str, required) – Name of the object to search in the JPL database.
id_type (str, optional, default=’smallbody’) – Type of object options:
smallbody,majorbody(planets but also anything that is not a small body),designation,name,asteroid_name,comet_name, orid(Horizons id number).spkid (str, int, optional) – SPK identifier of the object.
radius (int, float, optional) – Object radius, in km.
error_ra (int, float, optional, default=0) – Ephemeris RA*cosDEC error, in arcsec.
error_dec (int, float, optional, default=0) – Ephemeris DEC error, in arcsec.
mass (int, float, optional, default=0) – Object mass, in kg.
H (int, float, optional) – Object absolute magnitude.
G (int, float, optional) – Object phase slope.
- 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) – Horizons observer code, a SORA observer object, a SORA spacecraft object, or one of
'geocenter'and'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:
kernels (list, required) – List of paths for kernel files.
spkid (str, required) – spkid of the target object. Former ‘code’ (v0.1).
name (str, optional, default=None) – Name of the object.
radius (int, float, optional) – Object radius, in km.
error_ra (int, float, optional, default=0) – Ephemeris RA*cosDEC error, in arcsec.
error_dec (int, float, optional, default=0) – Ephemeris DEC error, in arcsec.
mass (int, float, optional, default=0) – Object mass, in kg.
H (int, float, optional) – Object absolute magnitude.
G (int, float, optional) – Object phase slope.
- get_position(time, observer='geocenter')[source]
Returns the object ICRS position for an 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, a SORA observer object, a SORA spacecraft object, or one of
'geocenter'and'barycenter'. String IAU codes must be present in the loaded kernels.
- Returns:
coord – Astropy SkyCoord object with the object coordinates at the given time.
- Return type:
astropy.coordinates.SkyCoord
Complementary functions
Utility functions for file, Horizons, and SPICE-kernel ephemerides.
- 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) – Target name or identifier accepted by Horizons.
observer (str, sora.Observer, sora.Spacecraft) – Horizons observer code, a SORA observer object, a SORA spacecraft object, or one of
'geocenter'and'barycenter'.id_type (str, optional, default=’smallbody’) – Type of target object options:
smallbody,majorbody(planets but also anything that is not a small body),designation,name,asteroid_name,comet_name, orid(Horizons id number).output (str, optional, default=’ephemeris’) – The output of data.
ephemeriswill output the observed position, whilevectorwill output the Cartesian state vector, without light time correction.
- Returns:
coord – ICRS coordinate of the target when
output='ephemeris'. Cartesian state vector from Horizons whenoutput='vector'.- 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, sora.Observer, sora.Spacecraft) – IAU (kernel) code of the observer, a SORA observer object, a SORA spacecraft object, or one of
'geocenter'and'barycenter'. String IAU codes must be present in the loaded kernels.kernels (list, str) – List of paths for all the kernels.
output (str, optional, default=’ephemeris’) – The output of data.
ephemeriswill output the observed position, whilevectorwill output the Cartesian state vector, without light time correction.
- Returns:
coord – ICRS coordinate of the target when
output='ephemeris'. Cartesian state vector of the target relative to the observer whenoutput='vector'.- Return type:
astropy.coordinates.SkyCoord
- sora.ephem.utils.getBSPfromJPL(identifier, initial_date, final_date, email, directory='./')[source]
Warns that automatic BSP download from JPL is unavailable.
This function is kept for compatibility, but currently returns without downloading files because the JPL Query service changed.
When available, BSP files contain information to generate object ephemerides and are named as (without spaces):
'[identifier].bsp'.Important
Automatic download is currently not working. It is also not possible to download BSP files for planets or satellites with this helper.
- 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, optional, default=’./’) – Directory path to save the bsp files.
- Returns:
The function currently only emits a warning and returns.
- Return type:
None