-
Notifications
You must be signed in to change notification settings - Fork 266
Closed
Labels
Description
When the filename contains 'tcat' as the trigger number, the parse_spikeglx_fname() function fails
The error below happens when the name of my file was 20230907_g0_tcat.imec0.ap. neo was actually called via SpikeInterface in this case.
File /opt/miniconda3/envs/ephys/lib/python3.10/site-packages/neo/rawio/spikeglxrawio.py:336, in parse_spikeglx_fname(fname)
333 run_name, device, stream_kind = r[0]
334 gate_num, trigger_num = None, None
--> 336 if gate_num is not None:
337 gate_num = int(gate_num)
338 if trigger_num is not None:
UnboundLocalError: local variable 'gate_num' referenced before assignment
I can see the regular expression in neo/rawio/spikeglxrawio.py that parses the filename expects only digits as the trigger number
r = re.findall(r'(\S*)_g(\d*)_t(\d*)\.(\S*).(ap|lf)', fname)
which explains why gate_num is not assigned later.
Might also make sense to pre-initalize gate_num and trigger_num to None, in case the parsing fails.
Environment:
- OS: Ubuntu Linux
- Python version - 3.10
- Neo version - 0.12.0