From 2b2bb777561590046c692a0b5ce4a166791f3f28 Mon Sep 17 00:00:00 2001 From: Mihai Cara Date: Mon, 9 Sep 2024 09:22:22 -0400 Subject: [PATCH 1/2] Update test matrix --- .github/workflows/ci.yml | 6 ++++++ tox.ini | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index aa92db7..211d2eb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,4 +43,10 @@ jobs: pytest-results-summary: true - windows: py312-xdist pytest-results-summary: true + - linux: py312-numpy21-xdist + pytest-results-summary: true + - macos: py312-numpy21-xdist + pytest-results-summary: true + - windows: py312-numpy21-xdist + pytest-results-summary: true - linux: py312-dev-xdist diff --git a/tox.ini b/tox.ini index cb814bb..de531fa 100644 --- a/tox.ini +++ b/tox.ini @@ -2,7 +2,7 @@ envlist = check-{style,security,build} test{,-dev}{,-pyargs,-cov} - test-numpy{120,122,125} + test-numpy{120,121,122,125,20,21} build-{docs,dist} # tox environments are constructed with so-called 'factors' (or terms) @@ -66,9 +66,13 @@ extras = deps = xdist: pytest-xdist cov: pytest-cov + numpy120: numpy==1.20.* numpy121: numpy==1.21.* + numpy122: numpy==1.22.* numpy123: numpy==1.23.* numpy125: numpy==1.25.* + numpy20: numpy==2.0.* + numpy21: numpy==2.1.* commands_pre = dev: pip install -r requirements-dev.txt -U --upgrade-strategy eager pip freeze From 7c63fecac6029b96a725fc70fd90d88420f348ff Mon Sep 17 00:00:00 2001 From: Mihai Cara Date: Mon, 9 Sep 2024 20:29:34 -0400 Subject: [PATCH 2/2] Fix failure related to astropy PR 16673 --- tweakwcs/linearfit.py | 18 +++++++++++------- tweakwcs/tests/test_linearfit.py | 5 +++-- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/tweakwcs/linearfit.py b/tweakwcs/linearfit.py index 01e2ba5..3b95e97 100644 --- a/tweakwcs/linearfit.py +++ b/tweakwcs/linearfit.py @@ -10,16 +10,18 @@ """ import logging import numbers -from packaging.version import Version -import numpy as np import astropy -from astropy.modeling.fitting import LevMarLSQFitter +import numpy as np +from packaging.version import Version + if Version(astropy.__version__) >= Version('5.1'): from astropy.modeling.fitting import fitter_to_model_params + from astropy.modeling.fitting import LMLSQFitter else: from astropy.modeling.fitting import (_fitter_to_model_params as fitter_to_model_params) + from astropy.modeling.fitting import LevMarLSQFitter as LMLSQFitter from . linalg import inv from . import __version__ # noqa: F401 @@ -27,8 +29,10 @@ __author__ = 'Mihai Cara, Warren Hack' __all__ = [ - 'iter_linear_fit', 'build_fit_matrix', 'SUPPORTED_FITGEOM_MODES', - '_LevMarLSQFitter2x2' + 'iter_linear_fit', + 'build_fit_matrix', + 'SUPPORTED_FITGEOM_MODES', + '_LevMarLSQFitter2x2', ] # Supported fitgeom modes and corresponding minobj @@ -846,10 +850,10 @@ def build_fit_matrix(rot, scale=1): return matrix -class _LevMarLSQFitter2x2(LevMarLSQFitter): +class _LevMarLSQFitter2x2(LMLSQFitter): """ Performs fits of 2D vector-models to 2D reference points. """ def objective_function(self, fps, *args): - model, weights, inputs, meas = args + model, weights, inputs, meas, *_ = args fitter_to_model_params(model, fps) if weights is None: return np.ravel(np.subtract(model(*inputs), meas)) diff --git a/tweakwcs/tests/test_linearfit.py b/tweakwcs/tests/test_linearfit.py index fafdc89..be8924d 100644 --- a/tweakwcs/tests/test_linearfit.py +++ b/tweakwcs/tests/test_linearfit.py @@ -7,9 +7,10 @@ from itertools import product import math import sys -import pytest -import numpy as np + from astropy.modeling.models import Shift, Rotation2D +import numpy as np +import pytest from tweakwcs import linearfit, linalg