Skip to content

Commit 161513d

Browse files
Jammy2211claude
authored andcommitted
Update tests to use new fits API instead of removed output_to_fits methods
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 220d03a commit 161513d

7 files changed

Lines changed: 24 additions & 7 deletions

File tree

test_autoarray/dataset/imaging/test_dataset.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,14 @@ def test__output_to_fits__round_trips_data_psf_noise_map_correctly(
174174
imaging_7x7, test_data_path
175175
):
176176

177-
imaging_7x7.output_to_fits(
177+
from autoarray.dataset.plot.imaging_plots import fits_imaging
178+
179+
fits_imaging(
180+
dataset=imaging_7x7,
178181
data_path=path.join(test_data_path, "data.fits"),
179182
psf_path=path.join(test_data_path, "psf.fits"),
180183
noise_map_path=path.join(test_data_path, "noise_map.fits"),
184+
overwrite=True,
181185
)
182186

183187
dataset = aa.Imaging.from_fits(

test_autoarray/dataset/interferometer/test_dataset.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,10 @@ def test__output_all_arrays(mask_2d_7x7):
109109

110110
os.makedirs(test_data_path)
111111

112-
dataset.output_to_fits(
112+
from autoarray.dataset.plot.interferometer_plots import fits_interferometer
113+
114+
fits_interferometer(
115+
dataset=dataset,
113116
data_path=path.join(test_data_path, "data.fits"),
114117
noise_map_path=path.join(test_data_path, "noise_map.fits"),
115118
uv_wavelengths_path=path.join(test_data_path, "uv_wavelengths.fits"),

test_autoarray/mask/test_mask_2d.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,13 @@ def test__from_fits__output_to_fits__roundtrip_preserves_values_pixel_scales_and
392392

393393
os.makedirs(output_path)
394394

395-
mask.output_to_fits(file_path=path.join(output_path, "mask.fits"))
395+
from autoconf.fitsable import output_to_fits
396+
output_to_fits(
397+
values=mask.astype("float"),
398+
file_path=path.join(output_path, "mask.fits"),
399+
header_dict=mask.header_dict,
400+
ext_name="mask",
401+
)
396402

397403
mask = aa.Mask2D.from_fits(
398404
file_path=path.join(output_path, "mask.fits"),

test_autoarray/structures/arrays/test_uniform_1d.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,8 @@ def test__output_to_fits__ones_array__fits_file_has_correct_values_and_header():
166166

167167
os.makedirs(test_data_path)
168168

169-
arr.output_to_fits(file_path=path.join(test_data_path, "array.fits"))
169+
from autoconf.fitsable import output_to_fits
170+
output_to_fits(values=arr.native.array.astype("float"), file_path=path.join(test_data_path, "array.fits"), header_dict=arr.mask.header_dict)
170171

171172
array_from_out = aa.Array1D.from_fits(
172173
file_path=path.join(test_data_path, "array.fits"), hdu=0, pixel_scales=1.0

test_autoarray/structures/arrays/test_uniform_2d.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,8 @@ def test__output_to_fits__3x3_ones__fits_file_has_ones_and_correct_pixel_scale_h
213213

214214
os.makedirs(test_data_path)
215215

216-
array_2d.output_to_fits(file_path=path.join(test_data_path, "array.fits"))
216+
from autoconf.fitsable import output_to_fits
217+
output_to_fits(values=array_2d.native.array.astype("float"), file_path=path.join(test_data_path, "array.fits"), header_dict=array_2d.mask.header_dict)
217218

218219
array_from_fits = aa.Array2D.from_fits(
219220
file_path=path.join(test_data_path, "array.fits"), hdu=0, pixel_scales=1.0

test_autoarray/structures/grids/test_uniform_2d.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,8 @@ def test__to_and_from_fits_methods():
475475

476476
file_path = path.join(test_grid_dir, "grid_2d.fits")
477477

478-
grid_2d.output_to_fits(file_path=file_path, overwrite=True)
478+
from autoconf.fitsable import output_to_fits
479+
output_to_fits(values=grid_2d.native.array.astype("float"), file_path=file_path, overwrite=True, header_dict=grid_2d.mask.header_dict)
479480

480481
grid_from_fits = aa.Grid2D.from_fits(file_path=file_path, pixel_scales=2.0)
481482

test_autoarray/structures/test_visibilities.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,8 @@ def test__output_to_fits():
102102

103103
os.makedirs(test_data_path)
104104

105-
visibilities.output_to_fits(file_path=path.join(test_data_path, "data.fits"))
105+
from autoconf.fitsable import output_to_fits
106+
output_to_fits(values=visibilities.in_array, file_path=path.join(test_data_path, "data.fits"))
106107

107108
visibilities_from_out = aa.Visibilities.from_fits(
108109
file_path=path.join(test_data_path, "data.fits"), hdu=0

0 commit comments

Comments
 (0)