@@ -15,11 +15,18 @@ def activate(schema_name, *, create_schema=True, create_tables=True):
15
15
:param create_schema: when True (default), create schema in the database if it does not yet exist.
16
16
:param create_tables: when True (default), create tables in the database if they do not yet exist.
17
17
"""
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
+ )
19
21
20
22
# 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
+ ):
23
30
ProbeType .create_neuropixels_probe (probe_type )
24
31
25
32
@@ -43,7 +50,7 @@ class Electrode(dj.Part):
43
50
"""
44
51
45
52
@staticmethod
46
- def create_neuropixels_probe (probe_type = ' neuropixels 1.0 - 3A' ):
53
+ def create_neuropixels_probe (probe_type = " neuropixels 1.0 - 3A" ):
47
54
"""
48
55
Create `ProbeType` and `Electrode` for neuropixels probes:
49
56
+ neuropixels 1.0 - 3A
@@ -58,29 +65,65 @@ def create_neuropixels_probe(probe_type='neuropixels 1.0 - 3A'):
58
65
"""
59
66
60
67
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
+ ),
76
113
}
77
114
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
+ ):
81
124
"""
82
125
: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
84
127
:param row_spacing: (um) vertical spacing between columns
85
128
:param white_spacing: (um) offset spacing
86
129
:param col_count: number of column per shank
@@ -89,35 +132,47 @@ def build_electrodes(site_count, col_spacing, row_spacing,
89
132
:return:
90
133
"""
91
134
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
+ )
93
138
y_coords = np .repeat (np .arange (row_count ) * row_spacing , col_count )
94
139
95
140
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
+ )
97
144
x_coords = x_coords + x_white_spaces
98
145
99
146
shank_cols = np .tile (range (col_count ), row_count )
100
147
shank_rows = np .repeat (range (row_count ), col_count )
101
148
102
149
npx_electrodes = []
103
150
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
+ )
112
166
113
167
return npx_electrodes
114
168
115
169
electrodes = build_electrodes (** neuropixels_probes_config [probe_type ])
116
- probe_type = {' probe_type' : probe_type }
170
+ probe_type = {" probe_type" : probe_type }
117
171
with ProbeType .connection .transaction :
118
172
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
+ )
121
176
122
177
123
178
@schema
0 commit comments