Closed lvsltz closed 4 years ago
If I remember our last discussion correctly, then @t-b requested that it should accept TimeSeries more broadly, rather than being restricted to PatchClampSeries. I believe that would also fix this issue.
Closing in favor of #25 which should also cover this issue
Not sure if this is actually working. If I simply add the stimulus_template
just before add_intracellular_recording
:
nwbfile.add_stimulus_template(myPatchClampSeries)
row_id = nwbfile.add_intracellular_recording(electrode = electrode,
stimulus = myPatchClampSeries,
response = myotherPatchClampSeries)
I get a KeyError
when I write.
I wonder if this line is complete without stimulus_template. Please let me know if I misunderstood how these checks work or how I should add the stimulus_template to nwbfile:
Error:
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
.../nwbwrite.py in saveNWB(self, nwbfile, nwb_filename)
212 io = pynwb.NWBHDF5IO(nwb_path, 'w')
213
--> 214 io.write(nwbfile)
~/miniconda3/envs/nwb/lib/python3.7/site-packages/hdmf/utils.py in func_call(*args, **kwargs)
451
452 if is_method:
--> 453 return func(args[0], **parsed['args'])
454 else:
455 return func(**parsed['args'])
~/miniconda3/envs/nwb/lib/python3.7/site-packages/hdmf/backends/hdf5/h5tools.py in write(self, **kwargs)
267
268 cache_spec = popargs('cache_spec', kwargs)
--> 269 call_docval_func(super().write, kwargs)
270 if cache_spec:
271 ref = self.__file.attrs.get(SPEC_LOC_ATTR)
~/miniconda3/envs/nwb/lib/python3.7/site-packages/hdmf/utils.py in call_docval_func(func, kwargs)
341 def call_docval_func(func, kwargs):
342 fargs, fkwargs = fmt_docval_args(func, kwargs)
--> 343 return func(*fargs, **fkwargs)
344
345
~/miniconda3/envs/nwb/lib/python3.7/site-packages/hdmf/utils.py in func_call(*args, **kwargs)
451
452 if is_method:
--> 453 return func(args[0], **parsed['args'])
454 else:
455 return func(**parsed['args'])
~/miniconda3/envs/nwb/lib/python3.7/site-packages/hdmf/backends/io.py in write(self, **kwargs)
42 container = popargs('container', kwargs)
43 f_builder = self.__manager.build(container, source=self.__source)
---> 44 self.write_builder(f_builder, **kwargs)
45
46 @abstractmethod
~/miniconda3/envs/nwb/lib/python3.7/site-packages/hdmf/utils.py in func_call(*args, **kwargs)
451
452 if is_method:
--> 453 return func(args[0], **parsed['args'])
454 else:
455 return func(**parsed['args'])
~/miniconda3/envs/nwb/lib/python3.7/site-packages/hdmf/backends/hdf5/h5tools.py in write_builder(self, **kwargs)
534 f_builder, link_data, exhaust_dci = getargs('builder', 'link_data', 'exhaust_dci', kwargs)
535 for name, gbldr in f_builder.groups.items():
--> 536 self.write_group(self.__file, gbldr, exhaust_dci=exhaust_dci)
537 for name, dbldr in f_builder.datasets.items():
538 self.write_dataset(self.__file, dbldr, link_data, exhaust_dci=exhaust_dci)
~/miniconda3/envs/nwb/lib/python3.7/site-packages/hdmf/utils.py in func_call(*args, **kwargs)
451
452 if is_method:
--> 453 return func(args[0], **parsed['args'])
454 else:
455 return func(**parsed['args'])
~/miniconda3/envs/nwb/lib/python3.7/site-packages/hdmf/backends/hdf5/h5tools.py in write_group(self, **kwargs)
694 for subgroup_name, sub_builder in subgroups.items():
695 # do not create an empty group without attributes or links
--> 696 self.write_group(group, sub_builder, exhaust_dci=exhaust_dci)
697 # write all datasets
698 datasets = builder.datasets
~/miniconda3/envs/nwb/lib/python3.7/site-packages/hdmf/utils.py in func_call(*args, **kwargs)
451
452 if is_method:
--> 453 return func(args[0], **parsed['args'])
454 else:
455 return func(**parsed['args'])
~/miniconda3/envs/nwb/lib/python3.7/site-packages/hdmf/backends/hdf5/h5tools.py in write_group(self, **kwargs)
694 for subgroup_name, sub_builder in subgroups.items():
695 # do not create an empty group without attributes or links
--> 696 self.write_group(group, sub_builder, exhaust_dci=exhaust_dci)
697 # write all datasets
698 datasets = builder.datasets
~/miniconda3/envs/nwb/lib/python3.7/site-packages/hdmf/utils.py in func_call(*args, **kwargs)
451
452 if is_method:
--> 453 return func(args[0], **parsed['args'])
454 else:
455 return func(**parsed['args'])
~/miniconda3/envs/nwb/lib/python3.7/site-packages/hdmf/backends/hdf5/h5tools.py in write_group(self, **kwargs)
686 parent, builder, exhaust_dci = getargs('parent', 'builder', 'exhaust_dci', kwargs)
687 if builder.written:
--> 688 group = parent[builder.name]
689 else:
690 group = parent.create_group(builder.name)
h5py/_objects.pyx in h5py._objects.with_phil.wrapper()
h5py/_objects.pyx in h5py._objects.with_phil.wrapper()
~/miniconda3/envs/nwb/lib/python3.7/site-packages/h5py/_hl/group.py in __getitem__(self, name)
262 raise ValueError("Invalid HDF5 object reference")
263 else:
--> 264 oid = h5o.open(self.id, self._e(name), lapl=self._lapl)
265
266 otype = h5i.get_type(oid)
h5py/_objects.pyx in h5py._objects.with_phil.wrapper()
h5py/_objects.pyx in h5py._objects.with_phil.wrapper()
h5py/h5o.pyx in h5py.h5o.open()
KeyError: "Unable to open object (object 'ccss_Test_eCode_0001' doesn't exist)"
Thanks, I'll work on this early next week. Not sure yet why this would be broken. Since it happens on write, maybe somehow the object gets assigned a bad parent or something in my code (or it's a but outside of the extension). I'll check.
@lvsltz #43 should fix this.
add_intracellular_recording
should accept for thestimulus
argument both a stimulus presentation and a stimulus template.I think somebody else mentioned this, so I haven't tested it.