Skip to content

Commit

Permalink
ENH: allow more than one default trigger channgel label.
Browse files Browse the repository at this point in the history
Defaults: `'trigger'` and `'digital input'`
  • Loading branch information
pvelasco committed May 18, 2021
1 parent dd3de2c commit 4cd6ae4
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions bidsphysio.acq2bids/bidsphysio/acq2bids/acq2bidsphysio.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,16 @@
PhysioData)


def acq2bids(physio_acq_files, trigger_label='trigger'):
def acq2bids(physio_acq_files, trigger_labels=['trigger', 'digital input']):
"""Reads the physiological data from a series of AcqKnowledge
files and stores it in a PhysioData member
Parameters
----------
physio_acq_files : list of str
List of paths of the original physio files
trigger_label : str
Label of the channel that carries the scanner trigger.
trigger_labels : list of str
List with labels of the channel that carries the scanner trigger.
Just one word from the channel name is enough
Returns
Expand All @@ -80,6 +80,8 @@ def acq2bids(physio_acq_files, trigger_label='trigger'):
# In case we are handled just a single file, make it a one-element list:
if isinstance(physio_acq_files, str):
physio_acq_files = [physio_acq_files]
if not isinstance(trigger_labels, list):
trigger_labels = [trigger_labels]

# Init PhysioData object to hold physio signals:
physio = PhysioData()
Expand All @@ -103,7 +105,7 @@ def acq2bids(physio_acq_files, trigger_label='trigger'):
elif 'resp' in item.name.lower():
physio_label = 'respiratory'

elif trigger_label.lower() in item.name.lower():
elif any([tl.lower() in item.name.lower() for tl in trigger_labels]):
physio_label = 'trigger'
trigger_channel = item.name

Expand Down

0 comments on commit 4cd6ae4

Please sign in to comment.