分类 工具使用 下的文章

Routines and Flow例程与流程

The Builder view of the PsychoPy® application is designed to allow the rapid development of a wide range of experiments for experimental psychology and cognitive neuroscience experiments.
PsychoPy®应用的构建器视图旨在为实验心理学和认知神经科学实验提供快速开发多种实验的能力。
The Builder view comprises two main panels for viewing the experiment’s Routines (upper left) and another for viewing the Flow (lower part of the window).
构建器视图包含两个主要面板:上方左侧用于查看实验的例程(Routines),下方窗口区域用于查看流程(Flow)。
An experiment can have any number of Routines, describing the timing of stimuli, instructions and responses. These are portrayed in a simple track-based view, similar to that of video-editing software, which allows stimuli to come on go off repeatedly and to overlap with each other.
实验可以包含任意数量的例程(Routines),用于描述刺激呈现、指导语和反应的时间进程。这些例程以类似视频编辑软件的简单轨道化视图呈现,允许刺激反复出现、相互叠加。
The way in which these Routines are combined and/or repeated is controlled by the Flow panel. All experiments have exactly one Flow. This takes the form of a standard flowchart allowing a sequence of routines to occur one after another, and for loops to be inserted around one or more of the Routines. The loop also controls variables that change between repetitions, such as stimulus attributes.
例程的组合方式和重复次数由流程面板(Flow panel)控制。所有实验必须包含且仅有一个流程(Flow)。流程采用标准流程图形式,允许按顺序排列多个例程,并在例程周围插入循环。循环同时控制每次重复时变化的变量(如刺激属性)。
If it is your first time opening PsychoPy®, we highly recommend taking a look at the large number of inbuilt demos that come with PsychoPy®. This can be done through selecting Demos > unpack demos within your application. Another good place to get started is to take a look at the many openly available demos at pavlovia.org you can view an intro to Pavlovia at our Youtube channel.
如果您是首次打开PsychoPy®,我们强烈建议您查看应用内置的大量演示实验。可通过菜单栏选择「Demos > 解压演示」访问这些示例。另一个入门途径是访问Pavlovia平台的开源演示库(pavlovia.org),您可以在我们的YouTube频道观看Pavlovia平台介绍视频。
p1.png
The |PsychoPy| builder, the Routines panel an the Flow are highlighted, if you are new to |PsychoPy|, we recommend starting by unpacking your demos and exploring the example tasks
|PsychoPy| 构建器、例程面板(Routines panel)和流程(Flow)会被突出显示。若您是 |PsychoPy| 新手,我们建议您从解压演示实验并探索示例任务开始。

The components panel组件面板

You can add components to an experiment by selecting components from the Components panel. This is currently divided into 7 sections:
您可以通过从组件面板(Components panel)中选择组件向实验添加组件。当前面板分为7个部分:
Favorites - your commonly used components
收藏夹 - 常用组件
Stimuli - components used to present a stimulus (e.g. a visual image or shape, or an auditory tone or file)
刺激 - 用于呈现刺激的组件(例如视觉图像/形状,或听觉音调/文件)
Responses - stimulu used to gather responses (e.g. keyboards or mouse components - amongst many others!)
反应 - 用于收集反应的组件(例如键盘或鼠标组件等!)
Custom - builder can be used to make a fair few complex experiments now, but for added flexibility, you can add code components at any point in an experiment (e.g. for providing response-dependant feedback).
自定义 - 构建器现已支持创建较复杂的实验,但为增加灵活性,您可在实验任意位置添加代码组件(例如提供反应依赖性反馈)。
EEG - PsychoPy® can actually be used with a range of EEG devices. Most of these are interacted with through delivering a trigger through the parallel port (see I/O below), or serial port (see ../api/serial.html). However, PsychoPy® Builder has inbuilt support (i.e. no need for code snippets) for working with Emotiv EEG, you can view a Youtube tutorial on how to use Emotiv EEG with PsychoPy here.
EEG - PsychoPy® 可与多种脑电设备配合使用。多数设备通过并行端口发送触发信号(见下方I/O说明)或串口通信(见../api/serial.html)。但PsychoPy®构建器已内置对Emotiv脑电的支持(无需代码片段),您可通过此链接查看YouTube教程。
Eyetracking - PsychoPy® 2021.2 released inbuilt supprort for eyetrackers! PsychoPy® had supported eye tracker research for a while, but not via components in PsychoPy® builder. You can learn more about these from the more specific components.html info.
眼动追踪 - PsychoPy® 2021.2 已内置眼动仪支持!此前PsychoPy®虽支持眼动研究,但无法通过构建器组件实现。更多信息请参阅components.html文档。
I/O - I/O stands for “input/output” under the hood this is ../api/iohub.html, this is useful for if you are working with external hardware devices requiring communication via the parallel port (e.g. EEG).
I/O - I/O代表“输入/输出”,底层对应../api/iohub.html。此功能适用于需通过并行端口(如EEG设备)与外部硬件通信的场景。

Making experiments to go online创建可在线运行的实验

p2.png
Buttons to interact with pavlovia.org from your experiment builder
从实验构建器与pavlovia.org交互的按钮
Before making an experiment to go online, it is a good idea to check the status of online options - remember PsychoJS (the javascript sister library of PsychoPy®) is younger that PsychoPy® - so not everything can be done online yet! but for most components there are prototype work arounds to still make things possible (e.e. RDKs and staircases). You can learn more about taking experiments online from builder via the online documentation.
在创建在线实验前,建议先查看在线选项的状态——请注意PsychoJS(PsychoPy®的JavaScript姊妹库)比PsychoPy®年轻,因此并非所有功能都能在线实现!不过大多数组件已有原型解决方案(例如随机点运动刺激RDKs和阶梯法staircases)。您可通过在线文档了解如何通过构建器将实验部署到线上。

