1
- """
2
- Neuropixels Probes
3
- """
4
-
5
1
import datajoint as dj
6
2
7
3
from .readers import probe_geometry
8
4
from .readers .probe_geometry import build_electrode_layouts
9
5
6
+ log = dj .logger
7
+
10
8
schema = dj .schema ()
11
9
12
10
@@ -33,20 +31,6 @@ def activate(
33
31
schema_name , create_schema = create_schema , create_tables = create_tables
34
32
)
35
33
36
- # Add neuropixels probes
37
- for probe_type in (
38
- "neuropixels 1.0 - 3A" ,
39
- "neuropixels 1.0 - 3B" ,
40
- "neuropixels UHD" ,
41
- "neuropixels 2.0 - SS" ,
42
- "neuropixels 2.0 - MS" ,
43
- ):
44
- if not (ProbeType & {"probe_type" : probe_type }):
45
- try :
46
- ProbeType .create_neuropixels_probe (probe_type )
47
- except dj .errors .DataJointError as e :
48
- print (f"Unable to create probe-type: { probe_type } \n { str (e )} " )
49
-
50
34
51
35
@schema
52
36
class ProbeType (dj .Lookup ):
@@ -87,39 +71,10 @@ class Electrode(dj.Part):
87
71
88
72
@staticmethod
89
73
def create_neuropixels_probe (probe_type : str = "neuropixels 1.0 - 3A" ):
90
- """
91
- Create `ProbeType` and `Electrode` for neuropixels probes:
92
- + neuropixels 1.0 - 3A
93
- + neuropixels 1.0 - 3B
94
- + neuropixels UHD
95
- + neuropixels 2.0 - SS
96
- + neuropixels 2.0 - MS
97
-
98
- For electrode location, the (0, 0) is the
99
- bottom left corner of the probe (ignore the tip portion)
100
- Electrode numbering is 0-indexing
101
- """
102
-
103
- npx_probes_config = probe_geometry .M
104
- npx_probes_config ["neuropixels 1.0 - 3A" ] = npx_probes_config ["3A" ]
105
- npx_probes_config ["neuropixels 1.0 - 3B" ] = npx_probes_config ["NP1010" ]
106
- npx_probes_config ["neuropixels UHD" ] = npx_probes_config ["NP1100" ]
107
- npx_probes_config ["neuropixels 2.0 - SS" ] = npx_probes_config ["NP2000" ]
108
- npx_probes_config ["neuropixels 2.0 - MS" ] = npx_probes_config ["NP2010" ]
109
-
110
- probe_type = {"probe_type" : probe_type }
111
- probe_params = dict (
112
- zip (
113
- probe_geometry .geom_param_names ,
114
- npx_probes_config [probe_type ["probe_type" ]],
115
- )
116
- )
117
- electrode_layouts = probe_geometry .build_npx_probe (
118
- ** {** probe_params , ** probe_type }
74
+ log .warning (
75
+ "Class method `ProbeType.create_neuropixels_probe` is deprecated. Use `create_neuropixels_probe` instead." ,
119
76
)
120
- with ProbeType .connection .transaction :
121
- ProbeType .insert1 (probe_type , skip_duplicates = True )
122
- ProbeType .Electrode .insert (electrode_layouts , skip_duplicates = True )
77
+ return create_neuropixels_probe (probe_type )
123
78
124
79
125
80
@schema
@@ -171,3 +126,49 @@ class Electrode(dj.Part):
171
126
-> master
172
127
-> ProbeType.Electrode
173
128
"""
129
+
130
+
131
+ def create_neuropixels_probe_types ():
132
+ # Add neuropixels probes
133
+ for probe_type in (
134
+ "neuropixels 1.0 - 3A" ,
135
+ "neuropixels 1.0 - 3B" ,
136
+ "neuropixels UHD" ,
137
+ "neuropixels 2.0 - SS" ,
138
+ "neuropixels 2.0 - MS" ,
139
+ ):
140
+ if not (ProbeType & {"probe_type" : probe_type }):
141
+ create_neuropixels_probe (probe_type )
142
+
143
+
144
+ def create_neuropixels_probe (probe_type : str = "neuropixels 1.0 - 3A" ):
145
+ """
146
+ Create `ProbeType` and `Electrode` for neuropixels probes:
147
+ + neuropixels 1.0 - 3A
148
+ + neuropixels 1.0 - 3B
149
+ + neuropixels UHD
150
+ + neuropixels 2.0 - SS
151
+ + neuropixels 2.0 - MS
152
+
153
+ For electrode location, the (0, 0) is the
154
+ bottom left corner of the probe (ignore the tip portion)
155
+ Electrode numbering is 0-indexing
156
+ """
157
+ npx_probes_config = probe_geometry .M
158
+ if probe_type not in npx_probes_config :
159
+ raise ValueError (
160
+ f"Probe type { probe_type } not found in probe_geometry configuration. Not a Neuropixels probe?"
161
+ )
162
+
163
+ probe_params = dict (
164
+ zip (
165
+ probe_geometry .geom_param_names ,
166
+ npx_probes_config [probe_type ],
167
+ )
168
+ )
169
+ electrode_layouts = probe_geometry .build_npx_probe (
170
+ ** {** probe_params , "probe_type" : probe_type }
171
+ )
172
+ with ProbeType .connection .transaction :
173
+ ProbeType .insert1 ({"probe_type" : probe_type })
174
+ ProbeType .Electrode .insert (electrode_layouts )
0 commit comments