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:56] – [Status attribute] admin | kpnl:psychopy [2018/01/21 16:45] (current) – admin | ||
---|---|---|---|
Line 18: | Line 18: | ||
Moving between '' | Moving between '' | ||
</ | </ | ||
+ | |||
+ | ====== Tutorials ====== | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | ====== Miscellaneous Tips ====== | ||
+ | |||
+ | * Do not use " | ||
+ | * There are likely other variable names to avoid, but this is the first I've come across | ||
+ | |||
+ | |||
Line 23: | Line 34: | ||
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. | ||
+ | |||
+ | |||
+ | ===== 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 [[https:// | ||
+ | |forum thread]]// | ||
+ | |||
+ | The code used in PsychoPy to send digital codes via the LabJack device sets each bit sequentially, | ||
+ | |||
+ | To fix the problem, one needs to modify a little bit of code included in the OS X PsychoPy standalone package. | ||
+ | - Right click on the PsychoPy application and select '' | ||
+ | - Navigate to / | ||
+ | - Open the '' | ||
+ | - Replace the class U3 definition | ||
+ | |||
+ | Replace 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 | ||
+ | - 6008 = EIO (the DB15 connector) | ||
+ | """ | ||
+ | if endian==' | ||
+ | byteStr = ' | ||
+ | else: | ||
+ | byteStr = ' | ||
+ | [self.writeRegister(address+pin, | ||
+ | </ | ||
+ | |||
+ | 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, | ||
+ | </ | ||
+ | |||
+ | ==== LabJack Port Addresses ==== | ||
+ | https:// | ||
+ | |||
+ | |||
+ | |||
===== 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 36: | 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 (see psychopy users [[https:// | + | * There seems to be a bug in Builder that results in an attribute of the p_port not being initialized (see psychopy users [[https:// |
<code python> | <code python> |
kpnl/psychopy.1427565367.txt.gz · Last modified: 2015/03/28 12:56 by admin