11
11
12
12
data_path = Path (__file__ ).absolute ().parent .parent / "data" / "spikeglx"
13
13
14
+ def test_parse_meta ():
15
+ for meta_file in [
16
+ "doppio-checkerboard_t0.imec0.ap.meta" ,
17
+ "NP1_saved_only_subset_of_channels.meta" ,
18
+ "allan-longcol_g0_t0.imec0.ap.meta" ,
19
+ ]:
20
+ meta = parse_spikeglx_meta (data_path / meta_file )
21
+
22
+ def test_get_saved_channel_indices_from_spikeglx_meta ():
23
+ # all channel saved + 1 synchro
24
+ chan_inds = get_saved_channel_indices_from_spikeglx_meta (
25
+ data_path / "Noise_g0_t0.imec0.ap.meta"
26
+ )
27
+ assert chan_inds .size == 385
28
+
29
+ # example by Pierre Yger NP1.0 with 384 but only 151 channels are saved + 1 synchro
30
+ chan_inds = get_saved_channel_indices_from_spikeglx_meta (
31
+ data_path / "NP1_saved_only_subset_of_channels.meta"
32
+ )
33
+ assert chan_inds .size == 152
14
34
15
35
def test_NP1 ():
16
36
probe = read_spikeglx (data_path / "Noise_g0_t0.imec0.ap.meta" )
17
37
assert "1.0" in probe .annotations ["name" ]
18
38
19
39
20
- def test_NP2_4_shanks ():
21
- probe = read_spikeglx (data_path / "TEST_20210920_0_g0_t0.imec0.ap.meta" )
22
- assert probe .get_shank_count () == 4
23
- assert "2.0" in probe .annotations ["name" ]
24
-
25
-
26
40
def test_NP2_1_shanks ():
27
41
probe = read_spikeglx (data_path / "p2_g0_t0.imec0.ap.meta" )
28
42
assert "2.0" in probe .annotations ["name" ]
@@ -31,19 +45,72 @@ def test_NP2_1_shanks():
31
45
32
46
def test_NP_phase3A ():
33
47
# Data provided by rtraghavan
34
- probe = read_spikeglx (data_path / "NeuropixelPhase3A_file_g0_t0.imec.ap.meta" )
35
- assert "Phase3a" in probe .annotations ["name" ]
48
+ probe = read_spikeglx (data_path / "phase3a.imec.ap.meta" )
49
+
50
+ assert probe .annotations ["name" ] == "Phase3a"
51
+ assert probe .annotations ["manufacturer" ] == "IMEC"
52
+ assert probe .annotations ["probe_type" ] == "Phase3a"
53
+
54
+ assert probe .ndim == 2
36
55
assert probe .get_shank_count () == 1
56
+ assert probe .get_contact_count () == 384
57
+
58
+ # Test contact geometry
59
+ contact_width = 12.0
60
+ contact_shape = "square"
37
61
62
+ assert np .all (probe .contact_shape_params == {"width" : contact_width })
63
+ assert np .all (probe .contact_shapes == contact_shape )
38
64
39
65
def test_NP2_4_shanks ():
66
+ probe = read_spikeglx (data_path / "NP2_4_shanks.imec0.ap.meta" )
67
+
68
+ assert probe .annotations ["name" ] == "Neuropixels 2.0 - Four Shank"
69
+ assert probe .annotations ["manufacturer" ] == "IMEC"
70
+ assert probe .annotations ["probe_type" ] == 24
71
+
72
+ assert probe .ndim == 2
73
+ assert probe .get_shank_count () == 4
74
+ assert probe .get_contact_count () == 384
75
+
76
+ # Test contact geometry
77
+ contact_width = 12.0
78
+ contact_shape = "square"
79
+
80
+ assert np .all (probe .contact_shape_params == {"width" : contact_width })
81
+ assert np .all (probe .contact_shapes == contact_shape )
82
+
83
+ # This file does not save the channnels from 0 as the one above (NP2_4_shanks_g0_t0.imec0.ap.meta)
84
+ ypos = probe .contact_positions [:, 1 ]
85
+ assert np .min (ypos ) == pytest .approx (0 )
86
+
87
+
88
+ def test_NP2_4_shanks_with_different_electrodes_saved ():
40
89
# Data provided by Jennifer Colonell
41
- probe = read_spikeglx (data_path / "NP24_g0_t0.imec0.ap.meta" )
42
- assert "2.0" in probe .annotations ["name" ]
90
+ probe = read_spikeglx (data_path / "NP2_4_shanks_save_different_electrodes.imec0.ap.meta" )
91
+
92
+ assert probe .annotations ["name" ] == "Neuropixels 2.0 - Four Shank"
93
+ assert probe .annotations ["manufacturer" ] == "IMEC"
94
+ assert probe .annotations ["probe_type" ] == 24
95
+
96
+ assert probe .ndim == 2
43
97
assert probe .get_shank_count () == 4
98
+ assert probe .get_contact_count () == 384
99
+
100
+ # Test contact geometry
101
+ contact_width = 12.0
102
+ contact_shape = "square"
44
103
104
+ assert np .all (probe .contact_shape_params == {"width" : contact_width })
105
+ assert np .all (probe .contact_shapes == contact_shape )
106
+
107
+ # This file does not save the channnels from 0 as the one above (NP2_4_shanks_g0_t0.imec0.ap.meta)
108
+ ypos = probe .contact_positions [:, 1 ]
109
+ assert np .min (ypos ) == pytest .approx (2880.0 )
110
+ assert np .max (ypos ) == pytest .approx (5745.0 )
45
111
46
- def test_NP1_large_depth_sapn ():
112
+
113
+ def test_NP1_large_depth_span ():
47
114
# Data provided by Tom Bugnon NP1 with large Depth span
48
115
probe = read_spikeglx (data_path / "allan-longcol_g0_t0.imec0.ap.meta" )
49
116
assert "1.0" in probe .annotations ["name" ]
@@ -64,35 +131,11 @@ def test_NP1_other_example():
64
131
65
132
def tes_NP1_384_channels ():
66
133
# example by Pierre Yger NP1.0 with 384 but only 151 channels are saved
67
- probe = read_spikeglx (data_path / "Day_3_g0_t0.imec1.ap .meta" )
134
+ probe = read_spikeglx (data_path / "NP1_saved_only_subset_of_channels .meta" )
68
135
assert probe .get_shank_count () == 1
69
136
assert probe .get_contact_count () == 151
70
137
assert 152 not in probe .contact_annotations ["channel_ids" ]
71
138
72
-
73
- def test_parse_meta ():
74
- for meta_file in [
75
- "doppio-checkerboard_t0.imec0.ap.meta" ,
76
- "Day_3_g0_t0.imec1.ap.meta" ,
77
- "allan-longcol_g0_t0.imec0.ap.meta" ,
78
- ]:
79
- meta = parse_spikeglx_meta (data_path / meta_file )
80
-
81
-
82
- def test_get_saved_channel_indices_from_spikeglx_meta ():
83
- # all channel saved + 1 synchro
84
- chan_inds = get_saved_channel_indices_from_spikeglx_meta (
85
- data_path / "Noise_g0_t0.imec0.ap.meta"
86
- )
87
- assert chan_inds .size == 385
88
-
89
- # example by Pierre Yger NP1.0 with 384 but only 151 channels are saved + 1 synchro
90
- chan_inds = get_saved_channel_indices_from_spikeglx_meta (
91
- data_path / "Day_3_g0_t0.imec1.ap.meta"
92
- )
93
- assert chan_inds .size == 152
94
-
95
-
96
139
def test_NPH_long_staggered ():
97
140
# Data provided by Nate Dolensek
98
141
probe = read_spikeglx (data_path / "non_human_primate_long_staggered.imec0.ap.meta" )
0 commit comments