-
Notifications
You must be signed in to change notification settings - Fork 143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix problem with single power spectrum #797
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #797 +/- ##
==========================================
- Coverage 96.37% 96.27% -0.11%
==========================================
Files 44 44
Lines 8824 8855 +31
==========================================
+ Hits 8504 8525 +21
- Misses 320 330 +10 ☔ View full report in Codecov by Sentry. |
280509d
to
2d58b3a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hope I understood what this PR is doing.
Isn't it better to check what is in the "last" bin that we are now considering if segment size is almost an integer number of light curve bins?
Since the segment size could be set as the GTI length, if the flux in the last bin is zero, it probably means that the GTI is set such as that bin shouldn't be included. Do you agree?
Moreover, I didn't understand what happended when there are multiple GTIs and segment size Is None. It seems that segment size becomes gti[-1, 1] - gti[0, 0] which would return an error (I hope) since the segment size is larger than all GTIs.
I would add tests with multiple GTIs in the case segment size is not set.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM overall. A couple of minor questions, but I don't think they should stop merging.
@mgullik , @dhuppenkothen I think I've addressed all your comments. Quick answers to @mgullik 's question:
This is a good point, and the code takes care of it. The GTIs always account for the bin size, so ideally they go from |
Resolve #663
Note for reviewers: I created a test reproducing exactly the MWE by @dhuppenkothen in #663, and a similar one for cross spectra. My first solution broke other tests, so I changed slightly the logic in
fourier.py
andcrossspectrum.py
to make everything work.In particular, if a segment size is almost an integer number of light curve bins (less than 1% away), instead of approximating to the lower bin I approximate to the higher one. Not more than that, because a bin with a significantly lower flux could alter the statistical properties of the data. New function in
utils.py
for this