StingraySoftware / stingray

Anything can happen in the next half hour (including spectral timing made easy)!
https://stingray.science/stingray
MIT License
172 stars 141 forks source link

Gaussian Processes Tool #739

Closed Gaurav17Joshi closed 1 year ago

Gaurav17Joshi commented 1 year ago

Gaussian Processes Feature for QPO detection

Addressing #660 . This is an implementation for the GP tool (mainly for detection and parameter analysis for QPOs) . This addition makes use of tinygp library for Gaussian Processes implementation, and jaxns for nested sampling. The new feature is in the stingray.modeling.gpmodelling.py file. It has three main features:-

  1. get_prior: This function makes the prior function for a specified prior dictionary.
  2. get_likelihood: This function makes the log_likelihood function for the given Kernel, Mean model and lightcurve.
  3. GPResult class: The class which takes a Lightcurve, and performs Nested Sampling for a given prior and likelihood.

Work Remaining To be done:-

codecov[bot] commented 1 year ago

Codecov Report

Merging #739 (e9ef4df) into main (5d633c1) will increase coverage by 0.16%. Report is 76 commits behind head on main. The diff coverage is 98.21%.

@@            Coverage Diff             @@
##             main     #739      +/-   ##
==========================================
+ Coverage   97.13%   97.29%   +0.16%     
==========================================
  Files          42       43       +1     
  Lines        7929     7918      -11     
==========================================
+ Hits         7702     7704       +2     
+ Misses        227      214      -13     
Files Coverage Δ
stingray/__init__.py 100.00% <100.00%> (ø)
stingray/crossspectrum.py 99.00% <100.00%> (+0.78%) :arrow_up:
stingray/events.py 99.53% <100.00%> (-0.47%) :arrow_down:
stingray/fourier.py 99.79% <100.00%> (+0.05%) :arrow_up:
stingray/lightcurve.py 97.89% <100.00%> (+<0.01%) :arrow_up:
stingray/lombscargle.py 100.00% <100.00%> (ø)
stingray/powerspectrum.py 99.67% <100.00%> (+0.22%) :arrow_up:
stingray/pulse/overlapandsave/test_ols.py 100.00% <100.00%> (ø)
stingray/utils.py 98.85% <ø> (+0.35%) :arrow_up:
stingray/modeling/gpmodeling.py 95.78% <95.78%> (ø)

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

matteobachetti commented 1 year ago

Additional request: please add a short sentence in the installation instructions, about the added dependencies in case one wants to use the GP tool

pep8speaks commented 1 year ago

Hello @Gaurav17Joshi! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

Line 40:50: W291 trailing whitespace Line 622:101: E501 line too long (109 > 100 characters)

Line 25:1: E402 module level import not at top of file Line 26:1: E402 module level import not at top of file Line 27:1: E402 module level import not at top of file

dhuppenkothen commented 1 year ago

The black issue is my fault, I will fix this in the next PR. Other than that, all the tests are passing, all of Matteo's and my nitpicky comments have been addressed, and I think this is ready for merging.

Thank you, @Gaurav17Joshi for your fantastic work! It was a big effort, but I'm so excited that this method is now in stingray!