@@ -18,7 +18,7 @@ def activate(schema_name, *, create_schema=True, create_tables=True):
1818 schema .activate (schema_name , create_schema = create_schema , create_tables = create_tables )
1919
2020 # Add neuropixels probes
21- for probe_type in ('neuropixels 1.0 - 3A' , 'neuropixels 1.0 - 3B' ,
21+ for probe_type in ('neuropixels 1.0 - 3A' , 'neuropixels 1.0 - 3B' , 'neuropixels UHD' ,
2222 'neuropixels 2.0 - SS' , 'neuropixels 2.0 - MS' ):
2323 ProbeType .create_neuropixels_probe (probe_type )
2424
@@ -46,15 +46,38 @@ class Electrode(dj.Part):
4646 def create_neuropixels_probe (probe_type = 'neuropixels 1.0 - 3A' ):
4747 """
4848 Create `ProbeType` and `Electrode` for neuropixels probes:
49- 1.0 (3A and 3B), 2.0 (SS and MS)
49+ + neuropixels 1.0 - 3A
50+ + neuropixels 1.0 - 3B
51+ + neuropixels UHD
52+ + neuropixels 2.0 - SS
53+ + neuropixels 2.0 - MS
54+
5055 For electrode location, the (0, 0) is the
5156 bottom left corner of the probe (ignore the tip portion)
5257 Electrode numbering is 1-indexing
5358 """
5459
60+ neuropixels_probes_config = {
61+ 'neuropixels 1.0 - 3A' : dict (site_count = 960 , col_spacing = 32 , row_spacing = 20 ,
62+ white_spacing = 16 , col_count = 2 ,
63+ shank_count = 1 , shank_spacing = 0 ),
64+ 'neuropixels 1.0 - 3B' : dict (site_count = 960 , col_spacing = 32 , row_spacing = 20 ,
65+ white_spacing = 16 , col_count = 2 ,
66+ shank_count = 1 , shank_spacing = 0 ),
67+ 'neuropixels UHD' : dict (site_count = 384 , col_spacing = 6 , row_spacing = 6 ,
68+ white_spacing = 0 , col_count = 8 ,
69+ shank_count = 1 , shank_spacing = 0 ),
70+ 'neuropixels 2.0 - SS' : dict (site_count = 1280 , col_spacing = 32 , row_spacing = 15 ,
71+ white_spacing = 0 , col_count = 2 ,
72+ shank_count = 1 , shank_spacing = 250 ),
73+ 'neuropixels 2.0 - MS' : dict (site_count = 1280 , col_spacing = 32 , row_spacing = 15 ,
74+ white_spacing = 0 , col_count = 2 ,
75+ shank_count = 4 , shank_spacing = 250 )
76+ }
77+
5578 def build_electrodes (site_count , col_spacing , row_spacing ,
56- white_spacing , col_count = 2 ,
57- shank_count = 1 , shank_spacing = 250 ):
79+ white_spacing , col_count ,
80+ shank_count , shank_spacing ):
5881 """
5982 :param site_count: site count per shank
6083 :param col_spacing: (um) horrizontal spacing between sites
@@ -66,14 +89,15 @@ def build_electrodes(site_count, col_spacing, row_spacing,
6689 :return:
6790 """
6891 row_count = int (site_count / col_count )
69- x_coords = np .tile ([ 0 , 0 + col_spacing ] , row_count )
70- x_white_spaces = np .tile ([ white_spacing , white_spacing , 0 , 0 ], int (row_count / 2 ) )
92+ x_coords = np .tile (np . arange ( 0 , col_spacing * col_count , col_spacing ) , row_count )
93+ y_coords = np .repeat ( np . arange (row_count ) * row_spacing , col_count )
7194
72- x_coords = x_coords + x_white_spaces
73- y_coords = np .repeat (np .arange (row_count ) * row_spacing , 2 )
95+ if white_spacing :
96+ x_white_spaces = np .tile ([white_spacing , white_spacing , 0 , 0 ], int (row_count / 2 ))
97+ x_coords = x_coords + x_white_spaces
7498
75- shank_cols = np .tile ([ 0 , 1 ] , row_count )
76- shank_rows = np .repeat (range (row_count ), 2 )
99+ shank_cols = np .tile (range ( col_count ) , row_count )
100+ shank_rows = np .repeat (range (row_count ), col_count )
77101
78102 npx_electrodes = []
79103 for shank_no in range (shank_count ):
@@ -88,51 +112,12 @@ def build_electrodes(site_count, col_spacing, row_spacing,
88112
89113 return npx_electrodes
90114
91- # ---- 1.0 3A ----
92- if probe_type == 'neuropixels 1.0 - 3A' :
93- electrodes = build_electrodes (site_count = 960 , col_spacing = 32 , row_spacing = 20 ,
94- white_spacing = 16 , col_count = 2 )
95-
96- probe_type = {'probe_type' : 'neuropixels 1.0 - 3A' }
97- with ProbeType .connection .transaction :
98- ProbeType .insert1 (probe_type , skip_duplicates = True )
99- ProbeType .Electrode .insert ([{** probe_type , ** e } for e in electrodes ],
100- skip_duplicates = True )
101-
102- # ---- 1.0 3B ----
103- if probe_type == 'neuropixels 1.0 - 3B' :
104- electrodes = build_electrodes (site_count = 960 , col_spacing = 32 , row_spacing = 20 ,
105- white_spacing = 16 , col_count = 2 )
106-
107- probe_type = {'probe_type' : 'neuropixels 1.0 - 3B' }
108- with ProbeType .connection .transaction :
109- ProbeType .insert1 (probe_type , skip_duplicates = True )
110- ProbeType .Electrode .insert ([{** probe_type , ** e } for e in electrodes ],
111- skip_duplicates = True )
112-
113- # ---- 2.0 Single shank ----
114- if probe_type == 'neuropixels 2.0 - SS' :
115- electrodes = build_electrodes (site_count = 1280 , col_spacing = 32 , row_spacing = 15 ,
116- white_spacing = 0 , col_count = 2 ,
117- shank_count = 1 , shank_spacing = 250 )
118-
119- probe_type = {'probe_type' : 'neuropixels 2.0 - SS' }
120- with ProbeType .connection .transaction :
121- ProbeType .insert1 (probe_type , skip_duplicates = True )
122- ProbeType .Electrode .insert ([{** probe_type , ** e } for e in electrodes ],
123- skip_duplicates = True )
124-
125- # ---- 2.0 Multi shank ----
126- if probe_type == 'neuropixels 2.0 - MS' :
127- electrodes = build_electrodes (site_count = 1280 , col_spacing = 32 , row_spacing = 15 ,
128- white_spacing = 0 , col_count = 2 ,
129- shank_count = 4 , shank_spacing = 250 )
130-
131- probe_type = {'probe_type' : 'neuropixels 2.0 - MS' }
132- with ProbeType .connection .transaction :
133- ProbeType .insert1 (probe_type , skip_duplicates = True )
134- ProbeType .Electrode .insert ([{** probe_type , ** e } for e in electrodes ],
135- skip_duplicates = True )
115+ electrodes = build_electrodes (** neuropixels_probes_config [probe_type ])
116+ probe_type = {'probe_type' : probe_type }
117+ with ProbeType .connection .transaction :
118+ ProbeType .insert1 (probe_type , skip_duplicates = True )
119+ ProbeType .Electrode .insert ([{** probe_type , ** e } for e in electrodes ],
120+ skip_duplicates = True )
136121
137122
138123@schema
0 commit comments