tletools icon indicating copy to clipboard operation
tletools copied to clipboard

Development roadmap

Open FedericoStra opened this issue 5 years ago • 5 comments

  • [ ] Features
    • [ ] Add checksum verification
    • [ ] Improve support for loading TLE set files as a pandas.DataFrame by adding more options
  • [ ] Code quality
    • [x] Add documentation
    • [ ] Add testing
  • [ ] Code architecture
    • [ ] Decide whether unitful TLEs should be of the same class TLE, a subclass thereof, or a subclass of a common superclass
    • [ ] Decide whether interoperability with other packages requires them to be installed always or only as extra dependencies
    • [ ] Decide whether TLE should be immutable or not
    • [x] Separate clearly parsed and computed values
    • [x] Refactor the library as a package with submodules
  • [ ] Interoperability with other packages
    • [x] Fix support to convert a TLE to a poliastro.twobody.Orbit
    • [x] Add support for astropy.units
    • [x] Add support for loading TLE set files as a pandas.DataFrame
    • [ ] Reorganize the interoperability as explained here

FedericoStra avatar Sep 04 '19 09:09 FedericoStra

Hi Federico, thanks for this great library!

Fix support to convert a TLE to a poliastro.Orbit

I'm especially interested in improving the interoperability with poliastro and beyond as well. How do you like the following syntax (I didn't look into the details how to implement this yet though):

tle = TLE.from_lines(*tle_lines)
Orbit.from_classical(**tle)

This method allows tletools to be interoperable with all astrodynamics libraries which have the same naming convention as poliastro for classical elements.

edit: added some reasoning. :)

kerel-fs avatar Dec 04 '19 10:12 kerel-fs

Dear Fabian, thanks a lot for the interest in the library!

I didn't know about beyond, so I will have to research into it first.

Right now, the class tletools.tle.TLE has a method to_orbit which converts the TLE to a poliastro.twobody.orbit.Orbit. You can use it like this:

from tletools import TLE

tle_string = """ISS (ZARYA)
1 25544U 98067A   19249.04864348  .00001909  00000-0  40858-4 0  9990
2 25544  51.6464 320.1755 0007999  10.9066  53.2893 15.50437522187805"""

tle = TLE.from_lines(*tle_string.splitlines())
tle.to_orbit()

In this sense, the section Poliastro Interoperability in the documentation is a bit misleading, because the basic functionality is already present (now I have updated it).

What you suggest (Orbit.from_classical(**tle)) requires making tletools.tle.TLE a subclass of collections.abc.Mapping by implementing __getitem__, __iter__ and __len__. Once this is done, a tletools.tle.TLE instance can then be used in dictionary unpacking. The problem I see with this approach is that the returned mapping should contain only the keys attractor, a, ecc, inc, raan, argp and nu. A tletools.tle.TLE instance already has a way to be converted explicitly to a dict (check the asdict method), but the returned dictionary contains a lot more keys. You also see that the attractor key is necessary to work with poliastro, but maybe not with beyond.

In my opinion, any dict-like appearance of tletools.tle.TLE should reflect the structure of TLE, not what is required by poliastro to build an orbit. In particular, a TLE does not contain neither a nor nu, and this is reflected by tle.asdict() not returning those. Since it is so common to need a and nu, you can instead call tle.asdict(computed=True) to get a dictionary that contains also the computed values a and nu.

In conclusion, regarding the support for poliastro, for the moment I would stick with tle.to_orbit(). It is explicit and avoids implementing inheritance of Mapping which is in conflict with asdict.

FedericoStra avatar Dec 04 '19 14:12 FedericoStra

What I would like to do in the long term to support interoperability better is to

  • move everything interoperability-related inside a tletools.interop package
  • remove the install_requires dependency on pandas, astropy, poliastro
  • add optional features "pandas", "astropy", "poliastro", "beyond"... which depend on the necessary extra packages.

This way you could for instance pip install tletools[poliastro] to have poliastro interoperability and not worry about pandas if you don't need it.

This is probably overkill for such a small project.

FedericoStra avatar Dec 04 '19 14:12 FedericoStra

Hi @FedericoStra! @kerel-fs brought me here, I'm the author of poliastro :) I've been thinking about integrating TLE reading in poliastro for quite some time and I'm happy someone else is doing it. Let me know if I can be of any help!

astrojuanlu avatar Dec 04 '19 21:12 astrojuanlu

I also took the liberty to add your repo here, hope you don't mind! https://github.com/poliastro/poliastro/wiki/Projects-using-or-citing-poliastro

astrojuanlu avatar Dec 04 '19 21:12 astrojuanlu