python程序设计与实验_用于创建实验的Python应用程序和库

python程序设计与实验

In this post, I will describe the existing free Python applications and libraries for creating experiments.  So far, I have only used PsychoPy but I plan to test most of them. At least the ones that seem to still be maintained. All applications and libraries are open-source which makes it possible to download the source code and add your own stuff to it.

在这篇文章中,我将描述现有的免费Python应用程序和库来创建实验。 到目前为止,我仅使用PsychoPy,但我计划测试其中的大多数。 至少那些似乎仍然得到维护的。 所有应用程序和库都是开源的,这使得下载源代码和向其中添加自己的东西成为可能。

实验建设者 (Experiment builders)

PsychoPy and OpenSesame are two applications for creating psychology, neuroscience, and psychophysics experiments. Both applications are free, open source, alternatives  to Presentation™ or e-Prime™. Judging by the number of citations in Google Scholar, PsychoPy seems to be the most frequently used.

PsychoPy和OpenSesame是创建心理学,神经科学和心理物理学实验的两个应用程序。 两种应用程序都是免费的,开源的,是Presentation™或e-Prime™的替代产品。 从Google Scholar中的引用次数来看,PsychoPy似乎是最常用的。

精神病学 (PsychoPy)

PsychoPy is simple to install and  is cross-platform (works on Linux, OS-X, and Windows).  It promises precision timing and it  has a lot of different types of stimuli ready to use.  An important aspect of PsychoPy is that if you prefer to write code you can do that using the Application Programming Interface (API). However, if you do not want to write code you can use the builder view. You can see PsychoPy – free software to use in Research for a more extensive post on PsychoPy. If you are interested in an example program you can have a look at  Sustained Attention Task In PsychoPy.

PsychoPy易于安装且跨平台(可在Linux,OS-X和Windows上运行)。 它保证了精确的计时,并且有许多不同类型的刺激可供使用。 PsychoPy的一个重要方面是,如果您喜欢编写代码,则可以使用应用程序编程接口(API)进行操作。 但是,如果您不想编写代码,则可以使用构建器视图。 您可以看到PsychoPy –可在Research中使用的免费软件,以获取有关PsychoPy的更广泛的文章。 如果您对示例程序感兴趣,可以查看PsychoPy中的Sustained Attention Task

PsychoPy Builder View
Builder View of PsychoPy GUI
PsychoPy GUI的构建器视图

芝麻开门 (OpenSesame)

OpenSesame is also easy to install and  works on Linux, OS-X, Windows, and Android (both tablets, phones, and computers). OpenSesame is based on PsychoPy and the library Expyriment. As far as I can see you are not able to choose to write your own script (i.e., it does not have a coding interface). However, you are probably able to use your own editor and write a script. It is also possible to choose back-end (see About back-ends). That is, you can choose to use xpyriment (Expyriment), psycho (PsychoPy),  legacy, opengl, and droid. It seems that xpyriment has replaced the opengl back-end. Much like E-prime, it is possible to write in-line scripts when needed. One interesting option in OpenSesame is that you seem to be able to test your experiment using auto responses. Another interesting feature of OpenSesame is that you seem to be able to create your own plug-ins and extensions.

OpenSesame还易于安装,并且可在Linux,OS-X,Windows和Android(平板电脑,手机和计算机)上使用。 OpenSesame基于PsychoPy和库Expyriment。 据我所知,您不能选择编写自己的脚本(即,它没有编码接口)。 但是,您可能可以使用自己的编辑器并编写脚本。 也可以选择后端(请参阅关于后端 )。 也就是说,您可以选择使用xpyriment(Expyriment),psycho(PsychoPy),legacy,opengl和droid。 看来xpyriment已经取代了opengl后端。 与E-prime一样,可以在需要时编写内联脚本。 OpenSesame中一个有趣的选项是,您似乎可以使用自动响应来测试实验。 OpenSesame的另一个有趣的功能是您似乎能够创建自己的插件和扩展。

OpenSesame Experiment Builder in Python
Experiment Builder OpenSesame
实验构建器OpenSesame

There are a lot of example experiments on both applications websites as well as in the interfaces. Furthermore, you can also find a lot of guides and tutorials on their websites. OpenSesames website also offer some standard tasks. For instance, you can find a Conjunctive Continuous Performance Task.

在应用程序网站和界面上都有很多示例实验。 此外,您还可以在他们的网站上找到很多指南和教程。 OpenSesames网站还提供一些标准任务。 例如,您可以找到一个连续性连续表现任务。

Python库 (Python Libraries)

报酬 (Expyriment)

Expyriment, The Vision Egg, and PyEPL are Python libraries. That is, while PsychoPy and OpenSesame offer graphical interfaces where you can create your experiment with minimal knowledge of Python programming the libraries requires you to write scripts. However, their aim seems to be to decrease scripting and seems to be relatively easy to use.

Expyriment,Vision Egg和PyEPL是Python库。 就是说,尽管PsychoPy和OpenSesame提供了图形界面,但您可以在其中使用Python编程的最少知识来创建实验,而库则需要您编写脚本。 但是,它们的目的似乎是减少脚本编写,并且似乎相对易于使用。

Expyriment is an open-source library and is, of course, also platform independent. Actually, this library is very promising since it also works on Android systems. This library takes cares of the presentation of stimuli. It can handle the recording of both input and output events, communication with other devices, and the collection and preprocessing of data. On the library’s website, it is stated that it suitable for researchers and students with little experience of programming.

Expyriment是一个开放源代码库,并且当然也是与平台无关的。 实际上,该库非常有前途,因为它也可以在Android系统上运行。 该库负责刺激的呈现。 它可以处理输入和输出事件的记录,与其他设备的通信以及数据的收集和预处理。 在图书馆的网站上说,它适合没有编程经验的研究人员和学生。

