ndx-optogenetics 0.2.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,43 @@
1
+ from importlib.resources import files
2
+ import os
3
+ from pynwb import load_namespaces, get_class
4
+
5
+ # Get path to the namespace.yaml file with the expected location when installed not in editable mode
6
+ __location_of_this_file = files(__name__)
7
+ __spec_path = __location_of_this_file / "spec" / "ndx-optogenetics.namespace.yaml"
8
+
9
+ # If that path does not exist, we are likely running in editable mode. Use the local path instead
10
+ if not os.path.exists(__spec_path):
11
+ __spec_path = __location_of_this_file.parent.parent.parent / "spec" / "ndx-optogenetics.namespace.yaml"
12
+
13
+ # Load the namespace
14
+ load_namespaces(str(__spec_path))
15
+
16
+ ExcitationSourceModel = get_class("ExcitationSourceModel", "ndx-optogenetics")
17
+ ExcitationSource = get_class("ExcitationSource", "ndx-optogenetics")
18
+ OpticalFiberModel = get_class("OpticalFiberModel", "ndx-optogenetics")
19
+ OpticalFiber = get_class("OpticalFiber", "ndx-optogenetics")
20
+ OpticalFiberLocationsTable = get_class("OpticalFiberLocationsTable", "ndx-optogenetics")
21
+ OptogeneticVirus = get_class("OptogeneticVirus", "ndx-optogenetics")
22
+ OptogeneticVirusInjection = get_class("OptogeneticVirusInjection", "ndx-optogenetics")
23
+ OptogeneticViruses = get_class("OptogeneticViruses", "ndx-optogenetics")
24
+ OptogeneticVirusInjections = get_class("OptogeneticVirusInjections", "ndx-optogenetics")
25
+ OptogeneticExperimentMetadata = get_class("OptogeneticExperimentMetadata", "ndx-optogenetics")
26
+ OptogeneticEpochsTable = get_class("OptogeneticEpochsTable", "ndx-optogenetics")
27
+
28
+ __all__ = [
29
+ "ExcitationSourceModel",
30
+ "ExcitationSource",
31
+ "OpticalFiberModel",
32
+ "OpticalFiber",
33
+ "OpticalFiberLocationsTable",
34
+ "OptogeneticVirus",
35
+ "OptogeneticVirusInjection",
36
+ "OptogeneticViruses",
37
+ "OptogeneticVirusInjections",
38
+ "OptogeneticExperimentMetadata",
39
+ "OptogeneticEpochsTable",
40
+ ]
41
+
42
+ # Remove these functions/modules from the package
43
+ del load_namespaces, get_class, files, os, __location_of_this_file, __spec_path
@@ -0,0 +1,329 @@
1
+ groups:
2
+ - neurodata_type_def: ExcitationSourceModel
3
+ neurodata_type_inc: Device
4
+ doc: Excitation source model. Currently there are no additional attributes.
5
+ attributes:
6
+ - name: illumination_type
7
+ dtype: text
8
+ doc: 'Type of illumination. Suggested values: LED, Gas Laser (e.g., Argon, Krypton),
9
+ Solid-State Laser (e.g., Diode, DPSS).'
10
+ - name: wavelength_range_in_nm
11
+ dtype: float
12
+ shape:
13
+ - 2
14
+ doc: Excitation wavelength range of the stimulation light in nm. For LEDs, this
15
+ is the center wavelength +/- half of the full width at half maximum (FWHM).
16
+ For lasers, this is the peak wavelength (use as both min and max).
17
+ required: false
18
+ - neurodata_type_def: ExcitationSource
19
+ neurodata_type_inc: Device
20
+ doc: Excitation source device.
21
+ attributes:
22
+ - name: wavelength_in_nm
23
+ dtype: float
24
+ doc: Peak excitation wavelength of the stimulation light in nm.
25
+ - name: power_in_W
26
+ dtype: float
27
+ doc: Excitation power of the stimulation light in W.
28
+ required: false
29
+ - name: intensity_in_W_per_m2
30
+ dtype: float
31
+ doc: Intensity of the stimulation light in W/m^2.
32
+ required: false
33
+ links:
34
+ - name: model
35
+ target_type: ExcitationSourceModel
36
+ doc: The model of the excitation source.
37
+ - neurodata_type_def: OpticalFiberModel
38
+ neurodata_type_inc: Device
39
+ doc: Optical fiber device model.
40
+ attributes:
41
+ - name: description
42
+ dtype: text
43
+ doc: Description of the optical fiber and ferrule equipment, including cleave
44
+ type or tapering.
45
+ required: false
46
+ - name: fiber_name
47
+ dtype: text
48
+ doc: Name of the optical fiber.
49
+ - name: fiber_model
50
+ dtype: text
51
+ doc: Model (or product ID) of the optical fiber.
52
+ required: false
53
+ - name: manufacturer
54
+ dtype: text
55
+ doc: Manufacturer of the optical fiber and ferrule.
56
+ - name: numerical_aperture
57
+ dtype: float
58
+ doc: Numerical aperture, e.g., 0.39 NA.
59
+ - name: core_diameter_in_um
60
+ dtype: float
61
+ doc: Cannula core diameter in um, e.g., 200.0 um.
62
+ - name: active_length_in_mm
63
+ dtype: float
64
+ doc: Active length in mm for a tapered fiber, e.g., Optogenix Lambda fiber. See
65
+ https://www.optogenix.com/lambda-fibers/ for details of one example.
66
+ required: false
67
+ - name: ferrule_name
68
+ dtype: text
69
+ doc: Product name of the ferrule.
70
+ required: false
71
+ - name: ferrule_model
72
+ dtype: text
73
+ doc: Model (or product ID) of the ferrule from the manufacturer.
74
+ required: false
75
+ - name: ferrule_diameter_in_mm
76
+ dtype: float
77
+ doc: Ferrule diameter in mm, e.g., 1.25 mm (LC) or 2.5 mm (FC).
78
+ required: false
79
+ - neurodata_type_def: OpticalFiber
80
+ neurodata_type_inc: Device
81
+ doc: Optical fiber device.
82
+ links:
83
+ - name: model
84
+ target_type: OpticalFiberModel
85
+ doc: The model of the optical fiber.
86
+ - neurodata_type_def: OpticalFiberLocationsTable
87
+ neurodata_type_inc: DynamicTable
88
+ default_name: optical_fiber_locations_table
89
+ doc: Information about the targeted stereotactic coordinates of the tip of the implanted
90
+ optical fiber and the angles of the optical fiber in the brain.
91
+ attributes:
92
+ - name: reference
93
+ dtype: text
94
+ doc: Zero point for `ap_in_mm`, `ml_in_mm`, and `dv_in_mm` coordinates, e.g.,
95
+ "Bregma at the cortical surface".
96
+ datasets:
97
+ - name: implanted_fiber_description
98
+ neurodata_type_inc: VectorData
99
+ dtype: text
100
+ doc: Description of the implanted optical fiber, e.g., 'Lambda fiber implanted
101
+ into right GPe'.
102
+ - name: location
103
+ neurodata_type_inc: VectorData
104
+ dtype: text
105
+ doc: Name of the targeted location of the tip of the optical fiber in the brain.
106
+ - name: hemisphere
107
+ neurodata_type_inc: VectorData
108
+ dtype: text
109
+ doc: The hemisphere ("left" or "right") of the targeted location of the tip of
110
+ the optical fiber. Should be consistent with `ml_in_mm` coordinate.
111
+ - name: ap_in_mm
112
+ neurodata_type_inc: VectorData
113
+ dtype: float
114
+ doc: Anteroposterior coordinate in mm of the targeted location of the tip of the
115
+ optical fiber (+ is anterior), with reference to `reference`.
116
+ - name: ml_in_mm
117
+ neurodata_type_inc: VectorData
118
+ dtype: float
119
+ doc: Mediolateral coordinate in mm of the targeted location of the tip of the
120
+ optical fiber (+ is right), with reference to `reference`.
121
+ - name: dv_in_mm
122
+ neurodata_type_inc: VectorData
123
+ dtype: float
124
+ doc: Dorsoventral coordinate in mm of the targeted location of the tip of the
125
+ optical fiber (+ is dorsal/above the brain), with reference to `reference`.
126
+ - name: pitch_in_deg
127
+ neurodata_type_inc: VectorData
128
+ dtype: float
129
+ doc: Pitch angle in degrees of the implanted optical fiber (rotation around left-right
130
+ axis, + is rotating the nose upward).
131
+ quantity: '?'
132
+ - name: yaw_in_deg
133
+ neurodata_type_inc: VectorData
134
+ dtype: float
135
+ doc: Yaw angle in degrees of the implanted optical fiber (rotation around dorsal-ventral
136
+ axis, + is rotating the nose rightward).
137
+ quantity: '?'
138
+ - name: roll_in_deg
139
+ neurodata_type_inc: VectorData
140
+ dtype: float
141
+ doc: Roll angle in degrees of the implanted optical fiber (rotation around anterior-posterior
142
+ axis, + is rotating the right side downward).
143
+ quantity: '?'
144
+ - name: stereotactic_rotation_in_deg
145
+ neurodata_type_inc: VectorData
146
+ dtype: float
147
+ doc: TODO
148
+ quantity: '?'
149
+ - name: stereotactic_tilt_in_deg
150
+ neurodata_type_inc: VectorData
151
+ dtype: float
152
+ doc: TODO
153
+ quantity: '?'
154
+ - name: excitation_source
155
+ neurodata_type_inc: VectorData
156
+ dtype:
157
+ target_type: ExcitationSource
158
+ reftype: object
159
+ doc: The excitation source device connected to the optical fiber.
160
+ quantity: '?'
161
+ - name: optical_fiber
162
+ neurodata_type_inc: VectorData
163
+ dtype:
164
+ target_type: OpticalFiber
165
+ reftype: object
166
+ doc: The optical fiber device.
167
+ - neurodata_type_def: OptogeneticVirus
168
+ neurodata_type_inc: NWBContainer
169
+ doc: Metadata about the optogenetic virus.
170
+ attributes:
171
+ - name: construct_name
172
+ dtype: text
173
+ doc: Name of the virus construct/vector, e.g., "AAV-EF1a-DIO-hChR2(H134R)-EYFP".
174
+ - name: description
175
+ dtype: text
176
+ doc: Description of the optogenetic virus.
177
+ required: false
178
+ - name: manufacturer
179
+ dtype: text
180
+ doc: Manufacturer of the optogenetic virus.
181
+ - name: titer_in_vg_per_ml
182
+ dtype: float
183
+ doc: Titer of the optogenetic virus, in vg/ml, e.g., 1x10^12 vg/ml.
184
+ - neurodata_type_def: OptogeneticVirusInjection
185
+ neurodata_type_inc: NWBContainer
186
+ doc: Information about the injection of a virus for optogenetic experiments. The
187
+ name should be the virus name, e.g., "AAV-EF1a-DIO-hChR2(H134R)-EYFP". Use two
188
+ OptogeneticVirusInjection objects for a bilateral injection, one per hemisphere.
189
+ attributes:
190
+ - name: description
191
+ dtype: text
192
+ doc: Description of the optogenetic virus injection.
193
+ required: false
194
+ - name: location
195
+ dtype: text
196
+ doc: Name of the targeted location of the optogenetic virus injection.
197
+ - name: hemisphere
198
+ dtype: text
199
+ doc: The hemisphere ("left" or "right") of the targeted location of the optogenetic
200
+ virus injection. Should be consistent with `ml_in_mm` coordinate.
201
+ - name: reference
202
+ dtype: text
203
+ doc: Reference point for `ap_in_mm`, `ml_in_mm`, and `dv_in_mm` coordinates, e.g.,
204
+ "Bregma at the cortical surface".
205
+ - name: ap_in_mm
206
+ dtype: float
207
+ doc: Anteroposterior coordinate in mm of the optogenetic virus injection site
208
+ (+ is anterior), with reference to `reference`.
209
+ - name: ml_in_mm
210
+ dtype: float
211
+ doc: Mediolateral coordinate in mm of the optogenetic virus injection site (+
212
+ is right), with reference to `reference`.
213
+ - name: dv_in_mm
214
+ dtype: float
215
+ doc: Dorsoventral coordinate in mm of the optogenetic virus injection site (+
216
+ is dorsal/above the brain), with reference to `reference`.
217
+ - name: pitch_in_deg
218
+ dtype: float
219
+ doc: Pitch angle in degrees of the optogenetic virus injection (rotation around
220
+ left-right axis, + is rotating the nose upward).
221
+ required: false
222
+ - name: yaw_in_deg
223
+ dtype: float
224
+ doc: Yaw angle in degrees of the optogenetic virus injection (rotation around
225
+ dorsal-ventral axis, + is rotating the nose rightward).
226
+ required: false
227
+ - name: roll_in_deg
228
+ dtype: float
229
+ doc: Roll angle in degrees of the optogenetic virus injection (rotation around
230
+ anterior-posterior axis, + is rotating the right side downward).
231
+ required: false
232
+ - name: stereotactic_rotation_in_deg
233
+ dtype: float
234
+ doc: TODO
235
+ required: false
236
+ - name: stereotactic_tilt_in_deg
237
+ dtype: float
238
+ doc: TODO
239
+ required: false
240
+ - name: volume_in_uL
241
+ dtype: float
242
+ doc: Volume of injection, in uL., e.g., 0.45 uL (450 nL)
243
+ - name: injection_date
244
+ dtype: isodatetime
245
+ doc: Date of injection.
246
+ required: false
247
+ links:
248
+ - name: virus
249
+ target_type: OptogeneticVirus
250
+ doc: Link to OptogeneticVirus object with metadata about the name, manufacturer,
251
+ and titer.
252
+ - neurodata_type_def: OptogeneticViruses
253
+ neurodata_type_inc: NWBContainer
254
+ name: optogenetic_viruses
255
+ doc: Group containing one or more OptogeneticVirus objects, to be used within an
256
+ OptogeneticExperimentMetadata object.
257
+ groups:
258
+ - neurodata_type_inc: OptogeneticVirus
259
+ doc: OptogeneticVirus object(s).
260
+ quantity: +
261
+ - neurodata_type_def: OptogeneticVirusInjections
262
+ neurodata_type_inc: NWBContainer
263
+ name: optogenetic_virus_injections
264
+ doc: Group containing one or more OptogeneticVirusInjection objects, to be used
265
+ within an OptogeneticExperimentMetadata object.
266
+ groups:
267
+ - neurodata_type_inc: OptogeneticVirusInjection
268
+ doc: OptogeneticVirusInjection object(s).
269
+ quantity: +
270
+ - neurodata_type_def: OptogeneticExperimentMetadata
271
+ neurodata_type_inc: LabMetaData
272
+ name: optogenetic_experiment_metadata
273
+ doc: General metadata about the optogenetic stimulation.
274
+ attributes:
275
+ - name: stimulation_software
276
+ dtype: text
277
+ doc: Name of the software used to deliver optogenetic stimulation.
278
+ groups:
279
+ - name: optical_fiber_locations_table
280
+ neurodata_type_inc: OpticalFiberLocationsTable
281
+ doc: Information about the targeted stereotactic coordinates of the tip of the
282
+ implanted optical fiber and the angles of the optical fiber in the brain.
283
+ - name: optogenetic_viruses
284
+ neurodata_type_inc: OptogeneticViruses
285
+ doc: Group containing of one or more OptogeneticVirus objects.
286
+ - name: optogenetic_virus_injections
287
+ neurodata_type_inc: OptogeneticVirusInjections
288
+ doc: Group containing one or more OptogeneticVirusInjection objects.
289
+ - neurodata_type_def: OptogeneticEpochsTable
290
+ neurodata_type_inc: TimeIntervals
291
+ doc: General metadata about the optogenetic stimulation that may change per epoch.
292
+ Some epochs have no stimulation and are used as control epochs. If the stimulation
293
+ is on, then the epoch is a stimulation.
294
+ datasets:
295
+ - name: stimulation_on
296
+ neurodata_type_inc: VectorData
297
+ dtype: bool
298
+ doc: Whether optogenetic stimulation was used at any time during this epoch. If
299
+ False, then all other metadata values should be 0.
300
+ - name: pulse_length_in_ms
301
+ neurodata_type_inc: VectorData
302
+ dtype: float
303
+ doc: Duration of one pulse, in ms. Use NaN if stimulation was off.
304
+ - name: period_in_ms
305
+ neurodata_type_inc: VectorData
306
+ dtype: float
307
+ doc: Duration between the starts of two pulses, in ms. Use NaN if stimulation
308
+ was off.Note that the interpulse interval = `period_ms` - `pulse_length_ms`
309
+ - name: number_pulses_per_pulse_train
310
+ neurodata_type_inc: VectorData
311
+ dtype: int
312
+ doc: Number of pulses in one pulse train. After this number of pulses, no more
313
+ stimulation occurs until the next train begins (see `intertrain_interval_ms`).
314
+ Use -1 if stimulation was off.
315
+ - name: number_trains
316
+ neurodata_type_inc: VectorData
317
+ dtype: int
318
+ doc: Number of trains per stimulus. After this number of trains, no more stimulation
319
+ occurs until stimulation is re-triggered. Use -1 if stimulation was off.
320
+ - name: intertrain_interval_in_ms
321
+ neurodata_type_inc: VectorData
322
+ dtype: float
323
+ doc: Duration between the starts of two consecutive pulse trains, in ms. Determines
324
+ the frequency of stimulation. Use NaN if stimulation was off.
325
+ - name: power_in_mW
326
+ neurodata_type_inc: VectorData
327
+ dtype: float
328
+ doc: Constant power of excitation source throughout the epoch, in mW, e.g., 77
329
+ mW.
@@ -0,0 +1,15 @@
1
+ namespaces:
2
+ - author:
3
+ - Ryan Ly
4
+ - Horea Christian
5
+ - Ben Dichter
6
+ contact:
7
+ - rly@lbl.gov
8
+ - uni@chymera.eu
9
+ - ben.dichter@catalystneuro.com
10
+ doc: NWB extension to improve support for optogenetics data and metadata
11
+ name: ndx-optogenetics
12
+ schema:
13
+ - namespace: core
14
+ - source: ndx-optogenetics.extensions.yaml
15
+ version: 0.2.0
@@ -0,0 +1,453 @@
1
+ Metadata-Version: 2.4
2
+ Name: ndx-optogenetics
3
+ Version: 0.2.0
4
+ Summary: NWB extension to enhance support for optogenetics data and metadata in NWB
5
+ Project-URL: Homepage, https://github.com/rly/ndx-optogenetics
6
+ Project-URL: Bug Tracker, https://github.com/rly/ndx-optogenetics/issues
7
+ Project-URL: Discussions, https://github.com/rly/ndx-optogenetics/discussions
8
+ Project-URL: Changelog, https://github.com/rly/ndx-optogenetics/blob/main/CHANGELOG.md
9
+ Author-email: Ryan Ly <rly@lbl.gov>, Horea Christian <rly@lbl.gov>, Ben Dichter <ben.dichter@catalystneuro.com>
10
+ License-Expression: BSD-3-Clause
11
+ License-File: LICENSE.txt
12
+ Keywords: NWB,NeurodataWithoutBorders,ndx-extension,nwb-extension
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Intended Audience :: Science/Research
16
+ Classifier: License :: OSI Approved :: BSD License
17
+ Classifier: Programming Language :: Python
18
+ Classifier: Programming Language :: Python :: 3.9
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Programming Language :: Python :: 3.13
23
+ Requires-Python: >=3.9
24
+ Requires-Dist: hdmf>=3.14.1
25
+ Requires-Dist: pynwb>=2.8.0
26
+ Provides-Extra: dev
27
+ Requires-Dist: black>=24.4.2; extra == 'dev'
28
+ Requires-Dist: codespell>=2.3.0; extra == 'dev'
29
+ Requires-Dist: coverage>=7.5.4; extra == 'dev'
30
+ Requires-Dist: hdmf-docutils>=0.4.7; extra == 'dev'
31
+ Requires-Dist: pre-commit>=3.5.0; extra == 'dev'
32
+ Requires-Dist: pytest-cov>=5.0.0; extra == 'dev'
33
+ Requires-Dist: pytest-subtests>=0.12.1; extra == 'dev'
34
+ Requires-Dist: pytest>=8.2.2; extra == 'dev'
35
+ Requires-Dist: python-dateutil>=2.8.2; extra == 'dev'
36
+ Requires-Dist: ruff>=0.4.10; extra == 'dev'
37
+ Provides-Extra: docs
38
+ Requires-Dist: hdmf-docutils>=0.4.7; extra == 'docs'
39
+ Provides-Extra: min-reqs
40
+ Requires-Dist: hdmf==3.14.1; extra == 'min-reqs'
41
+ Requires-Dist: pynwb==2.8.0; extra == 'min-reqs'
42
+ Provides-Extra: test
43
+ Requires-Dist: coverage>=7.5.4; extra == 'test'
44
+ Requires-Dist: pytest-cov>=5.0.0; extra == 'test'
45
+ Requires-Dist: pytest-subtests>=0.12.1; extra == 'test'
46
+ Requires-Dist: pytest>=8.2.2; extra == 'test'
47
+ Requires-Dist: python-dateutil>=2.8.2; extra == 'test'
48
+ Description-Content-Type: text/markdown
49
+
50
+ # ndx-optogenetics Extension for NWB
51
+
52
+ NWB extension to enhance support for optogenetics data and metadata in NWB. This extension provides neurodata types for documenting optogenetic experiments, including excitation sources, optical fibers, virus injections, and stimulation parameters.
53
+
54
+ ## Installation
55
+
56
+ ```bash
57
+ pip install ndx-optogenetics
58
+ ```
59
+
60
+ ## Neurodata Types
61
+
62
+ ### Device Types
63
+
64
+ #### ExcitationSourceModel
65
+ A model of an excitation source device (e.g., laser, LED) with attributes:
66
+ - `illumination_type`: Type of illumination (e.g., LED, Gas Laser, Solid-State Laser)
67
+ - `wavelength_range_in_nm`: Excitation wavelength range in nm [min, max]
68
+
69
+ #### ExcitationSource
70
+ A specific excitation source device instance with attributes:
71
+ - `wavelength_in_nm`: Peak excitation wavelength
72
+ - `power_in_W`: Excitation power in Watts
73
+ - `intensity_in_W_per_m2`: Light intensity in W/m²
74
+ - Links to its corresponding `ExcitationSourceModel`
75
+
76
+ #### OpticalFiberModel
77
+ A model of an optical fiber with attributes for the fiber and ferrule specifications:
78
+ - `fiber_name`: Name of the optical fiber
79
+ - `fiber_model`: Model/product ID
80
+ - `manufacturer`: Manufacturer name
81
+ - `numerical_aperture`: Numerical aperture value
82
+ - `core_diameter_in_um`: Core diameter in micrometers
83
+ - `active_length_in_mm`: Active length for tapered fibers
84
+ - Various ferrule specifications (name, model, diameter)
85
+
86
+ #### OpticalFiber
87
+ A specific optical fiber device instance that links to its corresponding `OpticalFiberModel`
88
+
89
+ ### Experimental Metadata Types
90
+
91
+ #### OptogeneticVirus
92
+ Metadata about an optogenetic virus with attributes:
93
+ - `construct_name`: Name of the virus construct/vector
94
+ - `manufacturer`: Virus manufacturer
95
+ - `titer_in_vg_per_ml`: Titer in viral genomes per mL
96
+
97
+ #### OptogeneticVirusInjection
98
+ Information about a virus injection with attributes:
99
+ - Location coordinates (AP, ML, DV) relative to a reference point
100
+ - Injection angles (pitch, yaw, roll)
101
+ - `volume_in_uL`: Injection volume
102
+ - `injection_date`: Date of injection
103
+ - Links to the corresponding `OptogeneticVirus`
104
+
105
+ #### OpticalFiberLocationsTable
106
+ A dynamic table for documenting implanted optical fiber locations with columns for:
107
+ - Stereotactic coordinates (AP, ML, DV)
108
+ - Implant angles (pitch, yaw, roll)
109
+ - Links to the corresponding `ExcitationSource` and `OpticalFiber` devices
110
+
111
+ Because this type extends the `DynamicTable` class, you can add new columns to it without having to define a new type. You can also annotate a row of it with anatomical localization information using the [ndx-anatomical-localization](https://github.com/bendichter/ndx-anatomical-localization) extension.
112
+
113
+ #### OptogeneticEpochsTable
114
+ A dynamic table for documenting stimulation parameters per epoch:
115
+ - `stimulation_on`: Whether stimulation was active
116
+ - `pulse_length_in_ms`: Duration of each pulse
117
+ - `period_in_ms`: Time between pulse starts
118
+ - `number_pulses_per_pulse_train`: Number of pulses per train
119
+ - `number_trains`: Number of trains per stimulus
120
+ - `intertrain_interval_in_ms`: Time between train starts
121
+ - `power_in_mW`: Stimulation power
122
+
123
+ Because this type extends the `DynamicTable` class, you can add new columns to it without having to define a new type.
124
+
125
+ #### OptogeneticExperimentMetadata
126
+ Container for all optogenetics-related metadata including:
127
+ - `OpticalFiberLocationsTable`
128
+ - Collection of `OptogeneticVirus` objects
129
+ - Collection of `OptogeneticVirusInjection` objects
130
+ - `stimulation_software`: Name of software used for stimulation
131
+
132
+ You can define extensions to this ndx-optogenetics extension to store additional metadata in a structured
133
+ way. For example, the upcoming update to the
134
+ [ndx-franklab-novela extension](https://github.com/LorenFrankLab/ndx-franklab-novela)
135
+ defines a `FrankLabOptogeneticEpochsTable` that extends the `OptogeneticEpochsTable` defined here to store Frank Lab-specific optogenetic stimulation parameters for each epoch.
136
+
137
+ ## Entity Relationship Diagram
138
+
139
+ ```mermaid
140
+ %%{init: {'theme': 'base', 'themeVariables': {'primaryColor': '#ffffff', "primaryBorderColor': '#144E73', 'lineColor': '#D96F32'}}}%%
141
+ classDiagram
142
+ direction LR
143
+
144
+ class OptogeneticEpochsTable {
145
+ <<TimeIntervals>>
146
+ --------------------------------------
147
+ attributes
148
+ --------------------------------------
149
+ name : str
150
+ description : str
151
+
152
+ --------------------------------------
153
+ columns
154
+ --------------------------------------
155
+ start_time : VectorData[float]
156
+ stop_time : VectorData[float]
157
+ stimulation_on : VectorData[bool]
158
+ pulse_length_in_ms : VectorData[float]
159
+ period_in_ms : VectorData[float]
160
+ number_pulses_per_pulse_train : VectorData[int]
161
+ number_trains : VectorData[int]
162
+ intertrain_interval_in_ms : VectorData[float]
163
+ power_in_mW : VectorData[float]
164
+ }
165
+
166
+ class OptogeneticExperimentMetadata {
167
+ <<LabMetaData>>
168
+ --------------------------------------
169
+ attributes
170
+ --------------------------------------
171
+ optical_fiber_locations_table : OpticalFiberLocationsTable
172
+ optogenetic_viruses : OptogeneticViruses
173
+ optogenetic_virus_injections : OptogeneticVirusInjections
174
+ stimulation_software : str
175
+ }
176
+
177
+ class OpticalFiberLocationsTable {
178
+ <<DynamicTable>>
179
+ --------------------------------------
180
+ attributes
181
+ --------------------------------------
182
+ description : str
183
+ reference : str
184
+
185
+ --------------------------------------
186
+ columns
187
+ --------------------------------------
188
+ implanted_fiber_description : VectorData[str]
189
+ location : VectorData[str]
190
+ hemisphere : VectorData[str]
191
+ ap_in_mm : VectorData[float]
192
+ ml_in_mm : VectorData[float]
193
+ dv_in_mm : VectorData[float]
194
+ roll_in_deg : VectorData[float]
195
+ pitch_in_deg : VectorData[float]
196
+ yaw_in_deg : VectorData[float]
197
+ stereotactic_rotation_in_deg : VectorData[float]
198
+ stereotactic_tilt_in_deg : VectorData[float]
199
+ excitation_source : VectorData[ExcitationSource]
200
+ optical_fiber : VectorData[OpticalFiber]
201
+ }
202
+
203
+ namespace Devices {
204
+ class ExcitationSourceModel {
205
+ <<Device>>
206
+ --------------------------------------
207
+ attributes
208
+ --------------------------------------
209
+ illumination_type : str
210
+ wavelength_range_in_nm : float[2]
211
+ }
212
+
213
+ class ExcitationSource {
214
+ <<Device>>
215
+ --------------------------------------
216
+ attributes
217
+ --------------------------------------
218
+ wavelength_in_nm : float
219
+ power_in_W : float
220
+ intensity_in_W_per_m2 : float
221
+ model : ExcitationSourceModel
222
+ }
223
+
224
+ class OpticalFiberModel {
225
+ <<Device>>
226
+ --------------------------------------
227
+ attributes
228
+ --------------------------------------
229
+ fiber_name : str
230
+ fiber_model : str
231
+ numerical_aperture : float
232
+ core_diameter_in_um : float
233
+ active_length_in_mm : float
234
+ ferrule_name : str
235
+ ferrule_model : str
236
+ ferrule_diameter_in_mm : float
237
+ }
238
+
239
+ class OpticalFiber {
240
+ <<Device>>
241
+ --------------------------------------
242
+ attributes
243
+ --------------------------------------
244
+ model : OpticalFiberModel
245
+ }
246
+ }
247
+
248
+ namespace Virus {
249
+ class OptogeneticVirus {
250
+ <<NWBContainer>>
251
+ --------------------------------------
252
+ attributes
253
+ --------------------------------------
254
+ construct_name : str
255
+ manufacturer : str
256
+ titer_in_vg_per_ml : float
257
+ }
258
+
259
+ class OptogeneticVirusInjection {
260
+ <<NWBContainer>>
261
+ --------------------------------------
262
+ attributes
263
+ --------------------------------------
264
+ location : str
265
+ hemisphere : str
266
+ ap_in_mm : float
267
+ ml_in_mm : float
268
+ dv_in_mm : float
269
+ roll_in_deg : float
270
+ pitch_in_deg : float
271
+ yaw_in_deg : float
272
+ stereotactic_rotation_in_deg : float
273
+ stereotactic_tilt_in_deg : float
274
+ reference : str
275
+ volume_in_uL : float
276
+ virus : OptogeneticVirus
277
+ }
278
+
279
+ class OptogeneticViruses {
280
+ <<NWBContainer>>
281
+ --------------------------------------
282
+ contains
283
+ --------------------------------------
284
+ optogenetic_virus : OptogeneticVirus[]
285
+ }
286
+
287
+ class OptogeneticVirusInjections {
288
+ <<NWBContainer>>
289
+ --------------------------------------
290
+ contains
291
+ --------------------------------------
292
+ optogenetic_virus_injections : OptogeneticVirusInjection[]
293
+ }
294
+ }
295
+
296
+ OptogeneticExperimentMetadata *--> OpticalFiberLocationsTable
297
+ OptogeneticExperimentMetadata *--> OptogeneticViruses
298
+ OptogeneticExperimentMetadata *--> OptogeneticVirusInjections
299
+ OpticalFiberLocationsTable ..> ExcitationSource
300
+ OpticalFiberLocationsTable ..> OpticalFiber
301
+ ExcitationSource *..> ExcitationSourceModel
302
+ OpticalFiber *..> OpticalFiberModel
303
+ OptogeneticVirusInjection *..> OptogeneticVirus
304
+ OptogeneticViruses *--> OptogeneticVirus
305
+ OptogeneticVirusInjections *--> OptogeneticVirusInjection
306
+ ```
307
+
308
+ ## Usage Example
309
+
310
+ ```python
311
+ from datetime import datetime, timezone
312
+ from pynwb import NWBFile, NWBHDF5IO
313
+ from ndx_optogenetics import (
314
+ ExcitationSourceModel,
315
+ ExcitationSource,
316
+ OpticalFiberModel,
317
+ OpticalFiber,
318
+ OpticalFiberLocationsTable,
319
+ OptogeneticVirus,
320
+ OptogeneticVirusInjection,
321
+ OptogeneticViruses,
322
+ OptogeneticVirusInjections,
323
+ OptogeneticExperimentMetadata,
324
+ OptogeneticEpochsTable,
325
+ )
326
+
327
+ # Initialize NWB file
328
+ nwbfile = NWBFile(
329
+ session_description="session_description",
330
+ identifier="identifier",
331
+ session_start_time=datetime.now(timezone.utc),
332
+ )
333
+
334
+ # Create and add excitation source devices
335
+ excitation_source_model = ExcitationSourceModel(
336
+ name="Omicron LuxX+ 488-100 Model",
337
+ description="Laser for optogenetic stimulation.",
338
+ manufacturer="Omicron",
339
+ illumination_type="laser",
340
+ wavelength_range_in_nm=[488.0, 488.0],
341
+ )
342
+ excitation_source = ExcitationSource(
343
+ name="Omicron LuxX+ 488-100",
344
+ model=excitation_source_model,
345
+ wavelength_in_nm=488.0,
346
+ power_in_W=0.077,
347
+ intensity_in_W_per_m2=1.0e10,
348
+ )
349
+ nwbfile.add_device(excitation_source_model)
350
+ nwbfile.add_device(excitation_source)
351
+
352
+ # Create and add optical fiber devices
353
+ optical_fiber_model = OpticalFiberModel(
354
+ name="Lambda Model",
355
+ description="Lambda fiber (tapered fiber) from Optogenix.",
356
+ fiber_name="Lambda",
357
+ fiber_model="lambda_b5",
358
+ manufacturer="Optogenix",
359
+ numerical_aperture=0.39,
360
+ core_diameter_in_um=200.0,
361
+ active_length_in_mm=2.0,
362
+ ferrule_name="cFCF - ∅2.5mm Ceramic Ferrule",
363
+ ferrule_diameter_in_mm=2.5,
364
+ )
365
+ optical_fiber = OpticalFiber(
366
+ name="Lambda",
367
+ model=optical_fiber_model,
368
+ )
369
+ nwbfile.add_device(optical_fiber_model)
370
+ nwbfile.add_device(optical_fiber)
371
+
372
+ # Create optical fiber locations table
373
+ optical_fiber_locations_table = OpticalFiberLocationsTable(
374
+ description="Information about implanted optical fiber locations",
375
+ reference="Bregma at the cortical surface",
376
+ )
377
+ optical_fiber_locations_table.add_row(
378
+ implanted_fiber_description="Lambda fiber implanted into right GPe.",
379
+ location="GPe",
380
+ hemisphere="right",
381
+ ap_in_mm=-1.5,
382
+ ml_in_mm=3.2,
383
+ dv_in_mm=-5.8,
384
+ roll_in_deg=0.0,
385
+ pitch_in_deg=0.0,
386
+ yaw_in_deg=0.0,
387
+ excitation_source=excitation_source,
388
+ optical_fiber=optical_fiber,
389
+ )
390
+
391
+ # Create virus and injection metadata
392
+ virus = OptogeneticVirus(
393
+ name="AAV-EF1a-DIO-hChR2(H134R)-EYFP",
394
+ construct_name="AAV-EF1a-DIO-hChR2(H134R)-EYFP",
395
+ description="Excitatory optogenetic construct for ChR2-EYFP expression",
396
+ manufacturer="UNC Vector Core",
397
+ titer_in_vg_per_ml=1.0e12,
398
+ )
399
+ optogenetic_viruses = OptogeneticViruses(optogenetic_virus=[virus])
400
+
401
+ virus_injection = OptogeneticVirusInjection(
402
+ name="AAV-EF1a-DIO-hChR2(H134R)-EYFP Injection",
403
+ description="AAV-EF1a-DIO-hChR2(H134R)-EYFP injection into GPe.",
404
+ hemisphere="right",
405
+ location="GPe",
406
+ ap_in_mm=-1.5,
407
+ ml_in_mm=3.2,
408
+ dv_in_mm=-6.0,
409
+ roll_in_deg=0.0,
410
+ pitch_in_deg=0.0,
411
+ yaw_in_deg=0.0,
412
+ reference="Bregma at the cortical surface",
413
+ virus=virus,
414
+ volume_in_uL=0.45,
415
+ )
416
+ optogenetic_virus_injections = OptogeneticVirusInjections(
417
+ optogenetic_virus_injections=[virus_injection]
418
+ )
419
+
420
+ # Create experiment metadata container
421
+ optogenetic_experiment_metadata = OptogeneticExperimentMetadata(
422
+ optical_fiber_locations_table=optical_fiber_locations_table,
423
+ optogenetic_viruses=optogenetic_viruses,
424
+ optogenetic_virus_injections=optogenetic_virus_injections,
425
+ stimulation_software="FSGUI 2.0",
426
+ )
427
+ nwbfile.add_lab_meta_data(optogenetic_experiment_metadata)
428
+
429
+ # Create stimulation epochs table
430
+ opto_epochs_table = OptogeneticEpochsTable(
431
+ name="optogenetic_epochs",
432
+ description="Metadata about optogenetic stimulation parameters per epoch",
433
+ )
434
+ opto_epochs_table.add_row(
435
+ start_time=0.0,
436
+ stop_time=100.0,
437
+ stimulation_on=True,
438
+ pulse_length_in_ms=40.0,
439
+ period_in_ms=250.0,
440
+ number_pulses_per_pulse_train=100,
441
+ number_trains=1,
442
+ intertrain_interval_in_ms=0.0,
443
+ power_in_mW=77.0,
444
+ )
445
+ nwbfile.add_time_intervals(opto_epochs_table)
446
+
447
+ # Write the file
448
+ with NWBHDF5IO('example.nwb', mode='w') as io:
449
+ io.write(nwbfile)
450
+ ```
451
+
452
+ ---
453
+ This extension was created using [ndx-template](https://github.com/nwb-extensions/ndx-template).
@@ -0,0 +1,7 @@
1
+ ndx_optogenetics/spec/ndx-optogenetics.extensions.yaml,sha256=qfDixwqMtT2FBhwgR6cExyxUbPoPVnV98WQT-f1bBks,12471
2
+ ndx_optogenetics/spec/ndx-optogenetics.namespace.yaml,sha256=vi1bME85P65sG9JYnvL0bh1T_RQaaB8Lt-Uo0rMPS8s,342
3
+ ndx_optogenetics/__init__.py,sha256=tt6-tpkLSWdfzhyshJ8fEa0ZOR3HtquF2BF4AAvaJgE,1945
4
+ ndx_optogenetics-0.2.0.dist-info/METADATA,sha256=_DGF0BjhcvnQ1yBiPledZYTdZVz4wlIJXVgjBJwBCfg,16109
5
+ ndx_optogenetics-0.2.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
6
+ ndx_optogenetics-0.2.0.dist-info/licenses/LICENSE.txt,sha256=36_TjzPOi-sCdEQAgSITjymt6O9NEs-ia7QoAnp_IaA,1545
7
+ ndx_optogenetics-0.2.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.27.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,29 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2025, Ryan Ly, Horea Christian, Ben Dichter
4
+ All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
8
+
9
+ 1. Redistributions of source code must retain the above copyright notice, this
10
+ list of conditions and the following disclaimer.
11
+
12
+ 2. Redistributions in binary form must reproduce the above copyright notice,
13
+ this list of conditions and the following disclaimer in the documentation
14
+ and/or other materials provided with the distribution.
15
+
16
+ 3. Neither the name of the copyright holder nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.