def __init__(self, state, goal=None, size=(128, 340), nr_segments=10, gap=3, frame_line_width=20, active_colour=(150, 150, 150), inactive_colour=(0, 0, 0), frame_colour=(100, 100, 100), goal_colour=(0, 255, 0), gap_colour=(255, 255, 255), position=None): """Initializing a thermometer display. Parameters: ----------- state : int The state of the thermometer in percent. goal : int, optional The goal state indication in percent. size : (int, int), optional The size of the thermometer display (default=(128,340)). nr_segments : int, optional The number of segments to use (default=10). gap : int, optional The visual gap between the individual segments (default=3). frame_line_width : int, optional The line width of the frame around the thermometer display (default=20). active_colour : (int, int, int), optional The colour of the active segments (default=(150,150,150)). inactive_colour : (int, int, int), optional The colour of the inactive segments (default=(0,0,0)). frame_colour : (int, int, int), optional The colour of the frame around the thermometer display (default=(100,100,100)). goal_colour : (int, int, int), optional The colour of the goal indicator (default=(0,255,0)). gap_colour : (int, int, int), optional The gap colour of the thermometer stimulus (default=(255,255,255)). position : (int, int), optional The position of the thermometer display). """ self._state = state self._goal = goal self._size = size self._nr_segments = nr_segments self._gap = gap self._frame_line_width = frame_line_width self._active_colour = active_colour self._inactive_colour = inactive_colour self._frame_colour = frame_colour self._goal_colour = goal_colour self._gap_colour = gap_colour self._position = position Visual.__init__(self, position)
def __init__(self, size=None, position=None, background_colour=None): """Create a stimulus cloud. Parameters ---------- size : (int, int), optional size of the cloud position : (int, int), optional position of the cloud background_colour : (int, int, int), optional colour of the background """ Visual.__init__(self, position) self._cloud = [] if size is not None: self._size = size else: size = defaults.stimuluscloud_size if size is None: try: self._size = expyriment._active_exp.screen.surface.get_size() except: raise RuntimeError("Could not get size of screen!") if background_colour is not None: self._background_colour = background_colour else: self._background_colour = \ defaults.stimuluscloud_background_colour self._rect = None
def prepare(self): self._stim = Visual(position=self.to_xy(self.x, self.y)) self._stim.set_surface( canvas._noise_patch(self.env, self.size, self.stdev, self.col1, self.col2, self.bgmode)) self._stim.preload()
def __init__(self, radius=None, position=None, background_colour=None, dot_colour=None): """Create a dot cloud. Parameters ---------- radius : int, optional radius of the cloud position : (int, int), optional position of the stimulus background_colour : (int, int, int), optional colour of the background dot_colour : (int, int, int), optional colour of the dots """ Visual.__init__(self, position) self._cloud = [] if radius is not None: self._radius = radius else: try: self._radius = min( _internals.active_exp.screen.surface.get_size()) // 2 except: raise RuntimeError("Could not get size of screen!") self._background_colour = background_colour if dot_colour is not None: self._dot_colour = dot_colour else: self._dot_colour = _internals.active_exp.foreground_colour self.create_area()
def prepare(self): self._stim = Visual(position=self.to_xy(self.x, self.y)) self._stim.set_surface( canvas._gabor( self.orient, self.freq, self.env, self.size, self.stdev, self.phase, self.col1, self.col2, self.bgmode ) ) self._stim.preload()
def prepare(self): im = self._to_pil() surface = pygame.image.fromstring(im.tobytes(), im.size, im.mode) x, y = self.to_xy(self.x, self.y) if not self.center: x += im.width // 2 y -= im.height // 2 self._stim = Visual(position=(x, y)) self._stim.set_surface(surface) self._stim.preload()
def __init__(self, state, goal=None, size=(128,340), nr_segments=10, gap=3, frame_line_width=20, active_colour=(150,150,150), inactive_colour=(0,0,0), frame_colour=(100,100,100), goal_colour=(0,255,0), gap_colour=(255,255,255), position=None): """Initializing a thermometer display. Parameters: ----------- state : int The state of the thermometer in percent. goal : int, optional The goal state indication in percent. size : (int, int), optional The size of the thermometer display (default=(128,340)). nr_segments : int, optional The number of segments to use (default=10). gap : int, optional The visual gap between the individual segments (default=3). frame_line_width : int, optional The line width of the frame around the thermometer display (default=20). active_colour : (int, int, int), optional The colour of the active segments (default=(150,150,150)). inactive_colour : (int, int, int), optional The colour of the inactive segments (default=(0,0,0)). frame_colour : (int, int, int), optional The colour of the frame around the thermometer display (default=(100,100,100)). goal_colour : (int, int, int), optional The colour of the goal indicator (default=(0,255,0)). gap_colour : (int, int, int), optional The gap colour of the thermometer stimulus (default=(255,255,255)). position : (int, int), optional The position of the thermometer display). """ self._state = state self._goal = goal self._size = size self._nr_segments = nr_segments self._gap = gap self._frame_line_width = frame_line_width self._active_colour = active_colour self._inactive_colour = inactive_colour self._frame_colour = frame_colour self._goal_colour = goal_colour self._gap_colour = gap_colour self._position = position Visual.__init__(self, position)
def __init__(self, radius=None, position=None, background_colour=None, dot_colour=None): """Create a dot cloud. Parameters ---------- radius : int, optional radius of the cloud position : (int, int), optional position of the stimulus background_colour : (int, int, int), optional colour of the background dot_colour : (int, int, int), optional colour of the dots. """ Visual.__init__(self, position) self._cloud = [] if radius is not None: self._radius = radius else: radius = defaults.dotcloud_radius if radius is None: try: self._radius = min( expyriment._active_exp.screen.surface.get_size()) / 2 except: raise RuntimeError("Could not get size of screen!") if background_colour is not None: self._background_colour = background_colour else: self._background_colour = \ defaults.dotcloud_background_colour if dot_colour is None: dot_colour = defaults.dotcloud_dot_colour if dot_colour is not None: self._dot_colour = dot_colour else: self._dot_colour = expyriment._active_exp.foreground_colour self.create_area()
def __init__(self, radius, stimuli, position=None, background_colour=None): """Create a stimulus circle. Parameters ---------- radius : int radius of the circle stimuli : expyriment stimulus stimuli to put into the circle position : (int, int), optional position of the circle background_colour : (int, int, int), optional background colour of the circle """ Visual.__init__(self, position) self._radius = radius self._stimuli = stimuli self._background_colour = background_colour
def __init__(self, shape, position=None, size=None, colour=None, inactive_colour=None, background_colour=None, line_width=None, gap=None, simple_lines=None): """Create a LCD symbol. Parameters ---------- shape : list shape to show position : (int, int), optional position to show the symbol size : (int, int) size of the LCD symbol colour : (int, int, int), optional LCD symbol colour inactive_colour : (int, int, int), optional colour of inactive lines background_colour : (int, int, int), optional line_width : int, optional width of the lines gap :int, optional gap between lines simple_lines : bool, optional use simple lines """ Visual.__init__(self, position) if shape in self._shapes: self._shape = self._shapes[shape] else: self._shape = shape if size is not None: self._width = size[0] self._height = size[1] else: size = defaults.lcdsymbol_size if size is None: try: size = expyriment._active_exp.screen.surface.get_size() except: raise RuntimeError("Could not get size of screen!") self._width = size[0] self._height = size[1] if colour is None: colour = defaults.lcdsymbol_colour if colour is not None: self._colour = colour else: self._colour = expyriment._active_exp.foreground_colour if inactive_colour is not None: self._inactive_colour = inactive_colour else: self._inactive_colour = \ defaults.lcdsymbol_inactive_colour if background_colour is not None: self._background_colour = background_colour else: self._background_colour = \ defaults.lcdsymbol_background_colour if line_width is not None: self._line_width = line_width else: self._line_width = defaults.lcdsymbol_line_width if gap is not None: self._gap = gap else: self._gap = defaults.lcdsymbol_gap if simple_lines is not None: self._simple_lines = simple_lines else: self._simple_lines = defaults.lcdsymbol_simple_lines x = int(self.line_width / 2.0) + 1 self._points = (PolygonDot(radius=0, position=(x, x)), PolygonDot(radius=0, position=(self._width - x, x)), \ PolygonDot(radius=0, position=(x, math.floor(self._height / 2))), \ PolygonDot(radius=0, position=(self._width - x, math.floor(self._height / 2))), \ PolygonDot(radius=0, position=(x, self._height - x)), \ PolygonDot(radius=0, position=(self._width - x, self._height - x))) expyriment.stimuli._stimulus.Stimulus._id_counter -= 6
def __init__(self, state, goal=None, size=None, nr_segments=None, gap=None, frame_line_width=None, active_colour=None, inactive_colour=None, frame_colour=None, goal_colour=None, gap_colour=None, position=None): """Initializing a thermometer display. Parameters: ----------- state : int The state of the thermometer in percent. goal : int, optional The goal state indication in percent. size : (int, int), optional The size of the thermometer display. nr_segments : int, optional The number of segments to use. gap : int, optional The visual gap between the individual segments. frame_line_width : int, optional The line width of the frame around the thermometer display. active_colour : (int, int, int), optional The colour of the active segments. inactive_colour : (int, int, int), optional The colour of the inactive segments. frame_colour : (int, int, int), optional The colour of the frame around the thermometer display. goal_colour : (int, int, int), optional The colour of the goal indicator. gap_colour : (int, int, int), optional The gap colour of the thermometer stimulus. position : (int, int), optional The position of the thermometer display. """ self._state = state if goal is not None: self._goal = goal else: self._goal = defaults.thermometerdisplay_goal if size is not None: self._size = size else: self._size = defaults.thermometerdisplay_size if nr_segments is not None: self._nr_segments = nr_segments else: self._nr_segments = defaults.thermometerdisplay_nr_segments if gap is not None: self._gap = gap else: self._gap = defaults.thermometerdisplay_gap if frame_line_width is not None: self._frame_line_width = frame_line_width else: self._frame_line_width = \ defaults.thermometerdisplay_frame_line_width if active_colour is not None: self._active_colour = active_colour else: self._active_colour = defaults.thermometerdisplay_active_colour if inactive_colour is not None: self._inactive_colour = inactive_colour else: self._inactive_colour = \ defaults.thermometerdisplay_inactive_colour if frame_colour is not None: self._frame_colour = frame_colour else: self._frame_colour = defaults.thermometerdisplay_frame_colour if goal_colour is not None: self._goal_colour = goal_colour else: self._goal_colour = defaults.thermometerdisplay_goal_colour if gap_colour is not None: self._gap_colour = gap_colour else: self._gap_colour = defaults.thermometerdisplay_gap_colour if position is not None: self._position = position else: self._position = defaults.thermometerdisplay_position Visual.__init__(self, position)