• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python components.getInitVals函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中psychopy.app.builder.components.getInitVals函数的典型用法代码示例。如果您正苦于以下问题:Python getInitVals函数的具体用法?Python getInitVals怎么用?Python getInitVals使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了getInitVals函数的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: _writeCreationCode

 def _writeCreationCode(self,buff,useInits):
     #This will be called by either self.writeInitCode() or self.writeRoutineStartCode()
     #The reason for this is that moviestim is actually created fresh each time the
     #movie is loaded.
     #leave units blank if not needed
     if self.params['units'].val=='from exp settings': unitsStr=""
     else: unitsStr="units=%(units)s, " %self.params
     #If we're in writeInitCode then we need to convert params to initVals
     #because some (variable) params haven't been created yet.
     if useInits:
         params = components.getInitVals(self.params)
     else:
         params = self.params
     if self.params['backend'].val=='moviepy':
         buff.writeIndented("%s = visual.MovieStim3(win=win, name='%s',%s\n" %(params['name'],params['name'],unitsStr))
     elif self.params['backend'].val=='avbin':
         buff.writeIndented("%s = visual.MovieStim(win=win, name='%s',%s\n" %(params['name'],params['name'],unitsStr))
     else:
         buff.writeIndented("%s = visual.MovieStim2(win=win, name='%s',%s\n" %(params['name'],params['name'],unitsStr))
     buff.writeIndented("    filename=%(movie)s,\n" %(params))
     buff.writeIndented("    ori=%(ori)s, pos=%(pos)s, opacity=%(opacity)s,\n" %(params))
     if self.params['size'].val != '':
         buff.writeIndented("    size=%(size)s,\n"%(params))
     depth = -self.getPosInRoutine()
     buff.writeIndented("    depth=%.1f,\n" %depth)
     buff.writeIndented("    )\n")
开发者ID:natsn,项目名称:psychopy,代码行数:26,代码来源:movie.py


示例2: writeInitCode

 def writeInitCode(self, buff):
     kwargs = getInitVals(self.params) #replaces variable params with defaults
     kwargs['units'] = '\'\'' if self.params['units'].val == 'from exp settings' else self.params['units']
     kwargs.update(self.SHAPE_PARAMS[self.params['shape'].val])
     buff.writeIndented("%(name)s = visual.ShapeStim(win=win, name='%(name)s',units=%(units)s,\n" % kwargs)
     buff.writeIndented("    ori=%(ori)s, pos=%(pos)s, size=%(size)s, fillColor=%(color)s,\n" % kwargs)
     buff.writeIndented("    opacity=%(opacity)s, vertices=%(vertices)s, lineColor=None)\n" % kwargs)
开发者ID:BrainTech,项目名称:psychopy,代码行数:7,代码来源:shapes.py


示例3: writeInitCode

 def writeInitCode(self, buff):
     # do we need units code?
     if self.params["units"].val == "from exp settings":
         unitsStr = ""
     else:
         unitsStr = "units=%(units)s, " % self.params
     # do writing of init
     inits = components.getInitVals(self.params)  # replaces variable params with sensible defaults
     if self.params["wrapWidth"].val in ["", "None", "none"]:
         inits["wrapWidth"] = "None"
     buff.writeIndented("%(name)s = visual.TextStim(win=win, ori=%(ori)s, name='%(name)s',\n" % (inits))
     buff.writeIndented("    text=%(text)s," % inits)
     buff.writeIndented("    font=%(font)s,\n" % inits)
     buff.writeIndented(
         "    " + unitsStr + "pos=%(pos)s, height=%(letterHeight)s, wrapWidth=%(wrapWidth)s,\n" % (inits)
     )
     buff.writeIndented("    color=%(color)s, colorSpace=%(colorSpace)s, opacity=%(opacity)s,\n" % (inits))
     flip = self.params["flip"].val.strip()
     if flip == "horiz":
         buff.writeIndented("    flipHoriz=%s," % bool(flip == "horiz"))
     elif flip == "vert":
         buff.writeIndented("    flipVert=%s," % bool(flip == "vert"))
     elif flip:
         raise ValueError(
             "flip value should be 'horiz' or 'vert' (no quotes) in component '%s'" % self.params["name"].val
         )
     depth = -self.getPosInRoutine()
     buff.writeIndented("    depth=%.1f)\n" % (depth))
