Another couple of high resolution images, taken on the Appennines, with quite a lucky seeing.
Jupiter is now rising earlier, and it was a welcome preview to the observing night.

Firstly I tried shooting on prime focus, using small magnification, and then I used a 2.5 barlow lens. The prime focus shooting should have been just a test, but it proved to be the better one, as I had troubles focusing with the barlow lens (we were already in “night” mode, and I had to darken a lot my monitor, so focusing was really difficult).

This is the prime focus shooting elaboration.

Jupiter

Saturn is starting to rise earlier, and around 4am is starting to be fairly hight for a few shots.

Since we already finished observing I could remove my notebook darkening panel, and focus quite better with the 2.5x barlow.

Early Saturn

It was also a very satisfying deep sky stargazing night (which was actually the main purpouse of our trip to the Appennines).

Spring constellations enable us to go really “deep”, with very far and suggestive galaxy clusters.

Another shooting, much improved in quality compared to the previous ones: Jupiter bands are very well defined, rich of details, much more compared to the images of fifteen days ago: probably both because of the better seeing, and of the removal of the IR-pass filter, replaced with a more classical IR-Block, gathering much more light.

Jupiter, with Io shadow

The “guest” of the title is the dark dot almost at the center of the planet: it’s not an image artifact, but it’s the shadow of the Io satellite projected on the planet. Basically, a solar eclipse on Jupiter.

The satellite itself is not visible on the picture, submerged in the planet disk. The other two satellites are, from closest to farthest, Europa e Ganimede.

Notice: this article is currently available in italian only.
I will translate it soon. You may contact me via comments if you want me to “prioritize” this article first.

Per una serie di vicissitudini (e per il maltempo che l’ha fatta da padrone) non ho potuto osservare molto Giove, in opposizione proprio nei prossimi giorni, e quindi nel periodo di migliore osservabilità.

Ieri sera comunque sono riuscito ad effettuare qualche osservazione e qualche ripresa, approfittando di un seeing stranamente non cattivo come solitamente da casa mia: purtroppo non ho balconi o terrazzi, e mi tocca riprendere ed osservare dalla finestra aperta, cosa che alza di parecchio la turbolenza per il continuo passaggio d’aria tra interno ed esterno.

Jupiter - 2015-01-30

In visuale era piuttosto evidente la Grande Macchia Rossa, che nelle riprese invece sembra quasi invisibile. Non è infatti il globulo scuro che si vede nella banda in alto a sinistra. Questo perchè la ripresa è stata effettuata nel vicino infrarosso e non nel visuale, per ridurre l’interferenza atmosferica, quindi i dettagli visibili nella ripresa sono un po’ diversi da quelli che si vedono ad occhio nudo.

Si vedono molto bene anche due dei satelliti galileiani, Io ed Europa.

Ripresa effettuata al fuoco diretto di un Meade ACF 8″, 2000mm di focale, con filtro IR “Planet IR Pro 807“, camera QHY5II-L. Sommati circa 800 frames (di 2000 totali).

Aggiornamento, 02/02/2015
Giusto una manciata di giorni dopo ho potuto ripetere il tentativo, con una messa a fuoco un po’ più fortunata.
Non è visibile la macchia rossa, in questo caso, ma sono riuscito a tenere nel campo tutti e quattro i satelliti galileiani.

Jupiter and galileian satellites - 2015-02-02

It’s been a long time since I last wrote about SkyPlanner development, but I still kept working on it, enabling lots of new features.
The Telescopes page has been redesigned to include also eyepieces and barlow/focal reduces, and therefore has also been renamed to “Optical Instruments” in your settings menu.

Instruments Page

Adding at least a telescope and an eyepiece will show a new panel in the session pages, with all possible combinations, calculating magnification and field of view.
It will also add a new menu when clicking on a DSS preview image, that will show you field of view circles overlay.

Field of View Menu
Field of View Overlay

Filters have been heavly improved. We have now lots of new filters, and the existing ones were redesigned to offer a better experience.

Now you can filter by object type, by magnitude, time of transit, altitude, constellation, previously observed objects, angular size, catalogue. Filters are available both in the main objects list and in the “Suggested Objects” panel, allowing you to fine tune SkyPlanner suggestions for planning your stargazing night.

The “Suggested Objects” list can now be sorted also by magnitude and time.

