Точка движения в психопати - PullRequest
0 голосов
/ 25 марта 2020

Я новичок в психопатии, и в настоящее время я пытаюсь запрограммировать задачу точечного движения, используя какой-то предыдущий код python, который мне кто-то дал. Мой сценарий выглядит следующим образом:

from psychopy.visual import DotStim
from psychopy import event
from psychopy.visual import Window

win = Window([800,600], monitor = "testMonitor", units = "deg")

def __init__(self):
    # Create a DotStim, which is automatically updated with every `draw()` call.
    ds = DotStim(win, fieldSize=900, speed=4, dotLife=3, nDots=400, coherence= \
    self.get('coher'),dotSize=2.0,signalDots='different',dir=self.get('dir'), \
    noiseDots='walk')
    # Show 100 frames
    t0 = self.time()
    while True:
        ds.draw()
        win.flip
        # Get a list of pressed keys and break out of the loop as soon as this list
        # is not empty. Also note the timestamp of the response (t1)
        keys = event.getKeys(keyList=['s', 'l'])
        if keys != []:
            t1 = self.time()
            break
            # The response is the first pressed key (and usually the only one)
            response = keys[0]
            # The RT is the difference between t1 and t0
            response_time = t1 - t0
            # Set these response so that they are logged, etc.
            exp.set('response', response)
            exp.set('response_time', response_time)

Мой код выполняется без ошибок, но эксперимент не «запускается». Окно всплывает, но пусто. В командной строке окна запуска эксперимента я генерирую это сообщение:

## Running: C:\Users\pscmgo\OneDrive for Business\PhD\Project\Experiment_Code\psychopy\dot_motion2.py ##
pygame 1.9.6
Hello from the pygame community. https://www.pygame.org/contribute.html
##### Experiment ended. #####

Я попытался импортировать и использовать функцию core.wait (), но это не помогает. У кого-нибудь есть идеи, что может пойти не так? Заранее спасибо!

...