开发者ID:JasonLocklin,项目名称:psychopy,代码行数:28,代码来源:text.py


示例4: writeInitCode

 def writeInitCode(self,buff):
     #do we need units code?
     if self.params['units'].val=='from exp settings': unitsStr=""
     else: unitsStr="units=%(units)s, " %self.params
     inits = getInitVals(self.params)#replaces variable params with defaults
     if inits['size'].val=='1.0':
         inits['size'].val = '[1.0, 1.0]'
     if self.params['nVertices'].val == '2':
         buff.writeIndented("%s = visual.Line(win=win, name='%s',%s\n" %(inits['name'],inits['name'],unitsStr))
         buff.writeIndented("    start=(-%(size)s[0]/2.0, 0), end=(+%(size)s[0]/2.0, 0),\n" %(inits) )
     elif self.params['nVertices'].val == '3':
         buff.writeIndented("%s = visual.ShapeStim(win=win, name='%s',%s\n" %(inits['name'],inits['name'],unitsStr))
         buff.writeIndented("    vertices = [[-%(size)s[0]/2.0,-%(size)s[1]/2.0], [+%(size)s[0]/2.0,-%(size)s[1]/2.0], [0,%(size)s[1]/2.0]],\n" %(inits) )
     elif self.params['nVertices'].val == '4':
         buff.writeIndented("%s = visual.Rect(win=win, name='%s',%s\n" %(inits['name'],inits['name'],unitsStr))
         buff.writeIndented("    width=%(size)s[0], height=%(size)s[1],\n" %(inits) )
     else:
         buff.writeIndented("%s = visual.Polygon(win=win, name='%s',%s\n" %(inits['name'],inits['name'],unitsStr))
         buff.writeIndented("    edges = %s," % str(inits['nVertices'].val))
         buff.writeIndented(" size=%(size)s,\n" %(inits) )
     buff.writeIndented("    ori=%(ori)s, pos=%(pos)s,\n" %(inits) )
     buff.writeIndented("    lineWidth=%(lineWidth)s, lineColor=%(lineColor)s, lineColorSpace=%(lineColorSpace)s,\n" %(inits) )
     buff.writeIndented("    fillColor=%(fillColor)s, fillColorSpace=%(fillColorSpace)s,\n" %(inits) )
     buff.writeIndented("    opacity=%(opacity)s," %(inits) )
     depth = -self.getPosInRoutine()
     buff.write("depth=%.1f, \n" %depth)#finish with newline
     if self.params['interpolate'].val=='linear':
         buff.write("interpolate=True)\n")
     else: buff.write("interpolate=False)\n")
开发者ID:NSalem,项目名称:psychopy,代码行数:29,代码来源:polygon.py


示例5: writeInitCode

 def writeInitCode(self,buff):
     inits = components.getInitVals(self.params)#replaces variable params with sensible defaults
     if self.params['stopType'].val=='duration (s)' and len(self.params['stopVal'].val)>0:
         durationSetting=", secs=%(stopVal)s" %self.params
     else:
         durationSetting=""
     buff.writeIndented("%s = sound.Sound(%s%s)\n" %(inits['name'], inits['sound'], durationSetting))
     buff.writeIndented("%(name)s.setVolume(%(volume)s)\n" %(inits))
开发者ID:DiogoamCoutinho,项目名称:stimulus.py,代码行数:8,代码来源:sound.py


示例6: writeInitCode

 def writeInitCode(self, buff):
     inits = components.getInitVals(self.params)  # replaces variable params with sensible defaults
     if self.params["stopType"] == "duration (s)":
         durationSetting = "secs=%(stopVal)s" % self.params
     else:
         durationSetting = ""
     buff.writeIndented("%s=sound.Sound(%s,%s)\n" % (inits["name"], inits["sound"], durationSetting))
     buff.writeIndented("%(name)s.setVolume(%(volume)s)\n" % (inits))
