Skip to content

Commit 1cdf048

Browse files
committed
Force trigger channel index to be an integer
1 parent 18897d9 commit 1cdf048

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

phys2bids/physio_obj.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -590,6 +590,7 @@ def auto_trigger_selection(self):
590590
Automatically retrieved trigger index
591591
"""
592592
LGR.info('Running automatic trigger detection.')
593+
LGR.info('Matching channel names with known trigger names first.')
593594
joint_match = '§'.join(TRIGGER_NAMES)
594595
indexes = []
595596
for n, case in enumerate(self.ch_name):
@@ -607,7 +608,7 @@ def auto_trigger_selection(self):
607608
self.trigger_idx = indexes[0]
608609
else:
609610
# Time-domain automatic trigger detection
610-
611+
LGR.info('Find the trigger channel by measuring data distance from its value limits.')
611612
# Create numpy array with all channels (excluding time)
612613
channel_ts = np.array(self.timeseries[1:])
613614

@@ -621,7 +622,7 @@ def auto_trigger_selection(self):
621622
distance_mean = np.mean(distance, axis=1)
622623

623624
# Set the trigger as the channel with the smallest distance
624-
self.trigger_idx = np.nanargmin(distance_mean) + 1
625+
self.trigger_idx = int(np.nanargmin(distance_mean) + 1)
625626

626627
LGR.info(f'{self.ch_name[self.trigger_idx]} selected as trigger channel')
627628

0 commit comments

Comments
 (0)