--
You received this message because you are subscribed to the Google Groups "psychopy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to psychopy-user...@googlegroups.com.
To post to this group, send email to psychop...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/psychopy-users/f2a612cb-88c1-4ccc-935b-c8b59a9f41ba%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
-- Jonathan Peirce Nottingham Visual Neuroscience http://www.peirce.org.uk
This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it. Please do not use, copy or disclose the information contained in this message or in any attachment. Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham.
This message has been checked for viruses but the contents of an attachment may still contain software viruses which could damage your computer system, you are advised to perform your own checks. Email communications with the University of Nottingham may be monitored as permitted by UK legislation.
To view this discussion on the web visit https://groups.google.com/d/msgid/psychopy-users/5321E69F.9010102%40nottingham.ac.uk.
To view this discussion on the web visit https://groups.google.com/d/msgid/psychopy-users/CAKxL8GdFcXx5SBeDs5qAOMomhv1XfxUuje5_t3sc%3DR_NiqMP9w%40mail.gmail.com.
--
You received this message because you are subscribed to the Google Groups "psychopy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to psychopy-user...@googlegroups.com.
To post to this group, send email to psychop...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/psychopy-users/CA%2B0fxeX%3DxCBPEGLuYCtLt%2BCAPrYhsLn7VdU3BiyHCNBUW3u4og%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Great, these are really helpful suggestions/info. I'll try out the forp module first, and then look at trial and error with reading the serial port signal.
To view this discussion on the web visit https://groups.google.com/d/msgid/psychopy-users/CAE%2BhOZA8R835Geq42JJ7YwBN2Sc5oHSmNHVrLsiucO36gViMhQ%40mail.gmail.com.
Someone else had asked a couple months ago about adding PST button box support to iohub, using the streaming serial interface the box supports.
Hi Richard,
Would you be willing to share your code for setting up the threads for timing? I'd feel a lot better about doing that rather than polling the box once per frame.
Thanks
Andrew
--
You received this message because you are subscribed to the Google Groups "psychopy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to psychopy-user...@googlegroups.com.
To post to this group, send email to psychop...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/psychopy-users/03a70f63-c54f-4a77-b274-8c3bcaad76a4%40googlegroups.com.
SRBOX_BUTTON = {'1': int('11111110', 2), '2': int('11111101', 2), '3': int('11111011', 2), '4': int('11110111', 2), '5': int('11101111', 2), '6': int('11011111', 2), '7': int('10111111', 2), '8': int('01111111', 2)}
def getSpeededResponse(srbox, t0, RTmax=2):
global RT
global responseButton
gotResponse = False
srbox.flushInput()
while not gotResponse and (core.getTime() - t0 <= RTmax):
readByte = srbox.read(1)
if readByte != '' and readByte != '\x00':
k = ord(readByte)
if k != 0:
RT = core.getTime() - t0
if k | SRBOX_BUTTON['1'] == 255:
responseButton = 1
if k | SRBOX_BUTTON['2'] == 255:
responseButton = 2
if k | SRBOX_BUTTON['3'] == 255:
responseButton = 3
if k | SRBOX_BUTTON['4'] == 255:
responseButton = 4
if k | SRBOX_BUTTON['5'] == 255:
responseButton = 5
if k | SRBOX_BUTTON['6'] == 255:
responseButton = 6
if k | SRBOX_BUTTON['7'] == 255:
responseButton = 7
if k | SRBOX_BUTTON['8'] == 255:
responseButton = 8
gotResponse = True
--
You received this message because you are subscribed to the Google Groups "psychopy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to psychopy-user...@googlegroups.com.
To post to this group, send email to psychop...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/psychopy-users/58dbe95b-228c-4570-9633-9ebd20af46a4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/psychopy-users/532854D3.5080105%40nottingham.ac.uk.
To view this discussion on the web visit https://groups.google.com/d/msgid/psychopy-users/CAKxL8GefP7kQqZawDxEuXJ68vtjwSrq-zETGAFRVxhdjOdDyFA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Oh, I see, this box returns just a constant stream of bytes rather than information about keypress events? OK, that's pretty painful, and I'm not sure how you go about handling that. :-(
So I would start data streaming from the box at the start of the trial, poll the box once per frame, keep a running count of the number of samples until a button press is detected, and use that count to calculate RT.
--
You received this message because you are subscribed to the Google Groups "psychopy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to psychopy-user...@googlegroups.com.
To post to this group, send email to psychop...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/psychopy-users/d815dc18-412b-42da-9265-fc47f0c738c0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
This serial protocol is so simple I will try and make an iohub bbox device for it and just use another device to create a simulated SRbox serial stream for testing. Could you test it Richard when I get around to doing the iohub implementation?
Obviously test that a few times for known periods (to make sure the change in time matches the expected number of samples) to make sure that the buffer does fill at a constant rate. [This is probably obvious but I thought I should
from __future__ import print_function, division
import serial
from psychopy import core
SRBOX_PORT = "COM4"
srbox = serial.Serial(SRBOX_PORT, timeout=0, baudrate=19200)
#
# Wait a short while, turn off all lights, and switch the box to streaming mode.
#
core.wait(0.250)
srbox.write(np.uint8(64))
srbox.write('\xA0')
srbox.flushOutput()
tSleep = 5
for i in range(10):
srbox.flushInput()
core.wait(tSleep)
waiting = srbox.inWaiting()
print(waiting, 'chars in input buffer. This makes', waiting/tSleep, 'chars/s.')--
You received this message because you are subscribed to the Google Groups "psychopy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to psychopy-user...@googlegroups.com.
To post to this group, send email to psychop...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/psychopy-users/48ba8268-0c7a-47b0-bf22-faea7b77f605%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Richard, I've just noticed your comment about "switch the box to streaming mode". What other modes does it support?
This would make sense if, in non-streaming mode, you can then request
info about recent presses (send a command to receive a string back about
the last press)
This serial protocol is so simple I will try and make an iohub bbox device for it and just use another device to create a simulated SRbox serial stream for testing. Could you test it Richard when I get around to doing the iohub implementation?
--
You received this message because you are subscribed to the Google Groups "psychopy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to psychopy-user...@googlegroups.com.
To post to this group, send email to psychop...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/psychopy-users/8e8b2781-39ab-4a08-ae53-ebccde5d0f0c%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "psychopy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to psychopy-user...@googlegroups.com.
To post to this group, send email to psychop...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/psychopy-users/027a337e-f2b6-4a0f-82c8-6d0f3f272fb6%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/psychopy-users/38912916-147f-4f11-93b8-bc0025fdc71b%40googlegroups.com.
Hmm I definitely hadn't considered that. I am polling for a maximum of 2 seconds, so from what you said this could be a problem.
How would you recommend I do this? Include a time.sleep() call for a short duration every time through the loop, like for 5 ms or so? Or a longer sleep once every 200 ms?
I'm definitely glad you brought this up before I started losing data!
Thanks
Andrew
--
You received this message because you are subscribed to the Google Groups "psychopy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to psychopy-user...@googlegroups.com.
To post to this group, send email to psychop...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/psychopy-users/A710F15A-EACD-439C-A461-DBFC9C0F4B4A%40otago.ac.nz.
To view this discussion on the web visit https://groups.google.com/d/msgid/psychopy-users/CAKxL8GfRKWSxM2P2qdZ34AVDgpYuvsV6i%2BGPQLz0XZ3gvrLOOw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
-- Jonathan Peirce Nottingham Visual Neuroscience
If I can get some feedback / confirmation that the code seems to work with the box as expected, I'll do a pull request to psychopy/psychopy proper.
% Bit 7 = 128 -> Enable/Disable streaming.
% Bit 6 = 64 -> Lower bits control lamp state.
% Bit 5 = 32 -> Enable/Disable button queries.
% Bit 0-4 = 1-16 = Enable/Disable Lamp 0-4.
pstbox.write(chr(np.uint8(128+32+64+1)))
Kyle