开发者ID:chrox,项目名称:psychopy,代码行数:8,代码来源:sound.py


示例7: writeInitCode

 def writeInitCode(self, buff):
     #do we need units code?
     if self.params['units'].val=='from exp settings': unitsStr=""
     else: unitsStr="units=%(units)s, " %self.params
     #do writing of init
     inits = components.getInitVals(self.params)
     buff.writeIndented("%(name)s = visual.Aperture(win=win, name='%(name)s',\n" % (inits))
     buff.writeIndented("    "+unitsStr+"size=%(size)s, pos=%(pos)s)\n" % (inits))
     buff.writeIndented("%(name)s.disable()  # disable until its actually used\n" %(inits))
开发者ID:glupyan,项目名称:psychopy,代码行数:9,代码来源:aperture.py


示例8: writeInitCode

 def writeInitCode(self,buff):
     #if the movie is constant then load it once at beginning of script.
     #if it changes each repeat then we should wait and creat the entire object at
     #Routine start
     if self.params['movie'].updates=='constant':
         initVals = getInitVals(self.params)
         buff.writeIndented("%(name)s=visual.MovieStim(win=win, filename=%(movie)s, name='%(name)s',\n" %(self.params))
         buff.writeIndented("    ori=%(ori)s, pos=%(pos)s" %(self.params))
         if self.params['size'].val != '': buff.writeIndented(", size=%(size)s"%(self.params))
         buff.writeIndented(")\n")
开发者ID:kohske,项目名称:psychopy,代码行数:10,代码来源:movie.py


示例9: writeInitCode

 def writeInitCode(self,buff):
     #do we need units code?
     if self.params['units'].val=='window units': unitsStr=""
     else: unitsStr="units=%(units)s, " %self.params
     #do writing of init
     inits = getInitVals(self.params)#replaces variable params with sensible defaults
     buff.writeIndented("%(name)s=visual.TextStim(win=win, ori=%(ori)s, name='%(name)s',\n" %(inits))
     buff.writeIndented("    text=%(text)s,\n" %inits)
     buff.writeIndented("    font=%(font)s,\n" %inits)
     buff.writeIndented("    "+unitsStr+"pos=%(pos)s, height=%(letterHeight)s,\n" %(inits))
     buff.writeIndented("    color=%(color)s, colorSpace=%(colorSpace)s)\n" %(inits))
开发者ID:kohske,项目名称:psychopy,代码行数:11,代码来源:text.py


示例10: writeInitCode

 def writeInitCode(self,buff):
     inits = getInitVals(self.params)#replaces variable params with defaults
     buff.writeIndented("%(name)s=visual.PatchStim(win=win, name='%(name)s',\n" %(inits))
     buff.writeIndented("    tex=%(image)s, mask=%(mask)s,\n" %(inits))
     buff.writeIndented("    ori=%(ori)s, pos=%(pos)s, size=%(size)s, sf=%(sf)s, phase=%(phase)s,\n" %(inits) )
     buff.writeIndented("    color=%(color)s, colorSpace=%(colorSpace)s,\n" %(inits) )
     buff.writeIndented("    texRes=%(texture resolution)s" %(inits))# no newline - start optional parameters
     if self.params['units'].val!='window units': buff.write(", units=%(units)s" %(inits) )
     if self.params['interpolate']=='linear':
         buff.write(", interpolate=True")
     else: buff.write(", interpolate=False")
     buff.write(")\n")#finish with newline
开发者ID:kohske,项目名称:psychopy,代码行数:12,代码来源:patch.py


