Esempio n. 1
0
 def __init__(self, view_type=VisionEggView, *args, **kwargs):
     """ @param view_type: If a custom view class should be used, its
     type can be specified here. See _create_view for more.
     """
     MainloopFeedback.__init__(self, *args, **kwargs)
     self._view_type = view_type
     self.__init_parameters()
     self.init_parameters()
     self.__init_attributes()
Esempio n. 2
0
 def __init__(self, view_type=VisionEggView, *args, **kwargs):
     """ @param view_type: If a custom view class should be used, its
     type can be specified here. See _create_view for more.
     """
     MainloopFeedback.__init__(self, *args, **kwargs)
     self._view_type = view_type
     self.__init_parameters()
     self.init_parameters()
     self.__init_attributes()
Esempio n. 3
0
 def on_stop(self):
     self.send_parallel(Marker.status_change_to_stop)
     MainloopFeedback.on_stop(self)
Esempio n. 4
0
 def on_pause(self):
     if self._MainloopFeedback__running and self._MainloopFeedback__paused:
         self.send_parallel(Marker.status_change_to_play)
     if self._MainloopFeedback__running and not self._MainloopFeedback__paused:
         self.send_parallel(Marker.status_change_to_pause)
     MainloopFeedback.on_pause(self)
Esempio n. 5
0
 def on_play(self):
     self.send_parallel(Marker.status_change_to_play)
     MainloopFeedback.on_play(self)
Esempio n. 6
0
 def on_init(self):
     """
     Initializes the variables and stuff, but not pygame itself.
     """
     MainloopFeedback.on_init(self)
     self.logger.debug("on_init")
     self.send_parallel(self.INIT_FEEDBACK)
     
     self.durationUntilBorder = 1000
     self.durationPerTrial = 4000
     self.durationIndicateGoal = 1000
     self.trials = 20
     self.pauseAfter = 4
     self.pauseDuration = 9000
     self.availableDirections =  ['right', 'foot']
     self.FPS =  50
     self.fullscreen =  False
     self.screenWidth =  1000
     self.screenHeight =  700
     self.countdownFrom = 2
     self.hitMissDuration =  1000
     self.dampedMovement = False
     self.showPunchline = True
     #self.damping = 'linear'
     self.damping = 'distance'
         
     self.pause = False
     self.quit = True
     self.quitting = True
     
     self.gameover = False
     self.countdown = True
     self.hit = False
     self.miss = False
     self.shortPause = False
     self.indicateGoal = False
     
     self.firstTickOfTrial = True
     
     self.showsPause, self.showsShortPause = False, False
     self.showsHitMiss, self.showsGameover = False, False
     
     self.elapsed, self.trialElapsed, self.countdownElapsed = 0,0,0
     self.hitMissElapsed, self.shortPauseElapsed, self.indicateGoalElapsed = 0,0,0
     
     self.completedTrials = 0
     
     self.f = 0
     self.hitMiss = [0,0]
     self.resized = False
     self.pos = 0
     self.targetDirection = 0
     
     self.arrowPointlist = [(.5,0), (.5,.33), (1,.33), (1,.66), (.5,.66), (.5,1), (0,.5)]
     self.arrowColor = (127, 127, 127)
     self.borderColor = self.arrowColor
     self.backgroundColor = (64, 64, 64)
     self.cursorColor = (100, 149, 237)
     self.fontColor = self.cursorColor
     self.countdownColor = (237, 100, 148)
     self.punchLineColor = self.cursorColor
     self.punchLineColorImpr = (100, 200 , 100)  # if punchline is improved
     
     self.punchlineThickness = 5   # in pixels 
     self.borderWidthRatio = 0.4     # in pixels
     self.punchlinePos1, self.punchlinePos2 = 0,0
     
     #=============
     # NOTE: only one of the following variables should be True
     self.hitIfLateral = True  
     self.reject = False
     #=============
     
     
     # How many degrees counter clockwise to turn an arrow pointing to the 
     # left to point at left, right and foot
     self.LEFT, self.RIGHT, self.DOWN, self.UP = 'left', 'right', 'foot', 'up'
     self.directions = {self.LEFT: 0, self.RIGHT: 180, self.DOWN: 90, self.UP: 270}
