Skip to content

Commit

Permalink
removed unnecessary trial parameter and fixed aob experiment to run o…
Browse files Browse the repository at this point in the history
…n windows again
  • Loading branch information
pellet committed Nov 10, 2024
1 parent ab1a444 commit 8275489
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 9 deletions.
4 changes: 2 additions & 2 deletions eegnb/experiments/Experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"""

from abc import abstractmethod
from typing import Callable
from typing import Callable, Any
from psychopy import prefs
#change the pref libraty to PTB and set the latency mode to high precision
prefs.hardware['audioLib'] = 'PTB'
Expand Down Expand Up @@ -185,7 +185,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
self.__draw(lambda: self.present_stimulus(current_trial, current_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 @@ -72,11 +76,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 8275489

Please sign in to comment.