From a7be095a3da2f6201c518a549522590f73066f1c Mon Sep 17 00:00:00 2001 From: Michael-Sun Date: Fri, 23 Sep 2022 11:28:51 -0400 Subject: [PATCH 1/2] Update reproin.py --- heudiconv/heuristics/reproin.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/heudiconv/heuristics/reproin.py b/heudiconv/heuristics/reproin.py index bbf657f0..b34bb8af 100644 --- a/heudiconv/heuristics/reproin.py +++ b/heudiconv/heuristics/reproin.py @@ -124,6 +124,9 @@ - We replace all ( with { and ) with } to be able e.g. to specify session {date} - "WIP " prefix unconditionally added by the scanner is stripped + + +-Michael-Sun Plans on adding a heuristic to deal with ses-X* instances """ import os From 4e54f26f7a8d034dcc6f24be6cf767e0fe8e4b9f Mon Sep 17 00:00:00 2001 From: Michael-Sun Date: Fri, 23 Sep 2022 11:56:55 -0400 Subject: [PATCH 2/2] Update reproin to deal with ses-(X|x)* --- heudiconv/heuristics/reproin.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/heudiconv/heuristics/reproin.py b/heudiconv/heuristics/reproin.py index b34bb8af..a295740a 100644 --- a/heudiconv/heuristics/reproin.py +++ b/heudiconv/heuristics/reproin.py @@ -783,6 +783,13 @@ def infotoids(seqinfos, outdir): "Should have got a single session marker. Got following: %s" % ', '.join(map(repr, ses_markers)) ) + if re.match("(X|x)*", ses_markers): + # replace X* or x* sessions with prior_sessions+1 + prior_sessions = sorted(glob(os.path.join(sessions_dir, 'ses-*'))) + if prior_sessions: + session = '%03d' % (len(prior_sessions) + 1) + else: + session='001' session = ses_markers[0] else: # TODO - I think we are doomed to go through the sequence and split