@@ -43,6 +43,7 @@ def test_probeinterface_format(tmp_path):
4343 # ~ plot_probe_group(probegroup2, with_contact_id=True, same_axes=False)
4444 # ~ plt.show()
4545
46+
4647def test_writeprobeinterface (tmp_path ):
4748 probe = generate_dummy_probe ()
4849 file_path = tmp_path / "test.prb"
@@ -61,7 +62,6 @@ def test_writeprobeinterface_raises_error_with_bad_input(tmp_path):
6162 write_probeinterface (file_path , probe )
6263
6364
64-
6565def test_BIDS_format (tmp_path ):
6666 folder_path = tmp_path / "test_BIDS"
6767 folder_path .mkdir ()
@@ -77,9 +77,7 @@ def test_BIDS_format(tmp_path):
7777 # with BIDS specifications
7878 n_els = sum ([p .get_contact_count () for p in probegroup .probes ])
7979 # using np.random.choice to ensure uniqueness of contact ids
80- el_ids = np .random .choice (
81- np .arange (1e4 , 1e5 , dtype = "int" ), replace = False , size = n_els
82- ).astype (str )
80+ el_ids = np .random .choice (np .arange (1e4 , 1e5 , dtype = "int" ), replace = False , size = n_els ).astype (str )
8381 for probe in probegroup .probes :
8482 probe_el_ids , el_ids = np .split (el_ids , [probe .get_contact_count ()])
8583 probe .set_contact_ids (probe_el_ids )
@@ -102,12 +100,7 @@ def test_BIDS_format(tmp_path):
102100 assert all (np .isin (probe_orig .contact_ids , probe_read .contact_ids ))
103101
104102 # the transformation of contact order between the two probes
105- t = np .array (
106- [
107- list (probe_read .contact_ids ).index (elid )
108- for elid in probe_orig .contact_ids
109- ]
110- )
103+ t = np .array ([list (probe_read .contact_ids ).index (elid ) for elid in probe_orig .contact_ids ])
111104
112105 assert all (probe_orig .contact_ids == probe_read .contact_ids [t ])
113106 assert all (probe_orig .shank_ids == probe_read .shank_ids [t ])
@@ -116,21 +109,14 @@ def test_BIDS_format(tmp_path):
116109 assert probe_orig .si_units == probe_read .si_units
117110
118111 for i in range (len (probe_orig .probe_planar_contour )):
119- assert all (
120- probe_orig .probe_planar_contour [i ] == probe_read .probe_planar_contour [i ]
121- )
112+ assert all (probe_orig .probe_planar_contour [i ] == probe_read .probe_planar_contour [i ])
122113 for sid , shape_params in enumerate (probe_orig .contact_shape_params ):
123114 assert shape_params == probe_read .contact_shape_params [t ][sid ]
124115 for i in range (len (probe_orig .contact_positions )):
125- assert all (
126- probe_orig .contact_positions [i ] == probe_read .contact_positions [t ][i ]
127- )
116+ assert all (probe_orig .contact_positions [i ] == probe_read .contact_positions [t ][i ])
128117 for i in range (len (probe .contact_plane_axes )):
129118 for dim in range (len (probe .contact_plane_axes [i ])):
130- assert all (
131- probe_orig .contact_plane_axes [i ][dim ]
132- == probe_read .contact_plane_axes [t ][i ][dim ]
133- )
119+ assert all (probe_orig .contact_plane_axes [i ][dim ] == probe_read .contact_plane_axes [t ][i ][dim ])
134120
135121
136122def test_BIDS_format_empty (tmp_path ):
@@ -218,6 +204,7 @@ def test_prb(tmp_path):
218204 # plot_probe(probe)
219205 # plt.show()
220206
207+
221208if __name__ == "__main__" :
222209 # test_probeinterface_format()
223210 # test_BIDS_format()
0 commit comments