A blog about astronomy and software development, mainly focused on my experiences during the development of JPARSEC.


Tag index

Recent Posts

Most recent posts.

This is the end, or a new beginning

After more than 10 years having fun with this blog, and even more developing my Java library JPARSEC, this is probably my last post. I recently received a generous job offer to join a team at ESAC (the Spanish center of the European Space Agency) to work as a software engineer. I will contribute to maintain and design the databases generated by current and future space telescopes, and to develop VO (Virtual Observatory) tools to generate some scientific output from the data. So in the next weeks I will be moving to start a new exciting path in my career, full of new challenges.

I'm not sure how long this site will keep alive, so I recommend to download or copy any interesting information you may find here to keep it safe offline. I will check it from time to time, and, if necessary, I would replicate all the contents in my home server: I cannot discard to continue with my posts or developing my library in my own server, but right now I think it is unlikely. You can always contact me if you need to ask about something I wrote here using my gmail account. My user name on that mail provider is talonsoalbi.

During these years my effort developing the software and projects published here has been rewarded with some interesting and extremely satisfying little collaborations, some of them mentioned in the blog, and some not. I'm not going to reveal all of them, I will simply say it was great and funny. It is also amazing how every little project or achievement was a necessary step towards more complex developments, and how all them contributed with time to change my way of thinking, and how to solve more difficult problems. But here at OAN I was feeling there was no further challenges or interesting problems to face, or other people to share the same way of thinking. It was clearly the time to move on, and ESA is the right place for me to continue working with this philosophy and to face the next challenges of the astronomy of the future.

2021/06/21 12:35 · Tomás Alonso Albi · 0 Comments

Solar and lunar eclipse charts

Some years ago I posted some efforts to render solar and lunar eclipse maps with JPARSEC. It was something more or less preliminar and I really expected to improve it with time, but it seems there was too many things to do before. In the last version of my library I have fixed some errors in the sequences of lunar eclipses in RenderEclipse class, but overall everything is pretty similar, and the charts are far from being good compared to those produced with other tools.

A revision of this code would mean dramatic changes to create similar but better images. I was not sure about doing that, since anyway these charts are not very interesting. So, instead, I have written another RenderEclipse2 class that I present below to create new charts and videos, with much better and modern look.

I will present all charts and videos in Spanish, although the program can also generate them in English. Here is a video example for the next solar eclipse in June:


The video is similar to the ones available at web site, although I also show the eclipse sequence from some selected places. This kind of videos look very educative to show other people why the eclipse starts/ends or the Sun is eclipsed in different percentages from different places. I wonder how the terraplanists from Flat Earth Society would explain solar eclipses in a flat Earth …

Here is the corresponding eclipse sequence from Madrid:


Respect lunar eclipses, here are some charts and a video produced with the new code for the lunar eclipse of May 26, 2021:

→

[NEW] A runnable version of the simulator has been added, see the bottom of the page.

Solar System in 3d (part 3)

Due to COVID last summer was long, and in addition to the project related to numerical integration of planetary orbits I made a 3d project using Java3D to simulate the entire Solar System. In fact this was my main project and as a break I did the other. I also enjoyed many youtube videos about AI and machine learning from MIT, and played with WEKA (a machine learning library). While confined I learned a lot, but fortunately this year will end soon.

I expected to improve this project and present it during the Spring here, but new ideas are coming to my head and I prefer to present this project before the end of the year so I can forget about 3d stuff for a while (hopefully forever) and go back to more practical astronomy with a new control system for telescopes. For now there is only a youtube video about it, in Spanish, but even if you understand it I wouldn't recommend wasting your time watching it, it's quite boring…

