Skip to content

Commit 73bdf27

Browse files
Merge pull request #276 from pellet/dev/fix_present_stimulus
bugfix: pass down trial parameter to subclass.
2 parents f99d796 + 86b9daa commit 73bdf27

File tree

7 files changed

+15
-12
lines changed

7 files changed

+15
-12
lines changed

eegnb/experiments/Experiment.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ def iti_with_jitter():
262262
if rendering_trial < current_trial:
263263
# Some form of presenting the stimulus - sometimes order changed in lower files like ssvep
264264
# Stimulus presentation overwritten by specific experiment
265-
self.__draw(lambda: self.present_stimulus(current_trial, current_trial))
265+
self.__draw(lambda: self.present_stimulus(current_trial))
266266
rendering_trial = current_trial
267267
else:
268268
self.__draw(lambda: self.window.flip())

eegnb/experiments/__init__.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
from .visual_n170.n170 import VisualN170
22
from .visual_p300.p300 import VisualP300
33
from .visual_ssvep.ssvep import VisualSSVEP
4-
from .auditory_oddball.aob import AuditoryOddball
4+
5+
# PTB does not yet support macOS Apple Silicon,
6+
# this experiment needs to run as i386 if on macOS.
7+
import sys
8+
import platform
9+
if sys.platform != 'darwin' or platform.processor() != 'arm':
10+
from .auditory_oddball.aob import AuditoryOddball

eegnb/experiments/auditory_oddball/aob.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import numpy as np
22
from pandas import DataFrame
33
from psychopy import prefs
4-
# PTB does not yet support macOS Apple Silicon, need to fall back to sounddevice.
5-
prefs.hardware['audioLib'] = ['sounddevice']
4+
65
from psychopy import visual, core, event, sound
76

87
from time import time
@@ -72,11 +71,11 @@ def load_stimulus(self):
7271

7372
return
7473

75-
def present_stimulus(self, idx : int, trial):
74+
def present_stimulus(self, idx: int):
7675
""" Presents the Stimulus """
7776

7877
# Select and play sound
79-
ind = int(trial["sound_ind"])
78+
ind = int(self.trials["sound_ind"].iloc[idx])
8079
self.auds[ind].stop()
8180
self.auds[ind].play()
8281

eegnb/experiments/visual_n170/n170.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def load_stimulus(self):
4141
# Return the list of images as a stimulus object
4242
return [self.houses, self.faces]
4343

44-
def present_stimulus(self, idx : int, trial):
44+
def present_stimulus(self, idx: int):
4545

4646
# Get the label of the trial
4747
label = self.trials["parameter"].iloc[idx]

eegnb/experiments/visual_p300/p300.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def load_stimulus(self):
3535

3636
return [self.nontargets, self.targets]
3737

38-
def present_stimulus(self, idx:int, trial):
38+
def present_stimulus(self, idx: int):
3939

4040
label = self.trials["parameter"].iloc[idx]
4141
image = choice(self.targets if label == 1 else self.nontargets)

eegnb/experiments/visual_ssvep/ssvep.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ def init_flicker_stim(frame_rate, cycle, soa):
9191
init_flicker_stim(frame_rate, 3, self.soa),
9292
]
9393

94-
def present_stimulus(self, idx, trial):
95-
94+
def present_stimulus(self, idx: int):
95+
9696
# Select stimulus frequency
9797
ind = self.trials["parameter"].iloc[idx]
9898

requirements.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@ click
5353
pyobjc==7.3; sys_platform == 'darwin'
5454
#upgrade psychopy to use newer wxpython dependency which is prebuilt for m1 support.
5555
psychopy==2023.2.2
56-
# PTB does not yet support macOS Apple Silicon, need to fallback to sounddevice.
57-
psychopy-sounddevice
5856
psychtoolbox
5957
scikit-learn>=0.23.2
6058
pandas>=1.1.4

0 commit comments

Comments
 (0)