Searching...

Randomizing Events using EthoVision XT Trial Control


EthoVision’s trial control settings allow you to plan out sequences of events during a trial, with specified delays and durations. But sometimes it’s better to vary the delays or sequences unpredictably.

One option is simply to create multiple trial control settings profiles, and randomly assign them per trial. This keeps the trial control settings simple and has the advantage that trials with the same order of presentation can be grouped or labeled in the analysis results.

However, it’s also possible to vary both the timing and sequences of events within a single trial control settings profile.

Random Durations

The easiest way to add random variability is by varying the time between different events. Just as you can use a Time condition to add a delay of a fixed duration, you can specify a random duration:

Random Events and Sequences

If you want to randomly select between different events, e.g. selecting between two different stimuli, it is possible to do so using trial control variables. A variable just stores a numeric value. There is a trial control variable action which you can use to assign a random value to such a variable. Likewise there is a trial control variable condition which you could use to choose between two different paths. (You also have to create the variable. To do so, click the “TC Variables…” button in the settings for any trial control element that uses variables, then click Add and give it a name.) Variables can be used as counters but here we will use one to make a randomized choice.

Here's an example of a trial control sub-rule which randomly selects between presenting a noise stimulus (the upper path) and a tone stimulus (the lower path), and then afterwards waits for 5-30 seconds (after which the sub-rule could be made to repeat):

The first Action box (“Randomize”) assigns a random value between 0 and 10 to a trial control variable named “Choice.” We then have arrows going to two different conditions in order to pick which events should occur.

Two important things to note here:

  • When you split paths (with diverging arrows), the events on both paths will happen. So, if you only want to pick one of them, there needs to be a condition on each path such that only one condition is true. And it’s important that you don’t ever have a circumstance where neither will ever become true, because EthoVision will potentially wait forever in that case. (It’s ok if neither is true yet if you are waiting for something to happen, e.g. a certain amount of time to pass or the animal to enter a certain zone.)
  • When the arrows converge again, you need an Operator. This specifies whether EthoVision should wait until A) Any input is true (as here), B) All of the inputs are true, or C) X number of the inputs are true.

Random Events and Counting

In many cases, although the order of presentation should be randomized, the total number of presentations should be fixed. In this case, we want to make a random selection, but also keep a count of how many times each stimulus was presented. If we’ve reached the maximum number for the selected stimulus, we’ll switch to the other stimulus instead.

Here’s an example, using the same random selection of noise vs tone from above, but limiting each to a maximum of 5 presentations. Two additional variables have been created, ToneCount to count the number of tone stimuli and NoiseCount to count the number of noise stimuli:

In order to present each stimulus 5 times, the sub-rule should be called to execute the sub-rule a total of 10 times. Five will be tone and five will be noise, but the order will be random. Here’s the remaining part of the trial control settings, which in this example waits 60 seconds and then calls the sub-rule 10 times: