psychopy.org | Reference | Downloads | Github

How can experiment run just some of conditions of loop

#1

Hello everybody. I am very lucky that find this forum. There is a question.
I create an expriment by PsychoPy that has a loop. The loop comprises 52 conditions with 3 parameter. but just 15 of this conditions (not all of 52) must be play randomly. Would you please help me?

#2

Hello,

  • Set the loop type to be random.
  • Insert a Code Component into the last routine within the loop (from the “Custom” component panel).
  • In the “End routine” tab of that Code component, put something like this (i.e. some custom code that will run at the end of the routine):
# end after the trial numbered 14 (zero-based):
if your_loop_name.thisN == 14:
    your_loop_name.finished = True

Obviously, replace your_loop_name with the actual name.

#3

Thanks Michael, how can I do this in the builder view? I create the expriment by builder view.

#4

The instructions above were written assuming that you are using Builder. Just follow each step exactly, and ask any specific questions you might have as a result.

#5

Sorry, I thought the code component was in coder view. I do it in builder view, step by step. It works!
Thank you very much.

1 Like