Summary
Outer space holds a deep fascination for people of all ages, and the key principle in its exploration both near and far is orbital mechanics. Poliastro is a pure Python package for exploring and simulating orbit calculations. In this episode Juan Luis Cano Rodriguez shares the story behind the project, how you can use it to learn more about space travel, and some of the interesting projects that have used it for planning planetary and interplanetary missions.
Announcements
- Hello and welcome to Podcast.__init__, the podcast about Python’s role in data and science.
- When you’re ready to launch your next app or want to try a project you hear about on the show, you’ll need somewhere to deploy it, so take a look at our friends over at Linode. With the launch of their managed Kubernetes platform it’s easy to get started with the next generation of deployment and scaling, powered by the battle tested Linode platform, including simple pricing, node balancers, 40Gbit networking, dedicated CPU and GPU instances, and worldwide data centers. Go to pythonpodcast.com/linode and get a $100 credit to try out a Kubernetes cluster of your own. And don’t forget to thank them for their continued support of this show!
- Your host as usual is Tobias Macey and today I’m interviewing Juan Luis Cano Rodriguez about Poliastro, an open source library for interactive Astrodynamics and Orbital Mechanics, with a focus on ease of use, speed, and quick visualization.
Interview
- Introductions
- How did you get introduced to Python?
- Can you describe what Poliastro is and the story behind it?
- What are some of the simulations that Poliastro is designed to be used for?
- How much knowledge of orbital mechanics is necessary to get started with Poliastro?
- Can you describe how the project is implemented?
- How have the goals and design of the project changed or evolved since you first started it?
- What are some of the design philosophies that you focus on to make the package accessible to the range of users that you support?
- Can you talk through the workflow of using Poliastro to do something like track the path of the ISS and its traversal of the debris field from the recent satellite destruction?
- What are some of the other libraries or frameworks that are commonly used with Poliastro?
- How are you using Poliastro in your own work?
- What are some overlooked or underused aspects of the project that you would like to highlight?
- What are the most interesting, innovative, or unexpected ways that you have seen Poliastro used?
- What are the most interesting, unexpected, or challenging lessons that you have learned while working on Poliastro?
- When is Poliastro the wrong choice?
- What do you have planned for the future of Poliastro?
Keep In Touch
Picks
Closing Announcements
- Thank you for listening! Don’t forget to check out our other show, the Data Engineering Podcast for the latest on modern data management.
- Visit the site to subscribe to the show, sign up for the mailing list, and read the show notes.
- If you’ve learned something or tried out a project from the show then tell us about it! Email hosts@podcastinit.com) with your story.
- To help other people find the show please leave a review on iTunes and tell your friends and co-workers
Links
- Poliastro
- Fortran 90 (if only this community existed back then! https://ondrejcertik.com/blog/2021/03/resurrecting-fortran/)?utm_source=rss&utm_medium=rss
- Satellogic
- Read the Docs
- Wolfram Alpha
- Mathematica
- SageMath
- 2-Body Problem
- AstroPy
- Numba
- Import Linter
- Vallado "Fundamentals of Astrodynamics"
- International Space Station
- Starlink Satellites
- Planetary Ephemeritas Data
- Satellite Data
- Kerbal Space Program
- NumFOCUS
- Open Collective
- Python SGP4
- Libre Space Foundation
The intro and outro music is from Requiem for a Fish The Freak Fandango Orchestra / CC BY-SA
Hello, and welcome to Podcast Dot in It, the podcast about Python and the people who make it great. When you're ready to launch your next app or want to try a project you hear about on the show, you'll need somewhere to deploy it. So take a look at our friends over at Linode. With the launch of their managed Kubernetes platform, it's easy to get started with the next generation of deployment and scaling powered by the battle tested Linode platform, including simple pricing, node balancers, 40 gigabit networking, dedicated CPU and GPU instances, and worldwide data centers.
Go to python podcast.com/linode, that's l I n o d e, today and get a $100 credit to try out a Kubernetes cluster of your own. And don't forget to thank them for their continued support of this show. Your host, as usual, is Tobias Macy. And today, I'm interviewing Juan Luis Cano Rodriguez about Polyastro, an open source library for interactive astrodynamics and orbital mechanics with a focus on ease of use, speed, and quick visualization. So, Juan Luis, can you start by introducing yourself?
[00:01:13] Unknown:
Thank you very much, Tobias. I'm super happy to be here. So my name is Juan Luis. I'm an aerospace engineer by background. I studied in Madrid, Spain, and I taught Python myself because the only programming language that we were shown at the university was FORTRAN 90, if we were lucky. So I was always looking forward to use computers to solve mathematical problems, equations, simulations, doing visualization, and things like that. The crystallization of that work has been polyastro, this open source library. I have been developing for already about 10 years almost.
And apart from that, I've been working in software engineering roles over the years in several different industries. Especially like my most productive period so far has been mission planning engineer at Satellogic, an Argentinian startup creating a constellation of satellites. And since then, I have transitioned to developer advocate roles. So now I'm working as 1 through the docs, which is a company providing hosting service for documentation. And lastly, I have been doing lots of freelancing for small and big companies, especially for r and d projects and things like that.
And I have been professor of Python for big data at IE, which is an important business school here in Madrid.
[00:02:46] Unknown:
So, yeah, that's it about me for now. And so you mentioned that you taught yourself Python. I'm wondering if you can share how you ended up finding it and deciding that that was the language that you wanted to dig into and actually learn and use for your own projects?
[00:02:59] Unknown:
Like before university, I learned a few other languages. I don't recall if I started with ActionScript 3, the programming language behind Flash games and things like that, or if I started directly with PHP because I wanted to create my own website where I will publish my games and be rich. That was my dream with 15 years old. I never got rich. However, I learned a lot of programming. And yeah, like I did a bunch of other things, but then at university, 1st year, we got tasked with a problem that was a bit involved. So I wanted to use the computer somehow to do simulations. And I don't know why, but I arrived to Mathematica, which is a commercial software for scientific calculations, probably because of this Word From Alpha website website that gives you, like, answers and things like that.
So I paid a student license for 6 months, and then I ran out of it. So I said, okay. What's the free alternative to Mathematica? And then I found a system called Sage. This is, like, computer algebra system on top of Python that is open source, and I never looked back. So since then, it's been Python 247.
[00:04:13] Unknown:
And so you mentioned that the Polyastro project came about from your studies when you're in university, and I'm wondering if you can just describe a bit about what it is that you've built there and some of the story behind how it came to be and why it is that you still are motivated to want to spend your time and energy on maintaining it and improving it and keeping it up to date?
[00:04:34] Unknown:
Mhmm. So when I was in 4th year, I went to Milan, Italy to do my Erasmus year, which is like an exchange that you do with foreign university Europe. And again, we got tasked with analyzing issues, a spacecraft going from the Earth to Venus, and then doing some more perturbation and analysis of what the orbit around Venus would look like. In principle, it was the 2 of us. But my colleague, which was Italian, he was a student there, he said, you know, I'm out. I quit. So he left me with a thousand lines of MATLAB code that I couldn't understand and lots of questions about my future.
And I say, okay. I'm going to dump all of this and start writing it in Python from scratch. So that's how Polyester was born. So at the beginning, it was just some helper functions to help me with this orbital analysis project. But then, you know, over the years, I had to keep using it because I was still at uni and I had all related subjects, so I kept on improving it. At the beginning, it was a bunch of MATLAB scripts with Fortran codes all glued together with Python that was only known to work on my computer and nowhere else. But around 2015, I discovered Numba, which is a Python library that accelerates code and only applying, like, 1 line decorator to functions.
And I was like, well, if I can keep this code within an order of magnitude of the performance of Fortran, like, not faster than it, but more or less, I can dump all the Fortran and have a Python only library. And that's exactly what happened. Like, I could make Python almost as fast as Fortran. And since then, the library has kept evolving a lot and adding a lot of functionality. We can go over the details during the rest of the conversation, but that's how I started developing it.
[00:06:45] Unknown:
So in terms of the sort of features and capabilities of the Polyastro project, I'm wondering what are the kind of core use cases that you're targeting and some of the types of simulations that is designed to be used for?
[00:06:59] Unknown:
Is focused on what we call the 2 body problem, which is a simplification of the dynamics of the solar system. So there is the sun and there's a lot of other planets and moons, asterisk, comets, and whatever. But if you're doing a simplified analysis, first iteration, then it's usually enough to concentrate only 2 bodies. For example, the sun and the earth or the earth and the moon or a satellite around the earth and things like that. And the equations are surprisingly accurate for this approximation, and it's perfect to do qualitative analysis and things like that. So Polyastro focuses on that part of the Lestral mechanics branch, and then it adds some extra, what we call, perturbations on top of it. For example, it's very useful when studying satellites around the Earth to take into account the drag of the atmosphere because a few 100 kilometers, there's still a very thin layer of atmosphere that drags the satellite down, and it's very important to predict future motion of spacecraft.
Then there's also some effects that you can take into account that relate to the fact that the Earth is not a perfect sphere, but instead is more like a potato. And the first approximation is like an oblate spheroid. So if you take that into account, then the analysis that you do are much more useful. And we keep adding, like, more perturbations like this, so the motion is much more precise. So that's 1 thing, the problem that we call propagation. So moving the position of the satellite forward in time to try to predict where is it going to be at some other point in the future. Then apart from that, there's a few visualization tools that we have. So for example, you can display how the satellite around the Earth looks in 2 dimensions, in 3 dimensions.
We also plot some charts that allow you to pick when is the best opportunity to go from the Earth to Mars, for example, and things like that. So there's lots of visualization involved as well. And finally, and I think that's quite unique of polyester as part of my master thesis, I implemented some, what we call, continuous thrust guidance laws, which means that the satellites can have some small thruster onboard that allows it to make small tweaks and correction to the orbit. So all this maneuver analysis of how applying thrust in a particular direction for a period of time affects the orbit and so forth is also implemented there. And I don't think it's implemented in other packages, at least open source ones that I know.
So, yeah, that's more or less a summary.
[00:10:08] Unknown:
For people who are curious about being able to play around with polyastro and experiment with some of these orbital mechanics calculations, how much knowledge of that overall discipline and the mathematics involved is necessary to be able to start using it and experimenting with it and building out your own simulations and visualizations?
[00:10:27] Unknown:
Fortunately, we've focused on making the Polyastro API as simple as possible. And in fact, most of the operations are like 2 lines or 3 lines. And we're hiding all the mathematical complexity inside the code. So there's not a requirement of knowing, like, even how orbits work or things like that. We have a lot of tutorials, how to guides that apply polyester to some particular cases. So for example, analyzing some asteroids or picking some orbital data from the NASA websites and then visualizing it and things like that. And as long as the user understands more or less the mechanics of Polyester in terms of how orbits are created or retrieved from external databases.
That's about it. So we try to keep the barrier of entry as low as possible. And, also, there's 1 other feature of the Polyastro API that we're very proud of, which is that we try to minimize unit errors. There has been some missions in the past. I recall, like, I believe it's the Mars Polar Orbiter or some mission that we sent to Mars some years ago that crashed onto the surface of the planet because 1 contractor was working in the international system and the other 1 was working with imperial units, which is quite embarrassing, right, for a multimillion dollar endeavor. So we try to apply this philosophy of using units for everything.
And for that, we liberate the super powerful library, which is called Astropy. So AstroPi has a lot of other modules, but 1 of them is astropy.units that allow us to accept physical units as part of the API. And, for example, if the user is operating the radius of the planet in kilometers and then the altitude over the surface of the planet in meters, for example, then adding these 2 values together doesn't result in any error, and AstraPy takes care of absolutely everything. So we try to make all these little decisions on the API as simple as possible so users don't have to, like, necessarily have in mind what units should be used for every operation or things like
[00:12:54] Unknown:
that. So as far as the design of the library and how you think about building out the APIs and the interfaces and the user experience around it. Who are the types of users that you're targeting, and how does that inform the decisions around what to call the different functions and what capabilities to put into the package versus what you want to leave up to people to be able to implement on their own on top of the the library?
[00:13:18] Unknown:
Mhmm. Yeah. It's an excellent question. So at the beginning, we were targeting beginners. And it was so surprising to me, like, you know, I had these simple use cases in mind all the time, and I wanted to make the library as simple as possible. And we made it so simple that at some point, most of the new users of the library were first timers on open source, for example, or first timers in Python. Like I get lots of issues on the repository from people that just created their GitHub account. And I am super excited about this because in a way, we're opening Python and open source to people that were totally outside of that, and I think that's super cool.
So those are like my primary focus or have been my primary focus for a lot of time. But then in recent years, there have been some power users as well of the library. I don't know how everybody is using Polyastro, of course, because I don't have control over that. But we do have a mailing list, and sometimes some interesting domains appear in that mailing list from people that just subscribed. So I know that at least there's interest or it's being used in lots of aerospace companies around the world as well as, universities.
And in particular, we are trying now to make it easier to do massively parallel orbit analysis. So for example, 1 colleague has been trying to use Polyastra to do simulations of all the asteroids of the solar system, which are a lot of them. And even if Polyastra is quite fast, propagating for a very long period of time, like maybe years, a family of asteroids and comets that might have, like, hundreds of thousands of bodies takes a lot of time. So what we're trying to do is to extract some of the lower level parts of the library and make them more reusable on their own so people don't depend on this high level interface that takes physical units, also because these physical units add significant performance penalty. So for people that want to do things that know what they're doing, usually, units get underway somehow.
And on the other hand, we have a research project now that is funded by Nonfocus, which is 1 of the parent organizations that is supporting Polyastro a lot in recent years to try to run some of the Polyastro algorithms on GPUs. So we're experimenting with some last generation GPUs, try to parallelize this workload. The problem of propagating a satellite is governed by what we call an ordinary differential equation, which means that for every step, you always need to know the previous history or the previous steps. And, therefore, this problem is very difficult to parallelize on a GPU in a native way. However, with enough skill, you can take many of these propagations and try to analyze several asteroids or several satellites at the same time. So that's the things that we're working on now. So our focus there is, on 1 hand, to make Polyastro super easy to use for 1st timers and beginners and aerospace engineering students and so forth.
But on the other hand, now we're focusing more on enabling power users to do massive calculations, to simulation, more technical simulation, and all these kind of things in a way that is as fast as possible while retaining the good properties of the library in terms of correctness and ease of use and so forth.
[00:17:24] Unknown:
And as far as the implementation of the project itself, can you talk through some of the architectural and technical aspects of how it's designed and built and some of the ways that you have evolved the architecture over time as you moved it from the initial implementation to where it is now using Numba as the sort of performance layer for the system?
[00:17:45] Unknown:
So the most important architectural decision is separating, on 1 hand, this high level API I was mentioning before that always takes units and tries to protect the user from common mistakes and does some nice representation of the results and so forth from what we call the core algorithms, which are like the numerically intensive operations that are in Polyastro that have to run as fast as possible. So we have sort of like a sandwich architecture with 2 layers. And all these core algorithms have some requirements, so they only depend on NumPy and Numba. They have no other dependencies. They don't take astropay units or anything like that. And to the extent that we can, all these core functions are accelerated with numbers. So all of them have this git decorator applied so that the code can run as fast as possible.
And then we have some intermediate layer that takes the units that the user specifies and then translates that into the lower level core functions that need to run as fast as possible. So it acts like as a translation layer between the 2. And it's what allow us to concentrate all the performance bottlenecks that come because of the dynamic nature of Python and all of that in the high level layer API. And then puts all the numerically sensitive code that has to run as fast as possible and so forth only in the core layer interface. So we try to keep these 2 separated. And for example, very recently, like 2 weeks ago or something like that, I implemented a change using a project called Import Linter that makes sure that in these core functions, we never import astropy,
[00:19:50] Unknown:
which, surprisingly, was not the case. Like, we had made some mistakes in the past, and we discovered them thanks to these tools. So that was very cool too. On the topic of the sort of development flow of being able to build the system, particularly given the mathematical rigor that's necessary to ensure that the orbital calculations that are being done are as accurate as possible? What are some of the other tools and techniques and processes that you've put in place to ensure the maintainability and sustainability of the project and its overall accuracy as you continue to build it and add new calculations and capabilities?
[00:20:25] Unknown:
Yeah. That's an excellent question. And in fact, is what, by far, takes the most amount of time because, these algorithms are usually quite simple. Like, they are 30 lines of code, 10 lines of code, 50 at most. So it takes a few minutes or at most a few hours to any decent programmer to implement those, like to type them. But then the challenge comes with validating the results to a very precise level because there's basically like, 3 kinds of problems. Right? Either the algorithm doesn't work, and this sometimes happens because when we are reading some scientific papers that propose algorithms or something like that, they don't take into account limit cases and you end up with divisions by 0 in some corner cases or things like that.
Then sometimes we just screw it up. And there's some logic error in the implementation, and the results very obviously deviate from what you would expect. At least these are easy to spot, sometimes not so easy to fix. Because I have learned over the years that even though it's a good strategy to doubt from my code first, right, It turns out that the scientific literature is not so good, especially old papers, at offering reproducibility for the results. And we have found lots of times that we cannot reproduce the results or there are no test cases or there's very obvious logic errors in the algorithms that have not been corrected in future editions and so forth. So this is complicated territory to navigate.
Sometimes we are successful and we find errors and we correct them. Some other times, we have to mark the test as x failed because, basically, we don't know what is going on. And then the most tricky kind of errors are the ones that, yes, the results look plausible. Like, sure, this looks like a reasonable quantity for the output, but it's not exactly that. And for that level of precision, what we do is to resort to other libraries that we can compare results to. So for example, there's a number of other open source projects that are either similar to Polyastro or at least they have similar functionality.
I can name, for example, Oracad, which is a Java library that's very battle tested for astrodynamics as well. There's a graphical software called GMAT by NASA that also provides some of this functionality, but we take a point and click interface and so forth rather than with the programming language API. And so what we do, and my colleague, Jorge, who is also from Spain, has been working on this, thanks to an Onfocus grant last year, was to implement what we call a validation framework. So thanks to GitHub actions, now every time there's a commit in Polyastro, of course, we have our unit tests and everything.
But we also have some integration tests that run the results of Polyastro and then compare those with orchids from Java, but also this GMAT thing and etc. And it tries to match those to with a relative error of 0.001% or even less, something like that. And so this way, you know, even if we are not certain that we did the right thing, at least we're certain that we're giving the same result as all the tools that are being used in the industry as well. So we're either all wrong or we're all right.
[00:24:28] Unknown:
To the point of the kind of level of accuracy and being able to reproduce some of the research you're trying to incorporate into the package. I'm wondering if there have been cases where you have been able to identify some of these limit cases because of the tests that you're running on Polyastro and then be able to submit that back to the authors of the paper to help them improve the accuracy and quality of their own research? Absolutely. And in fact, I have a very cool anecdote with this.
[00:24:55] Unknown:
Like, all these algorithms starting with a book that that is 1 of my favorite astrodynamics book that I still have it with me. This is the the same book that I was using when I was at university. And, you know, this book is cool because apart from giving the algorithms, the author also publishes online its own version of the implementations in, like, MATLAB, Fortran, c plus plus and I don't remember if there's something else. So at some point, I was, like, running these algorithms and for some reason it was not working. So it was giving me, like, too many iterations or things like that. And after a lot of digging, I discovered that for orbits around the Earth, it was working, but for orbits around the sun, it was not.
And the reason is that it was doing a tolerance check-in some of the parts of the algorithm that was using absolute tolerance instead of relative tolerance. So in the end, the fix was, like, adding a division and that's it. So it was literally, like, 3 character change or something like that. And I told the author of the book, I never expected a response, but within a couple of days, David Ballado replied back and said, well, thank you very much for this. I will try to incorporate these fixes into the next edition of my book. And I think they have been incorporated in the 4th edition.
So, yes, luckily, sometimes we have been able to reach out to the researchers and they reply back. Some of the times, we haven't been so lucky or they were very slow to respond or things like that. So, yeah, like, I really hope that at some point, there's, like, more fluid communication, you know, between research software engineers, programmers implementing these kind of algorithms, etcetera, and the researchers at the front of human knowledge and everything that probably they're not, like, super expert coders or something like that. But there's lots of things that we can learn from each other and lots of things that we can do if we collaborate.
[00:27:01] Unknown:
And so for somebody who's using Polyastro, I'm wondering if you can just talk through some of the workflow of getting it set up and setting up the simulation and identifying some of the outputs or building a visualization. And to make it concrete might be fun to talk through if we were to try and identify sort of what the path of the International Space Station is as it orbits the planet and the times that it is passing through the cloud of debris that was recently created by the destruction of a defunct satellite and just some of the types of calculations that you might run there, some of the visualizations or information that you might be able to gather by working through that simulation.
[00:27:40] Unknown:
For those that don't know, at the moment of recording this interview, there has been what we call an anti satellite test performed by Russia that consisted in them throwing a missile against 1 of their satellites and making it explode, basically, which has created an enormous amount of fragments of debris in the region that we call low earth orbit, and therefore the region in which not only the National Space Station, but also lots of earth observation satellites, operate. These antisatellite tests have been done by other countries in the past. Like, I think the previous 1 was by India some years ago, and China has done it as well, and the United States has done it again. So, basically, all the powers that have space assets have done it at some point.
And no matter how much people cry, please never do this again, they keep doing it. So it's a pity. But in any case, the interesting thing about satellites, debris, and so forth is that everybody can see them. Like for big spacecraft, like the International Space Station and even smaller ones, like the Starlink satellites, for example, launched by SpaceX and so forth, they're visible with the naked eye at night. And for smaller fragments of debris, small satellites, and so forth, there's a global network of telescopes that try to track all these fragments up to a certain point. If I recall correctly, I'm not 100% sure, but I think they can track objects as small as 1 centimeter, which is quite a fit.
And all this data is being published by 1 of the arms of the US Air Force in a public way. So everybody is able to download this dataset and basically try to simulate how these orbits are going to evolve. Normally, the problem is not on the data itself. Like, the observations are super good. However, propagating these objects in a precise manner is very difficult. With Polyastro, we have, like, a decent amount of perturbations implemented already. As I said, like, atmospheric drag, oblate sphere effects, and so forth. But that's not enough to try to predict, you know, whether there's going to be a collision with the International Space Station or not because you're talking about objects that travel at kilometers per second, and you want to analyze these things with a precision of centimeters or meters. So it's a very difficult problem.
But in any case, if 1 wanted to analyze such a thing with Polyastro, there's a way to download this data from public sources that publish it. So you can go and fetch what's the current trajectory of the International Space Station, where is each of these individual fragments of debris located at the moment, and so forth. And, usually, I do all this analysis on Jupyter Notebook because we have some special integrations with Jupyter, and you can see all the visualizations in the same document where you're writing the code, essentially. And so you can propagate all these objects forward in time, say, 3 hours or 1 day, for example, and then observe how the paths can cross in 3 dimensions.
And that is usually quite straightforward. Like loading these orbits, then propagating and visualizing can take you about 20 lines of code or something like that. So it's absolutely feasible and lots of fun, actually.
[00:31:32] Unknown:
As far as the sort of data collection aspect of it, as you mentioned, there are some of these public datasets of different satellites and space debris, and then there are also datasets available for planetary motion and galactic bodies. I'm wondering if you can just talk through some of the aspect of finding and identifying and collecting the source data to be able to use to plug into these different orbital mechanics calculations and some of the useful or interesting types of questions that can be answered by using these datasets and combining it with the simulation capabilities of Polyastro?
[00:32:06] Unknown:
So there's, like, basically 2 types of data that's collected that's available online. 1 is what we call orbital data. And this is like a snapshot of how the trajectory of an object looks like. So, for example, if I go to 1 of the JPL databases that store orbital data for comets, small asteroids, and things like that. Then I'll be able to see that, I don't know, comet Halley has this particular trajectory and so forth. And then from Polyastro, using some of the class methods or orbit class, then you can load the data directly in 1 line, and that gives you an orbit that you can propagate. Then on the other hand, another kind of data that is called fmerities.
So this is more complex in the sense that rather than giving you a snapshot that then you can propagate with any method that you want, Folks do already a very complex simulation that involves all the plans of the solar system, all the perturbations possible, very precise propagators, very good algorithms, and so forth that take a lot of computational power. And they upload the results of such simulation so you can download them directly. So for example, for complex motion of celestial bodies or if you want to get in a very precise way what is going to be the position of some planetary body in many years or things like that, then it's usually better to download this f m a, this data when it's available because it already gives you, like, a trajectory that you don't need to propagate.
All of this kind of data can be downloaded usually from NASA servers. There's also some European observatories that publish their own similarities and, yeah, and orbital data for small bodies. And then, like, the business of satellites and everything that is in the vicinity of the Earth orbit, that's a totally different story because that's less of a scientific thing and more of a national security thing. So it's of interest for all the governments and all of us, basically, because these days, we depend on GPS satellites to navigate, and we depend on Earth observation satellites to have, like, accuracy accurate information about the earth and so forth. And so protecting the earth's orbit from debris, collision, and so forth is a task that all the countries are taking.
So this data is, however, difficult to collect because we're talking about objects that are much, much smaller than a planet or a moon or whatever. And this is where there's this global network of telescopes that are tracking these these objects. And to my knowledge, I think, basically, the main source of these observations is this 18th space command that publishes orbital information for satellites, debris, and so forth. So these are, like, the main sources of space trajectory information that we can find online.
[00:35:24] Unknown:
And as far as the ways that you're using Polyastro, I'm wondering what are some of the interesting projects that you've built with it or some of the ways that you are using it in your own work, both when you were working more in Astrodynamics and now in your role as a developer advocate?
[00:35:40] Unknown:
So when I was working in Satellogic, we would use it for different tasks. So for example, we wanted to simulate how to transfer the satellites between 1 orbit and the other in the context of assembling a constellation. So when you have several satellites, as it was our case, there were Earth observation satellites, you want to have them follow particular patterns of motion so that you can revisit the same place of the Earth with some desired time frame, or if you want to go over the same place every few days, or if you want to see it at particular times of the day so you have good lightning conditions, not very long shadows, and so forth.
So controlling all this, motion when you have several satellites flying, it's quite important. And these satellites have some propulsion system on board that allows them to make, you know, like, small corrections to the orbit, go up and down, make tiny inclination changes, and so forth. So we were using Polyester for some parts of that analysis. That was 1 of the things. Then very recently, like, I was doing a freelance project for the LibreSpace Foundation, which is an entity based in Greece that promotes free software and free hardware for space.
And they were trying to design a constellation visualization tool for the European Space Agency that could be useful for telecommunication satellites. You know, like, there has been a paradigm shift in the space industry in recent years in which companies have stopped building massive satellites the size of a bus that cost 1, 000, 000 of dollars and lots of years to put in orbit. And now they are, like, building smaller satellites but more numerous, and they operate them in constellations. Like, they have to coordinate all of them as I was describing before. So there's a few orbital patterns that can be used for these constellations.
And we used Polyastro to do part of that analysis as well, and we ended up publishing, like, an online constellation designer tool where you can say how many satellites do you want and how many orbital planes. And then it gives you what is, like, the optimal way of arranging them according to some metrics. And then finally, there is a global competition called the Global Trajectory Optimization Competition, or GTOC, which started by the advanced concepts team, the European Space Agency, and has been running for 12 editions already. Like, I think it's once a year. And they pose very, very difficult problems related to orbit analysis that well, like, they have an optimal solution, but it's impossible to find, basically, because it will take an infinite amount of computational power.
And so the task teams coming up with optimization algorithms that are very smart and very clever strategies to try to find what would be the optimal way of doing something, like, for example, carrying some asteroids from 1 place of the solar system to the other or trying to arrange a constellation of tiny satellites to cover some formation or things like that. And 1 team from University of Malaga in Spain found Polyastro online, and I got in touch with them. And so we've been working very closely to try to submit a solution for this competition. Unfortunately, we couldn't do it in the end because lots of things happened, but it was a very fun problem to work with anyway. So, yeah, as you can see, it's lots of different things between problems that are more, like, research oriented that perhaps not many practical applications in the short term, but nonetheless interesting for the longer term. And there are also very practical and real applications that are now solving problems for space companies around the world. So polyester is very flexible in that sense, and
[00:40:05] Unknown:
we're using it for many different things. Yeah. It's definitely interesting the types of things that people will build as citizen scientists when they're given the tools to be able to take advantage of it. Yeah. Absolutely. That has been an inspiration as well. Like, trying
[00:40:18] Unknown:
to democratize in a way or with analysis even though it's not something that, of course, we think about on a daily basis. But somehow space manages to fascinate us equally. Like, it's about the only thing that adults are willing to admit that they don't know anything about, but still be curious enough to, like, listen and learn and understand and so forth. So I think space has a lot of potential to motivate not only you know, young people that might want to go into STEM and so forth, but also adults to try to make them aware that, as Carl Sagan, the famous astronomer, said, like, we're only a tiny speck in the middle of the universe, and therefore, like, we have to be more humble and more careful with our planet.
[00:41:10] Unknown:
Absolutely. And so as you have built and maintained and worked with the Polyastro community, what are some of the most interesting or innovative or unexpected ways that you've seen it used?
[00:41:21] Unknown:
So there's always interesting feature requests coming up in the issue tracker. You know? So for example, I remember some years ago there was a person that was trying to create their own source systems. So it turns out that our object hierarchy was a little bit too rigid for that. So he asked for ways, you know, to define different stars and different planetary systems and so forth. Then there has been some other people that tried to use it to play Kerbal Space Program, which is a video game very related to this kind of space engineering things where you have some small characters and you can build a rocket and spacecraft and so forth. And it's quite realistic in some ways. Of course, it's a video game and it's not 100%.
It will be too boring otherwise. But, yeah, there's people, like, trying to mix polyester with this sort of more funny activities. And, recently, I'm very proud of professors using it for teaching. So many years ago, I received an email from University of Qaraqi in Pakistan from 1 professor that was using polyester to teach orbital mechanics to his students. And he wanted to publish a book and everything, and he was asking me for permission to use it. I haven't follow-up on the book yet. I don't know if it's available. But in any case, it's super cool because in some sense, Polyastro helped me understand the Orbita mechanics concepts when I was a student.
And the fact that it's being able to teach all the people around the world to do that without me doing anything, like, just sitting here, it's just amazing.
[00:43:05] Unknown:
In your own experience of building the project, what are some of the most interesting or unexpected or challenging lessons that you've learned in the process?
[00:43:12] Unknown:
So the most challenging thing is that it's very difficult to find people that have domain knowledge and good programming skills. It's very, very scarce. Not even, you know, people that are aerospace engineers necessarily, but people that can confront a scientific paper with lots of equations that break tears and so forth, and at the same time, come up with good abstractions, good coding skills, organization skills, and so forth. Like, for me, it's still a struggle. Like, I'm not even happy with some of the APIs that I baked into Polyastro, and I consider myself as someone that is always learning.
So trying to build a community as welcoming as possible and trying to, you know, value out of anything else, having good relationships and being respectful, and, of course, not making mean or stupid comments to anyone else because of sex or race or anything like that. I think it's the most important priority for any community, and I take it very, very seriously. Then I think it's very interesting that documentation is key. Like now, I'm, of course, working in a documentation company, important disclaimer. But, you know, if your code is not documented, it's like it doesn't exist. Sure.
Anybody can find it on Google, GitHub, whatever, and look at it and so forth. But the entry point of most people to a software project is its documentation. So if you have, like, good looking documentation that is aesthetically pleasing, which is also important. Sometimes we forget about that as well. And that explains the concepts clearly, and that it has lots of examples and so forth. I think many people will pick the alternative that is better documented with respect to the 1 that maybe is more powerful, but more difficult to understand. And in that sense, I think we don't pay enough attention to good documentation, and I think we should write more of it.
And, also, like, engage with technical writers that know a lot about how to write to a technical audience. And I've improved a lot, especially in the past months, myself, thanks to being surrounded by good technical writers on the write the docs community. And in general, like, bearing in mind that the code is not everything. Sometimes we technical people focus a lot on the code, and we say, yeah, the code is there. It's self documenting. It doesn't need any comments and things like that. But having lots of empathy towards users and trying to understand what the use cases are and how they feel when they first find your project online or your documentation or whatever, I think it's very, very important to build a successful project. So that has been 1 of the things.
I have confronted as well over the years lots of licensing discussions. And I don't want to get too much into this topic because it's very contentious. But for me, the philosophy of the Matplotlib developers, and in particular, John Hunter that passed away some years ago, was that the most important thing that software project needs is users. So any way that you can lower the barrier of entry to get more and more users, the better the project is going to be. And so permissive licenses play a very important role in that, I believe. Now I think we're seeing, like, a paradigm shift on that as well because there's lots of commercial open source. There's licenses that are not open source, but source available. Like, all these definitions are in flux, and I think we're going to see lots of interesting developments in the coming years.
But I think all the backbone of scientific Python is MIT or equivalent, and I think that has played a very important role in making it more popular. Trying to have a community as welcoming as possible, trying to have good documentation, play along well with licenses, and also, like, don't reinvent the wheel have been, like, some of the guiding principles that we had. And now as a final remark, like, I am now transitioning more into, like, a project manager for Polyastro. So in the past year, we have very lucky we have been very lucky to have funding from Google, thanks to the Google Summer of Code program, and it has had tremendous amount of impact on the project that we were able to implement things that will have been impossible only on my free time. And couple of years ago, we were accepted as an affiliated project of NumFOCUS, which is the organization that is also supporting NumPy, SciPy, AstroPie, and lots of other different projects.
And thanks to these small development grants, we're also being able to develop functionality that was not possible before. So I think if open source projects want to be successful, trying to find a way of achieving sustainability is very important. And now we're in the golden age to try to do that. There's open collective. We are also an open collective as well that allows projects to, like, have accountability on the expenses and donations and everything. There's grants, small or big, depending on the organization. There's GitHub Sponsors. There are some people making their living on GitHub Sponsors.
There's only, like, a tiny number of them, but it's a viable alternative depending on that. And that we developers also need to pay attention to things like marketing, design, and so forth that are completely outside of the realm of coding, but are nonetheless very important to reach a wider audience and making our projects more successful. So I think it's really crucial that we try to build projects in a more holistic way, and we take into account that, yes, the code is important, but also the infrastructure, the documentation, the community, the communication channels, the sustainability, donations, the role of corporate partners, like, everything forms an ecosystem that we have to embrace and develop if we want to be successful.
[00:50:06] Unknown:
For people who are interested in being able to dig into orbital mechanics or build out their own simulations or understand more about astrodynamics, What are some of the cases where a polyastro is the wrong choice and they might be better suited with a different framework or library or just building out their own custom implementation of a particular algorithm? Mhmm. So we were asked
[00:50:29] Unknown:
to implement some 3 body problem algorithms. So we talked at the beginning about the 2 body problem. So the 3 body problem tries to take into account 3 bodies instead of only 2, and things get much more complicated. So it's like another order of magnitude. So even though we have some small things for that, more advanced or more sophisticated propagation tool will be needed for things like traveling to the moon, for example, because, yeah, you need to take into account both the attraction of the Earth and the moon if you want to design, trajectory to the moon, basically. On the other hand, like, for high fidelity propagation of Earth satellites and things like that, as we were mentioning as well, yes, we do have a number of perturbations implemented, but nothing is going to be more precise than taking the orbital data that the space command shares and apply the propagation algorithm that is especially meant for that kind of orbits, which is called sdp 4. So there's a Python library by Brandon Rhodes called Python sdp 4 that is much more useful to propagate these kind of orbits. So these, like, 2 extremes would be, I think, out of scope for
[00:51:49] Unknown:
at least for now. What are some of the things that you have planned for the near to medium term future of or any particular projects or improvements that you're excited to dig into?
[00:52:00] Unknown:
So in the short term, I need to get a release out in the coming weeks. We do conference driven development. So we present talks to events and we make releases right before the events so we can present all the new things that we have developed and so forth. So we have the open source CubeSat workshop in December and also the SciPy Latin America. Both events are free to join and everything, and we're going to be present in both. So we have to squeeze 0.16 release in the very short term. In the medium term, we're working with Ernest to have this GPU thing working, and he's been doing a number of analysis also to try to organize the Polyastro API in a slightly different way that is more maintainable, more flexible, and things like that. So we will do some heavy refactoring in the coming months to accommodate all the changes that we need to make it even faster.
And in the hopefully not so long term, I would love to declare 1 0 for Polyastro. And it's probably the first time that I say this out loud, but I'm probably going to use the 10 year anniversary to do that. So that's going to be 2023. And, yeah, everything that is attached to it, like being more careful with backwards compatibility, like having some sort of deprecation policy and things like that. Because now I'm, like, breaking everything in every release. Not everything, but some of the more experimental stuff is breaking very often. I'm just telling people to come here and complain if they have any problems.
So with 1.0, I would like to have a more stable policy, publish a paper on the Journal of Open Source Software as well, like to graduate the project into something that can be used for production in a more confident way. And, yeah, like, having a solid architecture for the project that can evolve into the future
[00:54:07] Unknown:
in a more sustainable way. So those are, like, my goals for the long term. Are there any other aspects of the work that you're doing on Polyastro or the overall space of orbital mechanics that we didn't discuss yet that you'd like to cover before we close out the show?
[00:54:20] Unknown:
So I think we didn't talk enough about AstroPi is an amazing project, or should I say ecosystem of projects that are doing a tremendous job in making astronomic research easier to do. Like, we're using some parts of it in Polyastro, but it has lot more functionality also for more, like, astronomical stuff, not so much astrodynamics stuff. So things like loading data from space telescopes or doing space spectroscopy reductions and things like that. Like, it's really a super powerful tool that is enabling a new generation of scientists to do things in a different way. Now I think for some years, it has already been the most highly used tool in astronomy research for quite some time. And also, I mentioned it very briefly, but 2 organizations that are supporting a lot are Nonfocus and also the Livspace Foundation. They are the organizers of the open source CubeSat workshop.
And I think it's very important that to the extent that everybody has a different focus on everything, There's organizations that try to promote free software and free hardware, free knowledge in general, to all the fields of the science, engineering, and everything. Because we need a more healthy relationship between, like, commercial software, private, or however you want to call it, and the free tools, the maintainers that are doing it, the users that are using these free tools and so forth. We need to have healthier conversations and more coordination and so forth.
But also, I think it's very important for the general public to always have an open alternative for everything when things like accountability, transparency, and so forth are more of a priority. So in that sense, I think the job that the Liberty Space Foundation is doing is amazing. Like, basically, they are doing satellites, open hardware, and they are publishing everything. And they have a global network of radio amateurs, tracking satellites in space, and putting all of that in a global database. You can check it out in the SatNOCs project. I want to see more of it, basically. So more open source for everything, not only orbital analysis, but all the fields of knowledge.
And, yeah, that's it.
[00:56:54] Unknown:
Alright. Well, for anybody who wants to get in touch with you and follow along or get involved with the project, I'll have you add your preferred contact information to the show notes. And with that, I'll move us into the picks. And this week, I'm going to choose a comedian that I watched recently named Josh Blue. He's hilarious, just very funny guy. Not really appropriate for small kids, but just very funny to watch. So definitely recommend checking him out. And with that, I'll pass it to you, Juan Luis. Do you have any picks this week?
[00:57:20] Unknown:
So I listen to a lot of happy hardcore music. It's a genre of electronic music. It's quite fast and quite fun to listen. If you're able to tolerate the intensity, of course. There's a few DJs that I follow. My favorite 1 is DJ Cuts from Australia on YouTube, and then there's also DJ Weaver on Twitch that does, like, a streaming 1 or twice a week. I enjoy those very much.
[00:57:48] Unknown:
Alright. Well, thank you very much for taking the time today to join me and share the work that you're doing on Polyastro. It's definitely a very interesting project and an interesting problem domain. I appreciate all the time and energy that you and the community have put into making it available and making orbital mechanics a more accessible problem for people to be able to experiment with. So thank you for all the time and energy you put in there, and I hope you enjoy the rest of your day. Thank you very much, Tobias, for the invitation. It was a great pleasure. And,
[00:58:14] Unknown:
yeah, have a nice day. You too.
[00:58:18] Unknown:
Thank you for listening. Don't forget to check out our other show, the Data Engineering Podcast at at dataengineeringpodcast.com for the latest on modern data management. And visit the site at pythonpodcast.com to subscribe to the show, sign up for the mailing list, and read the show notes. And if you've learned something or tried out a project from the show, then tell us about it. Email host@podcastinit.com with your story. To help other people find the show, please leave a review on Itunes and tell your friends and coworkers.
Introduction and Guest Introduction
Juan Luis Cano Rodriguez's Background
Self-Learning Python and Early Projects
Birth of Polyastro
Core Features and Capabilities of Polyastro
Accessibility and Ease of Use
Target Users and API Design
Architectural and Technical Aspects
Ensuring Accuracy and Validation
Collaboration with Researchers
Workflow Example: Tracking Space Debris
Data Collection and Source Integration
Real-World Applications and Projects
Community and Unexpected Uses
Challenges and Lessons Learned
When Polyastro is Not the Right Choice
Future Plans for Polyastro
Final Thoughts and Acknowledgements
Picks and Recommendations