Thursday, August 18, 2016

LabPlot is comfortable with FITS

So we are here, GSoC 2016 is officially over, it's time for the final evaluations, so this will be a closing post for this GSoC. I've learned many things while I was working on my project and I'm really thankful to my mentors, Stefan and Alexander (not officially my mentor, but we talked many times and he helped me many times too). I'll be happy to help in integration of this project in the next release of LabPlot :)
Since my last post I've fixed some minor bugs, and implemented some new features too.

Let's say we want to add a new keyword to one of our FITS extension:

FITS header editor's new keyword adding dialog
 And then we can add units to our keyword, which will appear in squared bracelets in the beginning of the comment:

Keyword unit adding dialog
I added some predefined units, such as meters, kilograms, seconds, parsec, solar mass, astronomical unit, kelvin, light year.
The newly added keyword unit

If a keyword has some kind of unit defined already, then the dialog will be shown with the unit of the keyword:

Saving keyword modifications

We have modified this value, the original is "lw", as you can see in the treeview.

The saved extension with the new keywords value
As you can see, after saving the modifications, and reopening the file, the name of the extension is modified.

Import a subset of data 

Let's say we have this image, but we'd like to import just a portion of it.

We just have to set the start/end row/columns in the import dialog,

..and voilá

File info dialog improved for FITS files

Import FITS tables to matrices

If the selected table extension has numeric columns (at least one) then we can import those in matrices. (btw notice the nice icons in the treeview, thanks to Alexander for the idea)

As you can see, the second and third column contains only values, so after import our matrix:

I think this was it. I hope you enjoyed it too. I'm really happy that I was part of GSoC '16, it's one of my greatest experiences. I look forward on reading other GSoC students blogs and I wish good luck to everybody on the final evaluation! :)

Friday, July 8, 2016

Further exports, delete extensions, FITS for LabPlot

I have implemented some features since my last post, soon I'll be polishing the features, searching for bugs. So, let's have a look at them:

Delete FITS extensions from files:

Context menu for deleting extensions
You just right-click on the extensions, and you can delete them, and after you save the file, reopen it, you can check the file again:

(I deleted the other extensions this time) And you can see that some extensions are removed from the file.

I've improved the export dialog for FITS files:

Now you can select whether you want to export your container to an image extension, or a table. If the spreadsheet contains non-numeric columns, then exporting to a FITS image it's not possible:

You can check the "Columns comments as units" checkbox if you'd like to export the column's comments as FITS table units, check comment:

And here you can see it as the unit of the column in the FITS table:

Other important it's that when you import tables to spreadsheets, then columnmodes are set properly, for example text/numeric columns:

To prove that:

In short, "A1" stands for a column which contains strings, with length of 1.
That's for now, I'd be happy if you could test the features/give feedback. See you soon.:)

Friday, June 17, 2016

Import, export FITS

There are some new features that I've implemented since my last posts, let's see them!
FITS tables can be imported to spreadsheets now. Let's see how it works:

FITS table imported to a spreadsheet
As before, I compare my results with the results of FV (FITS Verify). I set the column comments to the units defined for the columns in the FITS if they're available.

You can now export your matrices to FITS images! If the file exists, it just appends a new image extension, if not, it creates a new FITS file, check out the header of an exported matrix, and the tree of the file:

Header keywords of the exported matrix

You can export your spreadsheets to FITS tables too!

Currently the export dialog for FITS files

And then you can check out your file's header:

Header of the exported FITS file
 Great, isn't is?! If the file didn't exist yet, it creates one with an empty primary array, and appends an ASCII table. It still needs more improvements of course.

And then let's import back our exported spreadsheet:

The exported spreadsheet imported

There are still plenty of things to fix, and others to implement of course :)

Friday, June 10, 2016

Let's modify your FITS files

Another great step for the project, now you can add new keywords, or remove them from the extensions!
There are some restrictions:
  • you're not allowed to remove mandatory keywords (still needs some polishing)
  • you're not allowed to add mandatory keywords, since those must be available when you create the extension
  • no duplicates
Take a look at the newly added keywords, the DATE keyword proves, that it was written to the file, since cfitsio has a special method for adding DATE keywords, which sets the value and comment fields:

The new keywords
There are still many things to do, to refine:)

Thursday, June 2, 2016

Strong kickoff

Ever since I've connected with my mentor (Stefan) I've worked on LabPlot. Even before the community bonding period I have implemented LaTeX exporting support for spreadsheets and matrices. You can export now your datas in LaTeX tables, this is the export's dialog:

LaTeX export options

And then you can create some nice looking pdf's, like:

Exported LaTeX file converted to a PDF

In the community bonding period I did some modifications on it and just a few days after my project got accepted I started working on my project as my mentor suggested, because I was already familiar with the code and I had everything set up. My project's main goal is to enable importing of FITS images and tables in LabPlot.
In extra I had some ideas:
  • have a widget for editing (or just listing) the content of a FITS primary header or extension's  header unit. 
  • hopefully, if there will be time, export to FITS
I've done some of them already, but of course everything is changing yet.
The header edit dialog can be accessed through the Tool -> Edit FITS file header menu. This is how it looks like now:

FITS header preview

Currently you can open files, and for every file a nice tree is created, showing separately the Image and Table (ASCII table, binary table) extensions. In the table you can see the keywords of the currently selected header. I know the layout needs some improvements, soon that will be fixed too. It will be possible here to modify the entries, add new ones, or remove some. I've added some standard keywords from the FITS standard to be accessible from the "Key" KTextEdit. Adding a new keyword:

Dialog for adding a new keyword

After clicking on "Add keyword" you can see the newly added keyword:

Keyword added to the header's preview table

Currently the modifications appear only in the dialog, soon implementing the saving of the changes to the files.
Other thing I have achieved is that it's possible to import already FITS images. As you can see I use the same tree as in the header edit dialog. This is how the import dialog for FITS files looks now:

FITS import dialog - Image preview
The preview works nicely for FITS tables too:

FITS import dialog - Table preview
And then you can import some cool images from FITS files, like:

Imported FITS image
I compare my results with the results of FITS Liberator 3, as you can see, they are pretty the same.
The importing of FITS tables will work soon nicely too, but I think these are already some big steps for the project.

Have fun other GSoC participants!