Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix: pass down trial parameter to subclass. #276

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion eegnb/experiments/Experiment.py
Original file line number Diff line number Diff line change
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
8 changes: 7 additions & 1 deletion eegnb/experiments/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
from .visual_n170.n170 import VisualN170
from .visual_p300.p300 import VisualP300
from .visual_ssvep.ssvep import VisualSSVEP
from .auditory_oddball.aob import AuditoryOddball

# PTB does not yet support macOS Apple Silicon,
# this experiment needs to run as i386 if on macOS.
import sys
import platform
if sys.platform != 'darwin' or platform.processor() != 'arm':
from .auditory_oddball.aob import AuditoryOddball
7 changes: 3 additions & 4 deletions eegnb/experiments/auditory_oddball/aob.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
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']

from psychopy import visual, core, event, sound

from time import time
Expand Down Expand Up @@ -72,11 +71,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
2 changes: 0 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ click
pyobjc==7.3; sys_platform == 'darwin'
#upgrade psychopy to use newer wxpython dependency which is prebuilt for m1 support.
psychopy==2023.2.2
# PTB does not yet support macOS Apple Silicon, need to fallback to sounddevice.
psychopy-sounddevice
psychtoolbox
scikit-learn>=0.23.2
pandas>=1.1.4
Expand Down
Loading