Skip to content

Commit ccd7a29

Browse files
committed
make emission and excitation wavelength floats, and change manifold shape
1 parent a0d1e57 commit ccd7a29

File tree

5 files changed

+29
-29
lines changed

5 files changed

+29
-29
lines changed

docs/gallery/domain/ophys.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@
4747

4848

4949
optical_channel = OpticalChannel('my_optchan', 'Ca2+ imaging example',
50-
'pi wavelength', '3.14')
50+
'pi wavelength', 500.)
5151
imaging_plane = nwbfile.create_imaging_plane('my_imgpln',
5252
'Ca2+ imaging example',
5353
optical_channel,
5454
'a very interesting part of the brain',
5555
'imaging_device_1',
56-
'6.28', '2.718', 'GFP', 'my favorite brain location',
56+
600., '2.718', 'GFP', 'my favorite brain location',
5757
(1, 2, 1, 2, 3), 4.0, 'manifold unit', 'A frame to refer to')
5858

5959

src/pynwb/data/nwb.ophys.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ groups:
227227
dtype: text
228228
name: device
229229
- doc: Excitation wavelength
230-
dtype: text
230+
dtype: float
231231
name: excitation_lambda
232232
- doc: Rate images are acquired, in Hz.
233233
dtype: text
@@ -283,7 +283,7 @@ groups:
283283
dtype: text
284284
name: description
285285
- doc: Emission lambda for channel
286-
dtype: text
286+
dtype: float
287287
name: emission_lambda
288288
doc: 'One of possibly many groups storing channel-specific data COMMENT: Name
289289
is arbitrary but should be meaningful'

src/pynwb/ophys.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class OpticalChannel(NWBContainer):
2323
@docval({'name': 'name', 'type': str, 'doc': 'the name of this electrode'},
2424
{'name': 'source', 'type': str, 'doc': 'the source of the data'},
2525
{'name': 'description', 'type': str, 'doc': 'Any notes or comments about the channel.'},
26-
{'name': 'emission_lambda', 'type': str, 'doc': 'Emission lambda for channel.'},
26+
{'name': 'emission_lambda', 'type': float, 'doc': 'Emission lambda for channel.'},
2727
{'name': 'parent', 'type': 'NWBContainer',
2828
'doc': 'The parent NWBContainer for this NWBContainer', 'default': None})
2929
def __init__(self, **kwargs):
@@ -57,11 +57,11 @@ class ImagingPlane(NWBContainer):
5757
'doc': 'One of possibly many groups storing channelspecific data.'},
5858
{'name': 'description', 'type': str, 'doc': 'Description of this ImagingPlane.'},
5959
{'name': 'device', 'type': str, 'doc': 'Name of device in /general/devices'},
60-
{'name': 'excitation_lambda', 'type': str, 'doc': 'Excitation wavelength.'},
60+
{'name': 'excitation_lambda', 'type': float, 'doc': 'Excitation wavelength.'},
6161
{'name': 'imaging_rate', 'type': str, 'doc': 'Rate images are acquired, in Hz.'},
6262
{'name': 'indicator', 'type': str, 'doc': 'Calcium indicator'},
6363
{'name': 'location', 'type': str, 'doc': 'Location of image plane.'},
64-
{'name': 'manifold', 'type': Iterable, 'doc': 'Physical position of each pixel. height, weight, x, y, z.',
64+
{'name': 'manifold', 'type': Iterable, 'doc': 'Physical position of each pixel. height, weight, xyz.',
6565
'default': None},
6666
{'name': 'conversion', 'type': float,
6767
'doc': 'Multiplier to get from stored values to specified unit (e.g., 1e-3 for millimeters)',

tests/integration/ui_write/test_ophys.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ class TestImagingPlaneIO(base.TestMapRoundTrip):
2323

2424
def setUpContainer(self):
2525
self.optical_channel = OpticalChannel('optchan1', 'unit test TestImagingPlaneIO',
26-
'a fake OpticalChannel', '3.14')
26+
'a fake OpticalChannel', 500.)
2727
return ImagingPlane('imgpln1', 'unit test TestImagingPlaneIO', self.optical_channel,
28-
'a fake ImagingPlane', 'imaging_device_1', '6.28', '2.718', 'GFP', 'somewhere in the brain')
28+
'a fake ImagingPlane', 'imaging_device_1', 600., '2.718', 'GFP', 'somewhere in the brain')
2929

