77from astropy .io import fits
88
99import sunpy .map
10- from sunpy .net import Fido
11- from sunpy .net import attrs as a
1210
1311from sunkit_image .coalignment import coalign
14- from sunkit_image .coalignment .interface import (
15- REGISTERED_METHODS ,
16- AffineParams ,
17- _update_fits_wcs_metadata ,
18- register_coalignment_method ,
19- )
12+ from sunkit_image .coalignment .interface import AffineParams , _update_fits_wcs_metadata
2013from sunkit_image .tests .helpers import figure_test
2114
2215
@@ -28,16 +21,12 @@ def eis_test_map():
2821
2922
3023@pytest .fixture ()
31- def aia193_test_map (eis_test_map ):
32- query = Fido .search (
33- a .Time (start = eis_test_map .date - 1 * u .minute ,
34- end = eis_test_map .date + 1 * u .minute ,
35- near = eis_test_map .date ),
36- a .Instrument .aia ,
37- a .Wavelength (193 * u .angstrom ),
38- )
39- file = Fido .fetch (query , site = 'NSO' )
40- return sunpy .map .Map (file )
24+ def aia193_test_map ():
25+ # This is matched to the EIS observation time
26+ url = "https://github.com/sunpy/data/raw/refs/heads/main/sunkit-image/aia.lev1.193A_2014_01_08T09_57_30.84Z.image_lev1.fits"
27+ with fits .open (url ) as hdul :
28+ hdul .verify ('silentfix' )
29+ return sunpy .map .Map (hdul [1 ].data , hdul [1 ].header )
4130
4231
4332@pytest .mark .remote_data ()
@@ -116,32 +105,18 @@ def test_coalignment_figure(incorrect_pointing_cutout_map, cutout_map, aia171_te
116105 return fig
117106
118107
119- def test_register_coalignment_method ():
120- @register_coalignment_method ("test_method" )
121- def test_func ():
122- return "Test function"
123-
124- assert "test_method" in REGISTERED_METHODS
125- assert REGISTERED_METHODS ["test_method" ] == test_func
126- assert test_func () == "Test function"
127-
128-
129108def test_unsupported_affine_parameters (incorrect_pointing_cutout_map , aia171_test_map ):
130109 affine_rot = AffineParams (
131110 scale = [1 ,1 ],
132111 rotation_matrix = 2 * np .eye (2 ),
133112 translation = [0 ,0 ],
134113 )
135114 with pytest .raises (NotImplementedError , match = r"Changes to the rotation metadata are currently not supported." ):
136- _ = _update_fits_wcs_metadata (incorrect_pointing_cutout_map ,
137- aia171_test_map ,
138- affine_rot )
115+ _update_fits_wcs_metadata (incorrect_pointing_cutout_map , aia171_test_map , affine_rot )
139116 affine_scale = AffineParams (
140117 scale = [2 ,3 ],
141118 rotation_matrix = np .eye (2 ),
142119 translation = [0 ,0 ],
143120 )
144121 with pytest .raises (NotImplementedError , match = r"Changes to the pixel scale metadata are currently not supported." ):
145- _ = _update_fits_wcs_metadata (incorrect_pointing_cutout_map ,
146- aia171_test_map ,
147- affine_scale )
122+ _update_fits_wcs_metadata (incorrect_pointing_cutout_map , aia171_test_map , affine_scale )
0 commit comments