-
Notifications
You must be signed in to change notification settings - Fork 144
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 powerspectrum from lightcurve - wrong size, float casting #760
Conversation
Codecov Report
@@ Coverage Diff @@
## main #760 +/- ##
==========================================
+ Coverage 96.62% 97.25% +0.62%
==========================================
Files 41 41
Lines 7388 7396 +8
==========================================
+ Hits 7139 7193 +54
+ Misses 249 203 -46
... and 6 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
@@ -1846,11 +1850,13 @@ def avg_pds_from_events( | |||
""" | |||
if segment_size is None: |
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.
If we have this line, do you think it's better to set segment_size = None as the default value?
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.
Yeah, it would indeed make sense. However, this would be a breaking change and would require to make a number of modifications to the rest of the code as well.
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 understand, it makes sense
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.
Hi @matteobachetti,
great upgrade to the code!
If I understood correctly you define
dt = np.median(np.diff(times[:100]))
in the case dt is not given. I was wondering what happens if there are less than 100 bins in the time array? And also if the function checks whether or not the light curve is evenly sampled?
There are also a couple of comments attached to the file
|
Resolves two recently reported issues:
avg_*s_from_event
methods not accepting complex fluxes andavg_*s_from_event
methods throwing errors of "no segment shorter than gti"The first one comes from our forcing a float casting on input fluxes (to avoid integers - that can lead to casting errors in Numba routines, and quadruple precision, which is overkill), that kills complex numbers.
The second one comes from our re-defining
dt
to accommodate an exact number of bins inside a segment. This works well with actual events, but does damage when you have a light curve that was sampled with a given dt.