Space Science with Python — An Introduction

Thomas Albin
5 min readApr 19, 2020

--

Photo by Jeremy Thomas on Unsplash

It has been said that astronomy is a humbling and character-building experience. […]

— Carl Sagan

Astronomy is probably the oldest scientific field, dating back thousands of years ago. At the very beginning (where no light pollution allowed us to have a clear view of the night sky) the stars and constellations were linked to mythology and fortune telling, but were also used to determine e.g., agricultural seasons. In particular, the seasonal position changes of the Pleiades were used to determine harvesting times, rain seasons and much more. The Nebra sky disk is one archaeological artefact, dating back to the Bronze Age that demonstrates the importance of astronomical topics in the past.

A few generations later: We have now the privilege and luck to live in a time where space exploration is a daily science business. First, we are capable to explore and visit our cosmic neighbourhood with high-performance telescopes and spacecraft. Second, thanks to ongoing improvements in information technologies we are able to handle more and more data with very sophisticated methods. I, for example, worked on cosmic dust detection devices on ESA’s Rosetta and NASA’s Cassini mission. I applied data scientific algorithms that were not invented and developed at the time of the missions’ launches! These missions are truly generation projects.

Open Source in Science

Working in the scientific community means, working on code, data, theories and content that needs to be published. Scientific results need to be reproducible. How shall others reproduce your results? How can I reproduce the results of others? Scientific work means also: Collaboration with other working groups. How do you speak “a common data or programming language”?

Well the answer is simple… sharing. A strong Open Source community and miscellaneous institutes and agencies sharing their (raw) data are available all over the Internet.

Where to start in Space Science?

But where does one find tutorials for topics like … Space Science? Machine Learning, Data Science, Deep Learning: One finds a lot of literature and content for these topics. But when I studied physics and worked as an intern at ESA I was confronted with these questions: How can I work in this field? Where do it get the data? What do I need to do? Well, Python was chosen as a programming language thanks to the great scientific packages like NumPy, SciPy or maptlotlib and its Open Source spirit. But I had no idea how to compute certain parameters and values for my space science research topic (I worked on Near-Earth Objects (NEOs*)).

Use SPICE(**), it’s godlike.

— My Supervisor

What? A library that’s “godlike” I have never heard of? It dates back to the 1980s and still being developed by NASA at JPL? I gave it a try.

A few weeks later, I became a big fan and continued to work with this library for years. I used it for my bachelor thesis, master thesis and finally my doctorate studies and it allows one to compute almost anything in our Solar System:

  • Position / Velocity of objects with respect to other objects (like our Earth, or the Sun)
  • Transformation between different coordinate systems (planetary system to ecliptic system), also considering the time!
  • Pointing of spacecraft instruments and orientation of the whole spacecraft
  • Camera specific tasks (is an object in the Field-Of-View of an instrument?)
  • Determine / Obtain parameters and attributes of planetary bodies
  • And much more

Everything appears to be possible using this library. But it requires a lot of work, like reading a lot of documentation … searching and implementing additional files (so called kernels) in miscellaneous archives … and so on.

My contribution

Space science teached me a lot. I worked with miscellaneous tools, powerful libraries and methods in Python. I changed my professional career path, but I still work on space science related questions in my free time. Several Python topics are covered by a lot of tutorials all over the internet, like machine learning. Now, I would like to contribute something. I would like to share my knowledge with you by providing frequent space science tutorials, using Python . I know that there are passionate developers out there and space science enthusiasts. We will start with first steps using the SPICE library and plotting packages to create scientific insights. In the beginning we will build up a fundament to compute basic parameters and create animations (see the video below) and later we will aim for real space science related questions. You will get a feeling and hands-on experience how to handle scientific data and how to create the insights and results that can be found in peer-reviewed publications.

2D trajectory of the ESA’s Rosetta spacecraft. Credit: Thomas Albin

Let’s begin a tutorial journey. You do not need to work in academia to became a scientist. Let’s become Citizen (Space) Scientists!

The next tutorial will be published on 2020.04.21.

Best,

Thomas

P.S.: If you have any questions or ideas please let me know. I will inform the Reddit community in the future about this tutorial series and would like to thank r/learnpython for their encouragement (https://www.reddit.com/r/learnpython/comments/g2zmul/space_science_related_python_tutorial/)!

The tutorials will assume some Python and / or programming knowledge in general. I will try to explain the astrodynamics as much as possible. However, some basic understanding of our Solar System is an advantage.

* NEOs revolve around our Sun on orbits that approach our Earth’s orbit up to a maximum distance of 0.3 Astronomical Units (AU; 1 AU corresponds to the average distance between Earth and Sun). NEOs are separated in 5 different classes. We will work on these objects in a later tutorial.

** SPICE, an abbreviation for Spacecraft Planet Instrument C-matrix Events, is a powerful tool developed and provided by NASA’s Navigation and Ancillary Information Facility (NAIF) at the Jet Propulsion Laboratory (JPL). The software is powerful and widely used e.g., in the Solar System research community. The documentation is sophisticated and quite large and the software is provided in C, Fortran, IDL, Matlab and Java. Python wrappers are provided by the community. More information: https://naif.jpl.nasa.gov/naif/index.html

--

--

Thomas Albin
Thomas Albin

Written by Thomas Albin

Data Scientist and Engineer. Astrophysicist and Solar System researcher — Now working in the automotive industry

Responses (4)