视觉蛋 (The Vision Egg)

The Vision Egg is a Python library. The purpose of the library seems to be the production of visual stimuli (the clue might be in its name). Judging from the library’s GitHub page, it has not been updated for roughly 3 years.

Vision Egg是一个Python库。 该库的目的似乎是视觉刺激的产生(线索可能就是它的名字)。 从库的GitHub页面来看,它大约三年没有更新。

PyEPL (PyEPL)

PyEPL (the Python Experiment-Programming Library) is the last Python library, I have found, for coding psychology experiments. PyEPL can be used to create both visual and auditory stimuli. It supports both manual (keyboard/joystick) and sound (microphone) input as responses.

我发现PyEPL(Python实验编程库)是最后一个用于对心理学实验进行编码的Python库。 PyEPL可用于创建视觉和听觉刺激。 它支持手动(键盘/操纵杆)和声音(麦克风)输入作为响应。

Note that for timing critical experiments it is probably wise to write your own scripts PsychoPy API or Expyriment.  This will let you use system specific (e.g., Linux specific if using Linux) settings and optimize your experiment based on the hardware available (see Garaizar & Vadillo, 2014 for tests and comparisons of PsychoPy, E-prime, and DMDX).

请注意,对于定时关键实验,编写自己的脚本PsychoPy API或Expyriment可能是明智的。 这将使您可以使用特定于系统的设置(例如,如果使用Linux,则为特定于Linux的设置),并根据可用的硬件优化实验(有关PsychoPy,E-prime和DMDX的测试和比较,请参阅Garaizar &Vadillo,2014年)。

To summarize,  PsychoPy seem to be the only application that offers both coding and builder interfaces. I am, therefore, suggesting that undergraduate students, as well as graduate students and researchers uses it. Naturally, that it is free and not dependent on windows also make it a really strong alternative to proprietary software such as E-prime and Presentation. However, this is true for all the Python based applications and libraries.  It might be worth end this post with noting that Python is also a free alternative to Matlab. Personally, I did find Python easier to learn compared to Matlab.

总而言之,PsychoPy似乎是唯一提供编码和构建器界面的应用程序。 因此,我建议本科生以及研究生和研究人员使用它。 自然,它是免费的并且不依赖于Windows,这也使其成为专有软件(例如E-prime和Presentation)的强大替代品。 但是,对于所有基于Python的应用程序和库都是如此。 值得一提的是,本文还是指出Python也是Matlab的免费替代品。 我个人确实发现,与Matlab相比,Python更易于学习。

相关文章: (Related posts:)

How to Install Psychopy on LMDE.

如何在LMDE上安装Psychopy。

Python script for trial randomization making use of PsychoPy’s TrialHandler.

利用PsychoPy的TrialHandler 进行随机试验的Python脚本

参考资料 (References)

Garaizar, P., & Vadillo, M. A. (2014). Accuracy and Precision of Visual Stimulus Timing in PsychoPy: No Timing Errors in Standard Usage. PLoS ONE, 9(11), e112033. http://doi.org/10.1371/journal.pone.0112033

Garaizar,P.&Vadillo,MA(2014)。 PsychoPy中视觉刺激计时的准确性和准确性:标准用法中没有计时错误。 公共科学图书馆,9(11),e112033。 http://doi.org/10.1371/journal.pone.0112033

Garaizar, P., Vadillo, M. A., López-de-Ipiña, D., & Matute, H. (2014). Measuring Software Timing Errors in the Presentation of Visual Stimuli in Cognitive Neuroscience Experiments. PLoS ONE, 9(1), e85108. http://doi.org/10.1371/journal.pone.0085108

Garaizar,P.,Vadillo,MA,López-de-Ipiña,D.,&Matute,H.(2014年)。 在认知神经科学实验中测量视觉刺激演示中的软件计时错误。 PLoS ONE,9(1),e85108。 http://doi.org/10.1371/journal.pone.0085108

Krause, F. & Lindemann, O. (2014). Expyriment: A Python library for cognitive and neuroscientific experiments. Behavior Research Methods, 46(2), 416-428. doi:10.3758/s13428-013-0390-6.

Krause,F.&Lindemann,O.(2014年)。 Expyriment:用于认知和神经科学实验的Python库。 行为研究方法,46(2),416-428。 doi:10.3758 / s13428-013-0390-6。

Mathôt, S., Schreij, D., & Theeuwes, J. (2012). OpenSesame: An open-source, graphical experiment builder for the social sciences. Behavior Research Methods, 44(2), 314-324. doi:10.3758/s13428-011-0168-7

Mathôt,S.,Schreij,D.和Theeuwes,J.(2012年)。 OpenSesame:社会科学的开源,图形化实验构建器。 行为研究方法,44(2),314-324。 doi:10.3758 / s13428-011-0168-7

Peirce, J. (2010). PsychoPy – Psychology software for Python. Integration The Vlsi Journal.

Peirce,J.(2010年)。 PsychoPy –适用于Python的心理学软件。 集成Vlsi Journal。

Peirce, J. W. (2007). PsychoPy-Psychophysics software in Python. Journal of Neuroscience Methods, 162(1-2), 8–13. http://doi.org/10.1016/j.jneumeth.2006.11.017

Peirce,JW(2007)。 Python中的PsychoPy-Psychophysics软件。 神经科学方法杂志,162(1-2),8-13。 http://doi.org/10.1016/j.jneumeth.2006.11.017

翻译自: https://www.pybloggers.com/2015/12/python-apps-and-libraries-for-creating-experiments/

python程序设计与实验

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值