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

Shift and add #849

Open matteobachetti opened 5 hours ago

matteobachetti commented 5 hours ago

Basic implementation of the shift-and-add technique from Mendez+1998 Guide for review: the basic mechanism is in fourier.py, the examples in the doctests should be self-explanatory. InDynamicalCrossspectrum and DynamicalPowerspectrum, I just wrap the same functionality in convenient methods that unpack the relevant information from the dynamical spectra and use the function in fourier.py.

Example: if a QPO is changing its frequency during our observation Screenshot 2024-10-04 at 14 01 18

we can think of tracing its maximum (e.g. with dcs.trace_maximum(), here I did it by hand): Screenshot 2024-10-04 at 14 03 31

and then applying shift_and_add to improve signal-to-noise and, maybe, detect a second QPO: Screenshot 2024-10-04 at 14 03 49

codecov[bot] commented 5 hours ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 96.11%. Comparing base (39431fc) to head (7b7585d).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #849 +/- ## ========================================== + Coverage 96.08% 96.11% +0.02% ========================================== Files 48 48 Lines 9292 9359 +67 ========================================== + Hits 8928 8995 +67 Misses 364 364 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.