Respect the 3d Solar System the idea was to create a Java3D implementation of the Celestia space simulator, just to learn some Java3D and do something funny during the summer. I know there are more powerful libraries, but Java3D is easy to learn. It is a pity I cannot project shadows with it like in the previous 3d blog entries about Mars and Moon using JMonkeyEngine. Of course the program I wrote depends heavily on my JPARSEC library, but it has only 2100 lines of code to create the VirtualUniverse, put on it the tree of objects (BranchGroup, Transform3D stuff), and include the animation (PositionPathInterpolator and RotationInterpolator) and user interaction. The planets are shown as spheres in this first version, and many other things are listed as TODO at the top. As some from the MIT would say, TODO stuff are things you will never do … At least the code is clean enough to be easy to follow and understand (I think so), even in this first version, and despite having all the stuff in just one class. So if you have more time than me then you can continue the project.

This program is quite useful to learn the basics about Java3D and 3d in general. All objects are added in a tree depending one on another, so that if a planet is moving around the Sun and a satellite orbiting around the planet, the satellite is also moving around the Sun. The PositionPathInterpolator is updated in intervals of half an orbit so that the simulation shows the accurate position of the satellite and the time can be reversed. The planets are Shape3D objects added at the end of all the transforms, with their appearance and material properties. The atmospheres of the Earth or Mars are created with a set of almost transparent spheres trying to simulate the atmospheric opacity. For the Earth the clouds layer is added with a particular rotation so they move around the Earth surface independently. To mimic the behavior of Celestia I included a transition effect when the navigation mode is set to free so that the camera is rotated towards the destination body and then its position is interpolated to simulate a trip. The free mode will not follow the planet or satellite as it moves, to do that the free mode should be disabled to enter the orbit mode, in which you can follow even the satellite as it moves around the mother planet. The user interaction supports the alt and shift keys to move the camera in a similar way as Celestia does.

The program also shows the sky, constellations, and the ecliptic line. As a TODO I had the idea of implementing all the sky with Java3D including deep sky objects with textures, to be later integrated in JPARSEC along with the current but powerful 2d mode for sky rendering. My library can even be used to render 3d videos pixel by pixel without the need of any 3d library (with geometry and lighting done by hand, quite funny to implement), but of course with a 3d library the animation is more smooth and enjoyable. The face of the terrestrial planets or the Great Red Spot in Jupiter are also incorrect in the simulation, I was in fact working on that (longitude of central meridian of the planets) right before the end of the Summer. Of course, I may work on all this in a future, or not, who knows …

Here is a 5 minute video of the program in action.


→

2020/12/14 12:45 · Tomás Alonso Albi · 0 Comments

Numerical integration of planetary orbits with Newton's law

I remember when I was a kid drawing with my Amstrad the orbits of the satellites of Jupiter and the planets. I was 12 when I started doing that. Later at 16 or so, with a PC, I did my first n-body simulation of the planetary orbits in QBasic based on the Newton's law of gravitation, improved later with some ideas from the codes by S. Aarseth to reduce the time step of the simulation when two particles are very close. After that I did not think anymore about these simple n-body simulations.

At that time the JPL DE200 integration was already available, and S. Moshier had just published a C code reproducing those results (de118i program). Understanding that program is hard, I sometimes think how interesting could be to port it to Java. But the question I asked myself this time is how necessary is to consider some of the effects implemented in that program, like the figure of the Earth and Moon, the tides, or non-linear relativistic corrections to the gravity, to reproduce the JPL DE4xx rectangular coordinates. In other words, how accurate can be a numerical integration of the planets when using only the Newton's law ? So my idea with this educational post/little summer project is to present a simple example program (included in the examples provided with JPARSEC) to propagate orbits and also to show/animate them in Java to obtain an updated implementation of my old programs.

Planetary ephemerides can be computed in a variety of ways, from numerical integration to analytical methods, or by using orbital elements. For an example of the two last methods you can take a look at my post about computing the position of the Sun, Moon, and planets. Here I will show the most simple case of numerical integration in which the target is to show the orbits visually (as in my old programs) but to also compute ephemerides up to the accuracy of the Newton's law of gravitation. As you will see this does not require necessarily an implementation with extended precision arithmetics. I will show some well-known but interesting effects like the movement of the Sun around the barycenter, or how to take advantage of this integrator to create a custom ephemerides file to obtain approximate results without messing with many GB of data from JPL files.