A new interesting feature is the post-session report: when reviewing a past session, you can mark as observer each object in your list.

After doing so, a “report” button will appear for that object, allowing you to write an extended description of your observation.

Finally, clicking the “Report” button on the top toolbar will display your report almost ready to be printed. You may wish to click the “Write report” button to write some notes about the whole session, instead of single objects.

Additionally, you can share your report. By default this is disabled, but clicking the “Share” button will make it publicly available.

You can share it with a few options: first, a web address, that you can embedd on your blog/website, or send via email. But you can also one of the predefined buttons for social sharing, on Google+, Facebook, Twitter.

But sharing is now enabled also for the regular session planning: in the “preview with images” section of a planned session you’ll see the same “Share” button.

Lastly, there were a few additions to the objects catalogues, most notably the Barnard catalogue of dark objects.

These were just a few highlights, to find out more just go to SkyPlanner home page and try it.

I’ve been long waiting for sharing SkyPlanner source code in a public repository.

Problem is, I had to fix a few copyright headers, cleanup some stuff, and, you know, laziness.

Now I finally published them on my GitHub account: https://github.com/GuLinux/SkyPlanner.

It’s still missing a README file for compiling and all, but if someone is curious about how SkyPlanner works, this is a huge start for poking it.

Happy hacking!

When programming in C++ it can often happen to be using C-style API.
These usually come in the form:

int some_api_call(char *inputParameter, char **outputParameter);

where the return value is never a real output value, but instead an exit code, and usually 0 means success.

To handle such API in a sequence of operations, one is then usually blinded to do something like this:

 int result = first_c_api_call();
 if(result != 0) {
 cerr << "Error executing first_c_api_call: " << result << endl;
 return;
 }

result = second_c_api_call();
if(result != 0) {
cerr << "Error executing second_c_api_call: " << result << endl;
return;
}

result = third_c_api_call();
.....

and so on, which is kinda boring when you have to call lots of API functions in one method.

I have been trying to write some kind of wrapper that can help making this a bit easier.
In a real life example, I’ve been trying to use gphoto2 api in a c++11 application.
Using c++11 lambdas and RAII this is what I’ve been able to do:

 void GPhotoCamera::connect() {
      CameraAbilities abilities;
      GPPortInfo portInfo;
      CameraAbilitiesList *abilities_list = nullptr;
      GPPortInfoList *portInfoList = nullptr;
      CameraText camera_summary;
      CameraText camera_about;
      int model, port;
      gp_api{ {
        sequence_run( [&]{ return gp_abilities_list_new (&abilities_list); } ),
        sequence_run( [&]{ return gp_abilities_list_load(abilities_list, d->context); } ),
        sequence_run( [&]{ model = gp_abilities_list_lookup_model(abilities_list, d->model.toLocal8Bit()); return model; } ),
        sequence_run( [&]{ return gp_abilities_list_get_abilities(abilities_list, model, &abilities); } ),
        sequence_run( [&]{ return gp_camera_set_abilities(d->camera, abilities); } ),
        sequence_run( [&]{ return gp_port_info_list_new(&portInfoList); } ),
        sequence_run( [&]{ return gp_port_info_list_load(portInfoList); } ),
        sequence_run( [&]{ return gp_port_info_list_count(portInfoList); } ),
        sequence_run( [&]{ port = gp_port_info_list_lookup_path(portInfoList, d->port.c_str()); return port; } ),
        sequence_run( [&]{ return gp_port_info_list_get_info(portInfoList, port, &portInfo); return port; } ),
        sequence_run( [&]{ return gp_camera_set_port_info(d->camera, portInfo); } ),
        sequence_run( [&]{ return gp_camera_get_summary(d->camera, &camera_summary, d->context); } ),
        sequence_run( [&]{ return gp_camera_get_about(d->camera, &camera_about, d->context); } ),
      }, make_shared<QMutexLocker>(&d->mutex)}
      .on_error([=](int errorCode, const std::string &label) {
        qDebug() << "on " << label << ": " << gphoto_error(errorCode);
        emit error(this, gphoto_error(errorCode));
      }).run_last([&]{
        d->summary = QString(camera_summary.text);
        d->about = QString(camera_about.text);
        emit connected();    
      });  
      // TODO d->reloadSettings();
      gp_port_info_list_free(portInfoList);
      gp_abilities_list_free(abilities_list);
}

