Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Add Lomb-Scargle detection function #1070
This pull request adds the Lomb-Scargle algorithm for period detection to gammapy/time. The Lomb-Scargle is from astropy. It is extended by different significance criteria for periodogram peaks. The spectral window function is introduced to investigate the influence of sampling on the periodogram.
@wegenmat - Thanks!
I've done a first round of review and left inline comments. After we've iterated a bit on this and polished the code / tests / docs, I would then ask someone else to review the API / method.
I did some of the recommend minor changes. I am not quite sure about the plotting function. On the one hand, it is not essential for the periodogram, but one the other hand, since at least the spectral window function needs to be inspected by eyesight, plotting comes in handy for the analysis.
OK to keep the plotting function. But then you have to write a good docstring explaining what the inputs are and what the plots show.
A new idea about the plotting function: since it is the same for the Lomb-Scargle and the robust regression techniques (upcoming), it may be smart to outsource it to an independent method that is dedicated to period detection in general, not only Lomb-Scargle. Your thoughts about this, @cdeil ?
@wegenmat - I left a bunch of inline comments. The most important one is the request to add a working example to the high-level docs. Having that will make it much more likely that people will use this, and also easier to do the review if there's a working example one can easily start playing with.
Sep 7, 2017
Please review the changes in f2cd0cc and let me know if you have any questions or disagree with something. We've found that setting plotting style in library functions is not a good pattern because styles keep changing (e.g. matplotlib 1.0 vs 2.0) and it's best to leave styling to users.
Some questions / comments:
@wegenmat - Maybe you could open a new follow-up PR (starting from master) where we can do further improvements for this code?
The docs build is currently failing because you're referencing PNG images in gammapy-extra that aren't there yet. Please make a pull request against gammapy-extra to add them.