10
10
import os
11
11
os .environ ['OMP_NUM_THREADS' ] = '1'
12
12
13
+ import numpy as np
13
14
import pyvale .dic as dic
14
15
15
16
test_dir = os .path .dirname (__file__ )
@@ -39,8 +40,15 @@ def test_image_scan_znssd_affine():
39
40
test_file = os .path .abspath (os .path .join (test_dir , "./test_image_scan_znssd_affine_plate_rigid_def0000.csv" ))
40
41
41
42
42
- with open (ref_file ) as f1 , open (test_file ) as f2 :
43
- assert list (f1 ) == list (f2 )
43
+ ref = np .loadtxt (ref_file , skiprows = 1 , delimiter = ',' )
44
+ test = np .loadtxt (test_file , skiprows = 1 , delimiter = ',' )
45
+
46
+ np .testing .assert_allclose (
47
+ ref [:, :7 ],
48
+ test [:, :7 ],
49
+ rtol = 1e-8 , atol = 1e-6 ,
50
+ err_msg = "First 7 columns of reference and test CSVs do not match."
51
+ )
44
52
45
53
os .remove (test_file )
46
54
@@ -63,8 +71,15 @@ def test_image_scan_znssd_rigid():
63
71
test_file = os .path .abspath (os .path .join (test_dir , "./test_image_scan_znssd_rigid_plate_rigid_def0000.csv" ))
64
72
65
73
66
- with open (ref_file ) as f1 , open (test_file ) as f2 :
67
- assert list (f1 ) == list (f2 )
74
+ ref = np .loadtxt (ref_file , skiprows = 1 , delimiter = ',' )
75
+ test = np .loadtxt (test_file , skiprows = 1 , delimiter = ',' )
76
+
77
+ np .testing .assert_allclose (
78
+ ref [:, :7 ],
79
+ test [:, :7 ],
80
+ rtol = 1e-8 , atol = 1e-6 ,
81
+ err_msg = "First 7 columns of reference and test CSVs do not match."
82
+ )
68
83
69
84
os .remove (test_file )
70
85
@@ -87,8 +102,15 @@ def test_image_scan_nssd_affine():
87
102
test_file = os .path .abspath (os .path .join (test_dir , "./test_image_scan_nssd_affine_plate_rigid_def0000.csv" ))
88
103
89
104
90
- with open (ref_file ) as f1 , open (test_file ) as f2 :
91
- assert list (f1 ) == list (f2 )
105
+ ref = np .loadtxt (ref_file , skiprows = 1 , delimiter = ',' )
106
+ test = np .loadtxt (test_file , skiprows = 1 , delimiter = ',' )
107
+
108
+ np .testing .assert_allclose (
109
+ ref [:, :7 ],
110
+ test [:, :7 ],
111
+ rtol = 1e-8 , atol = 1e-6 ,
112
+ err_msg = "First 7 columns of reference and test CSVs do not match."
113
+ )
92
114
93
115
os .remove (test_file )
94
116
@@ -110,9 +132,20 @@ def test_rg_znssd_affine():
110
132
ref_file = os .path .abspath (os .path .join (test_dir , "./reference/ref_rg_znssd_affine_plate_rigid.csv" ))
111
133
test_file = os .path .abspath (os .path .join (test_dir , "./test_rg_znssd_affine_plate_rigid_def0000.csv" ))
112
134
135
+ ref = np .loadtxt (ref_file , skiprows = 1 , delimiter = ',' )
136
+ test = np .loadtxt (test_file , skiprows = 1 , delimiter = ',' )
137
+
138
+ np .testing .assert_allclose (
139
+ ref [:, :7 ],
140
+ test [:, :7 ],
141
+ rtol = 1e-8 , atol = 1e-6 ,
142
+ err_msg = "First 7 columns of reference and test CSVs do not match."
143
+ )
113
144
114
- with open (ref_file ) as f1 , open (test_file ) as f2 :
115
- assert list (f1 ) == list (f2 )
145
+
146
+
147
+ # with open(ref_file) as f1, open(test_file) as f2:
148
+ # assert list(f1) == list(f2)
116
149
117
150
118
151
os .remove (test_file )
@@ -136,8 +169,15 @@ def test_fft_znssd_affine():
136
169
test_file = os .path .abspath (os .path .join (test_dir , "./test_fft_znssd_affine_plate_rigid_def0000.csv" ))
137
170
138
171
139
- with open (ref_file ) as f1 , open (test_file ) as f2 :
140
- assert list (f1 ) == list (f2 )
172
+ ref = np .loadtxt (ref_file , skiprows = 1 , delimiter = ',' )
173
+ test = np .loadtxt (test_file , skiprows = 1 , delimiter = ',' )
174
+
175
+ np .testing .assert_allclose (
176
+ ref [:, :7 ],
177
+ test [:, :7 ],
178
+ rtol = 1e-8 , atol = 1e-6 ,
179
+ err_msg = "First 7 columns of reference and test CSVs do not match."
180
+ )
141
181
142
182
143
183
os .remove (test_file )
0 commit comments