def __init__(self, subject): """ Fixation """ fp = dictattr() fp.bgbrightness = 0.5 fp.color = (1.0, 0.0, 0.0, 1.0) fp.width = 0.25 self.fixation_left = Fixation(viewport='left', subject=subject, params=fp) self.fixation_right = Fixation(viewport='right', subject=subject, params=fp) """ Random Dots with disc""" dp = dictattr() dp.bgbrightness = 0.5 dp.antialiase = True dp.dotSquareWidth = 7.5 dp.dotsNumber = 2000 dp.randomSeed = 0 dp.dotColor = (0.8, 0.8, 0.8) dp.dotSize = 3 dp.discDistDeg = 2.5 dp.discDiameter = 1.25 dp.disparity = 0 self.dp = dp self.subject = subject self.disc_left = StereoDisc(viewport='left', subject=subject, params=dp) self.disc_right = StereoDisc(viewport='right', subject=subject, params=dp) """ Mask: Random Dots """ mp = dictattr() mp.bgbrightness = 0.5 mp.antialiase = True mp.dotSquareWidth = 7.5 mp.dotsNumber = 4500 mp.randomSeed = 1 mp.dotColor = (1, 1, 1) mp.dotSize = 2 self.mp = mp self.mask_left = RandomDots(viewport='left', subject=subject, params=mp) self.mask_right = RandomDots(viewport='right', subject=subject, params=mp) """ Hint """ hp = dictattr() hp.bgbrightness = 0.5 hp.text = "Press left or right for disc interval." hp.xorigDeg = 5.0 hp.yorigDeg = 0.0 hp.color = (1.0, 0.0, 0.0, 1.0) hp.fontsize = 25 self.hint_left = Hint(viewport="left", params=hp) hp.xorigDeg = -5.0 self.hint_right = Hint(viewport="right", params=hp) self.sweep = FrameSweep() self.key_response = LeftRightKeyResponse(self.sweep) self.mouse_response = LeftRightMouseResponse(self.sweep)
def __init__(self, subject, eye): """ Fixation """ fp = dictattr() fp.bgbrightness = 0.5 fp.color = (1.0, 0.0, 0.0, 1.0) fp.width = 0.25 self.fixation_left = Fixation(viewport='left', subject=subject, params=fp) self.fixation_right = Fixation(viewport='right', subject=subject, params=fp) """ SED Grating """ gp = dictattr() gp.bgbrightness = 0.5 gp.on = True gp.mask = "circle" gp.ml = 0.5 gp.sfreqCycDeg = 3.0 gp.tfreqCycSec = 0.0 gp.phase0 = 0 gp.contrast = 0.5 gp.ori = 0.0 gp.maskDiameterDeg = 1.25 gp.radius = 2.0 self.grating_left = SEDGrating(viewport='left', subject=subject, params=gp) gp.ori = 90.0 self.grating_right = SEDGrating(viewport='right', subject=subject, params=gp) """ Mask """ mp = dictattr() mp.bgbrightness = 0.5 mp.ml = (0.5, 0.5) mp.ori = (0.0, 90.0) mp.sfreqCycDeg = (3.0, 3.0) mp.tfreqCycSec = (0.0, 0.0) self.plaid_left = Plaid(viewport="left", params=mp) self.plaid_right = Plaid(viewport="right", params=mp) """ Hint """ hp = dictattr() hp.bgbrightness = 0.5 hp.text = "Press left(right) or up(down) for grating orientation." hp.xorigDeg = 5.0 hp.yorigDeg = 0.0 hp.color = (1.0, 0.0, 0.0, 1.0) hp.fontsize = 25 self.hint_left = Hint(viewport="left", params=hp) hp.xorigDeg = -5.0 self.hint_right = Hint(viewport="right", params=hp) self.sweep = FrameSweep() self.key_response = LeftRightKeyResponse(self.sweep) self.mouse_response = LeftRightMouseResponse(self.sweep) self.test_eye = eye
def get_stimulus_params(self, eye, index=0): logger = logging.getLogger('StimControl.StimServer') params = dictattr() with open('stimulus_params.pkl', 'rb') as pkl_input: pkl_params = pickle.load(pkl_input) try: self._set_parameters(params, pkl_params[eye][index]) except: logger.error("Cannot get stimulus params for % eye." % eye) return None else: return params
def get_stimulus_params(self, eye, index=0): logger = logging.getLogger("StimControl.StimServer") params = dictattr() with open("stimulus_params.pkl", "rb") as pkl_input: pkl_params = pickle.load(pkl_input) try: self._set_parameters(params, pkl_params[eye][index]) except: logger.error("Cannot get stimulus params for % eye." % eye) return None else: return params
# Generate random orientation and spatial frequency gratings. # # Copyright (C) 2010-2011 Huang Xin # # See LICENSE.TXT that came with this file. from __future__ import division from StimControl.LightStim.SweepSeque import ParamSeque from StimControl.LightStim.FrameControl import FrameSweep from StimControl.LightStim.Grating import ParamsGrating, MonocularGrating from StimControl.LightStim.Core import DefaultScreen from StimControl.LightStim.LightData import dictattr,IndexedParam DefaultScreen(['left','right']) p = dictattr() p.ml = 0.5 p.tfreqCycSec = 2.0 p.bgbrightness = 0.5 p.phase0 = 0 p.contrast = 1 #Monocular stimuli phase_at_t0 = [0] monocular_param_left = ParamSeque(repeat=1, phase_at_t0=phase_at_t0, frame_duration=2.0, blank_duration=1.0) monocular_param_right = ParamSeque(repeat=1, phase_at_t0=phase_at_t0, frame_duration=2.0, blank_duration=1.0) monocular_grating_left = MonocularGrating(viewport='left', params=p, sweepseq=monocular_param_left) monocular_grating_right = MonocularGrating(viewport='right', params=p, sweepseq=monocular_param_right) #Binocular stimuli phase_at_t0 = [0]*16
Scroll the mouse wheel to change the orientation. Press right arrow to increase the spatial frequency. Press left arrow to decrease the spatial frequency. Press up arrow to increase the temporal frequency. ... """ from __future__ import division from StimControl.LightStim.Core import DefaultScreen from StimControl.LightStim.LightData import dictattr from StimControl.LightStim.FrameControl import FrameSweep from StimControl.LightStim.ManGrating import ManGrating # Manual Grating experiment parameters, all must be scalars DefaultScreen(['control', 'left', 'right']) p = dictattr() # mask, one of: None, 'gaussian', or 'circle' p.mask = 'circle' p.maskSizeStepDeg = 0.5 # initial grating phase p.phase0 = 0 # grating mean luminance (0-1) p.ml = 0.5 # grating contrast (0-1) p.contrast = 1 # background brightness (0-1) p.bgbrightness = 0.5 # antialiase the bar? p.antialiase = True # flash the grating? p.flash = False
layout = None if len(argv) >= 4: layout = argv[3] if layout not in ("LR", "TB"): layout = "2D" filename = argv[-1] movie = pygame.movie.Movie(filename) width, height = movie.get_size() pygame_surface = pygame.surface.Surface((width,height)) movie.set_display(pygame_surface) texture_object = SurfaceTextureObject(dimensions=2) p_left = dictattr() p_left.layout = layout p_left.bgbrightness = 0.0 p_left.contrast = 1.0 p_right = dictattr() p_right.layout = layout p_right.bgbrightness = 0.0 p_right.contrast = 0.5 cycle_left = dictattr(duration=0.04, pre=pre_left, stimulus=0.016) cycle_right = dictattr(duration=0.04, pre=pre_right, stimulus=0.016) block_left = dictattr(repeat=None, cycle=cycle_left, interval=0.0) block_right = dictattr(repeat=None, cycle=cycle_right, interval=0.0) sequence_left = TimingSeque(repeat=1, block=block_left, shuffle=True) sequence_right = TimingSeque(repeat=1, block=block_right, shuffle=True)
# Generate arbitrary onset and offset timing gratings. # # Copyright (C) 2010-2011 Huang Xin # # See LICENSE.TXT that came with this file. from __future__ import division from StimControl.LightStim.SweepSeque import TimingSeque from StimControl.LightStim.LightData import dictattr from StimControl.LightStim.FrameControl import FrameSweep from StimControl.LightStim.Grating import TimingSetGrating from StimControl.LightStim.Core import DefaultScreen DefaultScreen(['left', 'right']) p = dictattr() p.ml = 0.5 p.tfreqCycSec = 0.0 p.bgbrightness = 0.5 p.phase0 = 0 p.contrast = 1 stim_interval = 0.0 pre_left = 0.0 if stim_interval > 0 else abs(stim_interval) pre_right = 0.0 if stim_interval <= 0 else stim_interval repeats = 1600 cycle_left = dictattr(duration=0.132, pre=pre_left, stimulus=0.016) cycle_right = dictattr(duration=0.132, pre=pre_right, stimulus=0.016)
# Generate arbitrary onset and offset timing gratings. # # Copyright (C) 2010-2011 Huang Xin # # See LICENSE.TXT that came with this file. from __future__ import division from StimControl.LightStim.SweepSeque import TimingSeque from StimControl.LightStim.LightData import dictattr from StimControl.LightStim.FrameControl import FrameSweep from StimControl.LightStim.Grating import TimingSetGrating from StimControl.LightStim.Core import DefaultScreen DefaultScreen(['left','right']) p = dictattr() p.ml = 0.5 p.tfreqCycSec = 0.0 p.bgbrightness = 0.5 p.phase0 = 0 p.contrast = 1 stim_interval = 0.0 pre_left = 0.0 if stim_interval > 0 else abs(stim_interval) pre_right = 0.0 if stim_interval <= 0 else stim_interval repeats = 1600 cycle_left = dictattr(duration=0.132, pre=pre_left, stimulus=0.016) cycle_right = dictattr(duration=0.132, pre=pre_right, stimulus=0.016)