@@ -151,22 +151,35 @@ def test_dig_montage_trans(tmp_path):
151
151
assert str (position1 ) == str (position2 ) # exactly equal
152
152
153
153
154
- def test_fiducials ():
154
+ @pytest .mark .parametrize ("fname" , (fif_fname , ctf_fif_fname ))
155
+ def test_fiducials (tmp_path , fname ):
155
156
"""Test handling of fiducials."""
156
157
# Eventually the code used here should be unified with montage.py, but for
157
158
# now it uses code in odd places
158
- for fname in (fif_fname , ctf_fif_fname ):
159
- fids , coord_frame = read_fiducials (fname )
160
- points = _fiducial_coords (fids , coord_frame )
161
- assert points .shape == (3 , 3 )
162
- # Fids
163
- assert_allclose (points [:, 2 ], 0.0 , atol = 1e-6 )
164
- assert_allclose (points [::2 , 1 ], 0.0 , atol = 1e-6 )
165
- assert points [2 , 0 ] > 0 # RPA
166
- assert points [0 , 0 ] < 0 # LPA
167
- # Nasion
168
- assert_allclose (points [1 , 0 ], 0.0 , atol = 1e-6 )
169
- assert points [1 , 1 ] > 0
159
+ fids , coord_frame = read_fiducials (fname )
160
+ assert coord_frame == FIFF .FIFFV_COORD_HEAD
161
+ points = _fiducial_coords (fids , coord_frame )
162
+ assert points .shape == (3 , 3 )
163
+ # Fids
164
+ assert_allclose (points [:, 2 ], 0.0 , atol = 1e-6 )
165
+ assert_allclose (points [::2 , 1 ], 0.0 , atol = 1e-6 )
166
+ assert points [2 , 0 ] > 0 # RPA
167
+ assert points [0 , 0 ] < 0 # LPA
168
+ # Nasion
169
+ assert_allclose (points [1 , 0 ], 0.0 , atol = 1e-6 )
170
+ assert points [1 , 1 ] > 0
171
+ fname_out = tmp_path / "test-dig.fif"
172
+ make_dig_montage (
173
+ lpa = fids [0 ]["r" ], nasion = fids [1 ]["r" ], rpa = fids [2 ]["r" ], coord_frame = "mri_voxel"
174
+ ).save (fname_out , overwrite = True )
175
+ fids_2 , coord_frame_2 = read_fiducials (fname_out )
176
+ assert coord_frame_2 == FIFF .FIFFV_MNE_COORD_MRI_VOXEL
177
+ assert_allclose (
178
+ [fid ["r" ] for fid in fids [:3 ]],
179
+ [fid ["r" ] for fid in fids_2 ],
180
+ rtol = 1e-6 ,
181
+ )
182
+ assert coord_frame_2 is not None
170
183
171
184
172
185
def test_documented ():
0 commit comments