Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

default header does not replace missing GlobalConfiguration in header #542

Open
jihyunbak opened this issue Nov 12, 2020 · 0 comments · May be fixed by #546
Open

default header does not replace missing GlobalConfiguration in header #542

jihyunbak opened this issue Nov 12, 2020 · 0 comments · May be fixed by #546

Comments

@jihyunbak
Copy link

Context

from the header of an example .rec file:

<GlobalConfiguration filePath="/some/path" filePrefix="test" timestampAtCreation="6616239" saveDisplayedChanOnly="1" realtimeMode="0" systemTimeAtCreation="1504273426515"/>

from the default header in rec_to_nwb/data/default_header.xml:

<GlobalConfiguration timestampAtCreation="61738845" headstageFirmwareVersion="0.0" trodesVersion="1.8.2" headstageAccelSensorOn="1" headstageGyroSensorOn="1" filePath="" controllerFirmwareVersion="3.3" realtimeMode="0" headstageAutoSettleOn="0" qtVersion="5.9.8" commitHead="heads/Release_1.8.2-0-g9a3e37c" headstageMagSensorOn="1" controllerSerial="00000 00000" saveDisplayedChanOnly="1" compileDate="May 16 2019" filePrefix="" headstageSerial="00603 00104" headstageSmartRefOn="0" systemTimeAtCreation="1563493663594" compileTime="10:32:19"/>

Expected behavior

Because the rec_header data is missing fields such as "headstageSerial", which required by the builder, the corresponding value in the default header should be used.

Current behavior

Missing fields are populated with None.

Error message

Traceback:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<timed eval> in <module>

~/proj/rec_to_nwb/rec_to_nwb/processing/builder/nwb_file_builder.py in build(self)
    296         self.data_acq_device_originator.make(nwb_content)
    297 
--> 298         self.header_device_originator.make(nwb_content)
    299 
    300         self.camera_device_originator.make(nwb_content)

~/proj/rec_to_nwb/rec_to_nwb/processing/builder/originators/header_device_originator.py in make(self, nwb_content)
     29         fl_header_device = self.fl_header_device_manager.get_fl_header_device()
     30         logger.info('HeaderDevice: Creating')
---> 31         header_device = self.device_factory.create_header_device(fl_header_device)
     32         logger.info('HeaderDevice: Injecting into NWB')
     33         self.device_injector.inject_all_devices(nwb_content, [header_device])

~/proj/rec_to_nwb/rec_to_nwb/processing/tools/beartype/beartype.py in func_beartyped(__beartype_func, *args, **kwargs)

~/proj/rec_to_nwb/rec_to_nwb/processing/nwb/components/device/device_factory.py in create_header_device(cls, fl_header_device)
     94             commit_head=fl_header_device.global_configuration['commit_head'],
     95             system_time_at_creation=fl_header_device.global_configuration['system_time_at_creation'],
---> 96             file_path=fl_header_device.global_configuration['file_path']
     97         )

~/opt/anaconda3/envs/nwb/lib/python3.6/site-packages/hdmf/utils.py in func_call(*args, **kwargs)
    557         if is_method:
    558             def func_call(*args, **kwargs):
--> 559                 pargs = _check_args(args, kwargs)
    560                 return func(args[0], **pargs)
    561         else:

~/opt/anaconda3/envs/nwb/lib/python3.6/site-packages/hdmf/utils.py in _check_args(args, kwargs)
    550                 if parse_err:
    551                     msg = '%s: %s' % (func.__qualname__, ', '.join(parse_err))
--> 552                     raise ExceptionType(msg)
    553 
    554             return parsed['args']

TypeError: HeaderDevice.__init__: None is not allowed for 'headstage_serial' (expected 'str', not None), None is not allowed for 'headstage_smart_ref_on' (expected 'str', not None), None is not allowed for 'headstage_auto_settle_on' (expected 'str', not None), None is not allowed for 'controller_firmware_version' (expected 'str', not None), None is not allowed for 'controller_serial' (expected 'str', not None), None is not allowed for 'headstage_firmware_version' (expected 'str', not None), None is not allowed for 'qt_version' (expected 'str', not None), None is not allowed for 'compile_date' (expected 'str', not None), None is not allowed for 'compile_time' (expected 'str', not None), None is not allowed for 'headstage_gyro_sensor_on' (expected 'str', not None), None is not allowed for 'headstage_mag_sensor_on' (expected 'str', not None), None is not allowed for 'trodes_version' (expected 'str', not None), None is not allowed for 'headstage_accel_sensor_on' (expected 'str', not None), None is not allowed for 'commit_head' (expected 'str', not None)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant