Example #1
0
Displays event information from ioHub Keyboard Events. 

Inital Version: May 6th, 2013, Sol Simpson
"""
from psychopy import visual
from iohub import launchHubServer,EventConstants 


# launchHubServer is a fucntion that can be used to create an instance of the 
#   ioHub Process within a procedural PsychoPy Script and without the need for
#   external configuration files. It is useful when devices like the Keyboard,
#   Mouse, Display, and Experiment are all that is needed. By default the
#   Display device will use pixel units and display index 0 of a multimonitor setup.
#   The returned 'io' variable gives access to the ioHub Process.
#
io=launchHubServer(experiment_code='kb_evts',psychopy_monitor_name='default')

# Devices that have been created on the ioHub Process and will be monitored
# for events during the experiment can be accessed via the io.devices.* attribute.
#
# save some 'dots' during the trial loop
#
display = io.devices.display
keyboard = io.devices.keyboard
mouse=io.devices.mouse

# Hide the 'system mouse cursor'.
mouse.setSystemCursorVisibility(False)

# Get settings needed to create the PsychoPy full screen window.
#   - display_resolution: the current resolution of diplsay specified by the screen_index.
Example #2
0
# -*- coding: utf-8 -*-
"""
keyboard_rt.run.py

Keyboard Reaction Time Calulation shown within a line length matching task. 

Inital Version: May 6th, 2013, Sol Simpson
"""
from psychopy import visual, core
from iohub import launchHubServer, EventConstants
from math import fabs

io = launchHubServer(psychopy_monitor_name='default')
#window=FullScreenWindow(io.devices.display)
display = io.devices.display
window = visual.Window(display.getPixelResolution(),
                       monitor=display.getPsychopyMonitorName(),
                       units=display.getCoordinateType(),
                       color=[128, 128, 128],
                       colorSpace='rgb255',
                       fullscr=True,
                       allowGUI=False,
                       screen=display.getIndex())

# save some 'dots' during the trial loop
keyboard = io.devices.keyboard

# constants for use in example
line_size_match_delay = 5 + int(core.getTime() * 1000) % 5
full_length = window.size[0] / 2
latest_length = 0
Example #3
0
# -*- coding: utf-8 -*-
"""
keyboard_rt.run.py

Keyboard Reaction Time Calulation shown within a line length matching task. 

Inital Version: May 6th, 2013, Sol Simpson
"""
from psychopy import visual, core
from iohub import launchHubServer,EventConstants
from math import fabs

io=launchHubServer(psychopy_monitor_name='default')
#window=FullScreenWindow(io.devices.display)
display = io.devices.display
window=visual.Window(display.getPixelResolution(), monitor=display.getPsychopyMonitorName(), 
                        units=display.getCoordinateType(),
                        color=[128,128,128], colorSpace='rgb255',
                        fullscr=True, allowGUI=False,
                        screen=display.getIndex()
                        )                 
                   
# save some 'dots' during the trial loop
keyboard = io.devices.keyboard

# constants for use in example
line_size_match_delay=5+int(core.getTime()*1000)%5
full_length=window.size[0]/2
latest_length=0
# Store the RT calculation here
spacebar_rt=0.0