@@ -15,11 +15,18 @@ def activate(schema_name, *, create_schema=True, create_tables=True):
1515 :param create_schema: when True (default), create schema in the database if it does not yet exist.
1616 :param create_tables: when True (default), create tables in the database if they do not yet exist.
1717 """
18- schema .activate (schema_name , create_schema = create_schema , create_tables = create_tables )
18+ schema .activate (
19+ schema_name , create_schema = create_schema , create_tables = create_tables
20+ )
1921
2022 # Add neuropixels probes
21- for probe_type in ('neuropixels 1.0 - 3A' , 'neuropixels 1.0 - 3B' , 'neuropixels UHD' ,
22- 'neuropixels 2.0 - SS' , 'neuropixels 2.0 - MS' ):
23+ for probe_type in (
24+ "neuropixels 1.0 - 3A" ,
25+ "neuropixels 1.0 - 3B" ,
26+ "neuropixels UHD" ,
27+ "neuropixels 2.0 - SS" ,
28+ "neuropixels 2.0 - MS" ,
29+ ):
2330 ProbeType .create_neuropixels_probe (probe_type )
2431
2532
@@ -43,7 +50,7 @@ class Electrode(dj.Part):
4350 """
4451
4552 @staticmethod
46- def create_neuropixels_probe (probe_type = ' neuropixels 1.0 - 3A' ):
53+ def create_neuropixels_probe (probe_type = " neuropixels 1.0 - 3A" ):
4754 """
4855 Create `ProbeType` and `Electrode` for neuropixels probes:
4956 + neuropixels 1.0 - 3A
@@ -58,29 +65,65 @@ def create_neuropixels_probe(probe_type='neuropixels 1.0 - 3A'):
5865 """
5966
6067 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 )
68+ "neuropixels 1.0 - 3A" : dict (
69+ site_count = 960 ,
70+ col_spacing = 32 ,
71+ row_spacing = 20 ,
72+ white_spacing = 16 ,
73+ col_count = 2 ,
74+ shank_count = 1 ,
75+ shank_spacing = 0 ,
76+ ),
77+ "neuropixels 1.0 - 3B" : dict (
78+ site_count = 960 ,
79+ col_spacing = 32 ,
80+ row_spacing = 20 ,
81+ white_spacing = 16 ,
82+ col_count = 2 ,
83+ shank_count = 1 ,
84+ shank_spacing = 0 ,
85+ ),
86+ "neuropixels UHD" : dict (
87+ site_count = 384 ,
88+ col_spacing = 6 ,
89+ row_spacing = 6 ,
90+ white_spacing = 0 ,
91+ col_count = 8 ,
92+ shank_count = 1 ,
93+ shank_spacing = 0 ,
94+ ),
95+ "neuropixels 2.0 - SS" : dict (
96+ site_count = 1280 ,
97+ col_spacing = 32 ,
98+ row_spacing = 15 ,
99+ white_spacing = 0 ,
100+ col_count = 2 ,
101+ shank_count = 1 ,
102+ shank_spacing = 250 ,
103+ ),
104+ "neuropixels 2.0 - MS" : dict (
105+ site_count = 1280 ,
106+ col_spacing = 32 ,
107+ row_spacing = 15 ,
108+ white_spacing = 0 ,
109+ col_count = 2 ,
110+ shank_count = 4 ,
111+ shank_spacing = 250 ,
112+ ),
76113 }
77114
78- def build_electrodes (site_count , col_spacing , row_spacing ,
79- white_spacing , col_count ,
80- shank_count , shank_spacing ):
115+ def build_electrodes (
116+ site_count ,
117+ col_spacing ,
118+ row_spacing ,
119+ white_spacing ,
120+ col_count ,
121+ shank_count ,
122+ shank_spacing ,
123+ ):
81124 """
82125 :param site_count: site count per shank
83- :param col_spacing: (um) horrizontal spacing between sites
126+ :param col_spacing: (um) horizontal spacing between sites
84127 :param row_spacing: (um) vertical spacing between columns
85128 :param white_spacing: (um) offset spacing
86129 :param col_count: number of column per shank
@@ -89,35 +132,47 @@ def build_electrodes(site_count, col_spacing, row_spacing,
89132 :return:
90133 """
91134 row_count = int (site_count / col_count )
92- x_coords = np .tile (np .arange (0 , col_spacing * col_count , col_spacing ), row_count )
135+ x_coords = np .tile (
136+ np .arange (0 , col_spacing * col_count , col_spacing ), row_count
137+ )
93138 y_coords = np .repeat (np .arange (row_count ) * row_spacing , col_count )
94139
95140 if white_spacing :
96- x_white_spaces = np .tile ([white_spacing , white_spacing , 0 , 0 ], int (row_count / 2 ))
141+ x_white_spaces = np .tile (
142+ [white_spacing , white_spacing , 0 , 0 ], int (row_count / 2 )
143+ )
97144 x_coords = x_coords + x_white_spaces
98145
99146 shank_cols = np .tile (range (col_count ), row_count )
100147 shank_rows = np .repeat (range (row_count ), col_count )
101148
102149 npx_electrodes = []
103150 for shank_no in range (shank_count ):
104- npx_electrodes .extend ([{'electrode' : (site_count * shank_no ) + e_id ,
105- 'shank' : shank_no ,
106- 'shank_col' : c_id ,
107- 'shank_row' : r_id ,
108- 'x_coord' : x + (shank_no * shank_spacing ),
109- 'y_coord' : y }
110- for e_id , (c_id , r_id , x , y ) in enumerate (
111- zip (shank_cols , shank_rows , x_coords , y_coords ))])
151+ npx_electrodes .extend (
152+ [
153+ {
154+ "electrode" : (site_count * shank_no ) + e_id ,
155+ "shank" : shank_no ,
156+ "shank_col" : c_id ,
157+ "shank_row" : r_id ,
158+ "x_coord" : x + (shank_no * shank_spacing ),
159+ "y_coord" : y ,
160+ }
161+ for e_id , (c_id , r_id , x , y ) in enumerate (
162+ zip (shank_cols , shank_rows , x_coords , y_coords )
163+ )
164+ ]
165+ )
112166
113167 return npx_electrodes
114168
115169 electrodes = build_electrodes (** neuropixels_probes_config [probe_type ])
116- probe_type = {' probe_type' : probe_type }
170+ probe_type = {" probe_type" : probe_type }
117171 with ProbeType .connection .transaction :
118172 ProbeType .insert1 (probe_type , skip_duplicates = True )
119- ProbeType .Electrode .insert ([{** probe_type , ** e } for e in electrodes ],
120- skip_duplicates = True )
173+ ProbeType .Electrode .insert (
174+ [{** probe_type , ** e } for e in electrodes ], skip_duplicates = True
175+ )
121176
122177
123178@schema
0 commit comments