sora.body

The Body Class

class sora.Body(name, database='auto', **kwargs)[source]

Class that contains and manages the information of the body.

name

The name of the object. It can be the used spkid or designation number to query the SBDB (Small-Body DataBase). In this case, the name is case insensitive.

Type:

str, required

database

The database to query the object. It can be satdb for our temporary hardcoded satellite database, or 'sbdb' to query on the SBDB. If database is set as auto it will try first with satdb, then sbdb. If the user wants to use their own information, database must be given as None. In this case, spkid parameter must be given.

Type:

str, optional, default=’auto’

ephem

An Ephem Class that contains information about the ephemeris. It can be “horizons” to automatically defined an EphemHorizons object or a list of kernels to automatically define an EphemKernel object.

Type:

sora.EphemKernel, sora.EphemHorizons, sora.EphemJPL, sora.EphemPlanete

orbit_class

It defines the Orbital class of the body. It can be TNO, Satellite, Centaur, comet, asteroid, trojan, neo, and planet. It is important for a better characterization of the object. If a different value is given, it will be defined as unclassified.

Type:

str

spkid

If database=None, the user must give a spkid or an ephem which has the spkid parameter.

Type:

str, int, float

shape

It defines the input shape of the body. It can be a body.shape object or the path to OBJ file.

Type:

str, sora.body.shape.Shape3D

albedo

The albedo of the object.

Type:

float, int

H

The absolute magnitude.

Type:

float, int

G

The phase slope.

Type:

float, int

diameter

The diameter of the object, in km.

Type:

float, int, astropy.quantity.Quantity

density

The density of the object, in g/cm³.

Type:

float, int, astropy.quantity.Quantity

GM

The Standard Gravitational Parameter, in km³/s².

Type:

float, int, astropy.quantity.Quantity

rotation

The Rotation of the object, in hours.

Type:

float, int, astropy.quantity.Quantity

pole

The Pole coordinates of the object. It can be a SkyCoord object or a string in the format 'hh mm ss.ss +dd mm ss.ss'.

Type:

str, astropy.coordinates.SkyCoord

BV

The B-V color.

Type:

float, int

UB

The U-B color.

Type:

float, int

smass

The spectral type in SMASS classification.

Type:

str

tholen

The spectral type in Tholen classification.

Type:

str

Note

The following attributes are are returned from the Small-Body DataBase when database='sbdb' or from our temporary hardcoded Satellite DataBase when database='satdb':

orbit_class, spkid, albedo, H, G, diameter, density, GM, rotation, pole, BV, UB, smass, and tholen.

These are physical parameters the user can give to the object. If a query is made and user gives a parameter, the parameter given by the user is defined in the Body object.

__from_local(name, spkid)

Defines Body object with default values for mode=’local’.

__from_sbdb(name)

Searches the object in the SBDB and defines its physical parameters.

Parameters:

name (str) – The name, spkid or designation number of the Small Body.

apparent_magnitude(time, observer='geocenter')[source]

Calculates the object’s apparent magnitude.

Parameters:
  • time (str, astropy.time.Time) – Reference time to calculate the object’s apparent magnitude. 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:

ap_mag – Object apparent magnitude.

Return type:

float

get_orientation(time, observer='geocenter')[source]

Returns the object orientation as seen by an observer.

Parameters:
  • time (str, astropy.time.Time) – Epoch of observation to calculate the object orientation. 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’] to compute ephemeris.

Returns:

orientation – A dictionary with the following orientation parameters: - sub_observer: str

the longitude and latitude of the body in the direction of the observer.

  • sub_solarstr

    The sub-solar coordinate.

  • pole_position_angleastropy.coordinates.Angle

    Apparent position angle of the pole.

  • pole_aperture_angleastropy.coordinates.Angle

    Apparent aperture angle of the pole.

Return type:

dict

get_pole_position_angle(time, observer='geocenter')[source]

Returns the pole position angle and the aperture angle relative to the geocenter.

