Skip to content

Commit c124687

Browse files
rlybendichter
andauthored
Merge pull request #1213 from NeurodataWithoutBorders/schema_2.2.3
Co-authored-by: Ryan Ly <[email protected]> Co-authored-by: Ben Dichter <[email protected]>
2 parents 16e73d9 + 887acce commit c124687

File tree

6 files changed

+48
-24
lines changed

6 files changed

+48
-24
lines changed

CHANGELOG.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,25 @@
11
# PyNWB Changelog
22

3-
## PyNWB 1.3.1 (Upcoming)
3+
## PyNWB 1.3.1 (May 28, 2020)
44

55
### Bug fixes:
66
- Fix bugged `Device` constructor. @rly (#1209)
7+
- Fix link to code of conduct page in docs. @rly (#1229)
8+
- Fix docs for get_type_map. @oruebel (#1233)
9+
- Pass file object to parent when loading namespaces (#1242)
710

811
### Internal improvements:
912
- Update CI to use supported MacOS version. @rly (#1211)
13+
- Clean up tests to remove conversion warnings and use keyword args. @rly (#1202)
14+
- Fix flake8 errors. @rly (#1235)
15+
- Add changelog. @rly (#1215)
16+
- Update release process with notes about coordinating with nwb-schema. @rly (#1214)
17+
- Inform which unit value is actually overwritten. @yarikoptic (#1219)
18+
- Do not print out logging.DEBUG statements to stdout for test.py. @rly (#1240)
19+
- Add support for nwb-schema 2.2.4. @rly (#1213)
20+
- Make `ImagingPlane.imaging_rate` optional. This moves the `imaging_rate` argument down the list of constructor
21+
arguments for `ImagingPlane.__init__`. This will break existing code that calls the constructor of
22+
`ImagingPlane` with at least 6 positional arguments, such that one positional argument matches `imaging_rate`.
1023

1124
## PyNWB 1.3.0 (Mar. 4, 2020)
1225

docs/gallery/domain/ophys.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
from datetime import datetime
2121
from dateutil.tz import tzlocal
2222

23-
import numpy as np
24-
2523
from pynwb import NWBFile
2624
from pynwb.ophys import TwoPhotonSeries, OpticalChannel, ImageSegmentation, Fluorescence
2725
from pynwb.device import Device
@@ -53,9 +51,12 @@
5351
device = Device('imaging_device_1')
5452
nwbfile.add_device(device)
5553
optical_channel = OpticalChannel('my_optchan', 'description', 500.)
56-
imaging_plane = nwbfile.create_imaging_plane('my_imgpln', optical_channel, 'a very interesting part of the brain',
57-
device, 600., 300., 'GFP', 'my favorite brain location',
58-
np.ones((5, 5, 3)), 4.0, 'manifold unit', 'A frame to refer to')
54+
imaging_plane = nwbfile.create_imaging_plane('my_imgpln', optical_channel,
55+
description='a very interesting part of the brain',
56+
device=device, excitation_lambda=600., imaging_rate=300., indicator='GFP',
57+
location='my favorite brain location',
58+
reference_frame='A frame to refer to',
59+
grid_spacing=(.01, .01))
5960

6061

6162
####################

src/pynwb/ophys.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,11 @@ class ImagingPlane(NWBContainer):
5151
{'name': 'description', 'type': str, 'doc': 'Description of this ImagingPlane.'}, # required
5252
{'name': 'device', 'type': Device, 'doc': 'the device that was used to record'}, # required
5353
{'name': 'excitation_lambda', 'type': 'float', 'doc': 'Excitation wavelength in nm.'}, # required
54-
{'name': 'imaging_rate', 'type': 'float', 'doc': 'Rate images are acquired, in Hz.'}, # required
5554
{'name': 'indicator', 'type': str, 'doc': 'Calcium indicator'}, # required
5655
{'name': 'location', 'type': str, 'doc': 'Location of image plane.'}, # required
56+
{'name': 'imaging_rate', 'type': 'float',
57+
'doc': 'Rate images are acquired, in Hz. If the corresponding TimeSeries is present, the rate should be '
58+
'stored there instead.', 'default': None},
5759
{'name': 'manifold', 'type': 'array_data',
5860
'doc': ('DEPRECATED: Physical position of each pixel. size=("height", "width", "xyz"). '
5961
'Deprecated in favor of origin_coords and grid_spacing.'),

tests/integration/hdf5/test_ophys.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,11 @@ def buildPlaneSegmentationNoRois(self):
174174
external_file=['images.tiff'],
175175
starting_frame=[1, 2, 3], format='tiff', timestamps=ts)
176176
self.device = Device(name='dev1')
177-
self.optical_channel = OpticalChannel(name='test_optical_channel', description='optical channel description',
178-
emission_lambda=500.)
177+
self.optical_channel = OpticalChannel(
178+
name='test_optical_channel',
179+
description='optical channel description',
180+
emission_lambda=500.
181+
)
179182
self.imaging_plane = ImagingPlane(
180183
name='test_imaging_plane',
181184
optical_channel=self.optical_channel,

tests/unit/test_ophys.py

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ def CreatePlaneSegmentation():
2020

2121
oc = OpticalChannel('test_optical_channel', 'description', 500.)
2222
device = Device(name='device_name')
23-
ip = ImagingPlane('test_imaging_plane', oc, 'description', device, 600.,
24-
300., 'indicator', 'location', reference_frame='reference_frame')
23+
ip = ImagingPlane(name='test_imaging_plane', optical_channel=oc, description='description', device=device,
24+
excitation_lambda=600., imaging_rate=300., indicator='indicator', location='location',
25+
reference_frame='reference_frame')
2526

2627
pS = PlaneSegmentation('description', ip, 'test_name', iSS)
2728
pS.add_roi(pixel_mask=pix_mask[0:3], image_mask=img_mask[0])
@@ -36,8 +37,9 @@ def test_init(self):
3637
self.assertEqual(oc.emission_lambda, 500.)
3738

3839
device = Device(name='device_name')
39-
ip = ImagingPlane('test_imaging_plane', oc, 'description', device, 600.,
40-
300., 'indicator', 'location', reference_frame='reference_frame',
40+
ip = ImagingPlane('test_imaging_plane', oc, description='description', device=device, excitation_lambda=600.,
41+
imaging_rate=300., indicator='indicator', location='location',
42+
reference_frame='reference_frame',
4143
origin_coords=[10, 20], origin_coords_unit='oc_unit',
4244
grid_spacing=[1, 2, 3], grid_spacing_unit='gs_unit')
4345
self.assertEqual(ip.optical_channel[0], oc)
@@ -69,8 +71,9 @@ def test_init(self):
6971
def test_args(self):
7072
oc = OpticalChannel('test_name', 'description', 500.)
7173
device = Device(name='device_name')
72-
ip = ImagingPlane('test_imaging_plane', oc, 'description', device, 600.,
73-
300., 'indicator', 'location', reference_frame='reference_frame')
74+
ip = ImagingPlane('test_imaging_plane', oc, description='description', device=device, excitation_lambda=600.,
75+
imaging_rate=300., indicator='indicator', location='location',
76+
reference_frame='reference_frame')
7477
with self.assertRaises(ValueError): # no data or external file
7578
TwoPhotonSeries('test_tPS', unit='unit', field_of_view=[2., 3.],
7679
imaging_plane=ip, pmt_gain=1.0, scan_line_rate=2.0,
@@ -85,8 +88,9 @@ def test_manifold_deprecated(self):
8588

8689
msg = "The 'manifold' argument is deprecated in favor of 'origin_coords' and 'grid_spacing'."
8790
with self.assertWarnsWith(DeprecationWarning, msg):
88-
ImagingPlane('test_imaging_plane', oc, 'description', device, 600., 300., 'indicator', 'location',
89-
(1, 1, (2, 2, 2)))
91+
ImagingPlane('test_imaging_plane', oc, description='description', device=device, excitation_lambda=600.,
92+
imaging_rate=300., indicator='indicator', location='location',
93+
manifold=(1, 1, (2, 2, 2)))
9094

9195
def test_conversion_deprecated(self):
9296
oc = OpticalChannel('test_name', 'description', 500.)
@@ -97,8 +101,8 @@ def test_conversion_deprecated(self):
97101

98102
msg = "The 'conversion' argument is deprecated in favor of 'origin_coords' and 'grid_spacing'."
99103
with self.assertWarnsWith(DeprecationWarning, msg):
100-
ImagingPlane('test_imaging_plane', oc, 'description', device, 600., 300., 'indicator', 'location',
101-
None, 2.0)
104+
ImagingPlane('test_imaging_plane', oc, description='description', device=device, excitation_lambda=600.,
105+
imaging_rate=300., indicator='indicator', location='location', conversion=2.0)
102106

103107
def test_unit_deprecated(self):
104108
oc = OpticalChannel('test_name', 'description', 500.)
@@ -109,8 +113,8 @@ def test_unit_deprecated(self):
109113

110114
msg = "The 'unit' argument is deprecated in favor of 'origin_coords_unit' and 'grid_spacing_unit'."
111115
with self.assertWarnsWith(DeprecationWarning, msg):
112-
ImagingPlane('test_imaging_plane', oc, 'description', device, 600., 300., 'indicator', 'location',
113-
None, 1.0, 'my_unit')
116+
ImagingPlane('test_imaging_plane', oc, description='description', device=device, excitation_lambda=600.,
117+
imaging_rate=300., indicator='indicator', location='location', conversion=1.0, unit='my_unit')
114118

115119

116120
class MotionCorrectionConstructor(TestCase):
@@ -190,8 +194,9 @@ def getBoilerPlateObjects(self):
190194

191195
device = Device(name='device_name')
192196
oc = OpticalChannel('test_optical_channel', 'description', 500.)
193-
ip = ImagingPlane('test_imaging_plane', oc, 'description', device, 600.,
194-
300., 'indicator', 'location', reference_frame='reference_frame')
197+
ip = ImagingPlane('test_imaging_plane', oc, description='description', device=device, excitation_lambda=600.,
198+
imaging_rate=300., indicator='indicator', location='location',
199+
reference_frame='reference_frame')
195200
return iSS, ip
196201

197202
def create_basic_plane_segmentation(self):

0 commit comments

Comments
 (0)