I can then declare some variables in the first part of the method, and inside the “gp_api” block i can execute a sequence of operation, each one returning an int value. This value is automatically checked for an error, and if it it’s a success exit code, the next sequence block is executed.
run_last is finally executed if all steps are completed successfully. An optional mutex locker (QMutexLocker) is passed to the gp_api block as the last constructor argument, to automatically lock the c api for multithreading.

How have I accomplished this?

This is the main class so far:

#include <functional>
#include <list>
#include <mutex>

typedef std::shared_ptr<std::unique_lock<std::mutex>> default_lock;
template<typename T, T defaultValue, typename check_operator = std::equal_to<T>, typename RAII_Object = default_lock>
class sequence {
public:
  typedef std::function<T()> run_function;
  typedef std::function<void(const T &, const std::string &)> on_error_f;
  struct run {
    run_function f;
    std::string label;
    T check;
    run(run_function f, const std::string &label = {}, T check = defaultValue) : f(f), label(label), check(check) {}
  };
  sequence(const std::list<run> &runs, const RAII_Object &raii_object = {}) : runs(runs), _check_operator(check_operator{}), raii_object(raii_object) {}
  ~sequence() {
    for(auto r: runs) {
      T result = r.f();
      if(! _check_operator(result, r.check)) {
    _run_on_error(result, r.label);
    return;
      }
    };
    _run_last();
  }
  sequence &on_error(on_error_f run_on_error) { _run_on_error = run_on_error; return *this; }
  sequence &run_last(std::function<void()> run_last) { _run_last = run_last; return *this; }
  sequence &add(run r) { runs.push_back(r); }
private:
  std::list<run> runs;
  on_error_f _run_on_error = [](const T&, const std::string&) {};
  check_operator _check_operator;
  std::function<void()> _run_last = []{};
  RAII_Object raii_object;
};
#define sequence_run(...) { __VA_ARGS__ , #__VA_ARGS__}

The sequence class accepts a list of runs as construction parameters. These are stored as a class field, and sequentially executed at class destruction.
Sequence is a template class: you can define the return value type, the success value, a comparison operator to check each function result code against the success value, and finally a generic RAII_Object, which can be as previously told a mutex locker, or some other kind of resource to unlock after API executions.

The define directive at the end of the code is used to automatically create a run object which already contains a description of the code being executed (stringified).
You get this description in the on_error callback.

Near my gphoto class I also added a typedef to conveniently call the proper sequence template class with correct template parameters:

typedef sequence<int, GP_OK, std::greater_equal<int>, std::shared_ptr<QMutexLocker>> gp_api;

Which means that gp_api accepts code blocks returning int values, that the “ok” value is GP_OK (0), and that the returned value must be equal or greater than GP_OK to be considered a success run.
It also accepts a QMutexLocker shared pointer for thread locking.
As you can see in my first example I didn’t assign the gp_api object to any variable; this means that it is immediatly created, executed and destructed, for synchronous run.

So this is a simplified usage example:

gp_api{ {
  sequence_run([&]{ return first_c_api_call(); }),
  sequence_run([&]{ return second_c_api_call(); }),
}, std::make_shared<QMutexLocker>(&&;mutex)}
  .on_error([=](int errorCode, const std::string &label) {
      std::cerr << "Error at code block " << label << ": " << errorCode << std::endl;
    })
  .run_last([&]{
    // run when everything runned smoothly
  });

Visto che proprio questo fine settimana l’ho un po’ “ristrutturato”, ne approfitto per presentarvi il mio server:

Zerogoki

Si tratta di un vecchio notebook, con cpu Intel Core 2 Duo a 2,5 Ghz, con 4 GB di RAM.
E’ solo un server domestico quindi, ma con un bel po’ di servizi sopra: il blog/sito wordpress che state vedendo adesso, SkyPlanner, un media center web sviluppato da me, e una serie di servizi interni (ssh, database, file server).

La connessione ad internet è su fibra ottica, 100 Mbit in download, 10 in upload.

Il recente “restyling” è consistito nel togliere completamente la scheda madre dall’involucro “stipato” tipico dei portatili, in modo da far respirare un po’ di più le componenti (la temperatura è drasticamente calata, difatti). Ho anche tolto alcune componenti inutili, come il lettore dvd o la scheda di rete wireless e il bluetooth, in modo da ridurre anche i consumi.

