Skip to content

Commit 1ea6fde

Browse files
committed
Rename prefer_scipy to can_use_scipy, make the scipy uniform-dy skip in test_integer_inputs independent of the version skip, restore the original assert_allclose argument order, and reformat the validate_method signature
1 parent 4150433 commit 1ea6fde

2 files changed

Lines changed: 12 additions & 5 deletions

File tree

‎astropy/timeseries/periodograms/lombscargle/implementations/main.py‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,14 @@ def _get_frequency_grid(frequency, assume_regular_frequency=False):
7676

7777

7878
def validate_method( # ruff: ignore[PLR0917]
79-
method, dy, fit_mean, nterms, frequency, assume_regular_frequency, *, method_kwds=None
79+
method,
80+
dy,
81+
fit_mean,
82+
nterms,
83+
frequency,
84+
assume_regular_frequency,
85+
*,
86+
method_kwds=None,
8087
):
8188
"""
8289
Validate the method argument, and if method='auto'
@@ -88,7 +95,7 @@ def validate_method( # ruff: ignore[PLR0917]
8895
)
8996
# the scipy method accepts no additional keywords, so never select it
9097
# automatically when method_kwds are passed
91-
prefer_scipy = (
98+
can_use_scipy = (
9299
"scipy" in methods
93100
and dy is None
94101
and method_kwds is None
@@ -104,7 +111,7 @@ def validate_method( # ruff: ignore[PLR0917]
104111
method = "chi2"
105112
elif prefer_fast:
106113
method = "fast"
107-
elif prefer_scipy:
114+
elif can_use_scipy:
108115
method = "scipy"
109116
else:
110117
method = "cython"

‎astropy/timeseries/periodograms/lombscargle/tests/test_lombscargle.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ def test_integer_inputs(
181181
if method == "scipy":
182182
if fit_mean and not _scipy_supports_floating_mean():
183183
pytest.skip("SciPy 1.15+ required for using `fit_mean=True`")
184-
elif with_errors:
184+
if with_errors:
185185
pytest.skip("scipy method only supports uniform uncertainties dy")
186186

187187
t, y, dy = data
@@ -204,7 +204,7 @@ def test_integer_inputs(
204204
kwds = dict(center_data=center_data, fit_mean=fit_mean, normalization=normalization)
205205
P_float = LombScargle(t, y, dy, **kwds).power(frequency, method=method)
206206
P_int = LombScargle(t_int, y_int, dy_int, **kwds).power(frequency, method=method)
207-
assert_allclose(P_int, P_float)
207+
assert_allclose(P_float, P_int)
208208

209209

210210
@pytest.mark.parametrize("method", NTERMS_METHODS)

0 commit comments

Comments
 (0)