-
Notifications
You must be signed in to change notification settings - Fork 34
Data Sketches
Michael Mommert edited this page Aug 28, 2017
·
13 revisions
In the data
module we provide classes for orbital elements (Orbits
), ephemerides (Ephem
), physical properties (Phys
), and names (Names
). These classes can be used to load data from databases, populate them manually, use them as input and output for functions from other modules. No need to instantiate these classes. Basically, every function creates an astropy table holding the data - one line per epoch for ephemerides, orbital elements, and observations; single line tables for physical properties. The number of data columns per table may vary; different functions will have different requirements.
from astropy.time import Time
import astropy.units as u
from sbpy.data import Orbit
# retrieve elements from databases
epoch = Time('2018-05-14', scale='utc')
orb = Orbit.from_horizons('ceres', epoch=epoch)
orb = Orbit.from_mpc('ceres')
orb = Orbit.from_astdys('ceres')
# manually set elements from a dictionary or array
orb = Orbit.from_dict({'a': 2.7674*u.au,
'e': .0756,
'i': 10.59321*u.deg})
# convert state vector into orbit (MSK)
import astropy.coordinates as coords
r = coords.HeliocentricTrueEcliptic(coords.CartesianRepresentation(x=1, y=0, z=0, unit=u.au))
v = coords.HeliocentricTrueEcliptic(coords.CartesianRepresentation(x=30, y=0, z=0, unit=u.km / u.s))
orb = Orbit.from_state(r, v)
state = Orbit.to_state(orb)
# derive ephemerides using pyephem
from sbpy.data import Ephem
eph = Ephem.from_pyephem(orb,
location={'name':'Flagstaff',
'geolon':35.199167,
'geolat':-111.631111,
'altitude':'2106'},
epoch=epoch)
# using oorb to fit manually provided ephemerides
eph = Ephem.from_array([ra, dec, ra_sigma, dec_sigma, epochs, epochs_sigma],
names=['ra', 'dec', 'ra_sigma', 'dec_sigma', 'epochs', 'epochs_sigma'])
orb = Orbit.orbfit(eph)
# using rebound to integrate orbit
sim = Orbit.integrate(orb, time=1000*u.year, integrator='IAS15')
orb_future = Orbit.from_rebound(sim)
from sbpy.data import Ephem
from astropy.time import Time
epoch = Time('2018-05-14', scale='utc')
eph = Ephem.from_mpc('ceres', '568', epoch)
eph = Ephem.from_horizons('ceres', '568', epoch)
eph = Ephem.from_imcce('ceres', '568', epoch)
eph = Ephem.from_astorb('ceres', '568', epoch)
# check observability
import obsutil from sbpy
obsplot = obsutil.plot([eph1, eph2, eph3])
script = obsutil.script([eph1, eph2, eph3])
# get ephemerides from orbital elements using PyEphem (see above)
Requirements:
- Shape model requires sub-solar lat, long, sub-observer lat, long from
Ephem
.
from sbpy.data import Phys
from sbpy.photometry import diam2mag, HG
from astropy import Units as u
phys = Phys.from_astorb('ceres')
phys = Phys.from_sbdb('ceres')
phys = Phys.from_dict({'diam':1000*u.km, 'pv': 0.1, 'G': 0.15})
eph = Ephem.from_dict({'r': 1*u.au, 'delta': 1*u.au, 'phase': 0})
mag = diam2mag(phys, eph, model=HG())
# use physical properties in thermal
from sbpy.thermal import NEATM
thermalflux = NEATM.flux(phys, eph, eta=1.2, reflected_solar=True)
from sbpy.data import Names
ident = Names('1 Ceres') # automatically splits string in designation, number, name
print(ident)
# (None, 1, Ceres)
import sbpy.data as data
eph = data.sb_search('test.fits') # create a list of small bodies in FITS image
img = data.image_search('ceres') # create a list of images containing this target
pds = data.pds_ferret('ceres') # return all data from PDS on this target