Skip to content

Commit 2a7dbfe

Browse files
committed
re for filenames
1 parent 39390f6 commit 2a7dbfe

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

neo/rawio/openephysrawio.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -492,11 +492,11 @@ def explore_folder(dirname):
492492
if (seg_index + 1) > info['nb_segment']:
493493
info['nb_segment'] += 1
494494
elif filename.endswith('.spikes'):
495-
s = filename.replace('.spikes', '').split('_')
496-
if len(s) == 2:
497-
seg_index = 0
495+
s = re.findall("(_\d+)$", filename.replace('.spikes', ''))
496+
if s:
497+
seg_index = int(s[0][1:]) - 1
498498
else:
499-
seg_index = int(s[2]) - 1
499+
seg_index = 0
500500
if seg_index not in info['spikes'].keys():
501501
info['spikes'][seg_index] = []
502502
info['spikes'][seg_index].append(filename)

0 commit comments

Comments
 (0)