Skip to content

Commit

Permalink
removed unnecessary trial parameter and fixed aob experiment to run a…
Browse files Browse the repository at this point in the history
…gain
  • Loading branch information
pellet committed Nov 7, 2024
1 parent 4c0673a commit c73895c
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 9 deletions.
3 changes: 1 addition & 2 deletions eegnb/experiments/Experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
10 changes: 7 additions & 3 deletions eegnb/experiments/auditory_oddball/aob.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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()

Expand Down
2 changes: 1 addition & 1 deletion eegnb/experiments/visual_n170/n170.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion eegnb/experiments/visual_p300/p300.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions eegnb/experiments/visual_ssvep/ssvep.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down

0 comments on commit c73895c

Please sign in to comment.