11import numpy as np
22import os
3- from os import path
43import shutil
54
65import autoarray as aa
76import pytest
87
98from autoarray .operators import transformer
9+ from pathlib import Path
1010
11- test_data_path = path .join (
12- "{}" .format (path .dirname (path .realpath (__file__ ))),
13- "files" ,
14- )
11+ test_data_path = Path (Path (__file__ ).resolve ().parent ) / "files"
1512
1613
1714def test__dirty_image__shape_native_matches_real_space_mask (
@@ -70,11 +67,11 @@ def test__dirty_signal_to_noise_map__shape_native_matches_real_space_mask(
7067def test__from_fits__all_files_in_one_fits__load_using_different_hdus (mask_2d_7x7 ):
7168 dataset = aa .Interferometer .from_fits (
7269 real_space_mask = mask_2d_7x7 ,
73- data_path = path . join (test_data_path , "3x2_multiple_hdu.fits" ) ,
70+ data_path = Path (test_data_path ) / "3x2_multiple_hdu.fits" ,
7471 visibilities_hdu = 0 ,
75- noise_map_path = path . join (test_data_path , "3x2_multiple_hdu.fits" ) ,
72+ noise_map_path = Path (test_data_path ) / "3x2_multiple_hdu.fits" ,
7673 noise_map_hdu = 1 ,
77- uv_wavelengths_path = path . join (test_data_path , "3x2_multiple_hdu.fits" ) ,
74+ uv_wavelengths_path = Path (test_data_path ) / "3x2_multiple_hdu.fits" ,
7875 uv_wavelengths_hdu = 2 ,
7976 )
8077
@@ -85,26 +82,18 @@ def test__from_fits__all_files_in_one_fits__load_using_different_hdus(mask_2d_7x
8582
8683
8784def test__output_all_arrays (mask_2d_7x7 ):
88- test_data_path = path .join (
89- "{}" .format (path .dirname (path .realpath (__file__ ))),
90- "files" ,
91- )
85+ test_data_path = Path (Path (__file__ ).resolve ().parent ) / "files"
9286
9387 dataset = aa .Interferometer .from_fits (
9488 real_space_mask = mask_2d_7x7 ,
95- data_path = path . join (test_data_path , "3x2_ones_twos.fits" ) ,
96- noise_map_path = path . join (test_data_path , "3x2_threes_fours.fits" ) ,
97- uv_wavelengths_path = path . join (test_data_path , "3x2_fives_sixes.fits" ) ,
89+ data_path = Path (test_data_path ) / "3x2_ones_twos.fits" ,
90+ noise_map_path = Path (test_data_path ) / "3x2_threes_fours.fits" ,
91+ uv_wavelengths_path = Path (test_data_path ) / "3x2_fives_sixes.fits" ,
9892 )
9993
100- test_data_path = path .join (
101- "{}" .format (path .dirname (path .realpath (__file__ ))),
102- "files" ,
103- "array" ,
104- "output_test" ,
105- )
94+ test_data_path = Path (Path (__file__ ).resolve ().parent ) / "files" / "array" / "output_test"
10695
107- if path .exists (test_data_path ):
96+ if Path ( test_data_path ) .exists ():
10897 shutil .rmtree (test_data_path )
10998
11099 os .makedirs (test_data_path )
@@ -113,17 +102,17 @@ def test__output_all_arrays(mask_2d_7x7):
113102
114103 fits_interferometer (
115104 dataset = dataset ,
116- data_path = path . join (test_data_path , "data.fits" ) ,
117- noise_map_path = path . join (test_data_path , "noise_map.fits" ) ,
118- uv_wavelengths_path = path . join (test_data_path , "uv_wavelengths.fits" ) ,
105+ data_path = Path (test_data_path ) / "data.fits" ,
106+ noise_map_path = Path (test_data_path ) / "noise_map.fits" ,
107+ uv_wavelengths_path = Path (test_data_path ) / "uv_wavelengths.fits" ,
119108 overwrite = True ,
120109 )
121110
122111 dataset = aa .Interferometer .from_fits (
123112 real_space_mask = mask_2d_7x7 ,
124- data_path = path . join (test_data_path , "data.fits" ) ,
125- noise_map_path = path . join (test_data_path , "noise_map.fits" ) ,
126- uv_wavelengths_path = path . join (test_data_path , "uv_wavelengths.fits" ) ,
113+ data_path = Path (test_data_path ) / "data.fits" ,
114+ noise_map_path = Path (test_data_path ) / "noise_map.fits" ,
115+ uv_wavelengths_path = Path (test_data_path ) / "uv_wavelengths.fits" ,
127116 )
128117
129118 assert (dataset .data == np .array ([1.0 + 2.0j , 1.0 + 2.0j , 1.0 + 2.0j ])).all ()
0 commit comments