3030
def setUpBuilder(self):
3131
optchan_builder = GroupBuilder(
@@ -37,7 +37,7 @@ def setUpBuilder(self):
3737
'source': 'unit test TestImagingPlaneIO'},
3838
datasets={
3939
'description': DatasetBuilder('description', 'a fake OpticalChannel'),
40-
'emission_lambda': DatasetBuilder('emission_lambda', '3.14')},
40+
'emission_lambda': DatasetBuilder('emission_lambda', 500.)},
4141
)
4242
return GroupBuilder(
4343
'imgpln1',
@@ -49,7 +49,7 @@ def setUpBuilder(self):
4949
datasets={
5050
'description': DatasetBuilder('description', 'a fake ImagingPlane'),
5151
'device': DatasetBuilder('device', 'imaging_device_1'),
52-
'excitation_lambda': DatasetBuilder('excitation_lambda', '6.28'),
52+
'excitation_lambda': DatasetBuilder('excitation_lambda', 600.),
5353
'imaging_rate': DatasetBuilder('imaging_rate', '2.718'),
5454
'indicator': DatasetBuilder('indicator', 'GFP'),
5555
'location': DatasetBuilder('location', 'somewhere in the brain')},
@@ -70,10 +70,10 @@ def getContainer(self, nwbfile):
7070
class TestTwoPhotonSeries(base.TestDataInterfaceIO):
7171

7272
def make_imaging_plane(self, source):
73-
self.optical_channel = OpticalChannel('optchan1', source, 'a fake OpticalChannel', '3.14')
73+
self.optical_channel = OpticalChannel('optchan1', source, 'a fake OpticalChannel', 500.)
7474
self.imaging_plane = ImagingPlane('imgpln1', source, self.optical_channel,
7575
'a fake ImagingPlane',
76-
'imaging_device_1', '6.28', '2.718', 'GFP', 'somewhere in the brain')
76+
'imaging_device_1', 600., '2.718', 'GFP', 'somewhere in the brain')
7777

7878
def setUpContainer(self):
7979
self.make_imaging_plane('unit test TestTwoPhotonSeries')
@@ -95,7 +95,7 @@ def setUpBuilder(self):
9595
'source': 'unit test TestTwoPhotonSeries'},
9696
datasets={
9797
'description': DatasetBuilder('description', 'a fake OpticalChannel'),
98-
'emission_lambda': DatasetBuilder('emission_lambda', '3.14')},
98+
'emission_lambda': DatasetBuilder('emission_lambda', 500.)},
9999
)
100100
imgpln_builder = GroupBuilder(
101101
'imgpln1',
@@ -107,7 +107,7 @@ def setUpBuilder(self):
107107
datasets={
108108
'description': DatasetBuilder('description', 'a fake ImagingPlane'),
109109
'device': DatasetBuilder('device', 'imaging_device_1'),
110-
'excitation_lambda': DatasetBuilder('excitation_lambda', '6.28'),
110+
'excitation_lambda': DatasetBuilder('excitation_lambda', 600.),
111111
'imaging_rate': DatasetBuilder('imaging_rate', '2.718'),
112112
'indicator': DatasetBuilder('indicator', 'GFP'),
113113
'location': DatasetBuilder('location', 'somewhere in the brain')},
@@ -167,13 +167,13 @@ def buildPlaneSegmentation(self):
167167
starting_frame=[1, 2, 3], format='tiff', timestamps=list())
168168

169169
self.optical_channel = OpticalChannel('test_optical_channel', 'optical channel source',
170-
'optical channel description', '3.14')
170+
'optical channel description', 500.)
171171
self.imaging_plane = ImagingPlane('test_imaging_plane',
172172
'ophys integration tests',
173173
self.optical_channel,
174174
'imaging plane description',
175175
'imaging_device_1',
176-
'6.28', '2.718', 'GFP', 'somewhere in the brain',
176+
600., '2.718', 'GFP', 'somewhere in the brain',
177177
(1, 2, 1, 2, 3), 4.0, 'manifold unit', 'A frame to refer to')
178178

