2

I've recently started learning how to use PsychoPy, the psychopy.parallel module, and binary representation. I hope someone can let me know whether I'm understanding things correctly.

On PsychoPy's website, it says these two functions set pins 2 and 3 to high:

parallel.setData(3)

parallel.setData(int("00000011",2))

I'm assuming these two functions set specifically pins 2 and 3 to high because the right-most 1 in parallel.setData(int("00000011",2)) refers to pin 2, and the 1 on the left to that refers to pin 3. If I'm correct, are the following correct?

To set pins 2, 3, 4, 5, and 8 high, I should use either of these:

parallel.setData(79)

parallel.setData(int("01001111",2))

Also, how do people usually decide which combination of pins to set high/low when programming an experiment (I'm trying to send two or more triggers during an EEG experiment in PsychoPy)? Or is it entirely up to me, as long as I know which combination of pins set to high/low is associated with which particular experimental event?

I really appreciate any help anyone can provide. Thanks a lot!

hsl
  • 670
  • 2
  • 10
  • 22

1 Answers1

2

Your interpretation seems correct.

The choice of pins to set is really determined by your EEG system and its signalling protocol, or whatever you will be doing at the analysis software stage to extract meaning from those triggers. PsychoPy doesn't know or care about the value of the pins: that stuff is entirely up to you to determine correctly to meet the external requirements.

Note that you might also need to control the duration of the pulses: again, that will be determined by the EEG hardware.

Michael MacAskill
  • 2,411
  • 1
  • 16
  • 28
  • Thanks a lot! I'll check my EEG system and its signalling protocol. – hsl Jul 15 '15 at 03:25
  • 2
    Yep, a little counter-intuitive that they're not 1-8, but on the site documentation it mentions "(data pins are pins 2-9 inclusive)", so you're exactly right. Most analysis software lets you create a template with labels so that you can save the meaning of each channel directly with the data - knowing your analysis is key to choosing what your pins will mean. A final note on duration - make sure that they're high enough for the voltage to raise all the way - setting pins high then low within a single 16ms frame or two can sometimes miss signals. – Erik Kastman Jul 17 '15 at 12:01
  • 1
    We think of the bins as binary numbers. We use them to mark particular events. Fix On (one set of pins up); wait a bit and set all pins down; Fix Off (different pins) ... and so on. The eeg system, if it can read the parallel port, will then have an integer representation of what was going on when, and it makes it easier to slice the data up later. And I echo making sure that you don't turn the pins up and down too quickly or you will miss signals, but if you do what I just described you have to make sure you have some buffer between the different pin combinations or you will get collisions. – brittAnderson Jul 17 '15 at 12:27
  • I've managed to get PsychoPy to send triggers today! I have a question about sending consecutive triggers. Say my stimulus is shown at 0ms and a stimulus trigger is sent (trigger1). Then a keyboard response is made at 150ms and a trigger is sent for that response (trigger2). After sending trigger1, do I have to set all pins to low (`port.setData(0)` in PsychoPy) before I send the next trigger (trigger2) for the keyboard response? I actually tried sending trigger2 directly after trigger1, without setting all pins to low after trigger1, and it looked fine, but I might be wrong? @brittUWaterloo – hsl Jul 20 '15 at 23:24