GSoC’17- Report 3
Last week, I finished up my work on CrossCorrelation and made additional changes to the code, under the PR review done by the mentors. Matteo didn’t look entirely happy with the results I got on the lags as they were not consistent with the inputs(Complete review can be found here). So as an example, if I have two lightcurves with phase difference of pi/2 with a signal frequency of 1Hz, lag should be 0.25 sec. i.e 1/4 of a second which was not a case in some of the examples that I wrote in the crosscorrealtion notebook repository for stingray. It turned out that for correct computation of CrossCorrelation, one had to subtract mean from the data before calculating correlation for correct results. I made the changes and and lags turned out to be correct 👍.

Matteo also pointed out that correlation function common in astronomy has same size as input data. So, we had to introduce a mode parameter, that allowed user to add mode of correlation as an input to CrossCorrelation object. Different modes supported are {full, same and valid}, where default mode is same. Other changes requested by mentors included some refactoring with plots for better usability, making lightcurves class attributes and allowing for lightcurves with different sizes as inputs.
One interesting thing that I would like to share is floating point comparison bug that got me scratching my head. Tests that I wrote were failing for some unknown reasons and it turned out that I had forgotten a very important lesson from Intro to Computer Science class:
Never compare floating point numbers for equality.
Here is a screenshot that I took of a failing test due to a floating point comparison bug.

Final changes have been approved by mentors and CrossCorrelation along with notebook tutorial are soon to be a part of Stingray repository 😉.

I had a good discussion with mentors on next goals for GSoC, and my plans are to create a general Periodogram class to improve code re-usability for other periodograms that are to become a part of stingray. Next, we have a plan to include higher order specta for analysis of time series that include methods like Bispectrum and Bicoherence. More on these in the next blog .