Skip to content

Commit 851d963

Browse files
committed
Implement Brett's suggestions
1 parent 109d384 commit 851d963

3 files changed

Lines changed: 51 additions & 31 deletions

File tree

tweakwcs/__init__.py

Lines changed: 42 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,45 @@
1717
__version__ = ''
1818

1919

20-
from .correctors import (WCSCorrector, FITSWCSCorrector, # noqa: F401
21-
ST_V2V3_WCSCorrector, # noqa: F401
22-
JWSTWCSCorrector, RomanWCSCorrector, # noqa: F401
23-
TPWCS, JWSTgWCS, FITSWCS) # noqa: F401
24-
from .matchutils import MatchCatalogs, XYXYMatch, TPMatch # noqa: F401
25-
from .imalign import fit_wcs, align_wcs # noqa: F401
26-
from .wcsimage import (convex_hull, RefCatalog, WCSImageCatalog, # noqa: F401
27-
WCSGroupCatalog) # noqa: F401
28-
from .linalg import inv # noqa: F401
29-
from .linearfit import iter_linear_fit, build_fit_matrix # noqa: F401
20+
from .correctors import (
21+
WCSCorrector,
22+
FITSWCSCorrector,
23+
ST_V2V3_WCSCorrector,
24+
JWSTWCSCorrector,
25+
RomanWCSCorrector,
26+
)
27+
from .matchutils import XYXYMatch, MatchCatalogs, MatchSourceConfusionError
28+
from .imalign import fit_wcs, align_wcs
29+
from .wcsimage import (
30+
convex_hull,
31+
RefCatalog,
32+
WCSImageCatalog,
33+
WCSGroupCatalog,
34+
)
35+
from .linalg import inv
36+
from .linearfit import iter_linear_fit, build_fit_matrix
37+
38+
# import deprecated classes:
39+
from .correctors import TPWCS, JWSTgWCS, FITSWCS # noqa: F401
40+
from .matchutils import TPMatch # noqa: F401
41+
42+
43+
__all__ = [
44+
'FITSWCSCorrector',
45+
'JWSTWCSCorrector',
46+
'MatchCatalogs',
47+
'MatchSourceConfusionError',
48+
'RefCatalog',
49+
'RomanWCSCorrector',
50+
'ST_V2V3_WCSCorrector',
51+
'WCSCorrector',
52+
'WCSGroupCatalog',
53+
'WCSImageCatalog',
54+
'XYXYMatch',
55+
'align_wcs',
56+
'build_fit_matrix',
57+
'convex_hull',
58+
'fit_wcs',
59+
'inv',
60+
'iter_linear_fit',
61+
]

tweakwcs/tests/conftest.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,19 @@
33
from astropy import wcs as fitswcs
44
from astropy.table import Table
55

6+
from tweakwcs.correctors import (
7+
JWSTWCSCorrector,
8+
RomanWCSCorrector,
9+
ST_V2V3_WCSCorrector,
10+
)
611
from tweakwcs.linearfit import build_fit_matrix
712
from . helper_correctors import make_mock_st_wcs
813

914

10-
@pytest.fixture(scope='module')
15+
@pytest.fixture(
16+
scope='module',
17+
params=[ST_V2V3_WCSCorrector, JWSTWCSCorrector, RomanWCSCorrector]
18+
)
1119
def mock_st_wcs(request):
1220
corr_cls = request.param
1321
cd = build_fit_matrix((36, 47), 1e-5)

tweakwcs/tests/test_correctors.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -205,11 +205,6 @@ def test_jwst_wcs_corr_applied(corr_cls):
205205
assert 'dummy_meta' in wc.meta
206206

207207

208-
@pytest.mark.parametrize(
209-
'mock_st_wcs',
210-
[ST_V2V3_WCSCorrector, JWSTWCSCorrector, RomanWCSCorrector],
211-
indirect=True
212-
)
213208
def test_jwst_wcs_corr_are_being_combined(mock_st_wcs):
214209
wcs, corr_cls = mock_st_wcs
215210
wc = corr_cls(
@@ -245,11 +240,6 @@ def test_jwstgwcs_unsupported_wcs():
245240
JWSTWCSCorrector(dummy_wcs, {})
246241

247242

248-
@pytest.mark.parametrize(
249-
'mock_st_wcs',
250-
[ST_V2V3_WCSCorrector, JWSTWCSCorrector, RomanWCSCorrector],
251-
indirect=True
252-
)
253243
def test_jwstgwcs_inconsistent_ref(mock_st_wcs):
254244
wcs, corr_cls = mock_st_wcs
255245
wc = corr_cls(
@@ -263,11 +253,6 @@ def test_jwstgwcs_inconsistent_ref(mock_st_wcs):
263253
)
264254

265255

266-
@pytest.mark.parametrize(
267-
'mock_st_wcs',
268-
[ST_V2V3_WCSCorrector, JWSTWCSCorrector, RomanWCSCorrector],
269-
indirect=True
270-
)
271256
def test_jwstgwcs_wrong_tpcorr_type(mock_st_wcs):
272257
wcs, corr_cls = mock_st_wcs
273258
wc = corr_cls(
@@ -288,11 +273,6 @@ def test_jwstgwcs_wrong_tpcorr_type(mock_st_wcs):
288273
)
289274

290275

291-
@pytest.mark.parametrize(
292-
'mock_st_wcs',
293-
[ST_V2V3_WCSCorrector, JWSTWCSCorrector, RomanWCSCorrector],
294-
indirect=True
295-
)
296276
def test_jwstgwcs_ref_angles_preserved(mock_st_wcs):
297277
wcs, corr_cls = mock_st_wcs
298278
wc = corr_cls(

0 commit comments

Comments
 (0)