def createObjects(self): displayObject.createObjects(self) x,y=self.pos if isscalar(self.params['circlenum']): self.params['circlenum']=array([self.params['circlenum']]) self.totSteps=len(self.params['circlenum'])//2 sz=self.params['sz'] res=self.params['res'] r=self.params['radius'] box=primitives.Polygon(v=[(x-sz//2,y+sz//2),(x+sz//2,y+sz//2),(x+sz//2,y-sz//2),(x-sz//2,y-sz//2)],z=0, color=self.fg, stroke=2) self.statObjects+=(box,) for i in range(2): n=self.params['circlenum'][self.step*2+i] if n!=0: cornerx=x-sz/2+mod(n-1,res)*sz/res cornery=y+sz/2-((n-1)//res)*sz/res centerx=round(cornerx+sz/res/2) centery=round(cornery-sz/res/2) circle=primitives.Circle(centerx,centery,width=r*2,color=self.fg) self.fgObjects+=(circle,) if self.step>0: n=self.params['circlenum'][(self.step-1)*2+i] if n!=0: cornerx=x-sz/2+mod(n-1,res)*sz/res cornery=y+sz/2-((n-1)//res)*sz/res centerx=round(cornerx+sz/res/2) centery=round(cornery-sz/res/2) last=primitives.Circle(centerx,centery,width=r*2,color=(1,0,0,1),stroke=2) self.statObjects+=(last,)
def createObjects(self): displayObject.createObjects(self) #circ = primitives.Circle(self.pos[0],self.pos[1],width=self.params['radius']*2,color=self.fg) circ = primitives.mySquare(self.pos[0],self.pos[1],width=self.params['radius']*2,color=self.fg) #line1=primitives.myLineRel(self.pos[0],self.pos[1],a=(68,0), b=(-68,0), color=self.fg, stroke=15, rotation=0.0, style=0) #line2=primitives.myLineRel(self.pos[0],self.pos[1],a=(0,68), b=(0,-68), color=self.fg, stroke=15, rotation=0.0, style=0) self.fgObjects=(circ,)
def createObjects(self): displayObject.createObjects(self) x,y=self.pos if isscalar(self.params['circlenum']): self.params['circlenum']=array([self.params['circlenum']]) self.totSteps=len(self.params['circlenum']) #n is 1 based (first circle is number 1, not 0) n=self.params['circlenum'][self.step] sz=self.params['sz'] res=self.params['res'] if floor(sz/float(res))!=sz/float(res): sz=res*(sz//res) if n>0: r=self.params['radius'] cornerx=x-sz/2+mod(n-1,res)*sz/res cornery=y+sz/2-((n-1)//res)*sz/res centerx=round(cornerx+sz/res/2) centery=round(cornery-sz/res/2) circle=primitives.Circle(centerx,centery,width=r*2,color=self.fg) self.fgObjects=(circle,) box=primitives.Polygon(v=[(x-sz//2,y+sz//2),(x+sz//2,y+sz//2),(x+sz//2,y-sz//2),(x-sz//2,y-sz//2)],z=0, color=self.fg, stroke=2) if self.step>0: n=self.params['circlenum'][self.step-1] cornerx=x-sz/2+mod(n-1,res)*sz/res cornery=y+sz/2-((n-1)//res)*sz/res centerx=round(cornerx+sz/res/2) centery=round(cornery-sz/res/2) last=primitives.Circle(centerx,centery,width=r*2,color=(1,0,0,1),stroke=2) self.statObjects+=(box,last) else: self.statObjects+=(box,)
def createObjects(self): displayObject.createObjects(self) x,y=self.pos if isscalar(self.params['inner']): self.params['inner']=array([self.params['inner']]) self.totSteps=len(self.params['inner']) inner=primitives.Circle(x,y,width=self.params['inner'][self.step]*2,color=self.bg) outer=primitives.Circle(x,y,width=self.params['outer']*2,color=self.fg) self.fgObjects=(outer,inner,)
def createObjects(self): displayObject.createObjects(self) c=(myrand[mod(self.RC,len(myrand))]*self.params['std']+self.params['mu']) if c<0: c =0 elif c>1: c=1 color=(c,c,c,1) foreground=primitives.Polygon(v=[(0,0),(0,H),(W,H),(W,0),(0,0)],z=0, color=color, stroke=0) self.fgObjects=(foreground,)
def createObjects(self): displayObject.createObjects(self) x,y=self.pos if isscalar(self.params['radius']): self.params['radius']=array([self.params['radius']]) self.totSteps=len(self.params['radius']) r=self.params['radius'][self.step] spot = primitives.Circle(x,y,width=r*2,color=self.fg) self.fgObjects=(spot,) box=primitives.Polygon(v=[(x-r,y+r),(x+r,y+r),(x+r,y-r),(x-r,y-r)],z=0, color=self.fg, stroke=2) self.statObjects+=(box,)
def createObjects(self): displayObject.createObjects(self) if isscalar(self.params['intensity']): self.params['intensity']=array([self.params['intensity']]) self.totSteps=len(self.params['intensity']) c=self.params['intensity'][self.step] color=(c,c,c,1) w=self.params['width'] x,y=self.pos square=primitives.Polygon(v=[(x-w/2,y-w/2),(x-w/2,y+w/2),(x+w/2,y+w/2),(x+w/2,y-w/2),(x-w/2,y-w/2)], color=color, stroke=0) self.fgObjects=(square,)
def createObjects(self): displayObject.createObjects(self) x,y=self.pos if isscalar(self.params['orientation']): self.params['orientation']=array([self.params['orientation']]) self.totSteps=len(self.params['orientation']) start=self.params['orientation'][self.step]-self.params['width']/2 stop=self.params['orientation'][self.step]+self.params['width']/2 sector=primitives.Arc(x,y, radius=self.params['radius'], start=start, sweep=stop-start, color=self.fg, stroke=0, rotation=0.0, style=pyg.gl.GLU_FILL) self.fgObjects=(sector,) spot=primitives.Circle(x,y,width=self.params['radius']*2,color=self.fg,stroke=2) self.statObjects+=(spot,)
def createObjects(self): displayObject.createObjects(self) x,y=self.pos sz=float(self.params['sz']) try: res=float(self.params['res'][0]) except: res=float(self.params['res']) col=zeros(res**2) for n in range(int(res**2)): col[n]=(myrand[mod(n+self.RC,len(myrand))]*self.params['std']+self.params['mu']) self.stim.switch_to() self.fgObjects=(primitives.checkerBoard(x,y,sz,res,col), ) self.stat.switch_to() self.fgObjects[0].enableArrays()
def createObjects(self): displayObject.createObjects(self) x,y=self.pos if isscalar(self.params['intensity']): self.params['intensity']=array([self.params['intensity']]) intensity=self.params['intensity'] w=self.params['width'] x,y=self.pos square=primitives.Polygon(v=[(x-w/2,y-w/2),(x-w/2,y+w/2),(x+w/2,y+w/2),(x+w/2,y-w/2),(x-w/2,y-w/2)], color=self.bg, stroke=0) self.fgObjects=(square,) self.durF=ceil(self.params['duty']*2.*len(intensity))+100 self.preF=0 self.postF=0 self.totSteps=1
def createObjects(self): displayObject.createObjects(self) x,y=self.pos if isscalar(self.params['width']): self.params['width']=array([self.params['width']]) self.totSteps=len(self.params['width']) w=self.params['width'][self.step] v=[(x-w/2,y-w/2),(x-w/2,y+w/2),(x+w/2,y+w/2),(x+w/2,y-w/2),(x-w/2,y-w/2)] if 'fgsteps' in self.params.keys(): tmp=self.params['fgsteps'][mod(self.rep,len(self.params['fgsteps']))] fg=(tmp,tmp,tmp,1.) else: fg=self.fg square=primitives.Polygon(v=v, color=fg, stroke=0) self.fgObjects=(square,) box=primitives.Polygon(v=v,z=0, color=fg, stroke=2) self.statObjects+=(box,)
def createObjects(self): displayObject.createObjects(self) x,y=self.pos sz=float(self.params['sz']) try: res=float(self.params['res'][0]) except: res=float(self.params['res']) for n in range(int(res**2)): c=(myrand[mod(n+self.RC,len(myrand))]*self.params['std']+self.params['mu']) if c<0: c =0 elif c>1: c=1 color=(c,c,c,1) cornerx=x-sz//2+mod(n,res)*sz/res cornery=y+sz//2-(n//res)*sz/res vertexlist=[(cornerx,cornery),(cornerx+sz//res,cornery),(cornerx+sz//res,cornery-sz//res),(cornerx,cornery-sz//res)] self.fgObjects+=(primitives.Polygon(v=vertexlist,z=0,color=color,stroke=0),)
def createObjects(self): displayObject.createObjects(self) x,y=self.pos self.preF=list() self.durF=list() ''' self.preF.append(0) self.durF.append(self.params['pre'].max()+self.params['dur'].max()) ''' for i in range(len(self.params['pre'])): self.preF.append(ceil(self.params['pre'][i]*self.refreshRate)) self.durF.append(ceil(self.params['dur'][i]*self.refreshRate)) start=self.params['orientation'][i]-self.params['width'][i]/2 stop=self.params['orientation'][i]+self.params['width'][i]/2 sector=primitives.Arc(x,y, radius=self.params['radius'][i], start=start, sweep=stop-start, color=(self.params['fg'][i],self.params['fg'][i],self.params['fg'][i],1.), stroke=0, rotation=0.0, style=pyg.gl.GLU_FILL) self.fgObjects+=(sector,) self.postF=list(2*ones(len(self.preF))) spot=primitives.Circle(x,y,width=self.params['radius'][0]*2,color=self.fg,stroke=2) self.statObjects+=(spot,)
def createObjects(self): displayObject.createObjects(self) x,y=self.pos if isscalar(self.params['squarenum']): self.params['squarenum']=array([self.params['squarenum']]) self.totSteps=len(self.params['squarenum']) #n is 1 based (first circle is number 1, not 0) n=self.params['squarenum'][self.step] sz=self.params['sz'] res=self.params['res'] if floor(sz/float(res))!=sz/float(res): sz=res*(sz//res) if n>0: r=self.params['radius'] cornerx=x-sz/2+mod(n-1,res)*sz/res cornery=y+sz/2-((n-1)//res)*sz/res if 'fgCal' in self.params.keys() and n-1<len(self.params['fgCal']): fg=(self.params['fgCal'][n-1].astype(float64)/255.) self.fg=(fg,fg,fg,1.) #circle=primitives.Circle(centerx,centery,width=r*2,color=self.fg) v=[(cornerx,cornery),(cornerx+2*r,cornery),(cornerx+r*2,cornery-r*2),(cornerx,cornery-r*2)] square=primitives.Polygon(v=v,z=0,color=self.fg,stroke=0) self.fgObjects=(square,) box=primitives.Polygon(v=[(x-sz//2,y+sz//2),(x+sz//2,y+sz//2),(x+sz//2,y-sz//2),(x-sz//2,y-sz//2)],z=0, color=self.fg, stroke=2) #this takes care of the red box showing where the last square was displayed if self.step>0: n=self.params['squarenum'][self.step-1] cornerx=x-sz/2+mod(n-1,res)*sz/res cornery=y+sz/2-((n-1)//res)*sz/res v=[(cornerx,cornery),(cornerx+2*r,cornery),(cornerx+r*2,cornery-r*2),(cornerx,cornery-r*2)] last=primitives.Polygon(v=v,z=0,color=(1,0,0,1),stroke=2) self.statObjects+=(box,last) else: self.statObjects+=(box,)
def createObjects(self): displayObject.createObjects(self) sz=self.params['sz'] foreground=primitives.Polygon(v=[(W/2-sz/2,H/2-sz/2),(W/2-sz/2,H/2+sz/2),(W/2+sz/2,H/2+sz/2),(W/2+sz/2,H/2-sz/2),(W/2-sz/2,H/2-sz/2)], color=self.bg, stroke=0) self.fgObjects=(foreground,)
def createObjects(self): displayObject.createObjects(self) #self.params['squarenum']=arange(res**2)+1 self.myCreateObjects()
def createObjects(self): displayObject.createObjects(self) foreground=primitives.Polygon(v=[(0,0),(0,H),(W,H),(W,0),(0,0)],z=0, color=self.fg, stroke=0) self.fgObjects=(foreground,)