EthoVision XT 19 - Sub-rules and Conditions
Last updated: Jul 26, 2026
Examples of Start-Stop Trial Rules
Start Data Recording at a Specific Time
You want to start recording at a time you are not in the lab, for example at 23:00 h.
Delete the default Start track condition. Define a Time condition. Select At clock time and enter 23:00:00. Click OK and place the resulting box before the Start track box. Before leaving the lab, click the Start trial button to start the trial. The program waits till 23:00 to start data recording.
Stop Data Recording After the Maximum Time Has Elapsed
Click Settings in the Condition box immediately before the Stop track box. Select After and enter the maximum time.
Note: Instead of using a Time condition, you can also use the Maximum trial duration option.
Water Maze: Stop the Trial When the Animal Has Found the Platform
In the Arena Settings, make sure that the platform has been defined as a zone. In the Trial Control Settings, delete the default Stop track condition. Next, define an In Zone condition.
- If you want the program to stop recording as soon as the animal is over the platform, select Frequency as Statistic and choose >= 1. Click Settings and select the platform zone.
- Sometimes the animal swims over the platform but does not stop there. In such cases the program would stop recording while the animal has not found the platform. Instead of selecting Frequency, choose Current duration and the minimum time the animal must stay on the platform (for example, 3 seconds). Click Settings and select the platform zone.
Click OK and place the resulting box before the Stop track box.
Water Maze: Stop the Trial Either When the Rat Has Found the Platform, or When It Has Been Swimming for 60 Seconds
The Arena Settings and the condition In platform zone are similar to those in the example above. The condition subject swimming for 60 s can be translated to Time >= 60 s.
The track stops when either condition is met. The two conditions are combined with OR logic.
This solution results in tracks of different duration: less than 60 s for the animals that found the platform, and 60 s for the others.
Tip: Instead of two Condition boxes in the example above, you can also define the In zone condition box and set a Maximum Trial duration.
Multiple Open Fields (Multiple Arenas): Starting Tracking When the Subject Is Released in the Open Field
Tracking starts independently in each open field. In this setup, four open fields are treated as separate arenas. You want to start acquisition when the animal is detected in the open field independent of what happens in other arenas.
This can be achieved by using the default Start-Stop trial rule. As soon as the subject is detected in an arena, tracking starts for that arena, not the others. This way you do not have to release all the animals at the same time.
Conditioning Test: Stop the Trial When the Conditioning Task Has Been Repeated N Times
For example, when the animal has obtained 25 rewards.
-
Create a new sub-rule containing the instructions for the testing session.
Sub-rule Begin - Condition: Is subject on top of the shelter? - Action: Drop a pellet - Sub-rule End.
Since the sub-rule is restarted immediately after the pellet has been dropped, it is possible that the animal is still on top of the shelter, and a new pellet is dropped before the animal eats the previous one. Therefore, you must make sure that the sub-rule ends when the animal has visited the reward zone, so the sub-rule can be repeated from that moment onward. You can do this by defining a condition "In Feeder zone" that is met when the animal has been in the Feeder zone for at least 1 s without break (Current duration >=1 s). Place this box to the left of Rule End.
- Create a Reference to the sub-rule and specify to have the sub-rule repeated 25 times. Place the resulting box at the left side of the Stop track box.
Eight-Arm Radial Maze: Stop the Trial When the Subject Has Been in Four Arms Within 10 Minutes
Combine eight conditions, one for each arm. At least four conditions must be met, no matter which arm the animal visits.
- Create an In zone condition and specify that the Frequency for Arm 1 must be >=1. That is, the animal must have visited Arm 1 at least once. Do the same for each of the other arms.
- Connect the resulting eight condition boxes in parallel using the N of All operator.
- Set the Maximum trial duration to 10 minutes to stop tracking in the case the animal fails to visit four arms in the meantime.
Important: The frequency of In zone can become high very easily when the animal walks along the edge of a zone. This may result in the condition being met sooner than expected. If that happens, increase the Zone exit threshold. If that does not help, open the Detection settings and click Advanced, then under Smoothing set Track noise reduction to On. This smooths the track.
Sub-rules
Use Sub-rules
A sub-rule is a sequence of actions and conditions separated from the Start-Stop trial rule. You can view a sub-rule like a subroutine in a larger program, where the program is your Trial Control.
- You can have the sub-rule start at specific times or under specific conditions. Each criterion defined is a Start condition of the sub-rule.
- A sub-rule can be repeated. When EthoVision finishes executing the instructions contained in the sub-rule, the program can start the sub-rule again from the beginning, for a specified number of times or until a condition is met.
- You can also have the same sub-rule called from different points of the Trial Control sequence. To do so, define multiple References to the same sub-rule.
Why Use a Sub-rule?
A sub-rule is necessary when your trials involve repetition of tasks. For example, when the animal has to press a lever to obtain a reward, and you want to repeat that 50 times. This is not feasible within the Start-Stop trial rule.
A sub-rule is also handy when your Trial Control logic is very complex, because it helps you have a clear overview of the phases within your trial. For example, different tasks within a trial can be kept separated and managed more easily.
Create a Sub-rule
- In the Components pane, under Structures, double-click Sub-rule, or click the button next to it.
-
If the Add a sub-rule window appears, choose one of the following:
- Create a new sub-rule. This creates a new sub-rule. You will be asked to enter a unique name for this sub-rule.
- Reuse an existing sub-rule. Choose this option if you want to re-use an existing sub-rule. Select the existing sub-rule and, if necessary, the Trial Control Settings where it is stored. Note: You only copy the sub-rule name, the Rule Begin and the Rule End boxes, not the actions and conditions inside the existing sub-rule.
- Under Name, enter a name for the sub-rule. The default name is Sub-rule (n) where n is a progressive number.
- Under Comment, enter a description of the sub-rule (optional).
- Click OK. The sub-rule is displayed on your Trial Control screen. It consists of a Rule begin box and a Rule end box.
- Complete the sub-rule by inserting the appropriate conditions and actions between the Rule Begin and Rule End boxes.
- Define a reference to this sub-rule (see the next section).
Notes:
- Sub-rule names. Names of sub-rules must be unique in your Trial Control Settings. You cannot define two sub-rules with the same Name, even if these are defined in two different Trial Control Settings. However, you can create a sub-rule with the same name of an existing sub-rule stored in other Trial Control Settings by re-using it.
- Re-using a sub-rule. If you choose to re-use a sub-rule and then change any property of this copy (Name or Comment), a window appears with the message Define the scope of your changes. The program asks you whether you want to apply the properties only to the newly-created sub-rule, or to the sub-rules with the same name in all Trial Control Settings. Choose the option you require and click OK.
- Deleting a sub-rule. You cannot delete a sub-rule if at least one reference to that sub-rule is present in the Trial Control. You must first delete its reference.
- If you create a sub-rule without a valid reference, you can still acquire data but EthoVision informs you that trial control may not work as expected.
Create a Reference to a Sub-rule
A Reference calls the instructions contained in an existing sub-rule.
- Make sure that the sub-rule has been defined in the Trial Control screen.
-
In the Components pane, under Structures, double-click Reference or click the button next to it.
If the Add a reference window appears, choose one of the following, then click OK.
- Create a new reference. To create a new reference to a sub-rule.
- Reuse an existing reference. Choose this option if you want to make a copy of an existing reference. Select that reference and, if necessary, the Trial Control Settings where it is stored.
- The Sub-rule Reference window appears. Under Name, enter a name for the reference. The default name is Reference (n), where n is a progressive number.
- Under Reference, from the Reference to sub-rule list select the sub-rule you have defined.
-
Under Schedule, the Start conditions box shows Without delay. This means that, by default, the sub-rule starts as soon as the reference box becomes active.
You can define one or more start conditions. Once the sub-rule starts according to Start condition, you can have it be repeated one or more times.
Click the Add button to add a Start condition. The Add Start Condition window appears.
-
From the Select type list, select one of the following:
- Without delay. To start the sub-rule as soon as the reference is activated.
- Delay (default). To start a specific time after the reference becomes active. Enter this time in the Delay field.
- Clock Time. To start at a specific day and time.
- Trial Control variable. To start when a Trial Control variable gets a specific value.
- Repeat steps 5-6 to add more start conditions. If you want to delete a start condition, select it and click the Delete button.
- Under Stop conditions, select one of the options to specify whether you want the sub-rule to be repeated once or more times.
-
If you select to repeat the sub-rule, the Repeat interval option becomes available. Select:
- Stop to Start (default). To keep a constant time between the stop of a repeat and the start of the next repeat.
- Start to Start. To keep a constant time between the start of successive repeats. For example, start repeats at every hour.
Enter this time in the corresponding box (hh:mm:ss).
- Select one of the options to specify what to do when a new start condition becomes true and a previous repeat is still ongoing.
- Under Comment, enter a description of the sub-rule reference (optional).
- Click OK. The reference box is displayed on your Trial Control screen.
- Insert the reference box in the appropriate place in the Trial Control sequence (this can be either the Start-Stop trial rule, or another sub-rule).
Notes:
- If you want the sub-rule not to start immediately as its Reference becomes active, select Without delay and click the Delete button.
- If you accept the default options (Without delay in the Start conditions box and one repeat), the sub-rule starts immediately and is repeated just once.
- You cannot edit a condition that you have added to the Start conditions box. Delete the condition first (select the condition and click the Delete button), then click Add to add a new condition.
- The Start conditions are listed in the following order: Without delay, Delay, Clock Time, Trial Control variable.
- Stop to Start of a repeat. There is always at least 1 sample difference between the time that the Rule End box is evaluated and the time that the Rule Begin box is evaluated for the start of a new repeat. This means that a new repeat can never start exactly at the same time as the end of a repeat.
- Reference names. Names of sub-rule references must be unique in your experiment, unless you have re-used an existing reference. You cannot define two sub-rule references with the same Name, even when these are defined in two different Trial Control Settings. This is because analysis of Trial Control data is based on names of elements (sub-rules, references, actions and conditions). Elements with the same name would give ambiguous results.
- Re-using a sub-rule reference. If you choose to create a copy of a sub-rule reference and then change any property of this copy (Name, Reference options, or Comment), a window appears with the message Define the scope of your changes. The program asks you whether you want to apply the properties only to the newly-created reference, or to the references with the same name in all Trial Control Settings. Choose the option you require and click OK. If you re-use a Reference that is stored in another Trial Control profile, and this profile is locked after data acquisition, changing any of the Reference settings will not affect the Reference in the locked profile.
- Modifying a sub-rule reference. To modify a sub-rule reference, click the Settings button in the reference box.
- Multiple references to one sub-rule. You can define multiple references to the same sub-rule, and place the corresponding Reference boxes in the same Trial Control sequence.
Source: EthoVision XT 19 - Trial and Hardware Control Reference Manual