Thinking about training our AI to locate stars Sebi ran a test demonstrating a simplified training set we’ll be needing images of 20 brightest stars – 10.000 per each having:
- reasonable focus / zoom in & out
- any possible rotation
- good quality
- no atmospheric effects
- no horizon
- no planets / sun / moon / satellites
The obvious question came instantly – where to get such a training set for our project? The idea came to use Stellarium.

Stellarium is already a pretty old application (started 2001) which can emulate a planetarium for your computer. It shows a realistic sky in 3D, just like what you see with the naked eye, binoculars or a telescope.
Getting and running Stellarium on a Linux is piece of cake:
$ git clone https://github.com/Stellarium/stellarium.git
$ cd stellarium
$ mkdir -p build/unix
$ cd build/unix
$ cmake -DCMAKE_INSTALL_PREFIX=/opt/stellarium ../..
$ make -j4
<wait here>
$ ./src/stellarium
Application throws you straight to a nice screen – showing very late morning in North Brisbane. 🙂

Well, this is a moment when things got little bit more complicated. I had to get familiar with the Stellarium scripting engine, its API, Julian calendar and also PyTorch training set layout and ended up with submitting an actual patch to the Stellarim guys with all that wrapped up.
Let’s start with a patch which seems to be trivial – just allows creating a subfolder when needed:
From 6d2fcc079705385f4803c78902099a38ddc4e89f Mon Sep 17 00:00:00 2001
From: Jan Bilek <jan.bilek@eftlab.com.au>
Date: Sat, 13 Aug 2022 22:22:59 +1000
Subject: [PATCH] Screenshot to attempt to create folder when missing
---
src/StelMainView.cpp | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/src/StelMainView.cpp b/src/StelMainView.cpp
index 288832dc75..d72b1c14f6 100644
--- a/src/StelMainView.cpp
+++ b/src/StelMainView.cpp
@@ -1718,16 +1718,17 @@ void StelMainView::doScreenshot(void)
}
else
screenshotDir = StelFileMgr::getUserDir().append(screenshotDirSuffix);
+ StelApp::getInstance().getSettings()->setValue("main/screenshot_dir", screenshotDir);
+ }
- try
- {
- StelFileMgr::setScreenshotDir(screenshotDir);
- StelApp::getInstance().getSettings()->setValue("main/screenshot_dir", screenshotDir);
- }
- catch (std::runtime_error &e)
- {
- qDebug("Error: cannot create screenshot directory: %s", e.what());
- }
+ //Always check if destination folder exists and attempt to recreate it if not
+ try
+ {
+ StelFileMgr::setScreenshotDir(screenShotDir.isEmpty() ? StelFileMgr::getScreenshotDir() : screenShotDir);
+ }
+ catch (std::runtime_error &e)
+ {
+ qDebug("Error: cannot create screenshot directory: %s", e.what());
}
if (screenShotDir == "")
--
2.25.1
Don’t get distracted by that – it looks much worse then what it is – it is just couple lines, all the rest is computer generated fluff to make it look cool (and needed to be working with the original code).
Interesting part comes now – following script generates a PyTorch star training set for our celestial navigation project – 20 x 10000 pictures of the brightest stars. 🙂
var stars = ["Sirius", "Canopus", "Arcturus", "Rigel", "Vega", "Capella", "Rigel Kentaurus", "Procyon", "Betelgeuse", "Achernar", "Hadar", "Altair", "Acrux", "Aldebaran", "Spica", "Antares", "Pollux", "Fomalhaut", "Deneb", "Mimosa"]; //20 brightest stars
DIR="~/Pictures/Stellarium/";
var pictsInSet = 10000; //Size of a training set per star
var minMjDay = 50000.000000 //Min Julian calendar date to consider for randomization
var maxMjDay = 60000.000000 //Max Julian calendar date to consider for randomization
var minZoom = 10 //Min zoom to consider for randomization
var maxZoom = 30 //Max zoom to consider for randomization
//Helper functions
function randomFloat(min, max) {
return min + (max - min) * Math.random();
}
function showAStar(cName) {
core.setMJDay(randomFloat(minMjDay, maxMjDay));
core.selectObjectByName(cName, true);
StelMovementMgr.autoZoomIn(0);
StelMovementMgr.zoomTo(randomFloat(minZoom, maxZoom),0);
StelMovementMgr.deselection();
core.wait(0.1); //Making sure that UI has a moment to catch up
}
//Disabling all
ConstellationMgr.setFlagArt(false);
ConstellationMgr.setFlagBoundaries(false);
ConstellationMgr.setFlagLines(false);
ConstellationMgr.setFlagLabels(false);
GridLinesMgr.setFlagEquatorGrid(false);
GridLinesMgr.setFlagAllLines(false);
LandscapeMgr.setFlagLandscape(false);
MilkyWay.setFlagShow(false);
NebulaMgr.setFlagHints(false);
SolarSystem.setFlagPlanets(false);
StarMgr.setFlagLabels(false);
core.setGuiVisible(false);
core.setTimeRate(0);
core.wait(1); //Making sure that UI has a moment to catch up
for (i=0; i<stars.length;++i) {
for (ii=0; ii<pictsInSet; ++ii) {
showAStar(stars[i]);
var fileName = ii;
core.debug(DIR + stars[i] + "/" + fileName +".png");
core.screenshot(fileName, false, DIR + stars[i], true);
}
}
core.setGuiVisible(true);
Well then it took almost 5 days (I had some problems with stability), but it worked out well. We’ve ended up with 42.3 GB images of 20 brightest stars – 10.000 each!

Even that directory listing looks impressive!

Adding a first three images of Sirius here for reference.



Huge thanks here belongs to the Stellarium team – this wouldn’t be possible without you!
Next stage – onto some serious machine learning! 🙂
Já se picnu