psychopy

How to create a continuous visual.Window background/wrapping of background?

柔情痞子 提交于 2019-12-11 19:06:26
问题 For instance, in my case, a cluster of random dots derived from ElementArrayStim spreaded across the stimulus window with the cluster centred on (0,0) moving at x=5. Eventually, each of these dots will hit the window's right boundary. How do I make these dots reappear on the left window boundary in a smooth transition? 回答1: The strategy is to look into psychopy.visual.ElementArrayStim.xys which is an Nx2 numpy.array of the current coordinates of all N elements. You can get the N indicies

Duplicating random visual stimuli in Python/Psychopy

妖精的绣舞 提交于 2019-12-11 12:46:42
问题 Using Python/Psychopy. I am presenting 3 random visual stimuli to the center of the screen for 1 second (imgList1). I am then presenting 3 other random visual stimuli to the upper right of the screen (imgList). On 50% of occasions I need the second group of stimuli (imgList) to be the same as the first (imgList1). How do i access which stimuli were randomly selected at part 1 so i can then use that information to display those same ones thereafter? I am not sure how to keep track of what

Key Releases Psychopy

孤街浪徒 提交于 2019-12-11 08:27:01
问题 I'm fairly new to psychopy but I'm having a lot of trouble recording keyboard events so far. The keyboard demo works so I know it is possible, but when I implement the code in my own program it doesn't record any keyboard activity at all. Right now my program is super simple as I'm just trying to get the hang of it. I have a picture and want to record the duration of keypresses during the time the picture is on screen. I have a couple print statements as sanity checks and when I run it (and

PsychoPy Key Down Code using ioHub

怎甘沉沦 提交于 2019-12-11 04:51:24
问题 I am trying to write a code in which the user is able to adjust the length of a line with the up and down arrow keys. I am able to have the user adjust the line by pressing them, but this takes a very long time since I am having it so that the length increases (if the up key is pressed) or decreases (if the down key is pressed) by 1 pixel every time a key is pressed. I was wondering if anyone knew how to adjust the length of a line while a key is held down and stop the adjustment of that line

Why does my dialogue box not show when fullscr=True?

自作多情 提交于 2019-12-10 16:15:51
问题 I want to display a dialogue box to ask an experimental participant to enter a number, using psychopy. When fullscr=False in win, the dialogue box displays. When fullscr=True , it doesn't appear, even though typing the number and then return does progress the program to the next loop. Any ideas why? Relevant code lines below. from psychopy import visual, event, core, data, gui, logging win = visual.Window([1024,768], fullscr=True, units='pix', autoLog=True) respInfo={} respInfo['duration']=''

Shuffle two lists in the same order in python

こ雲淡風輕ζ 提交于 2019-12-10 11:19:28
问题 I have a question about shuffling, but first, here is my code: from psychopy import visual, event, gui import random, os from random import shuffle from PIL import Image import glob a = glob.glob("DDtest/targetimagelist1/*") b = glob.glob("DDtest/distractorimagelist1/*") target = a distractor = b pos1 = [-.05,-.05] pos2 = [.05, .05] shuffle(a) shuffle(b) def loop_function_bro(): win = visual.Window(size=(1280, 800), fullscr=True, screen=0, monitor='testMonitor', color=[-1,-1,-1], colorSpace=

psychopy coder模式编写心理试验程序 字符程序和记录反应时

末鹿安然 提交于 2019-12-10 05:28:37
自变量 呈现3个字母,中间为A或者B的话,被试需要反应f,中间为X或Y的话,被试需要反应j。 3个字母中间有两种情况:AB或XY 3个字母两边有同类或异类两种情况:AB两边是AB为同类,为XY为异类;XY则反之 3个字母两边的颜色:红、绿、蓝 注视点呈现时间:400ms、500ms、600ms 因变量 被试的反应时和判断正确率 实验设计 480次trail 注视点呈现400ms、500ms和600ms分别160次 红、绿、蓝分别160次 中间为A的情况120次,其中60次两边为B(同类),30次两边为X(异类),30次两边为Y (异类) 中间为B、X和Y的情况依此构造 需要记录的结果 被试ID、实验序号、注视点呈现时间、呈现的字母、两边字母的颜色、正确的反应按键、实际的反应按键、反应时、是否反应正确。 程序思路 首先准备实验刺激,生成有16个项目的trailTypes,和颜色组合成48种,翻10倍,再和注视点时间进行搭配。之后写函数来实现具体程序。阅读程序时,从“这是程序真正开始的地方”开始阅读会比较容易,之后再具体看程序。 # -*- coding: utf-8 -*- """ Created on Sun Apr 10 12:40:30 2016 @author: zbg """ from psychopy.visual import Window, ImageStim,

python tkinter 编写心理学试验程序干扰任务之四则运算 psychopy

安稳与你 提交于 2019-12-10 05:18:41
在训练任务与回忆任务之间,要求被试做4分钟的四则运算,包括20以内的加法、减法和乘法,被试需要输入运算结果。无论被试是否计算正确,皆进入下一题。4分钟的时间到后,结束干扰任务。 考虑到要求被试输入,用psychopy显得繁琐,使用了tkinter来做显示界面。 tkinter是python的自带模块,安装psychopy的计算机可以直接import tkinter来使用它。 # -*- coding: utf-8 -*- """ Created on Sun Aug 28 13:51:46 2016 @author: zbg 4分钟的四则运算 被试输入运算结果 无论是否正确,则进入下一题 """ from Tkinter import * #引入模块 import random from time import time as gettime #实验阶段 phase = "pre" timestart = 0 timelimit = 240 s = '' ans = '' def generate(): a = random.randint(1, 20) b = random.randint(1, 20) op = ['+', '-', '*'][random.randint(0, 2)] s = `a` + op + `b` ans = `eval(s)` if ans < 0:

psychopy心理学编程 socket联机通讯示例

余生颓废 提交于 2019-12-10 05:02:16
psychopy 定做实验程序 https://item.taobao.com/item.htm?spm=a230r.1.14.6.Q6E2OW&id=530690095131&ns=1&abbucket=15#detail 有的实验会用到两台电脑联机,要求被试互相为对方分配赏金或者得分,要求被试之间合作或者竞争。有时我们会用假被试,即让被试玩单机的,但却告诉他是联机的。这个方式虽然很机智,但有时也充满了遗憾——如果真的可以让被试做真正的联机任务该多好! 在这里,分享一个联机通讯脚本,以下是脚本运行过程和脚本文件。具体的思路请自行参悟,或者 from pydoc import help import socket help(socket.socket) 运行成果 秒拍视频 http://www.yixia.com/u/paike_r2r9ujpkf9 运行过程 把两台计算机连接到同一网络内,推荐连接在同一个WIFI下或者路由器下。使用路由器或WIFI热点的DHCP为计算机分配IP地址(通常是自动的),或者手动分配。令一台计算机为主机,令另一台为辅助机。 把service.py与client.py中的IP地址改成主机的IP地址。 把service.py拷贝到主机,把client.py拷贝到辅助机。 运行service.py,出现一个黑框。 运行client.py

PsychoPy sending triggers on 64bit OS

岁酱吖の 提交于 2019-12-09 11:56:47
问题 I have a problem with sending triggers for eeg recording using PsychoPy standalone v1.81.00 on a Win7 64bit OS. I followed the descriptions here and don't get any (more) errors. The triggers, however, don't show on the recording computer (Brainvision Recorder under Win7 32bit). What I did: Downloaded and installed the InpOutBinaries_1500 via InpOutBinaries_1500\Win32\InstallDriver.exe Copied the other files (inpout32.dll, .h and .lib as well as vssver2.scc) to the working directory of my