3

I need to find the way to plot orbit planets and satellites in a coherent way. Let's say I want to generate a chart of the Moon's orbit around the Earth, or the jovian satellites around Jupiter.

The hard way would be the use of a CAD software, manually. However, I'm not sure if I will be able to represent the orbits excentricity. And it would be a slow process, one by one...

My idea is to do it programmatically and recursively, so I can generate hundreds of charts for my articles. Can AstroPy do it? I'm using Debian 9 and I checked poliastro, but I had problems with the requirements... I also checked Xephem, and I could not compile it (it's too old, I think). Could Celestia or Kstars do that?

Any Linux/Unix tool would be fine! Especially if it works from the command line.

EDIT: I tried to compile ORSA without luck. Also failed.

I'm discovering the combo of python3-ephem with gnuplot. I can generate the data with Ephem and plot it with Gnuplot. What do you think about this combo?

EDIT 2:

Not only python3-ephem... Skyfield and REBOUND are good options!

Unix
  • 155
  • 7
  • 2
    Most of the answers will somewhat depend on how you want to see the orbits plotted. Anyhow, have a look at Stellarium. – planetmaker Aug 13 '20 at 08:47
  • Perpendicular to the ecliptic would be fine for me. – Unix Aug 13 '20 at 08:57
  • 1
    Skyfield can give you specific data on our solar system and has a Kepler solver module that can generate orbits based on Keplerian elements. Blender can also generate 3D rendered or simply illustrated views of anything and can be scripted from Python and even run programmatically/automatically as a Python module without running the GIU if you like and it even has its own Stack Exchange site! Are these kinds of things along the lines of what you need? If so I can write up a short answer. – uhoh Aug 13 '20 at 09:17
  • 2
  • 1
    @uhoh, yeah, Skyfield looks nice. I'm gonna take a look at it, firstly. This other answer you link here has a lot of tools. Now what I need is time to check them. Thanks a lot! – Unix Aug 13 '20 at 09:48
  • 1
  • Blender is very nice for 3D simulations. Once I implemented the rotation matrix formula in three dimensions for basic rotations to paint the sky (Sky Texture) according to the Sun position (SunLamp orientation coordinates). I would love to do more on it! – Unix Aug 13 '20 at 10:11
  • As I can see, Skyfield can do everything PyEphem does. They implemented everything, according to an issue on Github. So they are quite similar. I could install both with success: python-ephem and python3-ephem are in the repositories. Skyfield via pip package manager. – Unix Aug 13 '20 at 10:15
  • However, poliastro looks very good as well. I think I need to install Python 3.8 in a virtual env and then install all this stuff there, so I don't break the native Python version of the system. – Unix Aug 13 '20 at 10:20
  • 2
    I would reccomend, REBOUND for Python. It is very intuitive when you do a few tutorials. As an example it allowed me to plot this: https://www.youtube.com/watch?v=BWAIq5gi198 – Swike Aug 13 '20 at 11:38
  • @Swike, REBOUND is awesome! I could generate my first PNG image from the examples! Thanks a lot! – Unix Aug 13 '20 at 12:33
  • 1
    How fancy do you want the graphics to be? If you can write Python, it's easy to create simple 2D graphics directly with the Python Imaging Library, PIL (please use the modern fork, Pillow). OTOH, REBOUND looks pretty awesome. :) – PM 2Ring Aug 14 '20 at 09:06
  • @PM2Ring, 2D graphics are fine. About Pillow, could I do a bit of CAD or plotting with it? I've been searching a tool for that, as well, being Eukleides and Asymptote the only two languages I discovered at the moment. – Unix Aug 14 '20 at 09:30
  • Yes, you can do simple pixel graphics and drawing commands with PIL, and save the results in most common bitmap image file formats. PIL only has very simple facilities for displaying an image, I often use it in conjunction with Tkinter if I need interactive graphics, or want to watch an image as it's being plotted. PIL has facilities for exchanging data with Numpy, which is handy when you need to do a lot of number crunching. – PM 2Ring Aug 14 '20 at 09:38
  • OTOH, PIL doesn't support vector based image formats like EPSF or SVG. (All modern browsers support SVG, and it can easily be converted to PostScript or PDF for high quality printing). The Tkinter Canvas can be used for vector based drawing operations, and save the result as EPSF, but I've never tested its EPSF support. But I have done some work in Python that creates SVG data directly (i.e., without using an SVG library). Here's a basic example of SVG plotting I did 6 years ago. It's in Python 2, but it should be easy to convert to Python 3. https://unix.stackexchange.com/a/166921/88378 – PM 2Ring Aug 14 '20 at 09:45
  • @PM2Ring, or LaTeX libraries as well. I will use Tikz for some things. – Unix Aug 14 '20 at 09:52

1 Answers1

3

One keyword to search for is "spice kernel".

SPICE stands for Spacecraft Planet Instrument C-matrix Event. That is a type of data format in which orbital data are commonly provided by ESA, NASA and other institutions dealing with detailed data; it is the recommended format by IAU to use. Often the so-called kernels for objects and missions are also readily available for download and digestion of tools (e.g. here or here).

Quite a few poplular solutions are python modules like HelioPy, SpicePy or PoliAstro and possibly this tutorial might do what you want. They usually have good documentation with extensive examples for simply copy&paste on how to use them. That said, python is not the only option, there are solutions in other languages as well.

It's also worth to note that some missions come with their own dedicated tools like Cassini's JCSN or Cassini orbit plotting tool.

For natural bodies AstroPy, possibly along with JPLEphem might suffice and prove quite versatile.

planetmaker
  • 19,369
  • 3
  • 46
  • 80
  • 1
    That's a very good point: «it is the recommended format by IAU to use». I checked SPICE before in the NAIF website and I was not able to find how to install it. But knowing there are so much python modules based on it is really nice. I have a lot of modules to learn, now! I use Python, Bash, C, Go, Ruby, Perl... How do I find more tools in other languages? (Based on SPICE) – Unix Aug 14 '20 at 09:26
  • 2
    https://naif.jpl.nasa.gov/naif/toolkit.html has some further links... more likely at the end of some dedicated search queries with a search engine of your choice. I don't have bookmarks either. – planetmaker Aug 14 '20 at 10:09