Closed bendichter closed 4 years ago
The units DynamicTable contains a column named "name" https://github.com/ben-dichter-consulting/buffalo-lab-data-to-nwb/blob/6cd908c5846ed90195fbfed575a7acecc6053f0f/src/buffalonwb/add_units.py#L65 which is causing a read error in the dev version of pynwb:
DynamicTable
--------------------------------------------------------------------------- ValueError Traceback (most recent call last) ~/opt/anaconda3/lib/python3.7/site-packages/hdmf/build/map.py in construct(self, **kwargs) 1225 object_id=builder.attributes.get(self.__spec.id_key())) -> 1226 obj.__init__(**kwargs) 1227 except Exception as ex: ~/opt/anaconda3/lib/python3.7/site-packages/hdmf/utils.py in func_call(*args, **kwargs) 460 --> 461 return func(self, **parsed['args']) 462 else: ~/dev/pynwb/src/pynwb/misc.py in __init__(self, **kwargs) 154 kwargs['description'] = "data on spiking units" --> 155 call_docval_func(super(Units, self).__init__, kwargs) 156 if 'spike_times' not in self.colnames: ~/opt/anaconda3/lib/python3.7/site-packages/hdmf/utils.py in call_docval_func(func, kwargs) 349 fargs, fkwargs = fmt_docval_args(func, kwargs) --> 350 return func(*fargs, **fkwargs) 351 ~/opt/anaconda3/lib/python3.7/site-packages/hdmf/utils.py in func_call(*args, **kwargs) 460 --> 461 return func(self, **parsed['args']) 462 else: ~/opt/anaconda3/lib/python3.7/site-packages/hdmf/common/table.py in __init__(self, **kwargs) 256 if hasattr(self, col.name): --> 257 raise ValueError("Column name '%s' is not allowed because it is already an attribute" % col.name) 258 setattr(self, col.name, col) ValueError: Column name 'name' is not allowed because it is already an attribute The above exception was the direct cause of the following exception: Exception Traceback (most recent call last) <ipython-input-2-63b35bbd1cea> in <module> 1 io = NWBHDF5IO('/Volumes/black_backup/data/Buffalo/2017_4_27_test_processed.nwb','r') ----> 2 nwb = io.read() ~/opt/anaconda3/lib/python3.7/site-packages/hdmf/backends/hdf5/h5tools.py in read(self, **kwargs) 294 % (self.__path, self.__mode)) 295 try: --> 296 return call_docval_func(super(HDF5IO, self).read, kwargs) 297 except UnsupportedOperation as e: 298 if str(e) == 'Cannot build data. There are no values.': ~/opt/anaconda3/lib/python3.7/site-packages/hdmf/utils.py in call_docval_func(func, kwargs) 348 def call_docval_func(func, kwargs): 349 fargs, fkwargs = fmt_docval_args(func, kwargs) --> 350 return func(*fargs, **fkwargs) 351 352 ~/opt/anaconda3/lib/python3.7/site-packages/hdmf/utils.py in func_call(*args, **kwargs) 459 raise_from(ExceptionType(msg), None) 460 --> 461 return func(self, **parsed['args']) 462 else: 463 def func_call(*args, **kwargs): ~/opt/anaconda3/lib/python3.7/site-packages/hdmf/backends/io.py in read(self, **kwargs) 33 # TODO also check that the keys are appropriate. print a better error message 34 raise UnsupportedOperation('Cannot build data. There are no values.') ---> 35 container = self.__manager.construct(f_builder) 36 return container 37 ~/opt/anaconda3/lib/python3.7/site-packages/hdmf/utils.py in func_call(*args, **kwargs) 459 raise_from(ExceptionType(msg), None) 460 --> 461 return func(self, **parsed['args']) 462 else: 463 def func_call(*args, **kwargs): ~/opt/anaconda3/lib/python3.7/site-packages/hdmf/build/map.py in construct(self, **kwargs) 207 # we are at the top of the hierarchy, 208 # so it must be time to resolve parents --> 209 result = self.__type_map.construct(builder, self, None) 210 self.__resolve_parents(result) 211 self.prebuilt(result, builder) ~/opt/anaconda3/lib/python3.7/site-packages/hdmf/utils.py in func_call(*args, **kwargs) 459 raise_from(ExceptionType(msg), None) 460 --> 461 return func(self, **parsed['args']) 462 else: 463 def func_call(*args, **kwargs): ~/opt/anaconda3/lib/python3.7/site-packages/hdmf/build/map.py in construct(self, **kwargs) 1731 raise ValueError('No ObjectMapper found for builder of type %s' % dt) 1732 else: -> 1733 return attr_map.construct(builder, build_manager, parent) 1734 1735 @docval({"name": "container", "type": AbstractContainer, "doc": "the container to convert to a Builder"}, ~/opt/anaconda3/lib/python3.7/site-packages/hdmf/utils.py in func_call(*args, **kwargs) 459 raise_from(ExceptionType(msg), None) 460 --> 461 return func(self, **parsed['args']) 462 else: 463 def func_call(*args, **kwargs): ~/opt/anaconda3/lib/python3.7/site-packages/hdmf/build/map.py in construct(self, **kwargs) 1192 cls = manager.get_cls(builder) 1193 # gather all subspecs -> 1194 subspecs = self.__get_subspec_values(builder, self.spec, manager) 1195 # get the constructor argument that each specification corresponds to 1196 const_args = dict() ~/opt/anaconda3/lib/python3.7/site-packages/hdmf/build/map.py in __get_subspec_values(self, builder, spec, manager) 1125 ret[subspec] = self.__flatten(sub_builder, subspec, manager) 1126 # now process groups and datasets -> 1127 self.__get_sub_builders(groups, spec.groups, manager, ret) 1128 self.__get_sub_builders(datasets, spec.datasets, manager, ret) 1129 elif isinstance(spec, DatasetSpec): ~/opt/anaconda3/lib/python3.7/site-packages/hdmf/build/map.py in __get_sub_builders(self, sub_builders, subspecs, manager, ret) 1174 ret.update(self.__get_subspec_values(sub_builder, subspec, manager)) 1175 else: -> 1176 ret[subspec] = manager.construct(sub_builder) 1177 1178 def __flatten(self, sub_builder, subspec, manager): ~/opt/anaconda3/lib/python3.7/site-packages/hdmf/utils.py in func_call(*args, **kwargs) 459 raise_from(ExceptionType(msg), None) 460 --> 461 return func(self, **parsed['args']) 462 else: 463 def func_call(*args, **kwargs): ~/opt/anaconda3/lib/python3.7/site-packages/hdmf/build/map.py in construct(self, **kwargs) 203 if parent_builder is not None: 204 parent = self.__get_proxy_builder(parent_builder) --> 205 result = self.__type_map.construct(builder, self, parent) 206 else: 207 # we are at the top of the hierarchy, ~/opt/anaconda3/lib/python3.7/site-packages/hdmf/utils.py in func_call(*args, **kwargs) 459 raise_from(ExceptionType(msg), None) 460 --> 461 return func(self, **parsed['args']) 462 else: 463 def func_call(*args, **kwargs): ~/opt/anaconda3/lib/python3.7/site-packages/hdmf/build/map.py in construct(self, **kwargs) 1731 raise ValueError('No ObjectMapper found for builder of type %s' % dt) 1732 else: -> 1733 return attr_map.construct(builder, build_manager, parent) 1734 1735 @docval({"name": "container", "type": AbstractContainer, "doc": "the container to convert to a Builder"}, ~/opt/anaconda3/lib/python3.7/site-packages/hdmf/utils.py in func_call(*args, **kwargs) 459 raise_from(ExceptionType(msg), None) 460 --> 461 return func(self, **parsed['args']) 462 else: 463 def func_call(*args, **kwargs): ~/opt/anaconda3/lib/python3.7/site-packages/hdmf/build/map.py in construct(self, **kwargs) 1227 except Exception as ex: 1228 msg = 'Could not construct %s object' % (cls.__name__,) -> 1229 raise_from(Exception(msg), ex) 1230 return obj 1231 ~/opt/anaconda3/lib/python3.7/site-packages/six.py in raise_from(value, from_value) Exception: Could not construct Units object
This column should be renamed to "label"
closed with 558d16b
The units
DynamicTable
contains a column named "name" https://github.com/ben-dichter-consulting/buffalo-lab-data-to-nwb/blob/6cd908c5846ed90195fbfed575a7acecc6053f0f/src/buffalonwb/add_units.py#L65 which is causing a read error in the dev version of pynwb:This column should be renamed to "label"