179179
self.img_mask = deepcopy(img_mask)
@@ -195,7 +195,7 @@ def get_plane_segmentation_builder(self):
195195
'source': 'optical channel source'},
196196
datasets={
197197
'description': DatasetBuilder('description', 'optical channel description'),
198-
'emission_lambda': DatasetBuilder('emission_lambda', '3.14')},
198+
'emission_lambda': DatasetBuilder('emission_lambda', 500.)},
199199
)
200200
self.imgpln_builder = GroupBuilder(
201201
'imgpln1',
@@ -207,7 +207,7 @@ def get_plane_segmentation_builder(self):
207207
datasets={
208208
'description': DatasetBuilder('description', 'imaging plane description'),
209209
'device': DatasetBuilder('device', 'imaging_device_1'),
210-
'excitation_lambda': DatasetBuilder('excitation_lambda', '6.28'),
210+
'excitation_lambda': DatasetBuilder('excitation_lambda', 600.),
211211
'imaging_rate': DatasetBuilder('imaging_rate', '2.718'),
212212
'indicator': DatasetBuilder('indicator', 'GFP'),
213213
'manifold': DatasetBuilder('manifold', (1, 2, 1, 2, 3),

tests/unit/pynwb_tests/test_ophys.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ def CreatePlaneSegmentation():
1717
iSS = ImageSeries(name='test_iS', source='a hypothetical source', data=list(), unit='unit',
1818
external_file=['external_file'], starting_frame=[1, 2, 3], format='tiff', timestamps=list())
1919

20-
oc = OpticalChannel('test_optical_channel', 'test_source', 'description', 'emission_lambda')
21-
ip = ImagingPlane('test_imaging_plane', 'test_source', oc, 'description', 'device', 'excitation_lambda',
20+
oc = OpticalChannel('test_optical_channel', 'test_source', 'description', 500.)
21+
ip = ImagingPlane('test_imaging_plane', 'test_source', oc, 'description', 'device', 600.,
2222
'imaging_rate', 'indicator', 'location', (1, 2, 1, 2, 3), 4.0, 'unit', 'reference_frame')
2323

2424
pS = PlaneSegmentation('test source', 'description', ip, 'test_name', iSS)
@@ -29,19 +29,19 @@ def CreatePlaneSegmentation():
2929

3030
class TwoPhotonSeriesConstructor(unittest.TestCase):
3131
def test_init(self):
32-
oc = OpticalChannel('test_name', 'test_source', 'description', 'emission_lambda')
32+
oc = OpticalChannel('test_name', 'test_source', 'description', 500.)
3333
self.assertEqual(oc.description, 'description')
34-
self.assertEqual(oc.emission_lambda, 'emission_lambda')
34+
self.assertEqual(oc.emission_lambda, 500.)
3535

36-
ip = ImagingPlane('test_imaging_plane', 'test source', oc, 'description', 'device', 'excitation_lambda',
37-
'imaging_rate', 'indicator', 'location', (1, 2, 1, 2, 3), 4.0, 'unit', 'reference_frame')
36+
ip = ImagingPlane('test_imaging_plane', 'test source', oc, 'description', 'device', 600.,
37+
'imaging_rate', 'indicator', 'location', (50, 100, 3), 4.0, 'unit', 'reference_frame')
3838
self.assertEqual(ip.optical_channel[0], oc)
3939
self.assertEqual(ip.device, 'device')
40-
self.assertEqual(ip.excitation_lambda, 'excitation_lambda')
40+
self.assertEqual(ip.excitation_lambda, 600.)
4141
self.assertEqual(ip.imaging_rate, 'imaging_rate')
4242
self.assertEqual(ip.indicator, 'indicator')
4343
self.assertEqual(ip.location, 'location')
44-
self.assertEqual(ip.manifold, (1, 2, 1, 2, 3))
44+
self.assertEqual(ip.manifold, (50, 100, 3))
4545
self.assertEqual(ip.conversion, 4.0)
4646
self.assertEqual(ip.unit, 'unit')
4747
self.assertEqual(ip.reference_frame, 'reference_frame')
@@ -145,8 +145,8 @@ def test_init(self):
145145
iSS = ImageSeries(name='test_iS', source='a hypothetical source', data=list(), unit='unit',
146146
external_file=['external_file'], starting_frame=[1, 2, 3], format='tiff', timestamps=list())
147147

148-
oc = OpticalChannel('test_optical_channel', 'test_source', 'description', 'emission_lambda')
149-
ip = ImagingPlane('test_imaging_plane', 'test_source', oc, 'description', 'device', 'excitation_lambda',
148+
oc = OpticalChannel('test_optical_channel', 'test_source', 'description', 500.)
149+
ip = ImagingPlane('test_imaging_plane', 'test_source', oc, 'description', 'device', 600.,
150150
'imaging_rate', 'indicator', 'location', (1, 2, 1, 2, 3), 4.0, 'unit', 'reference_frame')
151151

152152
pS = PlaneSegmentation('test source', 'description', ip, 'test_name', iSS)

0 commit comments

Comments
 (0)