Open jrob93 opened 2 years ago
Thanks, @jrob93 . I actually have an active pull request that aims to improve the documentation and this could be a good example. Or maybe for our tutorial repository. (We definitely need this in the SSSC technical documentation.)
I think the main problem with the pandas dataframe is that it lacks (astropy) units, right? But we can go through an astropy QTable. How about something like this:
from astropy.table import QTable
tab = QTable.from_pandas(df_orb, units={'a': u.au, 'incl': u.deg, 'Omega': u.deg, 'w': u.deg, 'M': u.deg})
orbits = Orbit.from_table(tab)
QTable.from_pandas
can handle time objects, too, but I don't understand dataframes well enough to experiment with it right now: https://docs.astropy.org/en/stable/api/astropy.table.Table.html#astropy.table.Table.from_pandas
Ah cool, that's much better using QTable. I've never really used tables before because I was more familiar with pandas when I started learning astropy type things, but yes the units are easier with tables. I'm nearly finished the notebook you requested for the SSSC technical docs so I'll use those lines in it.
This is a request for
The requested changes will be implemented by
High-level concept Add the ability to initialise an
Orbit()
object from a table/dataframe containing orbital elements.Explain the relevance to sbpy sbpy
Orbit()
documentation only referencesfrom_mpc
andfrom_horizons
as the way to set up an orbit (unless I've missed something).Proposal details It is possible to create an empty
Orbit()
instance and fill the fields manually, this would probably just need a wrapper function. This functionality would be handy for dealing with simulated orbits, e.g. the LINCC Simulated Solar System Products Data BaseExample (pseudo-)code e.g. from dataframe
Fill fields (remember astropy units):
Add extra required fields: