I randomly show colorful circles in specific locations. I show a cue for the colorful circle and I want participants to remember the specific location. I get responses for the locations. If participant give an inaccurate response, I want PsychoPy to show the accurate response by showing the colorful circle in the accurate location.
Right now, I have a code like this:
testphase.finished = False
testphase.finished = True”
Do you know how can I command Coder to show the accurate circle by reading it from the excel sheet?
Sure, so if you have a header in your “conditions” excel sheet - say “corrLocation”, where the value is the xy coordinates of the correct location, your code component would look like
testphase.finished = False
testphase.finished = True
Where feedbackCircle is a circle object you have created at the begining of the experiment and feedbackDur is the duration (in seconds) that you want your feedback circle to be presented for.
Is this intended for use as a code component in builderview? if so you want this component in the “End Routine” tab.
Hope this helps.
Thank you so much Becca. This helped me a lot!
Hello again Becca,
I have one more question: How can I count correct mouse responses? For example, I want loops (trials and testphase) to stop after 8 accurate responses. How can I adapt this to the code?
There are multiple ways here. One would be to have a variable, say
corrCount=0 specified in “begin experiment” and following a correct response you add to this as
corrCount = corrCount+1 (in the first “if” part of the code above). Then when corrCount hits your limit (in your case 8) break the loop using the same method as before
Thank you for the quick response Becca. I tried your suggestion and it worked. There is one problem: I want counter to reset correct responses after the loop ends.
For example, in the test phase participants respond with mouse clicks but the loops trials and test should stop when participants give 8 accurate responses at one time.
Right now, correct responses are counted in test loop and if they give one incorrect answer trials loop starts again. Since the correct responses were counted before, the code continue to count from the number of previous trial.
I want to reset counts after test loop. How can I do this?
Great it worked. to reset a variable you can always set it to be 0 again in the ‘end routine’ tab
if (corrCount >= 8):
Thank you Becca But whenever I try to place “corrCount=0” somewhere, I get error.Where should I exactly add this to the code?
Although this question is tagged as “coding”, it seems from your screenshots that you are actually using Builder. In that case, you should purge any of your existing custom code of its
core.wait() lines. These will break Builder’s careful timing, which relies on calling
win.flip() itself on every screen refresh, typically 60 times per second.