Esempio n. 7
0
 def on_init(self):
     """
     Initializes the variables and stuff, but not pygame itself.
     """
     MainloopFeedback.on_init(self)
     
     if __name__ == '__main__':
         self.screenPos = [200, 200, 600, 400]
     else:
         self.screenPos = [0, 0, 1280, 800] #[0, 0, 1920, 1200]
         
     self.TODAY_DIR = 'l:/data/bbciRaw/'
     self.writeClassifierLog = 1
     self.classifier_log = []
     self.cls_evolution_log = []
     
     self.revolutionTime = 4000  # time the clock hand needs for one revolution (in ms)
     self.quarterTime = self.revolutionTime/4
     self.nRev = 2               # number of clockhand revolutions per trial
     self.intertrialInterval = [2500, 3500]     # (in ms)
     self.showClassifier = 'random'   # 'none', 'random', 'feedback'
     self.cls_move_prob = 0.25  # probability that classifier is true at a target 
                               # (only applies  if self.showClassifier=='random')
     self.trials = 50
     self.pauseAfter = 10
     self.pauseDuration = 9000      # (in ms)
     self.kp_perfect_tol = 15       # (in ms)
     self.FPS = 50
     self.fullscreen =  False
     self.screenWidth =  self.screenPos[2]#900
     self.screenHeight =  self.screenPos[3]#600
     self.countdownFrom = 3
     self.threshold = 0
     self.redClockDuration = self.revolutionTime/8
     self.SADuration = 1000
     self.cls_ival = (-400, -200)
     self.keypress_tolerance = 50     # time deviation tolerate (in ms) of the keypress from 
                                      # when the clockhand actually is at the target
     
     self.pause = False
     self.quit = True
     self.quitting = True
     
     self.gameover = False
     self.countdown = True
     self.hit = False
     self.miss = False
     self.shortPause = False
     self.end_of_trial = False
     self.start_animation = False
     self.firstTickOfTrial = True
     
     self.showsPause, self.showsShortPause = False, False
     self.showsHitMiss, self.showsGameover = False, False
     
     self.elapsed, self.trialElapsed, self.countdownElapsed, self.redClockElapsed = 0,0,0,0
     self.shortPauseElapsed, self.trialSAElapsed, self.endOfTrialElapsed = 0,0,0
     
     self.f = 0
     self.hitMiss = [0,0]
     self.it = 0
     
     self.backgroundColor = (64,64,100)
     self.clockColor = (50,50,200)
     self.redClockColor = (200,0,0)
     self.fontColor = (237, 100, 148)
     self.fb_color_good = (0, 180, 0)
     self.fb_color_bad = (200, 0, 0)
     self.countdownColor = (237, 100, 148)
     
     self.completedTrials = 0
     self.validTrials = 0
     self.infostr = ''
     self.infocolor = self.fb_color_good
 def setUp(self):
     self.fb = MainloopFeedback()
     self.init()
Esempio n. 9
0
 def on_stop(self):
     self.send_parallel(Marker.status_change_to_stop)
     MainloopFeedback.on_stop(self)
Esempio n. 10
0
 def on_pause(self):
     if self._MainloopFeedback__running and self._MainloopFeedback__paused:
         self.send_parallel(Marker.status_change_to_play)
     if self._MainloopFeedback__running and not self._MainloopFeedback__paused:
         self.send_parallel(Marker.status_change_to_pause)
     MainloopFeedback.on_pause(self)
Esempio n. 11
0
 def on_play(self):
     self.send_parallel(Marker.status_change_to_play)
     MainloopFeedback.on_play(self)