catalystneuro / mease-lab-to-nwb

MIT License
3 stars 2 forks source link

updating CED script to nwb-conversion-tools v0.6.2 #19

Closed CodyCBakerPhD closed 3 years ago

CodyCBakerPhD commented 3 years ago

@bendichter This will solve Issue 15 once it's working.

@alejoe91 @luiztauffer When running this on CED_example_data/Short example/M113_C4.smrx, I get the error posted below

image

Any ideas what's going wrong?

Also, I'm not crazy about how the user has to manually extract and specify the rhd channels to initialize the extractor, is there a reason why is this not handled internally like in other extractors? I remember something about the channel names not being "native" and therefore not being trustable or something?

luiztauffer commented 3 years ago

I am actually getting another error:

---------------------------------------------------------------------------
UnboundLocalError                         Traceback (most recent call last)
<ipython-input-25-fc95255e3ec9> in <module>
      2 converter.run_conversion(
      3     nwbfile_path='out_ced.nwb',
----> 4     metadata=metadata,
      5 #     conversion_options=conversion_options
      6 )

c:\users\luiz\documents\github\nwb-conversion-tools\nwb_conversion_tools\nwbconverter.py in run_conversion(self, metadata, nwbfile_path, save_to_file, conversion_options)
    120         # If conversion_options is valid, procede to run conversions for DataInterfaces
    121         for interface_name, data_interface in self.data_interface_objects.items():
--> 122             data_interface.run_conversion(nwbfile, metadata, **conversion_options.get(interface_name, dict()))
    123 
    124         # Save result to file or return object

c:\users\luiz\documents\github\nwb-conversion-tools\nwb_conversion_tools\baserecordingextractorinterface.py in run_conversion(self, nwbfile, metadata, stub_test)
     92             If True, will truncate the data to run the conversion faster and take up less memory.
     93         """
---> 94         recording_extractor = self.subset_recording(stub_test=stub_test)
     95         se.NwbRecordingExtractor.write_recording(
     96             recording_extractor,

c:\users\luiz\documents\github\nwb-conversion-tools\nwb_conversion_tools\baserecordingextractorinterface.py in subset_recording(self, stub_test)
     79                 **kwargs
     80             )
---> 81         return recording_extractor
     82 
     83     def run_conversion(self, nwbfile: NWBFile, metadata: dict = None, stub_test: bool = False):

UnboundLocalError: local variable 'recording_extractor' referenced before assignment

should subset_recording() be called if there's not subset defined?

CodyCBakerPhD commented 3 years ago

@luiztauffer And you're running CED_example_data/Short example/M113_C4.smrx there? Still giving me the same error.

The conversion script works for the m365_pt1_590-1190secs-001.smrx file, however; minus metadata required to make the proper nwbfile.

alejoe91 commented 3 years ago

@CodyCBakerPhD the problem is that for that file there are no Rhd channels. I'll add an assertion on the CEDRecordingExtractor side

alejoe91 commented 3 years ago

@CodyCBakerPhD the way I understand it the smrx file can contain several sources of signals, one of those being the Rhd files. However, I think that the labels (or channel title) are actually up to the user to choose, so it's convenient to keep it that way IMO

CodyCBakerPhD commented 3 years ago

@bendichter OK then, I understand why it didn't work on that first file; it's actually be design since it doesn't have rhd files.

Works well on the file that does have them. Should close Issue #15 when merged.