forked from psychopy/psychopy
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'refs/remotes/psychopy/master' into lazy…
…import Manually merged conflicting changes made to psychopy/iohub/devices/__init__.py (in psychopy/psychopy issue psychopy#1172) into new Computer class location psychopy/iohub/devices/computer.
- Loading branch information
Showing
11 changed files
with
159 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,24 @@ | ||
.. _labjack: | ||
|
||
labjack (USB I/O devices) | ||
labjacks (USB I/O devices) | ||
============================================= | ||
|
||
The labjack package is included in the Standalone PsychoPy distributions. | ||
It differs slightly from the standard version distributed by labjack | ||
(www.labjack.com) in the import. For the custom distribution use:: | ||
|
||
from labjack import u3 | ||
NOT:: | ||
import u3 | ||
In all other respects the library is the same and instructions on how to | ||
use it can be found here: | ||
|
||
PsychoPy provides an interface to the labjack U3 class with a couple of minor | ||
additions. | ||
|
||
This is accessible by:: | ||
|
||
from psychopy.hardware.labjacks import U3 | ||
|
||
Except for the additional `setdata` function the U3 class operates exactly as | ||
that in the U3 library that labjack provides, documented here: | ||
|
||
http://labjack.com/support/labjackpython | ||
|
||
.. note:: | ||
|
||
To use labjack devices you do need also to install the driver software | ||
To use labjack devices you do need also to install the driver software | ||
described on the page above | ||
.. autoclass:: labjack.u3.U3 | ||
:members: | ||
|
||
.. autoclass:: psychopy.hardware.labjacks.U3 | ||
:members: setData |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/usr/bin/env python2 | ||
# -*- coding: utf-8 -*- | ||
|
||
""" | ||
Demo of TrialHandler | ||
""" | ||
|
||
from __future__ import division | ||
|
||
from random import random | ||
from psychopy import data | ||
|
||
# create your list of stimuli | ||
# NB as of version 1.62 you could simply import an excel spreadsheet with this | ||
# using data.importConditions('someFile.xlsx') | ||
stimList = [] | ||
for ori in range(90, 180, 30): | ||
for sf in [0.5, 1.0, 2.0]: | ||
# append a python 'dictionary' to the list | ||
stimList.append({'sf':sf, 'ori':ori}) | ||
|
||
# organize them with the trial handler | ||
trials = data.TrialHandler2(stimList, 10, extraInfo= {'participant':"Nobody", 'session':1}) | ||
|
||
# run the experiment | ||
nDone = 0 | ||
for thisTrial in trials: # handler can act like a for loop | ||
# simulate some data | ||
thisReactionTime = random() + float(thisTrial['sf']) / 2.0 | ||
thisChoice = round(random()) | ||
trials.addData('RT', thisReactionTime) # add the data to our set | ||
trials.addData('choice', thisChoice) | ||
nDone += 1 # just for a quick reference | ||
|
||
msg = 'trial %i had position %s in the list (sf=%.1f)' | ||
print(msg % (nDone, trials.thisIndex, thisTrial['sf'])) | ||
|
||
# after the experiment | ||
print('\n') | ||
trials.saveAsPickle(fileName = 'testData') # this saves a copy of the whole object | ||
df = trials.saveAsWideText("testDataWide.csv") # wide is useful for analysis with R or SPSS. Also returns dataframe df | ||
|
||
# The contents of this file are in the public domain. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.