Although it is very simple, as an introduction I will revise how to implement the Newton's law programatically, with some notes about my particular implementation that uses as initial conditions the values obtained from a given JPL integration.

→

2020/07/31 14:44 · Tomás Alonso Albi · 0 Comments

[NEW] A runnable version of the simulator has been added, see the bottom of the page.

Solar System in 3d (part 2)

In an old, previous post I showed some renderings of Mars in 3d using Java3d. That library was abandoned long ago and I mentioned I was working in a newer version using JMonkeyEngine. Indeed I did that but never spend enough time to post the results here, as I was always busy with other things. Finally, it's time to show the results I obtained.

The starting point was the jmeplanet project by Aaron Perkins, which seems to be only available now on SourceForge as spaceworld. You can also enjoy some test videos he has on Youtube. The latest code there is probably the best option now, since I took an old version of his engine. Then I prepared the Mars images for each section of the planet using the MOLA altimetry data and a high resolution texture. I encoded some RGB and bump images using the channels to avoid losing accuracy in the altimetry (encoded as RGB channels also to conserve MOLA accuracy), so that these images can be directly loaded into the GPU and less space is needed. The code and textures used for such tasks are provided in the project link below, but obviously the original MOLA data is not included since the download is around 2 GB only for the altimetry.

As always I prefer to show results instead of describing in detail the code. In this case this is inevitable since I forgot almost everything about 3d programming (the little I learned with this project), and I developed this years ago. In addition, I simply put things together like in a puzzle, I'm not the author of the engine. But I think it can be useful and funny for others. I know a video would be better, but more time consuming, so I will put only screenshots (sorry).


There are some keys to control the movement (W, S, A, D; Q and E to rotate; S and X to go up and down), and in addition other keys like L and K to disable/enable the illumination and planet atmosphere. The program can also render the Earth, but using a low resolution bump map. Anyway, the global view with the atmosphere is quite nice, although not very realistic.

→

2019/03/20 12:57 · Tomás Alonso Albi · 0 Comments


One of the little projects I developed some years ago was a sky atlas. It was a very first version showing the capabilites of JPARSEC to create renderings of the sky in different color modes, from the classical white background to the black one with real photographic textures of many deep sky objects. The atlas was a simplified version of the classical Sky Atlas 2000, by Wil Tirion, but updated for the latest equinox year and with less stars and objects (to print it in a more confortable A4 size). Since then the rendering options in JPARSEC has been improved, including the possibility of rendering the sky in a realistic, Stellarium-like way, but I didn't find this feature useful for this project in particular.

I didn't expect that post to become very interesting to others, but during these years some people, first from Russia, and then from Italy, showed interest and asked me to continue with this project creating the atlas for the next years and improving it. In the last two weeks I have taken some time to do some additional touches and to extend the atlas in different directions. There is now a first section showing the sky during the year with a list of astronomical events for each month, which is useful to later anallize the region in detail with the atlas itself. A first explanatory page is useful to directly go to a particular atlas chart, and in each chart I have improved the information shown and added a navigation aid. One point is that here at the Observatorio Astronómico Nacional we are working in an amateur-like equipment for outreach purposes, and this atlas could be interesting to use it in our observatory. Here we have a 30 cm and 40 cm refractors in parallel from the 1940s, an older 30 cm refractor from around 1910, and an even older meridian circle that is inside the museum building. We now have bought a Celestron C11 with a little refractor and a camera, and plan to use it mainly to show the Sun, but without sacrifying the possible use of this telescope during the night. We plan to recuperate the older telescopes also for this purpose. As a member of the Agrupación Astronómica de Madrid (the main amateur group of astronomers here) I'm also showing this atlas for the team involved in showing the sky to the group of beginners, the new people potentially joining our group. And, of course, because it is just fun to take an old project and improve it.