Parameters:
  • time (str, astropy.time.Time) – Time from which 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.

  • 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:

position_angle, aperture_angle – Position angle and aperture angle of the object’s pole, in degrees.

Return type:

float array

get_position(time, observer='geocenter')[source]

Returns the object position as seen by 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 (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

plot(time=None, observer='geocenter', center_f=0, center_g=0, contour=False, ax=None, plot_pole=True, **kwargs)[source]

Plots the body shape as viewed by observer at some time given the body orientation. If the user wants to dictate the orientation, please use shape.plot() instead.

Parameters:
  • time (str, astropy.time.Time) – Reference time to calculate the object’s apparent magnitude. It can be a string in the ISO format (yyyy-mm-dd hh:mm:ss.s) or an astropy Time object. It must be only one value.

  • 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’]

  • center_f (int, float) – Offset of the center of the body in the East direction, in km

  • center_g (int, float) – Offset of the center of the body in the North direction, in km

  • radial_offset (int, float) – Offset of the center of the body in the direction of observation, in km

  • ax (matplotlib.pyplot.Axes) – The axes where to make the plot. If None, it will use the default axes.

  • contour (bool) – If True, it plots the limb of the projected shape. If False, it plots the 3D shape. Default: False.

  • plot_pole (bool) – If True, the direction of the pole is plotted. Ignored if contour=True

to_log(namefile)[source]

Saves the body log to a file.

Parameters:

namefile (str) – Filename to save the log.

PhysicalData Class

class sora.body.PhysicalData(name, value, uncertainty=0.0, reference='User', notes='', unit=Unit(dimensionless), raise_error=False)[source]

Defines PhysicalData with uncertainty, reference and notes.

Note

It inherits from astropy.units.quantity.Quantity().

Parameters:
  • name (str) – The name representing the corresponding physical parameter.

  • value (int, float, str, ~numpy.ndarray, astropy.quantity.Quantity) – The numerical value of this quantity in the units given by unit. If a Quantity (or any other valid object with a unit attribute), creates a new Quantity object, converting to unit units as needed. If a string, it is converted to a number or Quantity, depending on whether a unit is present.

  • uncertainty (int, float, str, ~numpy.ndarray, astropy.quantity.Quantity, default=0) – The numerical value of this quantity in the units given by unit. If a Quantity (or any other valid object with a unit attribute), creates a new Quantity object, converting to unit units as needed. If a string, it is converted to a number or Quantity, depending on whether a unit is present.

  • reference (str, default=’User’) – A string stating the reference for the parameter value.

  • notes (str, default=’’) – Any other important information about the physical parameter.

  • unit (str, ~astropy.units.UnitBase instance, default=’dimensionless’) – An object that represents the unit associated with the input value. Must be an ~astropy.units.UnitBase object or a string parsable by the units package.

  • raise_error (bool, default=False) – If value=None or raise_error=True the function raises an error, else value is redefined to NaN.

Complementary functions

sora.body.utils.apparent_magnitude(H, G, dist, sundist, phase=0.0)[source]

Calculates the object’s apparent magnitude.

Parameters:
  • H (int, float) – Absolute magnitude.

  • G (int, float) – Slope parameter.

  • dist (int, float) – Observer-object distance, in AU.

  • sundist (int, float) – Sun-object distance, in AU.

  • phase (int, float, default=0) – Phase angle (Sun-Target-Observer), in degrees.

Returns:

ap_mag – Apparent magnitude.

Return type:

float

sora.body.utils.search_sbdb(name)[source]

Searches JPL Small-Body DataBase to search for object information.

As the name implies, it searches only for Small Bodies. Planets and satellites information are not retrieved by this function.

Parameters:

name (str) – The name of the object for the search. It can be the attributed spkid or designation number. The name is case insensitive.

Returns:

sbdb – An ordered dictionary with the object information.

Return type:

dict

Important

The query is not an autocomplete search, so name='Charikl' will not find Chariklo. If more than 1 object is found, the user is asked to select the correct one (e.g: name='neowise').