Repository navigation
Conversation
|
Thank you for your contribution to Astropy! 🌌 This checklist is meant to remind the package maintainers who will review this pull request of some common things to look for.
|
| if fit_mean and SCIPY_LT_1_15: | ||
| pytest.skip("SciPy 1.15+ required for using `fit_mean=True`") | ||
| elif (errors == "full" or errors == "partial" and normalization == "psd"): | ||
| pytest.skip("scipy method only supports uniform uncertainties dy") |
There was a problem hiding this comment.
This is no longer true in scipy 1.15 – should we plumb through nonuniform uncertainties for scipy 1.15 as well?
There was a problem hiding this comment.
That would certainly be worth a stab; gonna look into this and see if there is a chance to get it in before feature-freeze as well.
There was a problem hiding this comment.
Yes, passing w / w.sum() as in the other methods as weights seems to work, just the psd normalisation will need some more investigation.
| assume_regular_frequency or _is_regular(frequency) | ||
| ) | ||
| prefer_scipy = "scipy" in methods and dy is None and not fit_mean | ||
| prefer_scipy = "scipy" in methods and dy is None and not (fit_mean and SCIPY_LT_1_15) |
There was a problem hiding this comment.
This logic is off I think – e.g. if fit_mean=True and scipy is version 1.14, this will return True, and then further down this will lead to an error because scipy 1.14 does not support fit_mean=True.
There was a problem hiding this comment.
But not () is False, so this is correctly skipped with 1.14 (those tests are passing, but I think I need to rebase to get rid of the failure in modeling).
4073b17 to
90d7d0c
Compare
|
Fixed the changelog locally, but other failures are unrelated, so holding off pushing again until that is resolved. |
|
Latest SciPy |
|
@dhomeier do you want my review now or after the be PR is undrafted ? |
|
Since the scipy change is still settling upstream, I'd recommend waiting on this PR until things stabilize. |
90d7d0c to
7a54238
Compare
|
Comments are always welcome, but I'll continue looking into adding the support for non-uniform |
| if method == "scipy": | ||
| P_expected = ls.power(frequency, method="cython") | ||
| else: | ||
| P_expected = ls.power(frequency) |
There was a problem hiding this comment.
This change seems strange to me – the default is scipy in some cases, but not in others. If it's important to do this for scipy, why is it not important to do this in other cases?
There was a problem hiding this comment.
I did not have a full overview of the defaults, but it seems for this dataset (not prefer_fast) the only other default would be cython, so using slow in that case would probably make sense. I guess in principle the comparisons should be symmetric, but when debugging the center_data settings I was not so sure. Anyway would make more sense than to compare a method to itself imo.
There was a problem hiding this comment.
Sure, but you're still comparing a method to itself whenever the default does not happen to be "scipy" – if that's a problem, shouldn't you fix it in all cases? And if it's not a problem, then why change this code at all?
There was a problem hiding this comment.
No, only for the cython case I'd add – or are there any configurations I have overlooked when auto would not choose either cython or scipy? Anyway that was the behaviour before, so just leaving it that way does not seem useful. I guess we could also always use slow for reference anytime method != "slow", just worried that might slow down the tests needlessly. ;-)
There was a problem hiding this comment.
For what it's worth, my reasoning in the original version of this was that doing the simple thing does not result in any lack of test coverage when running the full test suite, and also serves to test that the default is doing something sensible, even in PRs like this where the default has new behavior.
I think it would be cleanest to revert this change.
There was a problem hiding this comment.
Basically this was trying to take up @mhvk's suggestion to test the 'scipy' method against one of the internals, which was not (explicitly) done before. The issues I also have with the existing construct are
- ~¼ of the tests is not really comparing anything than repeating the same function call.
- 'scipy', and for some cases 'cython', is only ever tested indirectly (when some other methods are failing against it as the reference), which is creating confusing diagnostics in case that 'scipy' is broken – e.g. in TST: test_lombscargle.py has 80 failed tests in devdeps #17149 it initially appeared that all other methods were broken until someone remembered that 'scipy' was used as the baseline for those tests.
There was a problem hiding this comment.
OK, then if (1) is a problem, I think we should solve it for all test runs, rather than just for some. For (2), I think it's not going to be possible to escape this entirely, because some method needs to be chosen as a baseline for any particular test, and that baseline may someday break.
Should we move this to draft and remilestone to v7.1 then? Thanks, all! |
9c0365a to
e4f6ba9
Compare
scipy PR is merged, and did not affect how we are calling I have set a clearer precedence for the baseline I have implemented a first version for nonuniform weights in |
This is true so long as long as we're certain that scipy is not going to rethink argument names or default behavior again before the next release. |
|
To supplement @jakevdp, and as I already said on the issue (#17166 (comment)), I don't think we should merge this before scipy 1.15 is actually released (or has a release candidate, at least): however unlikely it is that the feature is changed again or removed before the actual release, they might want/need to, and having this patch merged already could create a catastrophic situation on our side (especially if released), so I strongly feel this shouldn't be on the 7.0 milestone. |
|
Rebased to have the tests run against Scipy 15.2 now that v15 API is fixed. |
|
If you need something from SciPy in the next |
|
Sorry I'm just now remembering this PR existed and pre-dated #17600, so I linked both PRs as mutually exclusive. However, they are not identical: my approach also includes deprecation cycles to eventually re-unify currently inconsistent default values for the |
|
Hi humans 👋 - this pull request hasn't had any new commits for approximately 4 months. I plan to close this in 30 days if the pull request doesn't have any new commits by then. In lieu of a stalled pull request, please consider closing this and open an issue instead if a reminder is needed to revisit in the future. Maintainers may also choose to add keep-open label to keep this PR open but it is discouraged unless absolutely necessary. If this PR still needs to be reviewed, as an author, you can rebase it to reset the clock. If you believe I commented on this pull request incorrectly, please report this here. |
|
I noticed that this hasn't been committed, and it references the scipy lombscargle parameter |
|
@dhomeier are you interested to revisit? Thanks, all! |
|
This has slipped under the radar for some time, don't know why tests are currently hanging, but need to check what has materialised on the scipy side now first. |
|
The CI is probably because you need to rebase. |
|
But why are tests running at all when this has been inactive for 4 months? No point in rebasing right now, as one kwarg used here is marked to be deprecated by Scipy, so should try to find a solution without it. |
Not sure what you mean. We bumped CI dependency versions, so the required job names changed from when you last ran this. Required jobs are always listed in status checks.
Would it be cleaner to open a new PR at this point? |
This. So these 3 were added in
Will decide when I have tried a rebase, and checked what is the status at Scipy (1.16 by now), and also compared to #17600. |
More like we changed the job name when we bump Python and/or Matplotlib minversions. |
|
I also expect CI to behave cleanly on a rebase. The jobs you see in your screenshot are now awaited specifically because they never ran, but are currently mandated for merging. |
|
Closing in favor of #20412, which incorporates the commits from here |

Description
Replacement of #17163, that will enable the scipy lombscargle implementation to be called with
fit_mean=Truefor scipy versions supporting this as thefloating_meanoption introduced with scipy/scipy#21277.This is also unskipping the respective tests for the
scipymethod, plus a number of others with constant uncertainties that are actually accepted by this method (though not used for anything, which however seems to only be relevant for thepsdnormalisation).The discussion over the final behaviour, and in particular defaults, of the
floating_meanoption was still open in scipy/scipy#21696, but has been settled for reverting to the old default as of scipy/scipy#21697.I'd still note some points:
fit_mean, as its default has always beenTrueinLombscargle, and thescipymethod can currently only be used when explicitly settingfit_mean=False:floating_meanwill not matter for this implementation, since it always explicitly sets it to the value offit_mean.fit_mean=Truewill now often becomescipy, where it has usually beencythonbefore. This could even be changed by not making this change inprefer_scipy, but since the results are identical, and performance per the tests on the scipy side should not be any worse than the Cython version, I would consider this an irrelevant change on the user side.fit_meanandcenter_datain the same branch, i.e effectively the latter is always treated asTrueif the former is. This is obviously related to the somewhat misleading documentation described in Clarify interaction between center_data and fit_mean in LombScargle #17038. I think this is equivalent to the oldprecenteroption insignal.lombscargle, but anyway scipy handles both independently, and will thus return different results forfit_mean=True,center_data=False. For consistency I am therefore also forcing the latter toTruein this case, but the wrapper function itself still accepts both combinations. I think this still needs more discussion which combinations should be supported or make sense at all.fit_mean=Truetolombscargle_scipy#17600 (added by @neutrinoceros)