kpnl:psychopy
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
kpnl:psychopy [2015/03/28 12:32] – [Hardware] admin | kpnl:psychopy [2018/01/21 16:45] (current) – admin | ||
---|---|---|---|
Line 19: | Line 19: | ||
</ | </ | ||
+ | ====== Tutorials ====== | ||
- | ====== | + | [[https:// |
+ | |||
+ | ====== Miscellaneous Tips ====== | ||
+ | |||
+ | * Do not use " | ||
+ | * There are likely other variable names to avoid, but this is the first I've come across | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ====== Sending | ||
It is critical that we acquire stimulus-locked digital codes so that we can bin the data according to stimulus type during analysis. This is also essential for creating event-related averages of psychophysiological data (e.g. creating ERPs from EEG data) as it gives us the precise onset time of each stimulus. Below is a description of the hardware, software, and steps necessary for sending and acquiring such codes with PsychoPy and the BioSemi ActiveTwo system. | It is critical that we acquire stimulus-locked digital codes so that we can bin the data according to stimulus type during analysis. This is also essential for creating event-related averages of psychophysiological data (e.g. creating ERPs from EEG data) as it gives us the precise onset time of each stimulus. Below is a description of the hardware, software, and steps necessary for sending and acquiring such codes with PsychoPy and the BioSemi ActiveTwo system. | ||
- | ===== Hardware | + | |
- | | + | ===== Sending an entire byte at once ===== |
- | | + | |
- | | + | //The following describes an issue and fix that is relevant for PsychoPy 1.83 and older. This fix will be included in version 1.84 and beyond. For a more detailed description of the issue and resolution see this PsychoPy |
- | | + | |forum thread]]// |
- | | + | |
+ | The code used in PsychoPy to send digital codes via the LabJack | ||
+ | |||
+ | To fix the problem, one needs to modify | ||
+ | | ||
+ | - Navigate to /Applications/PsychoPy2/ | ||
+ | - Open the '' | ||
+ | - Replace the class U3 definition | ||
+ | |||
+ | Replace this code: | ||
+ | |||
+ | <code python> | ||
+ | class U3(u3.U3): | ||
+ | | ||
+ | """ | ||
+ | |||
+ | parameters: | ||
+ | |||
+ | - byte: the value to write (must be an integer 0:255) | ||
+ | - endian: [' | ||
+ | - address: the memory address to send the byte to | ||
+ | - 6008 = EIO (the DB15 connector) | ||
+ | """ | ||
+ | if endian==' | ||
+ | byteStr = ' | ||
+ | | ||
+ | byteStr = ' | ||
+ | | ||
+ | </ | ||
+ | |||
+ | with this code: | ||
+ | |||
+ | <code python> | ||
+ | class U3(u3.U3): | ||
+ | def setData(self, | ||
+ | |||
+ | """ | ||
+ | |||
+ | parameters: | ||
+ | |||
+ | - byte: the value to write (must be an integer 0:255) | ||
+ | - endian: | ||
+ | |||
+ | - address: the memory address to send the byte to | ||
+ | - 6700 = FIO | ||
+ | - 6701 (default) = EIO (the DB15 connector) | ||
+ | - 6702 = CIO | ||
+ | """ | ||
+ | #Upper byte is the writemask, and lower byte is the 8 lines/bits to set. Bit 0 = line 0, bit 1 = line 1, bit 2 = line 2, etc. | ||
+ | self.writeRegister(address, | ||
+ | </code> | ||
+ | |||
+ | ==== LabJack Port Addresses ==== | ||
+ | https:// | ||
+ | |||
+ | |||
- | <WRAP center round box 80%> | ||
- | {{ : | ||
- | - USB from stimulus presentation computer | ||
- | - 8-bit digital output from I/O lines FIO0-FIO7. | ||
- | - A separate wire connects each line to the breakout board. | ||
- | - Wires are connected to screw terminals on the breakout board. Each terminal is connected to a single pin of the male/female DB-25 connectors. | ||
- | - FIO0-FIO7 should be wired to terminals 2-9 of the breakout board. | ||
- | - The ground should be wired to terminal 18 of the breakout board. | ||
- | - A 25-pin ribbon cable connects the breakout board to the MP150 | ||
- | </ | ||
===== Setting the default LabJack address ===== | ===== Setting the default LabJack address ===== | ||
- | | + | |
+ | <note important> | ||
+ | **The information contained in this box is moot if you use the method above to change the port address** | ||
+ | |||
+ | PsychoPy has a built-in python library to drive the LabJack DAQ device. By default, PsychoPy uses the address for the " | ||
<code python> | <code python> | ||
Line 53: | Line 114: | ||
[self.writeRegister(address+pin, | [self.writeRegister(address+pin, | ||
labjacks.U3.setData = mySetData | labjacks.U3.setData = mySetData | ||
- | </ | + | </ |
===== Initializing the LabJack ===== | ===== Initializing the LabJack ===== | ||
==== Status attribute ==== | ==== Status attribute ==== | ||
- | * There seems to be a bug in Builder that results in an attribute of the p_port not being initialized. Running | + | * There seems to be a bug in Builder that results in an attribute of the p_port not being initialized |
<code python> | <code python> |
kpnl/psychopy.1427563951.txt.gz · Last modified: 2015/03/28 12:32 by admin