Closed neuromusic closed 6 years ago
looking more closely at the ROI object... https://github.com/NeurodataWithoutBorders/pynwb/blob/936c4383415d335ef2f901f040c02e843ca8c2a8/src/pynwb/ophys.py#L165
reference_images
__nwbfields__
which seems important (cc @nicain)so the immediate fix here seems pretty clear, however...
__init__
, and __nwbfields__
)? Should all of this be inspected from nwb-schema to prevent these kinds of bugs?so #308 fixes this for creating the object, but I can't read it back out after writing to file.
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
<ipython-input-5-b4cc30c9675b> in <module>()
2
3 io = HDF5IO('{}.nwb'.format(lims_id),mode='r')
----> 4 nwb = io.read()
5 io.close()
/local1/Code/pynwb/src/pynwb/form/utils.pyc in func_call(*args, **kwargs)
304 msg = ', '.join(parse_err)
305 raise_from(TypeError(msg), None)
--> 306 return func(self, **parsed['args'])
307 else:
308 def func_call(*args, **kwargs):
/local1/Code/pynwb/src/pynwb/form/backends/io.pyc in read(self, **kwargs)
30 def read(self, **kwargs):
31 f_builder = self.read_builder()
---> 32 container = self.__manager.construct(f_builder)
33 return container
34
/local1/Code/pynwb/src/pynwb/form/utils.pyc in func_call(*args, **kwargs)
304 msg = ', '.join(parse_err)
305 raise_from(TypeError(msg), None)
--> 306 return func(self, **parsed['args'])
307 else:
308 def func_call(*args, **kwargs):
/local1/Code/pynwb/src/pynwb/form/build/map.pyc in construct(self, **kwargs)
66 result = self.__containers.get(builder_id)
67 if result is None:
---> 68 result = self.__type_map.construct(builder, self)
69 self.prebuilt(result, builder)
70 return result
/local1/Code/pynwb/src/pynwb/form/utils.pyc in func_call(*args, **kwargs)
304 msg = ', '.join(parse_err)
305 raise_from(TypeError(msg), None)
--> 306 return func(self, **parsed['args'])
307 else:
308 def func_call(*args, **kwargs):
/local1/Code/pynwb/src/pynwb/form/build/map.pyc in construct(self, **kwargs)
1012 % str(container.__class__.__name__)) # noqa: F821
1013 else:
-> 1014 return attr_map.construct(builder, build_manager)
1015
1016 @docval({"name": "container", "type": Container, "doc": "the container to convert to a Builder"},
/local1/Code/pynwb/src/pynwb/form/utils.pyc in func_call(*args, **kwargs)
304 msg = ', '.join(parse_err)
305 raise_from(TypeError(msg), None)
--> 306 return func(self, **parsed['args'])
307 else:
308 def func_call(*args, **kwargs):
/local1/Code/pynwb/src/pynwb/form/build/map.pyc in construct(self, **kwargs)
615 cls = manager.get_cls(builder)
616 # gather all subspecs
--> 617 subspecs = self.__get_subspec_values(builder, self.spec, manager)
618 # get the constructor argument each specification corresponds to
619 const_args = dict()
/local1/Code/pynwb/src/pynwb/form/build/map.pyc in __get_subspec_values(self, builder, spec, manager)
601 ret[subspec] = val
602 else:
--> 603 result = self.__get_subspec_values(sub_builder, subspec, manager)
604 ret.update(result)
605 else:
/local1/Code/pynwb/src/pynwb/form/build/map.pyc in __get_subspec_values(self, builder, spec, manager)
592 if self.__data_type_key in sub_builder.attributes or \
593 not (subspec.data_type_inc is None and subspec.data_type_def is None):
--> 594 val = manager.construct(sub_builder)
595 if subspec.is_many():
596 if subspec in ret:
/local1/Code/pynwb/src/pynwb/form/utils.pyc in func_call(*args, **kwargs)
304 msg = ', '.join(parse_err)
305 raise_from(TypeError(msg), None)
--> 306 return func(self, **parsed['args'])
307 else:
308 def func_call(*args, **kwargs):
/local1/Code/pynwb/src/pynwb/form/build/map.pyc in construct(self, **kwargs)
66 result = self.__containers.get(builder_id)
67 if result is None:
---> 68 result = self.__type_map.construct(builder, self)
69 self.prebuilt(result, builder)
70 return result
/local1/Code/pynwb/src/pynwb/form/utils.pyc in func_call(*args, **kwargs)
304 msg = ', '.join(parse_err)
305 raise_from(TypeError(msg), None)
--> 306 return func(self, **parsed['args'])
307 else:
308 def func_call(*args, **kwargs):
/local1/Code/pynwb/src/pynwb/form/build/map.pyc in construct(self, **kwargs)
1012 % str(container.__class__.__name__)) # noqa: F821
1013 else:
-> 1014 return attr_map.construct(builder, build_manager)
1015
1016 @docval({"name": "container", "type": Container, "doc": "the container to convert to a Builder"},
/local1/Code/pynwb/src/pynwb/form/utils.pyc in func_call(*args, **kwargs)
304 msg = ', '.join(parse_err)
305 raise_from(TypeError(msg), None)
--> 306 return func(self, **parsed['args'])
307 else:
308 def func_call(*args, **kwargs):
/local1/Code/pynwb/src/pynwb/form/build/map.pyc in construct(self, **kwargs)
615 cls = manager.get_cls(builder)
616 # gather all subspecs
--> 617 subspecs = self.__get_subspec_values(builder, self.spec, manager)
618 # get the constructor argument each specification corresponds to
619 const_args = dict()
/local1/Code/pynwb/src/pynwb/form/build/map.pyc in __get_subspec_values(self, builder, spec, manager)
592 if self.__data_type_key in sub_builder.attributes or \
593 not (subspec.data_type_inc is None and subspec.data_type_def is None):
--> 594 val = manager.construct(sub_builder)
595 if subspec.is_many():
596 if subspec in ret:
/local1/Code/pynwb/src/pynwb/form/utils.pyc in func_call(*args, **kwargs)
304 msg = ', '.join(parse_err)
305 raise_from(TypeError(msg), None)
--> 306 return func(self, **parsed['args'])
307 else:
308 def func_call(*args, **kwargs):
/local1/Code/pynwb/src/pynwb/form/build/map.pyc in construct(self, **kwargs)
66 result = self.__containers.get(builder_id)
67 if result is None:
---> 68 result = self.__type_map.construct(builder, self)
69 self.prebuilt(result, builder)
70 return result
/local1/Code/pynwb/src/pynwb/form/utils.pyc in func_call(*args, **kwargs)
304 msg = ', '.join(parse_err)
305 raise_from(TypeError(msg), None)
--> 306 return func(self, **parsed['args'])
307 else:
308 def func_call(*args, **kwargs):
/local1/Code/pynwb/src/pynwb/form/build/map.pyc in construct(self, **kwargs)
1012 % str(container.__class__.__name__)) # noqa: F821
1013 else:
-> 1014 return attr_map.construct(builder, build_manager)
1015
1016 @docval({"name": "container", "type": Container, "doc": "the container to convert to a Builder"},
/local1/Code/pynwb/src/pynwb/form/utils.pyc in func_call(*args, **kwargs)
304 msg = ', '.join(parse_err)
305 raise_from(TypeError(msg), None)
--> 306 return func(self, **parsed['args'])
307 else:
308 def func_call(*args, **kwargs):
/local1/Code/pynwb/src/pynwb/form/build/map.pyc in construct(self, **kwargs)
643 details = '%s: %s (%s)' % (ex, cls.__name__, builder.name)
644 msg = 'Could not construct %s object\n %s' % (cls.__name__, details)
--> 645 raise_from(Exception(msg), ex)
646 return obj
647
/local1/miniconda2/envs/ophys_nwb/lib/python2.7/site-packages/six.pyc in raise_from(value, from_value)
716 else:
717 def raise_from(value, from_value):
--> 718 raise value
719
720
Exception: Could not construct ROI object
missing argument 'reference_images': ROI (ROI_0067)
@neuromusic can you provide a gist of the code you used to write the file that causes this exception?
Steps to Reproduce
Environment
Please describe your environment according to the following bullet points.
Checklist