GSoC progress report

This is my first blog post on my progress after the first evaluation for Google Summer of Code 2020 under the GNU (GNU’s Not Unix) project for Gnuastro program. My mentor for this project is Mohammad Akhlaghi, under whose guidance I’m throughly enjoying this GSoC experience.

It might be a bit long so hang in tight.

Before starting, a random joke on open source:-)

May the source be with you! (source : xkcd webcomics)
May the source be with you! (source : xkcd webcomics)

git init

A bit background about my project.

So astronomical data are huge and for their storage, transmission and processing, a standard file format called FITS(Flexible Image Transport System) is used. Now we can have these data either as a 2D image or tables format, both of which can be easily and efficiently stored and used in the FITS format.

Sample FITS file on SAOImage DS9. (source : wikipedia)
Sample FITS file on SAOImage DS9. (source : wikipedia)

My project aims at developing libraries for image registration and their non-linear transformations in the FITS format. Image registration is done to transform different sets of data into one coordinate system. It is necessary in order to be able to compare and integrate the data obtained from different measurements and surveys. Non-linear warpings on datasets is done to remove any distortions from optical instruments and then perform the required transformations to synchronize the datasets in the same grid for proper evaluation.

The problems with existing software are their monolithic style and lack of modularity to be used in other similar context. This project tries to fix these problems by implementing high-level libraries and their integration in Gnuastro to provide multiple interface: as a CLI command and as a library.

cat distortions.txt

Before actually starting with the image registration, it seemed apparent to first convert the WCS (World Coordinate System) in the image metadata/header to a common form of distortion coefficient as some of the tools that have similar purposes cannot be easily interchanged, owing to the lack of a common standard. Among the many distortions that are used, the most widely used are the SIP (Simple Imaging Polynomial) and TPV distortions. A full mathamatical treatement for the convertion is given in the paper below,

“More flexibility in representing geometric distortion in astronomical images,” Shupe, David L.; Laher, Russ R.; Storrie-Lombardi, Lisa; Surace, Jason; Grillmair, Carl; Levitan, David; Sesar, Branimir, 2012, in Software and Cyberinfrastructure for Astronomy II. Proceedings of the SPIE, Volume 8451, article id. 84511M.

The actual equations for the convertion is given in Appendix of the paper. For implementing the equations in my code, I used a simple python script to generate all the equations in both TPV and SIP format given the CD and CD-inverse matrix. The repository cointaining this whole task before finally mearging to Gnuastro is hosted on Gitlab.

With this task complete, we can now convert TPV distortions to SIP distortion and vice-versa. This also makes it useful to get output from some other popular softwares like SExtractor which only takes images with TPV distortions and builds a catalogue of objects from them.

The below image shows a general workflow for conversion of pixel coordinate into world coordinate by applying prior and sequent distortion correction (taken from “Representations of distortions in FITS world coordinate systems”, Calabretta et al.”)

Conversion of pixel to world coordinate.
Conversion of pixel to world coordinate.

ls tasks

The main task completed was task #15128, which was further divided into more subtasks:

The whole discussion along with outputs results are provided on the respective savaanah pages.

git status

The main commits that merged the task into the Gnuastro source code are:

Other small commits which fixed and enhanced this library features are listed in this log.

exit

Now the task of image registration is in progress and will hopefully be finished before the second evaluation. That’s all for now.

EOF :wave: