コード例 #1
0
def main(auto_run):
    subject = create_subject(
        important_categories=[
            ImportantCategory('Dogs', 'Cats', 'Utility_Vehicle'),
            ImportantCategory('Cats', 'Dogs', 'Cars_Trucks'),
        ])
    # Create the window after creating the subject so that the window doesn't block the view of the
    # subject dialog box
    window = visual.Window([1360, 768], monitor='samsung', units='deg',
                           fullscr=True, allowGUI=False,
                           color=1, screen=0)
    images = load_images(
        window=window,
        source_dir=os.path.join(os.getcwd(), 'images_exp2')
    )
    tracker = pylinkwrapper.connect(window, subject.id)
    tracker.tracker.setPupilSizeDiameter('YES')
    tracker.calibrate()
    exp = Experiment(
        subject=subject,
        questions=[
            ('How hungry are you?', '1 = Not hungry ... 7 = Very hungry'),
            ('How tired are you?', '1 = Not tired ... 7 = Very tired'),
        ],
        blocks=[
            Block(8, 4, 48),
            Block(8, 4, 48),
            Block(8, 4, 48),
            Block(8, 4, 48),
            Block(8, 4, 48),
        ],
        images=images,
        auto_run=auto_run,
    )
    output_file = csv.writer(open(os.path.join(os.getcwd(), 'data_exp2', subject.id + '_mindwand_exp2.csv'), 'wb'))
    # To disable image logging, comment out the following line and uncomment the line after.
    image_log_file = csv.writer(open(os.path.join(os.getcwd(), 'data_exp2', subject.id + '_mindwand_exp2_images.csv'), 'wb'))
    # image_log_file = None
    experiment_path = 'C:\\edfs\\Nick\\mindwand\\'

    exp.run(window, tracker, output_file, experiment_path, image_log_file)
コード例 #2
0
ファイル: distspace.py プロジェクト: lkfink/JEMR_2018
if not gui.DlgFromDict(expinfo, title='Subject Info').OK:
    core.quit()

from psychopy import visual  # Because of OSX Bug

# Window set-up
win = visual.Window([1920, 1200],
                    monitor='nickMon',
                    units='deg',
                    fullscr=True,
                    allowGUI=False,
                    color=0)

# Eye-tracker setup
tracker = pylinkwrapper.connect(win, expinfo['Subject ID'])
tracker.tracker.setPupilSizeDiameter('YES')

## Shared Stimuli
fix = visual.Circle(win,
                    radius=.125,
                    pos=(0, 0),
                    fillColor=-1,
                    lineColor=-1,
                    autoDraw=True)

# Circles
target = visual.Circle(win,
                       radius=1.5,
                       fillColor=[1, -1, -1],
                       fillColorSpace='rgb255',
コード例 #3
0
ファイル: eyetest.py プロジェクト: yesjessn/mindwand
available parameters. 
'''

# Import modules
from psychopy import visual
from psychopy import core, event
import numpy as np

import pylinkwrapper# Here's the special one

# Window set-up
win = visual.Window(monitor = 'nickMon', units = 'deg', fullscr = True,
                    allowGUI = False, color = 0)

# Initiate eye-tracker link and open EDF
tracker = pylinkwrapper.connect(win, '1_test') 

# Calibrate eye-tracker
tracker.calibrate()

# Stimulus
fix = visual.Circle(win, radius = 1, pos = (0, 0), fillColor = [1, 0, 0],
                    lineColor = [1, 0, 0])
                    
cfix = visual.Circle(win, radius = .15, fillColor = -1, lineColor = -1)

# Display stimulus 5 times
for t in range(5):

    # Find random coordinates and set them
    fx = np.random.randint(-10, 10)
コード例 #4
0
ファイル: mindwand_exp2.py プロジェクト: yesjessn/mindwand
tcats = ["Aircraft", "Amphibians", "Arachnids", "Flowers", "Gardening_Tools", "Office_Tools"]
expinfo = {"Subject ID": "", "Target Category": tcats}

if not gui.DlgFromDict(expinfo, title="Subject Info").OK:
    core.quit()

# Window set-up
win = visual.Window([1920, 1200], monitor="Asus", units="deg", fullscr=True, allowGUI=False, color=1, screen=0)

# Open logfile
fname = expinfo["Subject ID"] + "_mindwand_exp2.csv"
file = open(os.path.join("data_exp2", fname), "wb")
log = csv.writer(file)

# Eye-tracker setup
tracker = pylinkwrapper.connect(win, expinfo["Subject ID"])
tracker.tracker.setPupilSizeDiameter("YES")
tracker.calibrate()

## Stimuli
fix = visual.Circle(win, radius=0.125, pos=(0, 0), fillColor=-1, lineColor=-1)

# Get image filenames
imgfiles = [
    os.path.join(dirpath, f)
    for dirpath, dirnames, files in os.walk(os.path.join(os.getcwd(), "images_exp2"))
    for f in fnmatch.filter(files, "*.jpg")
]

# Make master list of images
visual.TextStim(win, "Loading Images...", color=-1).draw()
コード例 #5
0
# Import modules
from psychopy import visual
from psychopy import core, event
import numpy as np

import pylinkwrapper  # Here's the special one

# Window set-up
win = visual.Window(monitor='nickMon',
                    units='deg',
                    fullscr=True,
                    allowGUI=False,
                    color=0)

# Initiate eye-tracker link and open EDF
tracker = pylinkwrapper.connect(win, '1_test')

# Calibrate eye-tracker
tracker.calibrate()

# Stimulus
fix = visual.Circle(win,
                    radius=1,
                    pos=(0, 0),
                    fillColor=[1, 0, 0],
                    lineColor=[1, 0, 0])

cfix = visual.Circle(win, radius=.15, fillColor=-1, lineColor=-1)

# Display stimulus 5 times
for t in range(5):