-
Notifications
You must be signed in to change notification settings - Fork 13
Refactor getResponses #27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
TO DO |
CerenB
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice. I'll run it today and let you know.
CerenB
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
function checkAbort only would work if in the main script I'm using for loop, right? It'd break the for loop with stopEverything.
What if a user is not using any for loop in their experiment?
Actually I trying to think of a way to make it abort more "gracefully" (like give a chance to save stuff) and that's why I wanted to create a global variable. Or do you think this is OK? |
|
well I was thinking that
|
|
I don't think this should be related to I have added a demo that should work and is very similar to what you sent. |
|
If this does not work try setting the cfg.escapeKey to At least we will know this is likely not "key" related. |
|
Been thinking of how to implement this "abort" as part of getResponse. At the moment getResponse only checks the response box, not the keyboard of the experimenter. So the only way to make this "abort" thing work woud be to ask getResponse to check for keypresses on all devices. I could make this the default and listening to the responseBox would have to be asked for. |
|
that's one of points I got stuck with in getResponse function. I thought now it's listening to all key presses. OR is it? It's listening to responseBox specific button presses, but in keyboard all presses? Maybe when I was checking on Friday, I got stuck at this point because I specified the keys to check but it was checking all the key presses (no additional keyboards were connected than built in mac keyboard) |
|
to respond to your question, how about separate these two functions completely? Both uses KbQueue checks/buffering. Aborting function checks keyboard and aborts things - maybe there's a way to do it smoothly when things are independent two functions? |
Maybe, since it prompts an error, we can have something in the Does it make sense? |
Need to check if we can have to KbQueues going in parallel. |
So by default getResponse listens to the responseBox but if you have only one device then the keyboard and the responseBox should be the same. Did you specify the keys to check like this? |
|
OK what I am thinking of starting to do is to have getResponse and the abort function to check for all devices by default (to make it most general) and then implement a way to let the user decide which device (keyboard or response box), each function should listen to. This will require some changes to the default and the initPTB I think but nothing crazy. This might make things less confusing for most new PTB users so that's not bad. |
- add comments - create demo - waitForTrigger returns automatically after last trigger
- to match the way the cfg is now structured
- will throw a specific error that can be catched to fail gracefully - update demo
- can listen to a specific device - all information about is passed through the cfg structure even info about restricted keys - information are passed through cfg.keyboard
- this will only work during the "check"
change to keyboards function and defaults
|
OK so a series of changes on all the keyboard functions:
|
|
Similarly will merge in 24 hours unless I get a veto. 😄 |
A lot of refactoring and @CerenB this should also fix #19 and problem of extra responses you were getting from getResponses.