diff --git a/eegnb/experiments/Experiment.py b/eegnb/experiments/Experiment.py index 539dc396..f02c56e7 100644 --- a/eegnb/experiments/Experiment.py +++ b/eegnb/experiments/Experiment.py @@ -188,8 +188,7 @@ def iti_with_jitter(): if rendering_trial < current_trial: # Some form of presenting the stimulus - sometimes order changed in lower files like ssvep # Stimulus presentation overwritten by specific experiment - ii, trial = next(iterate_events) - self.__draw(lambda: self.present_stimulus(ii, trial)) + self.__draw(lambda: self.present_stimulus(current_trial)) rendering_trial = current_trial else: self.__draw(lambda: self.window.flip()) diff --git a/eegnb/experiments/auditory_oddball/aob.py b/eegnb/experiments/auditory_oddball/aob.py index bc82675e..619eec1d 100644 --- a/eegnb/experiments/auditory_oddball/aob.py +++ b/eegnb/experiments/auditory_oddball/aob.py @@ -1,8 +1,12 @@ import numpy as np from pandas import DataFrame from psychopy import prefs + # PTB does not yet support macOS Apple Silicon, need to fall back to sounddevice. -prefs.hardware['audioLib'] = ['sounddevice'] +import sys +if sys.platform == 'darwin': + prefs.hardware['audioLib'] = ['sounddevice'] + from psychopy import visual, core, event, sound from time import time @@ -73,11 +77,11 @@ def load_stimulus(self): return - def present_stimulus(self, idx : int, trial): + def present_stimulus(self, idx: int): """ Presents the Stimulus """ # Select and play sound - ind = int(trial["sound_ind"]) + ind = int(self.trials["sound_ind"].iloc[idx]) self.auds[ind].stop() self.auds[ind].play() diff --git a/eegnb/experiments/visual_n170/n170.py b/eegnb/experiments/visual_n170/n170.py index 4cf42aad..6c41fbba 100644 --- a/eegnb/experiments/visual_n170/n170.py +++ b/eegnb/experiments/visual_n170/n170.py @@ -41,7 +41,7 @@ def load_stimulus(self): # Return the list of images as a stimulus object return [self.houses, self.faces] - def present_stimulus(self, idx : int, trial): + def present_stimulus(self, idx: int): # Get the label of the trial label = self.trials["parameter"].iloc[idx] diff --git a/eegnb/experiments/visual_p300/p300.py b/eegnb/experiments/visual_p300/p300.py index 08560d1a..d6a8a1df 100644 --- a/eegnb/experiments/visual_p300/p300.py +++ b/eegnb/experiments/visual_p300/p300.py @@ -35,7 +35,7 @@ def load_stimulus(self): return [self.nontargets, self.targets] - def present_stimulus(self, idx:int, trial): + def present_stimulus(self, idx: int): label = self.trials["parameter"].iloc[idx] image = choice(self.targets if label == 1 else self.nontargets) diff --git a/eegnb/experiments/visual_ssvep/ssvep.py b/eegnb/experiments/visual_ssvep/ssvep.py index 46119f55..94ae9121 100644 --- a/eegnb/experiments/visual_ssvep/ssvep.py +++ b/eegnb/experiments/visual_ssvep/ssvep.py @@ -91,8 +91,8 @@ def init_flicker_stim(frame_rate, cycle, soa): init_flicker_stim(frame_rate, 3, self.soa), ] - def present_stimulus(self, idx, trial): - + def present_stimulus(self, idx: int): + # Select stimulus frequency ind = self.trials["parameter"].iloc[idx]