-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
MAINT: signal.lombscargle: fix numerical backward-compat #21697
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
Conversation
Thanks for your patience on this. Perhaps the |
No worries. I sympathize with the large ecosystem that makes use of scipy. But it also feels unfortunate not to default to the preferred/better option, and hope the user discovers it. |
I've changed the default, and also tried to suggest in the docstring that the user might want to consider using I still propose that the default should be changed eventually—with sufficient notice. I understand there are many downstream users. Because scipy is the most popular toolbox that has this functionality, and is geared towards generalists, I believe providing for a "floating-mean" (which is generally preferred and recommended in literature) is the better choice. On balance, the current status quo is more likely to produce erroneous results. |
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 only have cosmetic suggestions:
The following line
Input arrays should be 1-D with a real floating dtype.
could be changed to something like:
Input arrays should be 1-D of a real floating data type, which are converted into float64 arrays before processing.
It describes a little more accurately, what is happening.
scipy/signal/_spectral_py.py
Outdated
>>> ax_p.set_xlabel('Angular frequency [rad/s]') | ||
>>> ax_p.set_ylabel('Power') | ||
>>> ax_p.legend(prop={'size': 7}) | ||
|
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.
Cosmetic nitpick: If you add line with ...
instead of a pure blank line, i.e,:
>>> ax_p.legend(prop={'size': 7})
...
>>> ax_n.plot(w, pgram_norm, label='default')
you'll get a continuous code block, which is easier to copy and paste.
FWIW I checked that this patch resolves failures in astropy's test suite. Thank you ! |
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.
Expert reviewer seems happy, downstream seems happy, CI seems happy. The diff and rendered docstring seem "ok" to me (maybe a few places where more bacticks would render variable names a bit nicer, but not worth holding this up for).
I'll go ahead and squash merge with adjusted commit message now.
thanks @adammj @DietBru @neutrinoceros |
Reference issue
#21696
What does this implement/fix?
Change
floating_mean
default fromTrue
toFalse
.Additional information
Additional verbiage to be figured out. Initial commit is just a placeholder.