Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change quantitative properties to add units to name #6

Merged
merged 53 commits into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from 50 commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
5e8072c
add new spec (not working for the stimulated_rois)
alessandratrapani Jan 11, 2024
7a762b4
tests not working
alessandratrapani Jan 11, 2024
b2a96f5
fix testing
alessandratrapani Jan 11, 2024
9073432
define what is required
alessandratrapani Jan 12, 2024
e698136
improve tutorial
alessandratrapani Jan 12, 2024
0e0e0ca
add explaination for stimulus table
alessandratrapani Jan 12, 2024
745352b
add testing for power,frequency and pulse_width as 1D arrays
alessandratrapani Jan 12, 2024
0f98a47
set defaults for power,frequency and pulse_width
alessandratrapani Jan 12, 2024
50da328
add schema diagram
alessandratrapani Jan 12, 2024
09ee15f
remove unnecessary imports
alessandratrapani Jan 12, 2024
811cacf
add targeted_rois (required) and segmented_rois (optional)
alessandratrapani Jan 15, 2024
b106332
remove unnecessary imports
alessandratrapani Jan 17, 2024
d9d6913
remove old schema
alessandratrapani Jan 17, 2024
a5bd57f
update schema
alessandratrapani Jan 17, 2024
1f61403
minor fixes
alessandratrapani Jan 17, 2024
15fbd13
add elements to __all__ to count as used
CodyCBakerPhD Jan 17, 2024
b90f2c4
add exception to ruff
CodyCBakerPhD Jan 17, 2024
eda4f36
remove space
CodyCBakerPhD Jan 17, 2024
4e07fcf
adjust to proper sentences
CodyCBakerPhD Jan 17, 2024
ddd876a
Update spec/ndx-patterned-ogen.extensions.yaml
alessandratrapani Jan 18, 2024
45ca7c2
Update spec/ndx-patterned-ogen.extensions.yaml
alessandratrapani Jan 18, 2024
3344214
Update spec/ndx-patterned-ogen.extensions.yaml
alessandratrapani Jan 18, 2024
7db44bc
Update spec/ndx-patterned-ogen.extensions.yaml
alessandratrapani Jan 18, 2024
4274bea
Update spec/ndx-patterned-ogen.extensions.yaml
alessandratrapani Jan 18, 2024
75ea106
Update spec/ndx-patterned-ogen.extensions.yaml
alessandratrapani Jan 18, 2024
26808e8
Update spec/ndx-patterned-ogen.extensions.yaml
alessandratrapani Jan 18, 2024
217170a
Update spec/ndx-patterned-ogen.extensions.yaml
alessandratrapani Jan 18, 2024
7686fde
Improve readability of doc strings
alessandratrapani Jan 18, 2024
4800b47
targeted_rois defined as table region
alessandratrapani Jan 18, 2024
af41ca4
add example for slm model and filter_description
alessandratrapani Jan 18, 2024
0279e3c
split SLM in 2 device SLM2D and SLM3D
alessandratrapani Jan 18, 2024
d1dd670
split OgenPattern in 2D and 3D
alessandratrapani Jan 18, 2024
e70a1fb
update tutorial and schema
alessandratrapani Jan 18, 2024
1820b44
minor fixes
alessandratrapani Jan 18, 2024
314b0f9
Merge branch 'main' into add_specs_improved
alessandratrapani Jan 18, 2024
8a8c8af
update schema
alessandratrapani Jan 18, 2024
899c183
set sweeep_size and sweep_mask as datasets
alessandratrapani Jan 24, 2024
f1c66aa
set SpiralScanning and TemporalFocusing properties as datasets
alessandratrapani Jan 24, 2024
71fa9f0
set effector as dataset
alessandratrapani Jan 24, 2024
2300fd7
set spatial_resolution as dataset
alessandratrapani Jan 24, 2024
f165ae8
set all LightSource properties as datasets except "model"
alessandratrapani Jan 24, 2024
b670de0
update tutorial
alessandratrapani Jan 24, 2024
39acd0d
set segmented_rois default
alessandratrapani Jan 25, 2024
05e8222
Merge branch 'add_specs_improved' into change_attributes_w_dataset
alessandratrapani Jan 25, 2024
39cb8b6
Merge branch 'main' into change_attributes_w_dataset
alessandratrapani Jan 25, 2024
dfcfabb
change required:false to quantity:'?' for dataset
alessandratrapani Jan 30, 2024
6ef39cd
remove unnecessary class definition
alessandratrapani Jan 30, 2024
51aac60
add unit, shape and dims
alessandratrapani Jan 30, 2024
370bf98
update tutorial and mock_fun accordingly
alessandratrapani Jan 30, 2024
e43d4c9
minor fixes
alessandratrapani Feb 1, 2024
72c7fd4
Apply suggestions from code review
CodyCBakerPhD Feb 1, 2024
d9058e4
Merge branch 'main' into change_attributes_w_dataset
alessandratrapani Feb 5, 2024
0726683
add unit measure in the name of the attribute
alessandratrapani Feb 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
183 changes: 137 additions & 46 deletions spec/ndx-patterned-ogen.extensions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,98 +6,140 @@ groups:
- name: description
dtype: text
doc: Description of the scanning or scanless method for shaping optogenetic light. Examples include diffraction limited points, 3D shot, disks, etc.
required: false
datasets:
- name: sweep_size
dtype: numeric
doc:
Size of the scanning sweep pattern in micrometers. If a scalar is provided, the sweep pattern is
Size of the scanning sweep pattern (default in micrometers). If a scalar is provided, the sweep pattern is
assumed to be a circle (for 2D patterns) with diameter 'sweep_size'.
If 'sweep_size' is a two dimensional array, the the sweep pattern is assumed to be a
rectangle, with dimensions [width, height].
required: false
quantity: "?"
dims:
- diameter
- width, height
shape:
- - 1
- - 2
attributes:
- name: unit
value: micrometers
doc: unit of measure of the scanning sweep pattern size, fixed to micrometers
CodyCBakerPhD marked this conversation as resolved.
Show resolved Hide resolved
dtype: text
- name: sweep_mask
dtype: numeric
doc:
Scanning sweep pattern designated using a mask of size [width, height] for 2D stimulation,
where for a given pixel a value of 1 indicates stimulation, and a
value of 0 indicates no stimulation.
required: false
quantity: "?"
dims:
- num_rows
- num_cols
shape:
-
-
- neurodata_type_def: OptogeneticStimulus3DPattern
neurodata_type_inc: LabMetaData
doc: Container to store the information about a generic 3D stimulus pattern (spatial information).
attributes:
- name: description
dtype: text
doc: Description of the scanning or scanless method for shaping optogenetic light. Examples include diffraction limited points, 3D shot, disks, etc.
required: false
datasets:
- name: sweep_size
dtype: numeric
doc:
Size of the scanning sweep pattern in micrometers. If a scalar is provided, the sweep pattern is
Size of the scanning sweep pattern (default in micrometers). If a scalar is provided, the sweep pattern is
assumed to be a cylinder (for 3D patterns), with diameter 'sweep_size'.
If 'sweep_size' is a three dimensional array, the the sweep pattern is assumed to be a
cuboid, with dimensions [width, height, depth].
required: false
quantity: "?"
dims:
- diameter
- width, height, depth
shape:
- - 1
- - 3
attributes:
- name: unit
value: micrometers
doc: unit of measure of the scanning sweep pattern size, fixed to micrometers
CodyCBakerPhD marked this conversation as resolved.
Show resolved Hide resolved
dtype: text
- name: sweep_mask
dtype: numeric
doc:
Scanning sweep pattern designated using a mask of size [width,height, depth] for 3D stimulation,
where for a given pixel a value of 1 indicates stimulation, and a
value of 0 indicates no stimulation.
required: false
quantity: "?"
dims:
- num_rows
- num_cols
- num_planes
shape:
-
-
-
- neurodata_type_def: SpiralScanning
neurodata_type_inc: LabMetaData
doc: Container to store the parameters defining a spiral scanning pattern.
attributes:
datasets:
- name: diameter
dtype: numeric
doc: Spiral diameter (in micrometers).
required: true
attributes:
- name: unit
value: micrometers
doc: unit of measure of the spiral diameter, fixed to micrometers
CodyCBakerPhD marked this conversation as resolved.
Show resolved Hide resolved
dtype: text
- name: number_of_revolutions
dtype: numeric
doc: Number of turns within a spiral.
required: true
- name: description
dtype: text
doc: Describe any additional details about the pattern.
required: false
- name: height
dtype: numeric
doc: Spiral height of each sweep (in micrometers).
quantity: "?"
attributes:
- name: unit
value: micrometers
doc: unit of measure of the spiral height, fixed to micrometers
CodyCBakerPhD marked this conversation as resolved.
Show resolved Hide resolved
dtype: text
attributes:
- name: description
dtype: text
doc: Describe any additional details about the pattern.
required: false
- neurodata_type_def: TemporalFocusing
neurodata_type_inc: LabMetaData
doc: Container to store the parameters defining a temporal focusing beam-shaping.
attributes:
datasets:
- name: lateral_point_spread_function
dtype: text
doc:
Estimated lateral spatial profile or point spread function, expressed as
mean [um] ± s.d [um].
required: true
- name: axial_point_spread_function
dtype: text
doc:
Estimated axial spatial profile or point spread function, expressed as mean
[um] ± s.d [um].
required: true
attributes:
- name: description
dtype: text
doc: Describe any additional details about the pattern.
required: false
- neurodata_type_def: PatternedOptogeneticStimulusSite
neurodata_type_inc: OptogeneticStimulusSite
doc: Patterned optogenetic stimulus site.
attributes:
datasets:
- name: effector
dtype: text
doc: Light-activated effector protein expressed by the targeted cell (e.g., ChR2).
required: true
links:
- name: light_source
target_type: LightSource
target_type: Device
doc: Light source used to apply photostimulation.
required: true
- name: spatial_light_modulator
target_type: Device
doc: Spatial light modulator used to generate photostimulation pattern.
Expand All @@ -110,10 +152,15 @@ groups:
dtype: text
doc: The model specification of the spatial light modulator (e.g. 'X15213 series', from Hamamatsu).
required: false
datasets:
- name: spatial_resolution
dtype: numeric
doc: Resolution of spatial light modulator (in pixels), formatted as [width, height].
required: false
quantity: "?"
dims:
- width, height
shape:
- 2
- neurodata_type_def: SpatialLightModulator3D
neurodata_type_inc: Device
doc: 3D spatial light modulator used in the experiment.
Expand All @@ -122,45 +169,80 @@ groups:
dtype: text
doc: The model specification of the spatial light modulator (e.g. 'NeuraLight 3D Ultra', from Bruker).
required: false
datasets:
- name: spatial_resolution
dtype: numeric
doc: Resolution of spatial light modulator (in pixels), formatted as [width, height, depth].
required: false
quantity: "?"
dims:
- width, height, depth
shape:
- 3
- neurodata_type_def: LightSource
neurodata_type_inc: Device
doc: Light source used in the experiment.
attributes:
datasets:
- name: stimulation_wavelength
dtype: numeric
doc: Excitation wavelength of stimulation light (nanometers).
required: true
- name: model
dtype: text
doc: Model of light source device.
required: false
attributes:
- name: unit
value: nanometers
doc: unit of measure of wavelength which is fixed to nanometers
CodyCBakerPhD marked this conversation as resolved.
Show resolved Hide resolved
dtype: text
- name: filter_description
dtype: text
doc: Filter used to obtain the excitation wavelength of stimulation light, e.g. 'Short pass at 1040 nm'.
required: false
quantity: "?"
- name: peak_power
dtype: numeric
doc: Incident power of stimulation device (in Watts).
required: false
quantity: "?"
attributes:
- name: unit
value: Watts
doc: unit of measure of power which is fixed to Watts
CodyCBakerPhD marked this conversation as resolved.
Show resolved Hide resolved
dtype: text
- name: peak_pulse_energy
dtype: numeric
doc: If device is pulsed light source, pulse energy (in Joules).
required: false
attributes:
- name: unit
value: Joules
doc: unit of measure of energy which is fixed to Joules
CodyCBakerPhD marked this conversation as resolved.
Show resolved Hide resolved
dtype: text
quantity: "?"
- name: intensity
dtype: numeric
doc: Intensity of the excitation in W/m^2, if known.
required: false
quantity: "?"
attributes:
- name: unit
value: W/m^2
doc: unit of measure of intensity which is fixed to Watts per square meters
CodyCBakerPhD marked this conversation as resolved.
Show resolved Hide resolved
dtype: text
- name: exposure_time
dtype: numeric
doc: Exposure time of the sample (in sec).
required: false
quantity: "?"
attributes:
- name: unit
value: seconds
doc: unit of measure of exposure time which is fixed to seconds
CodyCBakerPhD marked this conversation as resolved.
Show resolved Hide resolved
dtype: text
- name: pulse_rate
dtype: numeric
doc: If device is pulsed light source, pulse rate (in Hz) used for stimulation.
quantity: "?"
attributes:
- name: unit
value: Hz
doc: unit of measure of rate which is fixed to Hertz
CodyCBakerPhD marked this conversation as resolved.
Show resolved Hide resolved
dtype: text
attributes:
- name: model
dtype: text
doc: Model of light source device.
required: false
- neurodata_type_def: OptogeneticStimulusTarget
neurodata_type_inc: LabMetaData
Expand All @@ -169,46 +251,55 @@ groups:
- name: targeted_rois
neurodata_type_inc: DynamicTableRegion
doc: A table region referencing a PlaneSegmentation object storing targeted ROIs.
required: true
- name: segmented_rois
neurodata_type_inc: DynamicTableRegion
doc: A table region referencing a PlaneSegmentation object storing segmented ROIs that receive photostimulation.
required: false
quantity: "?"
- neurodata_type_def: PatternedOptogeneticStimulusTable
neurodata_type_inc: TimeIntervals
doc: Table to hold all patterned optogenetic stimulus onsets.
quantity: "?"
datasets:
- name: power
neurodata_type_inc: VectorData
doc: Power (in Watts) applied to each target during patterned photostimulation.
required: true
doc: Power applied to each target during patterned photostimulation, in W.
attributes:
- name: unit
value: Watts
doc: unit of measure of power which is fixed to Watts
CodyCBakerPhD marked this conversation as resolved.
Show resolved Hide resolved
dtype: text
- name: targets
neurodata_type_inc: VectorData
dtype:
target_type: OptogeneticStimulusTarget
reftype: object
doc: Targeted rois for the stimulus onset.
required: true
- name: stimulus_pattern
neurodata_type_inc: VectorData
dtype:
target_type: LabMetaData
reftype: object
doc: Link to the stimulus pattern.
required: true
- name: stimulus_site
neurodata_type_inc: VectorData
dtype:
target_type: PatternedOptogeneticStimulusSite
reftype: object
doc: Link to the stimulus site.
required: true
- name: frequency
neurodata_type_inc: VectorData
doc: Frequency of stimulation if the stimulus delivered is pulsed (in Hz).
required: false
doc: Frequency of stimulation if the stimulus delivered is pulsed, in Hz.
quantity: "?"
attributes:
- name: unit
value: Hertz
doc: unit of measure of frequency which is fixed to Hertz
CodyCBakerPhD marked this conversation as resolved.
Show resolved Hide resolved
dtype: text
- name: pulse_width
neurodata_type_inc: VectorData
doc: Pulse width of stimulation if the stimulus delivered is pulsed, in seconds/phase.
required: false
quantity: "?"
attributes:
- name: unit
value: seconds/phase
doc: unit of measure of power which is fixed to seconds/phase
CodyCBakerPhD marked this conversation as resolved.
Show resolved Hide resolved
dtype: text
20 changes: 11 additions & 9 deletions src/pynwb/ndx_patterned_ogen/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import os
from pynwb import load_namespaces
from pynwb import load_namespaces, get_class