Builder
构建器
Building experiments in a GUI
使用图形用户界面构建实验
Making your experiments using the PsychoPy® builder is the approach that we generally recommend. Why would we (a team of programmers) recommend using a GUI?:
我们通常推荐使用PsychoPy®构建器来创建实验。作为一个程序员团队,我们为何会推荐使用图形界面呢?原因如下:
制作速度更快
通过图形界面搭建实验流程,效率远高于手动编写代码。
降低实验错误率
自行编写代码的实验容易因疏忽产生漏洞——即使是由顶尖程序员编写也是如此!而构建器通过模块化设计减少了此类风险。
轻松实现在线实验
PsychoPy构建器在后台会自动生成Python脚本。若您希望将实验部署到浏览器运行,它还能通过姊妹库PsychoJS编译出JavaScript版本(需注意:PsychoJS作为新生工具,其功能完备性可能不及PsychoPy本体。建议在开发在线实验前查阅平台最新支持情况)。目前最便捷的PsychoPy在线实验托管平台是Pavlovia®,且构建器已内置与该平台的深度集成。
丰富的学习资源
PsychoPy官方YouTube频道提供大量入门教程,另有图文教程和实验模板库。教学场景中,构建器视图也配备了多样化的教学素材支持。
p.png
Contents: → 内容
Builder concepts → 构建器概念
Routines and Flow → 例程与流程
The components panel → 组件面板
Making experiments to go online → 创建可在线运行的实验
Routines → 例程
Flow → 流程
Adding Routines → 添加例程
Loops → 循环
Using a Staircase → 使用阶梯法
Using a simple staircase → 使用基础阶梯法
Using a QUEST staircase → 使用QUEST阶梯法
Using a QUEST Plus staircase → 使用QUEST Plus阶梯法
Blocks of trials and counterbalancing → 试次块与平衡设计
Blocking similar conditions → 对相似条件分组平衡
Counterbalancing similar conditions → 对相似条件交叉平衡
Counterbalancing different subtasks → 对不同子任务交叉平衡
Components → 组件
Pavlovia Survey → Pavlovia调查组件
Aperture Component → 孔径组件
Brush Component → 画笔组件
Button Component → 按钮组件
CameraComponent → 摄像头组件
Cedrus Button Box Component → Cedrus按钮盒组件
Code Component → 代码组件
Counterbalance Standalone Routine → 平衡独立例程
DotsComponent → 点组件
Emotiv Marking Component → Emotiv标记组件
Emotiv Record Component → Emotiv记录组件
Eye Tracker Region of Interest Component → 眼动仪感兴趣区域组件
Eye Tracker Calibration Component (Standalone Routine) → 眼动仪校准组件(独立例程)
EyetrackerRecordComponent → 眼动仪记录组件
Eye Tracker Validation Component (Standalone Routine) → 眼动仪验证组件(独立例程)
FormComponent → 表单组件
Creating a Google Cloud Speech API key → 创建Google Cloud语音API密钥
Grating Component → 光栅组件
Image Component → 图像组件
ioLab Systems buttonbox Component → ioLab系统按钮盒组件
JoyButtons Component → 摇杆按钮组件
Joystick Component → 摇杆组件
Keyboard Component → 键盘组件
Microphone Component → 麦克风组件
Mouse Component → 鼠标组件
Movie Component → 视频组件
Panorama Component → 全景组件
Parallel Port Out Component → 并行端口输出组件
Patch (image) Component → 补丁(图像)组件
Polygon (shape) Component → 多边形(形状)组件
Progress Bar Component → 进度条组件
Pump Component → 泵组件
RatingScale Component → 评分量表组件
Resource Manager Component → 资源管理器组件
Example: Loading resources in the background of instructions → 示例:在指令背景中加载资源
Loading resources for blocked or branched designs, or loading trial-by-trial → 为分块/分支设计加载资源,或逐试次加载资源
Reward Component → 奖励组件
Serial Port Out Component → 串口输出组件
Slider Component → 滑块组件
Sound Component → 声音组件
Static Component → 静态组件
Custom → 自定义
Text Component → 文本组件
Textbox Component → 文本框组件
Variable Component → 变量组件
Entering parameters → 参数输入
How often to evaluate the variable/code → 代码/变量的评估频率
Experiment settings → 实验设置
Settings → 设置
Defining the onset/duration of components → 定义组件的启动时间/持续时间
Examples → 示例
Generating outputs (datafiles) → 生成输出(数据文件)
Common Mistakes (aka Gotcha’s) → 常见错误(Gotchas)
General Advice → 通用建议
My stimulus isn’t appearing, there’s only the grey background → 我的刺激未显示,只有灰色背景
The loop isn’t using my Excel spreadsheet → 循环未使用我的Excel表格
I just want a plain square, but it’s turning into a grating → 我想要纯方框却出现光栅
The code snippet I’ve entered doesn’t do anything → 输入的代码片段无效
My stimulus isn’t changing as I progress through the loop → 循环中刺激未按预期变化
I’m getting the error message AttributeError: ‘unicode object has no attribute ‘XXXX’ → 报错:AttributeError: 'unicode'对象没有属性'XXXX'
The window opens and immediately closes → 窗口打开后立即关闭
Compiling a Script → 编译脚本
Set up your monitor properly → 正确设置显示器参数