psychopy.org | Reference | Downloads | Github

Variable Block duration in Builder

Win10; PsychoPy version 2020.1.3 ;Standard Standalone

Hi
I am new to PychoPy. I am currently designing a Motor imagery experimentation session. To avoid adaption of the brain to the stimuli I would like to implement a break with a variable duration between 1 to 2.5 seconds. Unfortunately, I wasn’t able to figure out how I could accomplish that so far.

I tried to realize it with a variable defined in the condition file, but the chosen approach did not work.

Further, I would like to have a long break after a certain amount of trials, in the current composition this break will also occur before the session ends, Is there a possibility of placing that block at the place marked in yellow.

Thank you very much for your support. It is appreciated!
I’m sorry if the answers might be obvious, yet I’m completely new to the program.

Best
Alex

Hi There,

I am making some assumptions about the requirements of your experiment here but lets see if this helps.

Short break

Would you like the short break to be at the start of each trial ? i.e. the Inter-trial-Interval? if so try the following:

  1. Add a code component to your “trial” routine (click on the “Custom” tab and the image for the code component is the one with the equation pictures on it)
  2. click on “begin routine” and add something like this
short_break_duration=np.random.choice(np.arange(1, 2.5, .001))

note: Incase you are also new to python this uses a function ( from the library numpy which is automatically loaded for short as “np”) to randomly select a number from 1 - 2.5 with step sizes of .001 to create your variable onset.

  1. For stimuli inside your “trial” routine set the parameter “Start” to “short_break_duration”

Long break

Is this like a break between blocks? If so, you can just rename your “short_break” routine as “long_break” (or whatever you want) and maybe just add a keyboard component to end the routine when a button is pressed (under “responses” select the image of the keyboard and make sure the “Force end routine” is selected)

Following this you should be able to remove your original “long_break” routine and your outermost loop, leaving you with just 4 routines (instructions, trial, break, session end) and one loop (trials).

As I say, I am making some assumptions about the requirements of your experiment here, but hopefully this helps.

Becca

1 Like