Probably the catalyst to this decision was the incredible Bungee Sky Atlas created by Angelo Nicolini with JPARSEC. This amazing atlas, maybe the best free atlas ever made, is extremely complete and detailed, very useful for expert observers. But one evident problem that this atlas leaves is the relatively lack of a less detailed atlas, in-between the Bungee Sky Atlas and the different atlases for beginners you can find in the web, like my favourite one the Free Beginners Star Atlas by Ed Vazhorov. Riccardo Camboni also contributed to make me work on this right now since he asked to do some improvements, for instance to remove the trajectories of planets and other bodies, which is something I may add in the future in another section of the atlas. Riccardo has also started some posts in forums to spread the existence of this atlas.


So in the last two weeks I have worked in the code, to clean it up enough and to publish it as GPL down below. The code is in just one laaaarge file (sorry!), since my code quality standards are limited to the library, not the projects I develop from it. There are different options in the first lines to set the color mode, language, and so on. As always I don't find interesting to extend a lot in my blog explaining the code: if you find it interesting and useful you will use it and play with it (so you will not need any help), if not, I will not lose my time to describe it in detail. Anyway, you have always the discussion section at the bottom to ask anything. There are a few todo things in Spanish at the top, so this code may improve and the 2020 version of the atlas could be even better.

You will find the new version of the atlas in Spanish and English in the Other projects section, currently only for year 2019. In case you want to create you own atlas with the code below, just remember the code is GPL and if you modify it, please publish it, and whatever atlas you may produce starting from this code must be published free of charge under the Creative Commons or similar license. You will need JPARSEC with its dependencies and the iText PDF library in the classpath to compile and execute this program. Just enjoy!

→

Rendering the sky like Stellarium with JPARSEC

There is an old project called Stellarium for Java. It is a port of the old 0.8 version of Stellarium, which is a very popular planetarium due to its high quality, realistic renderings. This project uses the JOGL library to offer a similar experience to the original using Java, but unfortunately it was later abandoned.

I have recently analized the original code to look how this port renders the sky, in particular how it computes the atmosphere brightness and the sky colors considering the position of the Sun or the Moon. I have taken just this code and connected it to the rendering process used in JPARSEC, so that similar renderings can be done (pixel by pixel, so slower) without using the GPU. For this task I have updated JPARSEC with a few improvements (availables from the JPARSEC repository at bitbucket) to improve the horizon rendering with terrain, adding two more more textures.

The idea is to render the sky with JPARSEC using a given texture for the horizon and a transparent image, and reuse the SkyRendering object to compute, pixel by pixel, the illumination and color of the background atmosphere using the formulae from Stellarium. With this you only have to draw the sky image on top of the atmosphere image for the final image. So here are the great results…


I leave to you the task of analyzing the code to try to understand the underlying maths and physics, I prefer not to describe it since I'm not an expert, I have just borrowed the code. Here is the rather long Java class that can be used for such renderings in case you want to play with it.

→

2018/02/19 16:10 · Tomás Alonso Albi · 1 Comment


Selected astronomical images taken with my equipment. As you will see, I'm not a professional photographer, but I do my best. Some of them are old images taken with a film camera, recent ones uses a digital SLR. In addition to the images I have also some videos:

Solar eclipse Solar annular eclipse on October, 3, 2005. It was my first day at OAN so I couldn't use my instrumental. I simply took the camera on my hands.

Venus transit: Venus transit on the Sun on July, 8, 2004. The black drop effect is clearly visible.

Solar eclipse: Solar eclipse of August, 11, 1999, as was shot through my S/C 20 cm telescope.

Log of visits

blog.txt · created: 2010/01/31 01:56 (Last modified 2021/06/22 21:40) by Tomás Alonso Albi
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki