byte-physics / x-to-nwb

Convert various patch-clamp data formats to NWBv2
Other
3 stars 6 forks source link

ValueError: Unexpected mismatching telegraph instruments #4

Open AdityaAsopa opened 3 years ago

AdityaAsopa commented 3 years ago

Hi, I get this error when I execute the simple command: >x-to-nwb testRecording.abf

>>x-to-nwb testRec.abf
Converting testRec.abf
c:\users\adity\anaconda3\envs\lab\lib\site-packages\x_to_nwb\ABF2Converter.py:168: UserWarning: Could not find the JSON file testRec.json with settings.
  warnings.warn(f"Could not find the JSON file {settings} with settings.")
Traceback (most recent call last):
  File "c:\users\adity\anaconda3\envs\lab\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\users\adity\anaconda3\envs\lab\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\adity\anaconda3\envs\lab\Scripts\x-to-nwb.exe\__main__.py", line 7, in <module>
  File "c:\users\adity\anaconda3\envs\lab\lib\site-packages\x_to_nwb\conversion.py", line 217, in convert_cli
    convert(
  File "c:\users\adity\anaconda3\envs\lab\lib\site-packages\x_to_nwb\conversion.py", line 97, in convert
    ABF2Converter(
  File "c:\users\adity\anaconda3\envs\lab\lib\site-packages\x_to_nwb\ABF2Converter.py", line 95, in __init__
    self._check(abf)
  File "c:\users\adity\anaconda3\envs\lab\lib\site-packages\x_to_nwb\ABF2Converter.py", line 213, in _check
    raise ValueError("Unexpected mismatching telegraph instruments.")
ValueError: Unexpected mismatching telegraph instruments.

Any information what is the source of the error. I am trying it on my personal machine after recording the data, and not on the rig computer. Thanks

AdityaAsopa commented 3 years ago

I have also tried, as described in the documentation:

>>x-to-nwb --no-searchSettingsFile testRec.abf

result: same error

>x-to-nwb --no-searchSettingsFile testRec.abf      
Converting testRec.abf
Traceback (most recent call last):
  File "c:\users\adity\anaconda3\envs\lab\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\users\adity\anaconda3\envs\lab\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\adity\anaconda3\envs\lab\Scripts\x-to-nwb.exe\__main__.py", line 7, in <module>
  File "c:\users\adity\anaconda3\envs\lab\lib\site-packages\x_to_nwb\conversion.py", line 217, in convert_cli
    convert(
  File "c:\users\adity\anaconda3\envs\lab\lib\site-packages\x_to_nwb\conversion.py", line 97, in convert
    ABF2Converter(
  File "c:\users\adity\anaconda3\envs\lab\lib\site-packages\x_to_nwb\ABF2Converter.py", line 95, in __init__
    self._check(abf)
  File "c:\users\adity\anaconda3\envs\lab\lib\site-packages\x_to_nwb\ABF2Converter.py", line 213, in _check
    raise ValueError("Unexpected mismatching telegraph instruments.")
ValueError: Unexpected mismatching telegraph instruments.
t-b commented 3 years ago

@AdityaAsopa The error message is from https://github.com/byte-physics/x-to-nwb/blob/597e5bbab026f50d849b2e0fc0464e87b9e1e7a3/src/x_to_nwb/ABF2Converter.py#L212-L213

What does abf._adcSection.nTelegraphInstrument contain?

AdityaAsopa commented 3 years ago

@t-b It prints an array:

abf._adcSection.nTelegraphInstrument = [24,0,0]
len(np.unique(abf._adcSection.nTelegraphInstrument))  = 2

My setup has only one channel (AI#0 of the DAC Digidata) telegraphed between multiclamp and clampex. Rest 2 channels are non-telegraphed external signals.

AdityaAsopa commented 3 years ago

Out of the three inputs that the Digidata DAC is recording: AI0, AI1, AI2, only first channel is telegraphed. Rest two are manually set i.e. with no telegraphing.


>>> abf._adcSection.sTelegraphInstrument   
['MultiClamp 700', 'Unknown instrument (manual or user defined telegraph table).', 'Unknown instrument (manual or user defined telegraph table).']

That is incompatible with the def _check(self, abf): function as the following condition gets triggered:

elif len(np.unique(abf._adcSection.nTelegraphInstrument)) > 1:

What is the solution? For now, I have bypassed it in the source code and the conversion to NWB is working, although, it looks like the channel information is lost.