Skip to content

Commit d19d3d8

Browse files
unknownventhur
unknown
authored andcommitted
Changes in Feedbacks/Oddball/
1 parent 33cdbd7 commit d19d3d8

File tree

4 files changed

+622
-17
lines changed

4 files changed

+622
-17
lines changed

src/Feedbacks/Oddball/CheckerboardVEP.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def init(self):
3131
super(CheckerboardVEP,self).init()
3232
self.dev_perc = 0.5
3333
self.nStim = 40
34-
self.nStim_per_block = 100 # number of stimuli until a pause
34+
self.nStim_per_block = 20 # number of stimuli until a pause
3535
self.dd_dist = 1
3636
self.squaresPerSide = 6
3737
self.response = 'none'

src/Feedbacks/Oddball/Oddball.py

+14-16
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
#!/usr/bin/env python
22

3-
# Q: - several standards and/or deviants (probabilities? e.g. std_prob = [0.2 0.5 0.3])
4-
# - option give several markers
5-
# - constraints (min. x standards between deviants)
6-
73

84
# ODDBALL BASE CLASS from which all the subclasses inherit.
95
#
@@ -53,23 +49,22 @@
5349
import pygame
5450

5551
from FeedbackBase.MainloopFeedback import MainloopFeedback
52+
from lib import marker
5653

5754
class Oddball(MainloopFeedback):
5855

59-
RUN_START, RUN_END = 252,253
60-
COUNTDOWN_START, COUNTDOWN_END = 40,41
6156
STANDARD, DEVIANT = list(),list()
6257
# standards have markers 10,11,12,... ; deviants 30,31,32,... (cf. get_stimuli())
6358
# if self.group_stim_markers==True, then there exist only two markers, one for
6459
# group standard (10), and one for group deviant (20)
6560
RESP_STD, RESP_DEV = 1,2
66-
SHORTPAUSE_START, SHORTPAUSE_END = 249, 250
6761

6862
def init(self):
6963
self.screen_pos = [100, 100, 640, 480]
64+
self.fullscreen = False
7065
self.FPS = 40
71-
self.nStim = 100
72-
self.nStim_per_block = 50
66+
self.nStim = 10
67+
self.nStim_per_block = 5
7368
self.dev_perc = 0.1
7469
self.countdown_from = 2
7570
self.show_standards = True
@@ -196,7 +191,7 @@ def pre_mainloop(self):
196191
Sets up all the necessary components (e.g. pygame, stimuli, graphics)
197192
to run the experiment.
198193
"""
199-
self.send_parallel(self.RUN_START)
194+
self.send_parallel(marker.RUN_START)
200195
self.init_pygame()
201196
self.get_stimuli()
202197
self.error_checking()
@@ -209,7 +204,7 @@ def post_mainloop(self):
209204
"""
210205
Sends end marker to parallel port and quits pygame.
211206
"""
212-
self.send_parallel(self.RUN_END)
207+
self.send_parallel(marker.RUN_END)
213208
pygame.quit()
214209

215210

@@ -376,15 +371,15 @@ def short_pause_tick(self):
376371
One tick of the short pause loop.
377372
"""
378373
if self.shortpauseElapsed == 0:
379-
self.send_parallel(self.SHORTPAUSE_START)
374+
self.send_parallel(marker.PAUSE_START)
380375

381376
self.shortpauseElapsed += self.elapsed
382377

383378
if self.shortpauseElapsed >= self.shortpauseDuration:
384379
self.shortpause = False
385380
self.shortpauseElapsed = 0
386381
self.countdown = True
387-
self.send_parallel(self.SHORTPAUSE_END)
382+
self.send_parallel(marker.PAUSE_END)
388383
return
389384

390385
self.do_print("Short Break...", self.fontColor, self.size / 10)
@@ -396,7 +391,7 @@ def countdown_tick(self):
396391
"""
397392
# start countdown
398393
if self.countdownElapsed == 0:
399-
self.send_parallel(self.COUNTDOWN_START)
394+
self.send_parallel(marker.COUNTDOWN_START)
400395
self.draw_initial()
401396
# initialize stimulus sequence for the next block according to the deviant probability
402397
n = min(self.nStim_per_block,self.nStim)
@@ -406,7 +401,7 @@ def countdown_tick(self):
406401

407402
# stop countdown
408403
if self.countdownElapsed >= (self.countdown_from) * 1000:
409-
self.send_parallel(self.COUNTDOWN_END)
404+
self.send_parallel(marker.COUNTDOWN_END)
410405
self.countdown = False
411406
self.countdownElapsed = 0
412407
self.beforestim = True
@@ -515,7 +510,10 @@ def init_pygame(self):
515510
os.environ['SDL_VIDEO_WINDOW_POS'] = "%d,%d" % (self.screen_pos[0], self.screen_pos[1])
516511
pygame.init()
517512
pygame.display.set_caption('Oddball')
518-
self.screen = pygame.display.set_mode((self.screen_pos[2], self.screen_pos[3]), pygame.RESIZABLE)
513+
if self.fullscreen:
514+
self.screen = pygame.display.set_mode((self.screen_pos[2], self.screen_pos[3]), pygame.FULLSCREEN)
515+
else:
516+
self.screen = pygame.display.set_mode((self.screen_pos[2], self.screen_pos[3]), pygame.RESIZABLE)
519517
self.clock = pygame.time.Clock()
520518

521519
def contrained_oddball_sequence(self, N, dev_perc, dd_dist=0):

0 commit comments

Comments
 (0)