try:
from importlib.resources import files
Expand All @@ -14,22 +14,24 @@
# If that path does not exist, we are likely running in editable mode. Use the local path instead
if not os.path.exists(__spec_path):
__spec_path = __location_of_this_file.parent.parent.parent / "spec" / "ndx-patterned-ogen.namespace.yaml"

load_namespaces(str(__spec_path))

SpatialLightModulator2D = get_class('SpatialLightModulator2D', 'ndx-patterned-ogen')
SpatialLightModulator3D = get_class('SpatialLightModulator3D', 'ndx-patterned-ogen')
LightSource = get_class('LightSource', 'ndx-patterned-ogen')
OptogeneticStimulus2DPattern = get_class('OptogeneticStimulus2DPattern', 'ndx-patterned-ogen')
OptogeneticStimulus3DPattern = get_class('OptogeneticStimulus3DPattern', 'ndx-patterned-ogen')
SpiralScanning = get_class('SpiralScanning', 'ndx-patterned-ogen')
TemporalFocusing = get_class('TemporalFocusing', 'ndx-patterned-ogen')

# Load the namespace
load_namespaces(str(__spec_path))

from .patterned_ogen import (
SpatialLightModulator3D,
SpatialLightModulator2D,
LightSource,
PatternedOptogeneticStimulusSite,
PatternedOptogeneticStimulusTable,
OptogeneticStimulus2DPattern,
OptogeneticStimulus3DPattern,
OptogeneticStimulusSite,
OptogeneticStimulusTarget,
SpiralScanning,
TemporalFocusing,
)

__all__ = [
Expand Down
Loading
Loading