Using Stellarium to generate animated simulations

Slashdot it! Delicious Share on Facebook Tweet! Digg!


Stellarium also lets users experience spectacular sunrises. Figure 2 shows an intermediate step of a picture sequence generated by the script from Listing 4. At the beginning of spring, the user can experience twilight phases, including astronomical, nautical, and civil, occurring before sunrise.

Figure 2: Once supplied with the correct parameters, the virtual planetarium can show the various types of sunrise, such as the nautical twilight.

Listing 4


01 // Name:  Sunrise
02 // License: Public Domain
03 // Author: rp 2016
04 // Description: Simulation of Sunrise.
06 function displ(jd, mg){
07   core.debug("Info: "+mg);
08   core.waitFor(jd);
09   LabelMgr.deleteAllLabels();
10   label = LabelMgr.labelScreen(mg, 20, 20, false, 30, "#aa0000");
11   LabelMgr.setLabelShow(mg, true);
12 }
14 core.goHome();
15 label = LabelMgr.labelScreen("Sunrise March 21 at latitude 30°", 20, 20, false, 30, "#aa0000");
16 LabelMgr.setLabelShow(label, true);
17 LandscapeMgr.setCurrentLandscapeID("grossmugl",5);
18 LandscapeMgr.setFlagLandscape(true);
19 GridLinesMgr.setFlagAzimuthalGrid(true);
20 GridLinesMgr.setFlagMeridianLine(true);
21 core.setObserverLocation(0, 30, 1, 1, "", "Earth"); //Location of observer
22 core.wait(3);
23 core.setDate("2016-03-21T04:00:00", "utc"); //Target time
24 core.wait(3);
25 core.moveToAltAzi(10,110, 5); //line of vision
26 core.wait(3);
27 StelMovementMgr.zoomTo(100, 15); //section
28 GridLinesMgr.setFlagEclipticLine(true); //turn on ecliptic
29 core.setDate("2016-03-21T04:00:00", "utc"); //observation time
30 core.setTimeRate(130); //time lapse x 130
31 core.wait(2);
32 LandscapeMgr.setFlagAtmosphere(true);
33 displ("2016:03:21T04:44:00", "astronomical twilight (18 deg)");
34 displ("2016:03:21T05:10:40", "nautical twilight (12 deg)");
35 displ("2016:03:21T05:37:00", "civil twilight (6 deg)");
36 displ("2016:03:21T06:01:00", "sunrise");

The function in line 6 bundles recurring steps. With core.waitFor in line 8, the script waits until the point in time – which has been entered as a parameter – has passed. This function started working properly with the time lapse function core.setTimeRate() in version 0.14. The function combination did not work in previous versions. Line 21 sets the observation point at the 30th parallel. This can be changed to -23 degrees to find out why the sun rises so quickly in the tropics or to 67 degrees to change the location to the polar circle.

Variable Stars

The software also understands variable stars, which are stars that periodically change in brightness. The developers are planning visual displays of their variability for a future version of the software. Time-dependent luminosity for supernovas has already been integrated. This lets you observe that within just a few days, a star appears seemingly out of nowhere. The star then slowly fades away during the course of an entire year until it has largely disappeared. The current version of Stellarium simply indicates the supernova type from which it derives the typical variation in brightness.

The program updates the list of supernovae provided the corresponding plugin has been activated. Activating this plugin is accomplished by selecting the Load at startup option in Configuration | Plug-ins | Historical Supernovae . After restarting, open the submenu Configuration | Plug-ins | Historical Supernovae and click the configure button. Information about the most recent update to the list is found in settings .

The supernovae data is found in JSON format at ~/.stellarium/modules/Supernovae/supernovae.json . When this file is opened, the user finds the supernova SN 2014j with the positional information "09h55m42.087s" and "+69d40m26.54s" . This supernova event reached maximum brightness on the date given by 2456687 , which is a Julian Date (the number of days that have elapsed since January 1, 4713 BCE) equivalent to January 29, 2014.

When the user visits the corresponding location, there is practically nothing to see because the program merely shows a small star. To observe the explosion (Figure 3), the user will need to use the script from Listing 5. The coordinates in line 5 are given as a string in hexadecimal units. Line 9 defines the date on which the event started. The loop in lines 13 to 17 runs at two-day intervals during the subsequent 130 days. Line 18 marks the location of the explosion.

Figure 3: The light from the January, 2014, explosion of supernova SN 2014J in the M82 galaxy.

Listing 5


01 // Name: Supernova SN 2014J
02 // License: Public Domain
03 // Author: rp 2016
04 // Description: Supernova SN 2014J in M 82
05 core.moveToRaDecJ2000("09h55m42.087s" , "+69d40m26.54s", 0);
06 LandscapeMgr.setFlagLandscape(false);
07 LandscapeMgr.setFlagAtmosphere(false);
08 core.selectObjectByName("SN 2014j", false);
09 core.setDate("2014-01-01T04:00:00", "utc");
10 core.setMountMode("equatorial");
11 StelMovementMgr.setFlagTracking(true);
12 StelMovementMgr.zoomTo(0.3, 0);
13 for(i=0; i<130; i++)
14 {
15   core.setDate("+2 day");
16   core.wait(.1);
17 }
18 core.selectObjectByName("SN 2014j", true);

At the end of 2015, the media was full of news about the explosion of ASASSN-151h [3], otherwise known as SN 2015L [4]. This explosion was a hundred times stronger than that from a typical supernova, and astronomers are still trying to figure out where the energy for the eruption originated. Stellarium makes it possible for the user to experience what the researchers actually observed.

To show this event, you should add data for the hypernova from Listing 6 to the ~/.stellarium/modules/Supernovae/supernovae.json file (see the "Hypernova" box for more information.) When performing this operation, it is important to use the commas correctly. Too many or too few commas cause error messages, which the program outputs to the terminal window. Placing a comma after the last element is not allowed.


A hypernova refers to the collapse of a star that is higher by several orders of magnitude than that of a supernova. Currently, research is being conducted to determine the extent of the release of energy.

Listing 6

Modify Location and Date

  "type": "Ia",
  "maxMagnitude": 16.3,
  "peakJD": 2457178.500000,
  "alpha": "22h02m15.490s",
  "delta": "-61d39m33.60s"

The script in Listing 6 lets you modify the location and date and obtain a version similar to that in Listing 7. You will probably need to start the script two times to perceive anything. Afterward, a small point will appear, briefly light up and then slowly fade away.

Listing 7

View Hypernova SN 2015L

// Name: Hypernova SN 2015L
// License: Public Domain
// Author: rp 2016
// Description: Hypernova SN 2015L
core.moveToRaDecJ2000("22h02m15.490s" , "-61d39m33.60s", 0);
core.setDate("2015-05-01T04:00:00", "utc");
StelMovementMgr.zoomTo(0.3, 2);
for(i=0; i<50; i++) {
    core.setDate("+2 day");
    core.wait(.1); }
core.selectObjectByName("SN 2015l", true);

This event is truly fascinating for scientists because the hypernova and its galaxy are located almost 4 billion light years away from the earth. By way of comparison, the distance from earth to SN 2014J amounts to 10 million light years.

Buy this article as PDF

Express-Checkout as PDF

Pages: 7

Price $0.99
(incl. VAT)

Buy Ubuntu User

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content