示例11: writeInitCode

 def writeInitCode(self,buff):
     #do we need units code?
     if self.params['units'].val=='from exp settings': unitsStr=""
     else: unitsStr="units=%(units)s, " %self.params
     #do writing of init
     inits = components.getInitVals(self.params)#replaces variable params with sensible defaults
     buff.writeIndented("%s=visual.DotStim(win=win, name='%s',%s\n" %(inits['name'], inits['name'],unitsStr))
     buff.writeIndented("    nDots=%(nDots)s, dotSize=%(dotSize)s,\n" %(inits))
     buff.writeIndented("    speed=%(speed)s, dir=%(dir)s, coherence=%(coherence)s,\n" %(inits))
     buff.writeIndented("    fieldPos=%(fieldPos)s, fieldSize=%(fieldSize)s,fieldShape=%(fieldShape)s,\n" %(inits))
     buff.writeIndented("    signalDots=%(signalDots)s, noiseDots=%(noiseDots)s,dotLife=%(dotLife)s,\n" %(inits))
     buff.writeIndented("    color=%(color)s, colorSpace=%(colorSpace)s, opacity=%(opacity)s)\n" %(inits))
开发者ID:nnb,项目名称:psychopy,代码行数:12,代码来源:dots.py


示例12: writeInitCode

 def writeInitCode(self,buff):
     #do we need units code?
     if self.params['units'].val=='from exp settings': unitsStr=""
     else: unitsStr="units=%(units)s, " %self.params
     inits = getInitVals(self.params)#replaces variable params with defaults
     buff.writeIndented("%s = visual.GratingStim(win=win, name='%s',%s\n" %(inits['name'],inits['name'],unitsStr))
     buff.writeIndented("    tex=%(tex)s, mask=%(mask)s,\n" %(inits))
     buff.writeIndented("    ori=%(ori)s, pos=%(pos)s, size=%(size)s, sf=%(sf)s, phase=%(phase)s,\n" %(inits) )
     buff.writeIndented("    color=%(color)s, colorSpace=%(colorSpace)s, opacity=%(opacity)s,\n" %(inits) )
     buff.writeIndented("    texRes=%(texture resolution)s" %(inits))# no newline - start optional parameters
     if self.params['interpolate'].val=='linear':
         buff.write(", interpolate=True")
     else: buff.write(", interpolate=False")
     depth = -self.getPosInRoutine()
     buff.write(", depth=%.1f)\n" %depth)#finish with newline
开发者ID:MattIBall,项目名称:psychopy,代码行数:15,代码来源:grating.py


示例13: writeInitCode

 def writeInitCode(self,buff):
     #do we need units code?
     if self.params['units'].val=='from exp settings': unitsStr=""
     else: unitsStr="units=%(units)s, " %self.params
     #do writing of init
     inits = components.getInitVals(self.params)#replaces variable params with sensible defaults
     if self.params['wrapWidth'].val in ['','None','none']:
         inits['wrapWidth']='None'
     buff.writeIndented("%(name)s=visual.TextStim(win=win, ori=%(ori)s, name='%(name)s',\n" %(inits))
     buff.writeIndented("    text=%(text)s,\n" %inits)
     buff.writeIndented("    font=%(font)s,\n" %inits)
     buff.writeIndented("    "+unitsStr+"pos=%(pos)s, height=%(letterHeight)s,wrapWidth=%(wrapWidth)s,\n" %(inits))
     buff.writeIndented("    color=%(color)s, colorSpace=%(colorSpace)s, opacity=%(opacity)s,\n" %(inits))
     depth=-self.getPosInRoutine()
     buff.writeIndented("    depth=%.1f)\n" %(depth))
开发者ID:chrox,项目名称:psychopy,代码行数:15,代码来源:text.py


示例14: writeInitCode

 def writeInitCode(self, buff):
     # do we need units code?
     if self.params["units"].val == "from exp settings":
         unitsStr = ""
     else:
         unitsStr = "units=%(units)s, " % self.params
     # do writing of init
     inits = components.getInitVals(self.params)  # replaces variable params with sensible defaults
     if self.params["wrapWidth"].val in ["", "None", "none"]:
         inits["wrapWidth"] = "None"
     buff.writeIndented("%(name)s=visual.TextStim(win=win, ori=%(ori)s, name='%(name)s',\n" % (inits))
     buff.writeIndented("    text=%(text)s,\n" % inits)
     buff.writeIndented("    font=%(font)s,\n" % inits)
     buff.writeIndented(
         "    " + unitsStr + "pos=%(pos)s, height=%(letterHeight)s,wrapWidth=%(wrapWidth)s,\n" % (inits)
     )
     buff.writeIndented("    color=%(color)s, colorSpace=%(colorSpace)s, opacity=%(opacity)s)\n" % (inits))
