def loadManbar(self, n): """Load Manbar n setting in dimstim config file and assign it to the current manual bar""" mbn = "Manbar" + str(n) self.x = intround( deg2pix(dc.get(mbn, "xorigDeg")) + I.SCREENWIDTH / 2 ) # int pix, since pygame.mouse pos works with ints self.y = intround(deg2pix(dc.get(mbn, "yorigDeg")) + I.SCREENHEIGHT / 2) self.widthDeg = dc.get(mbn, "widthDeg") self.heightDeg = dc.get(mbn, "heightDeg") self.ori = dc.get(mbn, "orioff") self.fp.position = self.x, self.y
def __init__(self, script, params): self.script = script.replace("\\", C.SLASH).replace( ".pyc", ".py" ) # Experiment script file name, with stuff cleaned up self.script = os.path.splitdrive(self.script)[-1] # strip the drive name from the start self.params = params self.params.check() for paramname, paramval in params.items(): setattr(self, paramname, paramval) # bind all parameter names to self if not self.flash: # DW self.flashSec = 0 self.flashvsyncs = sec2intvsync(self.flashSec) eye = dc.get("Eye", "open") # Init signals self.squarelock, self.brightenText = False, False self.UP, self.DOWN, self.LEFT, self.RIGHT = False, False, False, False self.PLUS, self.MINUS = False, False self.BRRIGHT, self.BRLEFT = False, False self.LEFTBUTTON, self.RIGHTBUTTON, self.SCROLL = False, False, False self.eyei = C.EYESTATES.index(eye) # Init Colors DW self.lastbrightness = self.brightness self.black = 0.0 self.white = 1.0
def __init__(self, script, params): self.script = script.replace('\\', C.SLASH).replace('.pyc', '.py') # Experiment script file name, with stuff cleaned up self.script = os.path.splitdrive(self.script)[-1] # strip the drive name from the start self.params = params self.params.check() for paramname, paramval in params.items(): setattr(self, paramname, paramval) # bind all parameter names to self self.flashvsyncs = sec2intvsync(self.flashSec) eye = dc.get('Eye', 'open') # Init signals self.squarelock, self.brightenText = False, False self.UP, self.DOWN, self.LEFT, self.RIGHT = False, False, False, False self.PLUS, self.MINUS, self.BRLEFT, self.BRRIGHT = False, False, False, False self.LEFTBUTTON, self.RIGHTBUTTON, self.SCROLL = False, False, False self.eyei = C.EYESTATES.index(eye) #Set up initial terrain self.brightness = self.terrain.color self.ori = self.terrain.orientation self.laps = [] #Set up initial gratings self.gratingWidth = I.SCREENWIDTH*2 self.gratingHeight = I.SCREENHEIGHT*2 self.ml = 0.5 self.snapDeg = 18 #set up encoder self.encoder.start() time.sleep(0.2) #give NIDAQ chance to take a buffer of data self.encDeg = self.encoder.getDegrees() self.lastDx = 0 if self.encoder.getVin() < 1: print 'Encoder not connected or powered on.' #set up reward self.reward.start() self.framescorrect = 0 self.rewards = [] #set up session clock self.sc = SessionClock() #set up logs self.posx = [] self.dx = [] self.terrainlog = []
from aibs.Terrain import Terrain from aibs.Reward import Reward from aibs.Encoder import Encoder p = StaticParams() # Foraging experiment parameters, all must be scalars # Mouse ID p.mouseid = 'test' # background brightness (0-1) p.bgbrightness = 0.5 # antialiase the bar? p.antialiase = True # screen gamma: None, or single value, or 3-tuple p.gamma = dc.get('Screen', 'gamma') # flash the stimulus? p.flash = False # duration of each flash cycle (on and off) (sec) p.flashSec = 1 # starting y position p.ypos = 540 #540 is center on 1080 pixel wide monitor # print vsync histogram? p.printhistogram = False # display on how many screens? p.nscreens = 2 # set up wheel encoder (NIDAQ Device, Vin, Vsig) p.encoder = Encoder(1,1,2) # set up terrain? [possible orientations], correct orientation] p.terrain = Terrain(['color','orientation']) # define terrain parameters