Discard FITS images with duplicate observation dates

Until now, photometry.py aborted the execution when it found two or
more images with the same observation date. Although a rare event,
most of the times this happens it is caused by negligence from the
user's side, such as making in the input directory a copy of one
of the FITS images that will be reduced by the pipeline.

However, astronomical instruments also have software errors, and we
have already encountered this situation while reducing images taken
with Omega2000, a wide-field camera for the 3.5m telescope at Calar
Alto: two images, although different in all other aspects, had the
same observation date. Not to pin the blame on somebody else, but
apparently something went wrong at the observatory and an incorrect
observation date was written to one of the FITS headers.

And that is precisely the issue: if we come across two images with the
same observation dates, which one has the right date? There is no way
we can find this out. Even worse, it may turn out that both images
have the wrong date; after all, something did already go wrong, for
what we know, and it could be worse than what we think.

The reason why we cannot have multiple images with the same date is
that light curves, which are our ultimate goal here, can only have one
differential magnitude for each point in time. This restriction shall
be partially lifted the day our pipeline can combine images taken with
different instruments, which is not currently the case. When that time
comes, duplicate observation dates should be fine as long as images
were observed with different filters.
First version of the graphical user interface for data analysis.

Except for the About window, the GUI is not functional; it just shows
a very few menu items and buttons whose signals are not even connected
to their callbacks. This is just a minimal, barely working example of
how the interface with which light curves will be analyzed should,
roughly, look like.

A word of caution: this is my first foray not only into PyGTK, but
also GUI programming at all. I'm using the excellent slides and code
examples that Juan Pedro Bolívar kindly shared with us last year
during the course given at the Institute of Astrophysics of Andalusia
(http://www.sinusoid.es/python-avanzado), but still it is a certainty
that, as someone with absolutely no previous experience with this,
many unforgivable bad practices will be perpetrated.
Change default extension of LEMON databases to '.LEMONdB'
Load a LEMONdB and display the list of its stars

Use a gtk.FileChooserDialog to let the user select a LEMON database
(files with the .LEMONdB extension), load it into memory and show to
the user some information of its stars: their ID, right ascension and
declination (in both sexagesimal and decimal), instrumental magnitude
and periods (in the hh:mm:ss format), computed with the string-length
method, for all the photometric filters in which they are known.
Use paths relative to the GUI root directory

Avoiding paths relative to the current directory means that
our code works independently of where it is executed from.
Show a dialog box with a progress bar when a LEMONdB is loaded

Loading a LEMON database into memory is not immediate, and may easily
take several seconds, so we use a progress bar to inform the user of
the status of the operation. A 'Cancel' button makes it possible to
abort the loading. When the process is complete, a second dialog box
lets the user know about how many stars were loaded.
Make the list of stars sortable by any column

Note that sexagesimal coordinates, stored as strings, are not sorted
lexicographically, but instead according to the values in the column
with the decimal coordinates. This is so because, in alphabetical
order, "+09d 23m 59.63s" precedes "-04d 29m 43.78s", for example,
while we would expect the latter (-4.495 deg) to be listed before
the former (9.4 deg).
Allow to select the format(s) of the star coordinates

Implement the functionality of the View — Coordinates submenu, which
lets the user choose whether sexagesimal coordinates, decimal or both
are shown. By default, only the 'Sexagesimal' checkbox is active.
Select the unit in which star periods are shown

Implement the functionality of the View — Coordinates submenu, which
allows to choose among three different formats: days (0.900694, for
example), hh:mm:ss (21:37:00) and seconds (77820).

Internally, this is implemented by creating three columns, with the
different formats, for each period, and displaying at a time only the
one that is selected. The columns with the periods in hh:mm:ss are
sorted according to their value in seconds, not lexicographically.

Until we figure out how to use empty cells for those photometric
filters for which the period of a star is unknown, -1 is used.
Allow only to have one LEMONdB open simultaneously

If the user attempts to open a second LEMONdB, display a dialog box
warning that data analysis must be done on one LEMONdB at a time and
therefore the current tabs will be automatically closed unless the
operation is canceled.

Imposing this restriction, at least for now, seems to be preferable to
increasing the complexity of the GUI, as otherwise the user may end up
with multiple tabs with stars belonging to different LEMONdBs.
Update the progress bar only when the percentage varies

Do not update the progress bar for each star of the LEMONdB that is
loaded into memory, but instead only when the percentage changes. If,
for example, it is 0.971 (97%), setting it to 0.972 (still 97%), and
particularly rendering it again, when the next star is loaded means
that the process is unnecessarily slowed down.
Open a page with the details of a star when double-clicking on it

These pages allow to select one of the photometric filters for which
the star has information, plotting (a) its light curve, (b) the list
of comparison stars, and their weights, that were used to compute it
and (c) the detailed list of points of the light curve. The methods
used here are only stubs, and even the layout of the page is just a
crude draft, so this should only be considered a first approximation.
Switch to already-opened stars when the user double-clicks on them
Do not display the 'Success' dialog box when a LEMONdB is loaded

It gets annoying after a few times and, in actuality, does not add any
useful information. It only tells us the number of stars that were
loaded from the LEMONdB, which is not worth having to click 'Close'
(or pressing Enter) before we can start analyzing the data.
Fix bug in StarDetailsGUI.show_pfilter

The details of the star for the first photometric filter (when sorted
by wavelength) are not displayed when the page is opened as we are not
taking into account that the 'shown' attribute is initialized to None.
Display the list of reference stars and their weights

For each photometric filter, show a GtkTreeView with the IDs of the
stars that were used as comparison and the weights with which they
were combined into the artificial comparison star. By default, these
rows are sorted in descending order by the weights (second column).
Display the detailed list of light curve points

When a photometric filter is selected, show a second GtkTreeView with
the data for each point of the light curve: (a) time of observation,
(b) differential magnitude, (c) signal-to-noise ratio and (d) maximum
and minimum errors, in magnitudes, induced by noise. By default, these
rows are sorted by the date (first column).
Open star details from the list of reference stars

Allow the user to see the details of a star by double-clicking on the
list of comparison stars that were used to calculate its light curve.
In this manner it is possible to easily examine the stars that were
used to compute each artificial comparison star, without having to go
back to the list of all the stars in the LEMONdB.
Use Matplotlib to plot the light curves

Implement a very rudimentary version of the light curve graphs. These
include vertical errorbars, derived from the signal-to-noise ratio of
each differential magnitude. Future versions should allow the user to
choose the line style, marker and maybe even the color; until then,
blue circle markers are used. Airmasses are not yet plotted.
Plot airmasses in the light curves

Add a check button which controls whether airmasses are shown in the
light curves. When enabled, airmassed are plotted on a second y-axis,
connecting with blue dashed lines the airmasses of the points of the
curve that are fewer than 'delta' seconds apart. In this manner,
airmasses from different nights are prevented from being connected by
the same line, which would not add any useful information and would
only clutter the plot unnecessarily.

This first version uses a hard-coded delta of 10800 seconds (three
hours), which works more than acceptably well with our data, until
the option of specifying its value is implemented.