# Python Libraries: Numerical Propagators and Access Calculations

I have written some of my own code in Matlab that performs two body unperturbed as well as J2 perturbed orbit propagation. I am shifting to a new environment that requires the use of Python, and can't seem to see if there are any libraries to that do numerical propagation and access calculations with Kepler orbital elements.

I am aware of libraries like astropy, but they all seem limited to just utilizing TLE's and no way of defining a custom orbit. I do not need super high fidelity.

• Check out our tagged posts for poliastro and pyephem (though the latter is depreciated.) Skyfield might get an integrator some day. You can also just try to roll-your-own – uhoh Mar 2 '20 at 15:01
• Why not port your MATLAB code? – Carl Witthoft Mar 2 '20 at 15:35
• Not extremely proficient at coding fast/vectorized python code – S moran Mar 2 '20 at 19:45
• I actually looked into poliastro, and i thought ease of use was phenomenal but the propagation was a little slower then I had hoped for. I need to be able to propagate at 30 second intervals for 90 day duration in under a 0.5 seconds. – S moran Mar 2 '20 at 19:47
• @Smoran I opened an issue on poliastro to consider your request github.com/poliastro/poliastro/issues/854 please leave a comment there so we can have as much information as possible – astrojuanlu Mar 3 '20 at 14:07

Disclaimer: I'm the author and lead developer of poliastro. Happy to see many others are recommending it, though! :) I also work for Satellogic, the company that open sourced orbit-predictor.

I have personal experience with two libraries: poliastro and orbit-predictor (see disclaimers above).

poliastro provides a generic framework for initial orbit determination and preliminary orbit analysis, currently focused on interplanetary applications. In our roadmap we explicitly mention adding more Earth-specific functionality, which is something we will keep doing this year (thanks to OpenAstronomy being selected in Google Summer of Code). This includes adding a semianalytical propagator accounting for J2 effects, among others. At the moment, you can simulate this by using the generic Cowell method and adding a J2 perturbation force, like demonstrated in the User Guide.

orbit-predictor is kind of a high-level wrapper for python-sgp4, the venerable SGP4 implementation maintained by Brandon Rhodes (recently with new releases). It provides Predictor objects that serve as propagators, like TLEPredictor, KeplerianPredictor (unperturbed) and J2Predictor (accounting for J2). The latter has factory methods to create Sun-synchronous satellites and whole constellations, and convenience methods to compute the passes over a location with some geometrical constraints, the eclipse duration, and the next eclipses (we are adding the latter as we speak). The documentation is not so good though, so my recommendation would be to read the source code.

## Extra historical insight

In poliastro we rewrote the API using Plyades as inspiration (thanks Helge!) but Plyades is now unmaintained because its author moved on to write JuliaAstro. Other packages like orbital suffer from the same thing. Please check out the project activity before making a choice :)

Speaking of which:

cohesive effort to merge Plyades, PoliAstro and other orbital mechanics Python software (the Python Astrodynamics Project)

The Python Astrodynamics project was an effort Helge, Frazer and I started to merge these three packages, but early on we found some disagreements so it never really started off. It was replaced by the OpenAstrodynamics Initiative, which states that it's better to spark diversity and collaboration through open standards and protocols than trying to coalesce projects into one.

• Thanks for clarifying Juan! :) – Sam Low Mar 4 '20 at 5:46

Check out PoliAstro by Juan! It's got great visualisation tools in addition to its propagation. Plyades too, is a library for orbit propagation with visualisation. I have heard that there is a cohesive effort to merge Plyades, PoliAstro and other orbital mechanics Python software (the Python Astrodynamics Project).

I have also heard of, but not used, Orekit which has a Python Wrapper. It was traditionally an orbit propagation tool written in Java, but has a Python wrapper for it here.

As for accesses, as far as I have searched, there is no Python library available. Nevertheless, you can tryout STK, the free license allows for access calculations, and if I'm not mistaken, you can use Python to automate tasks on STK too.

• +1 btw how did you hear of "...cohesive effort to merge..."? where can others also hear of it? – uhoh Mar 3 '20 at 9:14
• It was written inside the research paper (near the conclusion) of "Plyades: A Python Library for Space Mission Design" by Helge Eichhorn∗, Reiner Anderl, stating: "As of this writing Plyades has been superseded by the PythonAstrodynamics project [PyA15]. The project aims to mergethe three MIT-licensed, Python-based astrodynamics librariesPlyades, Poliastro [JCR15] and Orbital [FML15] and providea comprehensive Python-based astrodynamics toolkit for pro-ductive use." See: arxiv.org/pdf/1607.00849.pdf – Sam Low Mar 4 '20 at 5:39
• Super, thank you! I didn't know about any of that. – uhoh Mar 4 '20 at 5:46
• Juan, the author of PoliAstro, wrote some comments on the merger efforts below :) – Sam Low Mar 4 '20 at 5:47

Like Sam Low, I can also recommend PoliAstro, it's a great project with ever more contributors.

I am using the Orekit Python Wrapper a lot. The learning curve in Orekit can be steep at the beginning, because there are hundreds of Java classes. However, when you know how to use it, it is the most capable astrodynamics (open-source) library I know. Also, it is very fast, if you propagate the satellite without a loop and then retrieve the intermediate states via another loop later or via a StepHandler, see https://gitlab.orekit.org/orekit-labs/python-wrapper/-/blob/master/examples/Example_EarthObservation_-_Attitude_Sequence.ipynb.

As you only want J2 perturbations, you should consider using semi-analytical propagators such as DSST and Eckstein-Hechler, they are much faster than numerical propagators.

To add to Sam's point about accesses, there is also NASA's GMAT free software that allows you to report the accesses.

Alternatively, you can calculate that by yourself. I had no need to calc that before, but I did some related calcs that could be easily transformed into access windows calc. My proposed way is that I would define the ground station of interest first, then propagate the satellite of interest and get the trajectory data in ECI (alongside with time steps). Further, transform your LLA position of GS to ECI (with the same time steps) and perform the look angles calculation from GS to Sat (transformation from ECI to Azimuth-Elelevation-Range). The only thing left would be to define some sort of filtering or 'satellite visibility mask' (with minimal elevation angle as the definitive parameter), which you apply on your AzElRange data set and get the visible passes of your satellite. From there you can get your timestamps and access window duration.