EthoVision XT 19 - Programming Trial Control
Last updated: Jul 26, 2026
The Trial Control Screen
Maximum Trial Duration Pane
Aim: To define a maximum duration of the trial. This prevents EthoVision XT from waiting indefinitely for the condition to stop the trial to be met.
Example: In a novel object test, in the Start-Stop Trial rule you have defined a condition to stop the track when the mouse enters the zone with the familiar object. It may happen that the mouse completely ignores the familiar object and only pays attention to the novel object. To prevent EthoVision from never stopping tracking, set a maximum trial duration.
To Access This Option
In the Trial Control Settings screen, locate the Maximum Trial Duration pane, right below the Components pane. If you do not see it, click the Show/Hide button on the toolbar and select Maximum trial duration.
Notes
-
Instead of using a Maximum trial duration, you can also define a condition based on time and place it immediately before the Stop track box. However, there are two important differences:
- If you use the maximum trial duration, the program counts the time from the start of the trial (indicated by the Start-Stop trial box). A condition placed immediately before the Stop track box considers the time from the start of data recording (indicated by the Start track box). The two starting points may not be the same if you have a condition between Start-Stop trial and Start track that makes data recording start some time later than the trial.
- With a multi-arena setup, a maximum trial duration stops the trial (and thus data recording) in all the arenas simultaneously, even when data recording had started at different times. A time condition placed between the Start track and the Stop track box stops data recording in one arena when the condition is met in that arena. This means that you can have data recording stop at different times in different arenas.
Example: You set data recording to start when the animal is detected for the first time in its arena using an In zone-based condition. Next, you define a 5-minute Time condition and place it immediately before the Stop track box. If the animals are detected for the first time at different times in different arenas, data recording stops at different times too, because of the 5-minute interval set for all arenas. The trial ends when the recording stops in the last arena.
- The Maximum trial duration is not applied when you record video with the option Save video only, track later. You must stop video recording manually. When you track from the resulting video file, the Maximum trial duration is applied.
Program Trial Control
- If you just want to record data for a specific time, you can do so by setting the maximum trial duration.
- If you want to start and stop data recording in relation to a few simple conditions (for example, start recording when the animal is detected in the water maze, and stop when the animal reaches the platform), define the Start/Stop trial rule.
- In other cases, see the procedure below.
Procedure
- Before defining Trial Control in the program, it is helpful to draw your experimental procedure as a flow diagram, where each block represents an action or a condition which, when met, triggers other actions or conditions. The logical order in the example reads from left to right.
- From the Setup menu, select Trial Control Settings, select New, enter a name for the new Trial Control Settings or accept the suggested one, and click OK. The default Start/Stop trial rule appears on the screen.
-
Build the Trial Control sequence outlined in step 1 using the components available.
- To define a Condition or an Action, click one of the buttons under Conditions or Actions. Insert the box in the appropriate place in the sequence.
- For conditions: see the Conditions section and the detailed overview.
- For actions on hardware devices: see the Hardware Devices section.
- For actions on Trial Control variables: see the Trial Control Variables section.
- To define a set of actions and conditions to be repeated (Sub-rule), under Structures click the button next to Sub-rule.
- To define the command that calls a sub-rule, under Structures, click the button next to Reference. Insert the box in the appropriate place in the sequence.
- To define a Condition or an Action, click one of the buttons under Conditions or Actions. Insert the box in the appropriate place in the sequence.
- Test the Trial Control sequence.
- To apply Trial Control to your trials, before starting data acquisition make sure that the Trial Control Settings are highlighted in blue in the Experiment Explorer.
Notes
- When you create a new Trial Control element (action, condition, sub-rule or reference) and another of the same type has already been defined in this or other Trial Control Settings, a message appears asking you whether you want to create a new element or make a copy of the existing control.
- A Trial Control variable is a variable that you can define to control your trials. For example, a counter variable that is incremented every time a specific event occurs. You can then define conditions and actions based on this variable.
- If the experimental protocol is very complex, like in the case of a multiple-day recording session, it is helpful to split the procedure into main blocks; then, for each block specify the basic actions and conditions, and whether the logical sequence should be repeated. This helps you identify the main building blocks of your Trial Control logic, which will translate into Sub-rules.
- Important: If you have inserted Condition boxes based on Activity in your Trial Control rule and then deselect Activity analysis in the Experiment settings, the Condition boxes based on Activity are removed from your sequence and the connecting arrows are removed. This makes the rule invalid. Redesign your Trial Control rule and connect the arrows between the boxes.
- If you choose to record video with EthoVision XT by selecting the option Save video only, track later in the Acquisition screen, Trial Control is applied when you do tracking, not when you record video. To start and stop video recording, do so manually.
Example: A trial is to be run for a few days. On day 5 after the start, during the dark phase, an operant conditioning session must be repeated 10 times. On day 6, the same sequence must be carried out just once.
Procedures that must be repeated or represent a specific task must be defined as Sub-rules. Sub-rules can be called at specific times or under specific conditions. In the main Start-Stop diagram, draw a block that calls each sub-rule.
Conditions
A Condition is a statement that EthoVision checks during the trial. When the Condition is met (True), the program evaluates the next Trial Control element (another condition, an action, or a reference to a sub-rule).
Examples of conditions:
- When the rat reaches the platform, stop tracking.
- When the mouse is around the novel object, switch on the light.
- When the animal presses the lever, drop a pellet.
To Define a Condition
- In the Components pane, under Conditions, locate the type of condition you want to define.
- Double-click the condition name or click the button next to it.
- If the Add a condition window appears, it means that there is at least one condition of the same type in your experiment. You are asked to choose between creating a new condition or re-using an existing one. Choose the option you require and click OK. If this window does not appear, skip this step.
- Next to Condition name, type in the name you want to give to the condition, or accept the default name.
- Specify the condition properties.
- Enter a Comment (optional), then click OK.
- Insert the condition box in the sequence.
If the condition is complex (for example, stop the trial either if the rat has reached the platform or it has been swimming for 60 seconds), then you must define separate conditions and combine them.
Important: If you have inserted Condition boxes based on Activity in your Trial Control rule and then deselect Activity analysis in the Experiment settings, the Condition boxes based on Activity are removed from your sequence and the connecting arrows are removed. This makes the rule invalid. Redesign your Trial Control rule and connect the arrows between the boxes.
Actions
An Action is a command that EthoVision carries out during acquisition and that influences the trial.
Examples of actions:
- When the animal is detected in the arena, start tracking. This is an example of system actions (start tracking and stop tracking).
- When the animal enters the maze's left arm, do C = C+1. This is an example of actions on a Trial Control variable.
- When the animal is found on the shelter, drop a pellet. This is an example of actions on hardware devices.
- When the animal leaves the shelter, play a sound or present a visual stimulus. Or, when you start tracking, also start ultrasound recording with UltraVox XT. These are examples of actions based on an external command.
To Define an Action
-
In the Components pane, under Actions, locate the type of action you want to define:
- Trial Control variable for an action on a Trial Control variable.
- The device type name for actions on a hardware device.
- External command to start an external program or run a batch file.
- Double-click the action name or click the button next to it.
- If the Add an action window appears, it means that there is at least one action of the same type in your experiment. You are asked to choose between creating a new action or re-using an existing one. Choose the option you require and click OK. If this window does not appear, skip this step.
- Next to Action name, type in the name you want to give to the action, or accept the default name.
-
Specify the action properties:
- For actions on Trial Control variables, see the Trial Control Variables section.
- For actions on External commands, see the External Commands section.
- For actions on Hardware devices, see the Hardware Devices section.
- Enter a Comment (optional), then click OK.
- Insert the action box in the sequence.
You cannot create additional actions of type Start track and Stop track, nor can you delete the existing ones.
Trial Control Variables
You can define variables to be temporarily stored during a trial that you can use to influence the control of the experiment.
Example 1 - Variable as a marker: The variable Phase has been defined to specify the various phases of a trial (Phase = 1 means Conditioning; 2 = Testing, etc.). The researcher can then program EthoVision to follow specific Trial Control sequences according to the current value of Phase.
Example 2 - Variable as a counter: A researcher has defined the variable SR (successful response) to count the number of times the subject responds correctly to a stimulus. To increment the value of SR after a correct response, specify the formula SR = SR+1.
To Define a Trial Control Variable
- In the Components pane, click the button next to Trial Control variable under Conditions or Actions. Next, click the TC Variables button.
- The Trial Control Variables window lists the variables currently in the experiment (including those defined in other Trial Control Settings). To add a new variable, click Add variable.
- A new row is appended to the table. Under Name, type in the name you want to give to the variable. Under Initial Value, enter the value of this variable at the start of the trial (default: 0).
- Click OK. In the TC-variable action/condition window, define the action or condition you require. Click Cancel if you do not want to create a condition or action based on this variable at this point.
- To delete a variable, click the variable name in the Trial Control Variables window and click the Delete variable button.
- To rename a variable, click the variable name in the Trial Control Variables window and edit the name.
- The variable name cannot contain blank spaces.
- The default name of a new Trial Control variable is VarN, where N is a progressive number.
Actions on a Trial Control Variable
To assign a new value to a variable in Trial Control, define a Variable action in your Trial Control rule.
- In the Components pane, under Actions, click the button next to Trial Control variable.
- If the Add an action window appears, it means that there is at least one action of the same type in your experiment. You are asked to choose between creating a new action or re-using an existing one. If this window does not appear, skip this step.
- Next to Action Name, enter the name of the action (for example, Increment Counter) or accept the default name.
- Under Action to perform, select the variable from the list. You can also create the variable by clicking the TC Variables button if you have not yet done so.
-
Next to the "=" symbol, do one of the following:
- To assign the same value of another variable (for example A = B), select the other variable (B) from the second list.
- To enter a formula, click the double-arrow button. Select the operator from the list and specify the formula in the second and third lists. For example, A = A + 1.
- To assign a random value, select Random from the second list, and enter the Minimum and Maximum limits (only integer numbers 1 up to 999) within which the random value must fall. When you select Random, the Permutation option also appears.
- Enter a Comment (optional), then click OK.
- Insert the resulting Action box in the Trial Control rule.
Random Values and the Permutation Option
- When programming Variable ratio schedules, it is a good idea to use the Random option. Define a random variable R that specifies the number of rewards to be provided. Insert the resulting box in a sub-rule. Every time the sub-rule is repeated, the variable R gets a new value. Make sure that the food dispenser is activated as many times as specified by R during that repeat. You can do this by calling a second sub-rule that activates the food dispenser (Action "drop pellet" followed by a time condition that waits for a short time interval like a few seconds). This second sub-rule is repeated as many times as specified by the value of R.
- You cannot combine Random with a formula (for example, to compute A = Random+1). The equivalent solution is the following: define first an action B = Random, and then one more action A = B+1. Place the two boxes in sequence.
- Select the Permutation option to generate a value in such a way that all n values within the specified range occur once before a value is generated again. For example, if you specify 1 as Minimum and 5 as Maximum (n = 5), the value 1 will be generated only when all five values in the range have been generated in previous repeats of the action.
Source: EthoVision XT 19 - Trial and Hardware Control Reference Manual