开发者ID:nnb,项目名称:psychopy,代码行数:17,代码来源:text.py


示例15: writeInitCode

 def writeInitCode(self,buff):
     #do we need units code?
     if self.params['units'].val=='from exp settings': unitsStr=""
     else: unitsStr="units=%(units)s, " %self.params
     #do writing of init
     inits = components.getInitVals(self.params)#replaces variable params with sensible defaults
     if self.params['wrapWidth'].val in ['','None','none']:
         inits['wrapWidth']='None'
     buff.writeIndented("%(name)s = visual.TextStim(win=win, ori=%(ori)s, name='%(name)s',\n" %(inits))
     buff.writeIndented("    text=%(text)s," %inits)
     buff.writeIndented("    font=%(font)s,\n" %inits)
     buff.writeIndented("    "+unitsStr+"pos=%(pos)s, height=%(letterHeight)s, wrapWidth=%(wrapWidth)s,\n" %(inits))
     buff.writeIndented("    color=%(color)s, colorSpace=%(colorSpace)s, opacity=%(opacity)s,\n" %(inits))
     flip = self.params['flip'].val
     if flip == 'horiz':
         buff.writeIndented("    flipHoriz=%s," % bool(flip == 'horiz') )
     elif flip == 'vert':
         buff.writeIndented("    flipVert=%s," % bool(flip == 'vert') )
     elif '$' in flip and self.params['flip'].updates == 'constant':
         print 'Warning: %s Flip appears to be variable, but updates are constant' % self.params['name']
     depth=-self.getPosInRoutine()
     buff.writeIndented("    depth=%.1f)\n" %(depth))
开发者ID:DiogoamCoutinho,项目名称:stimulus.py,代码行数:22,代码来源:text.py


示例16: writeInitCode

 def writeInitCode(self, buff):
     inits = components.getInitVals(self.params)
     #do writing of init
     buff.writeIndented("%(name)s=visual.Aperture(win=win, name='%(name)s',\n" % (inits))
     buff.writeIndented("    size=%(size)s, pos=%(pos)s, units='pix')\n" % (inits))
     buff.writeIndented("%(name)s.disable() # is enabled by default\n" %(inits))
开发者ID:RSharman,项目名称:psychopy,代码行数:6,代码来源:aperture.py


示例17: writeInitCode

 def writeInitCode(self,buff):
     inits = components.getInitVals(self.params)#replaces variable params with sensible defaults
     buff.writeIndented("%s = sound.Sound(%s, secs=-1)\n" %(inits['name'], inits['sound']))
     buff.writeIndented("%(name)s.setVolume(%(volume)s)\n" %(inits))
开发者ID:NSalem,项目名称:psychopy,代码行数:4,代码来源:sound.py


示例18: writeRoutineStartCode

 def writeRoutineStartCode(self,buff):
     inits = components.getInitVals(self.params)
     buff.writeIndented("%s = microphone.AdvAudioCapture(name='%s', saveDir=wavDirName, stereo=%s)\n" %(
         inits['name'], inits['name'], inits['stereo']))
开发者ID:NSalem,项目名称:psychopy,代码行数:4,代码来源:microphone.py


示例19: writeRoutineStartCode

 def writeRoutineStartCode(self,buff):
     inits = components.getInitVals(self.params) #replaces variable params with sensible defaults
     buff.writeIndented("%s = microphone.SimpleAudioCapture(name='%s', saveDir=wavDirName)\n" %(
         inits['name'], inits['name']))
开发者ID:jsalva,项目名称:psychopy,代码行数:4,代码来源:microphone.py



注:本文中的psychopy.app.builder.components.getInitVals函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap