Array types for scaling for poliastro
A NumFOCUS small development grants program proposal
At the moment, while excellent for individual computations,
poliastro does not scale well to many parallel and array-like computations - e.g. propagating many orbits or many transfer solutions - as required by a lot of contemporary research. This will introduce array types and related infrastructure into
poliastro is an open source (MIT) pure Python library for interactive Astrodynamics and Orbital Mechanics, with a focus on ease of use, speed, and quick visualization. It provides a simple and intuitive API, and handles physical quantities with units.
In its current state, next to other closely related features,
poliastro provides a broad range of methods or algorithms for propagating orbits, studying perturbations, studying spacecraft maneuvers, and computing transfers. Similar to other open source software in this domain,
poliastro focuses on individual solutions, e.g. the propagation of one individual orbit to one individual point in time. Until recently, this was good enough for the majority of professionals and students alike in the fields of astrodynamics and mission design.
A lot of contemporary research, however, has begun to require a lot of computations of this kind at once. As a simple example, instead of plotting an individual orbit, a potential user may want to plot a large number of orbits at once. On a related subject, so-called "porkchop plots", a tool common in space mission design, require the computation of many transfers. Taking this one step further, a potential user may require a large number of porkchop plots or their underlying data for analysis at once.
poliastro in its current form inevitable involves working with iterative processes and loops. Although
poliastro JIT-compiles most of its performance-critical functions internally by relying on numba, iterative operations of this kind are rather slow due to
poliastro's current internal design.
The proposed work aims to change that. It is intended to re-work
poliastro's internals in such a way that array-like operations become feasible. In a subsequent step, at least one new array type, orbit arrays, is introduced. Furthermore, the API of at least one existing type, the
Orbit class, is also extended to demonstrate the capabilities of the library's internal design changes and to guide other developers in the correct usage of the added capabilities.
The proposal's author has more than one year of experience using
poliastro professionally. All of the proposed changes have been tested and studied before submitting this proposal in a separate, dedicated Github repository. Next to significantly improved usability, depending on the algorithm and the size of input data, speedups of one to three orders of magnitude can be expected for relevant computations.
Benefit to project and community
Currently highly active topics of research requiring the described ability to scale include the following, among others:
- Studies on the entire populations of Earth satellites, about 7k at the moment, including both operational and inactive ones.
- Analysis of clouds of space debris, both real ones and models of potential satellite collisions. There are an estimated 0.33M objects larger than 1mm orbiting Earth as of August 2021.
- Studies on the space debris mitigation and its removal, e.g. removing as many pieces of space debris with as little effort as possible
- Models of asteroid or even dust particle populations in the solar system. At the time of writing (September 2021) there have been more than one million unique objects identified in the solar system.
- The ongoing search for machine learning applications in orbit analysis and mission design.
From a technical point of view, the proposed changes will allow
poliastro to leverage even more features of well-established NumFOCUS projects such as
numpy. The developers of
poliastro will be given a new set of internal APIs applying the proposed changes for more algorithms in future. Early experiments also show that the proposed work paves the way for
poliastro to access GPUs for computations in a meaningful and easy way.
The proposed changes will give
poliastro a rather unique set of features and capabilities in the domain of astrodynamics and mission design. This will furthermore strengthen its position in the ecosystem. It is very likely going to help to attract new users, developers and resources. The proposed changes are already a much desired by the
The work will be carried out in a constant dialogue with
poliastro developers. The following deliverables are covered (with their estimated percentage of required work hours):
- 50%: Refactoring of existing internal infrastructure.
- 15%: Adding at least one array-like data type to the library, resembling existing ones: from the
Orbitclass to an "Orbit array" class.
- 5%: Adding at least one new method to an existing data type which is returning arrays:
propagate_manyallows a single
Orbitobject to be propagated to many different positions or points in time, respectively.
- 5%: A minimal set of benchmarks for future verification of the performance of the additions.
- 25%: Matching tests for all added features.
This proposal was submitted to NumFOCUS for review for a 5k USD grant. poliastro is a NumFOCUS-affiliated project. The original proposal text can be found on Github. Early versions of this code were used for my asteroid discovery video-remake.