|
2 | 2 |
|
3 | 3 | import os |
4 | 4 | import numpy as np |
5 | | -import pytest |
6 | 5 |
|
7 | | -from astropy.io import fits |
8 | | - |
9 | | -import autoarray as aa |
10 | 6 |
|
11 | 7 | test_data_path = os.path.join( |
12 | 8 | "{}".format(os.path.dirname(os.path.realpath(__file__))), "files" |
@@ -290,60 +286,6 @@ def test__resized_array_2d_from__padding_with_new_origin(): |
290 | 286 | ) |
291 | 287 | ).all() |
292 | 288 |
|
293 | | - |
294 | | -def test__ndarray_via_fits_from(): |
295 | | - arr = util.array_2d.ndarray_via_fits_from( |
296 | | - file_path=os.path.join(test_data_path, "3x3_ones.fits"), hdu=0 |
297 | | - ) |
298 | | - |
299 | | - assert (arr == np.ones((3, 3))).all() |
300 | | - |
301 | | - arr = util.array_2d.ndarray_via_fits_from( |
302 | | - file_path=os.path.join(test_data_path, "4x3_ones.fits"), hdu=0 |
303 | | - ) |
304 | | - |
305 | | - assert (arr == np.ones((4, 3))).all() |
306 | | - |
307 | | - |
308 | | -def test__numpy_array_2d_to_fits(): |
309 | | - file_path = os.path.join(test_data_path, "array_out.fits") |
310 | | - |
311 | | - if os.path.exists(file_path): |
312 | | - os.remove(file_path) |
313 | | - |
314 | | - arr = np.array([[10.0, 30.0, 40.0], [92.0, 19.0, 20.0]]) |
315 | | - |
316 | | - util.array_2d.numpy_array_2d_to_fits(arr, file_path=file_path) |
317 | | - |
318 | | - array_load = util.array_2d.ndarray_via_fits_from(file_path=file_path, hdu=0) |
319 | | - |
320 | | - assert (arr == array_load).all() |
321 | | - |
322 | | - |
323 | | -def test__numpy_array_2d_to_fits__header_dict(): |
324 | | - file_path = os.path.join(test_data_path, "array_out.fits") |
325 | | - |
326 | | - if os.path.exists(file_path): |
327 | | - os.remove(file_path) |
328 | | - |
329 | | - arr = np.array([[10.0, 30.0, 40.0], [92.0, 19.0, 20.0]]) |
330 | | - |
331 | | - util.array_2d.numpy_array_2d_to_fits(arr, file_path=file_path, header_dict={"A": 1}) |
332 | | - |
333 | | - header = aa.header_obj_from(file_path=file_path, hdu=0) |
334 | | - |
335 | | - assert header["A"] == 1 |
336 | | - |
337 | | - |
338 | | -def test__header_obj_from(): |
339 | | - header_obj = aa.header_obj_from( |
340 | | - file_path=os.path.join(test_data_path, "3x3_ones.fits"), hdu=0 |
341 | | - ) |
342 | | - |
343 | | - assert isinstance(header_obj, fits.header.Header) |
344 | | - assert header_obj["BITPIX"] == -64 |
345 | | - |
346 | | - |
347 | 289 | def test__replace_noise_map_2d_values_where_image_2d_values_are_negative(): |
348 | 290 | image_2d = np.ones(shape=(2, 2)) |
349 | 291 |
|
|
0 commit comments