La batteria originale del notebook è invece ancora lì, molto utile durante eventuali cali o interruzioni di tensione, per mantenere il server up and running.

A shot at the moon taken in a last quarter evening.

It’s a mosaic of 78 pictures, each of them stacked from 300 frames of 500. Images were taken at primary focus of my Meade ACF 8″ (2000 mm focal length), using a QHY5II-L mono.

Moon (mosaic), September 2014

Seeing was a bit too bad (I have to shoot from my window, since I don’t have a garden, which can make turbulence even worse).

Even if it’s not a perfect result I’m pretty satisfied: given the conditions lots of details are visible, and it also look quite good.
I hope to be able to shoot something even better soon!

Notice: this article is currently available in italian only.
I will translate it soon. You may contact me via comments if you want me to “prioritize” this article first.

Altre riprese delle macchie solari, in una giornata in cui la nostra stella era particolarmente ricca di dettagli.
In questo caso, essendoci parecchie macchie a fare da punti di riferimento, sono riuscito a fare un buon numero di riprese sovrapponibili per creare un mosaico (purtroppo non completo).

Sun Spots - 2014 07-06

Sono circa una decina di immagini da 400 frames ciascuna (su 1000 totali).
L’elaborazione è stata fatta sempre con registax, l’unione del mosaico con Hugin.

Notice: this article is currently available in italian only.
I will translate it soon. You may contact me via comments if you want me to “prioritize” this article first.

template<typename T>
class Fill {
private:
  T *array;
  long _size;
  T _value;
public:
  Fill(T *a) : array(a) {}
  Fill &size(long s) { _size = s; return *this; }
  Fill &with(T value) { _value = value; return *this; }
  ~Fill() {
    for(long i=0; i<_size; i++) array[i] = _value;
  }
};

Utilizzo snippet:

int array[10];
Fill<int>(array).size(10).with(1);

Ecco un po’ di teoria di cosa succede.

RAII è una tecnica che permette di sfruttare una caratteristica del c++ che lo differenzia dai linguaggi con garbage collector (Java, ad esempio): la certezza di quando il distruttore della classe verrà chiamato.

L’idea è di sfruttare entrata ed uscita dallo scope di una variabile per effettuare acquisizione e deallocazione delle risorse. O per dirla in altri termini, per eseguire istruzioni all’ingresso e all’uscita di uno scope.

In questo caso stiamo creando una istanza anonima della classe Filler.

Alla sua inizializzazione passiamo al costruttore

Fill<int>(T *a) : array(a) {}

un array, che vogliamo riempire. Il costruttore lo memorizzerà nel suo field “array”.

Con il metodo “size” diciamo quanti elementi dell’array vogliamo riempire, mentre col metodo “with” impostiamo il valore con cui riempire l’array.

Entrambi questi metodi tornano un riferimento a “this”, ossia all’istanza corrente, in modo da “tenerla viva” nello scope, e permettendo di effettuare method chaining.

Infine, quando la variabile scompare dallo scope (ossia subito, visto che è anonima), viene chiamato il distruttore, che contiene il ciclo for che riempie l’array col valore che abbiamo impostato.

E’ interessante notare come, non essendoci nessun metodo che esplicitamente riempie l’array, l’ordine delle chiamate è perfettamente invertibile: avrei infatti potuto ugualmente scrivere

Fill<int>(array).with(1).size(10);

E funzionerebbe nello stesso identico modo, dato che il riempimento vero e proprio verrà comunque effettuato nel distruttore.

Si tratta ovviamente di un esempio relativamente banale, ma che fa intuire la potenza della tecnica.

Basti pensare ad altre applicazioni, come l’apertura di un file con chiusura automatica quando la variabile RAII esce dallo scope, o una transazione che inizia nel costruttore, e viene automaticamente committata nel distruttore, o addirittura, nel c++11, l’esecuzione di una lambda quando la variabile RAII esce dallo scope.

class Scope {
  public:
    Scope(std::function<void()> onExit) : _onExit(onExit) {}
    ~Scope() { _onExit(); }
  private:
    std::function<void()> _onExit;
};

RAII viene molto usato sopratutto per gestire al meglio le eccezioni: non è infatti necessario un blocco finally come in Java, dato che sia in caso di eccezione che nel flusso normale la variabile viene comunque deallocata, e il distruttore invocato.