ANY-maze Help > I/O devices supported by ANY-maze > The ANY-maze Operant interfaces > A tutorial on the ANY-maze Operant interface > Operant interface tutorial : Setting up your protocol

Operant interface tutorial : Setting up your protocol

Introduction

Before creating an Operant protocol, you need to make sure that you have successfully connected the ANY-maze Operant interface to your computer. The steps required to do this can be found under Setting up the ANY-maze Operant interface for the first time.

This section provides an overview of the steps required to create a protocol and set up the parts of it that you'll need to work with an ANY-maze Operant interface - if you need a fuller description, you can find this under Creating an Operant protocol.

Creating an Operant protocol

Once you have your ANY-maze Operant interface connected, follow these steps to create a new protocol to use it:

 Create a new experiment. 

To do this, navigate to the File page and select New empty experiment, then select 'New empty experiment' from the right-hand side of the page.

 Navigate to the Protocol page, and select the 'Protocol' element at the top of the protocol list (it will probably already be selected). 
 Change the Protocol mode to 'Operant mode'. 

This protocol mode acts as a short-cut to building a protocol for the ANY-maze Operant interface.

Adding and configuring your ANY-maze Operant interface

Now that we've selected the correct protocol mode, we can add the ANY-maze Operant interface into the protocol, and configure it the way that we want it. To do this, follow these steps:

 1.Click the Add item button in the ribbon bar and select Add connected Operant cages in the menu that appears. 
 2.This option will open the Add connected Operant cages window, which will show you a list of all ANY-maze Operant interfaces connected to the computer. If your device doesn't appear in this list, check that it's correctly connected and plugged into a power supply. 
 3.Select the first cage in the list - it's probably called 'ANY-maze Operant cage 1'. 
 4.You'll now need to configure this cage by adding the components that are connected to it. We're not adding any real components for now; just some examples for the purposes of this tutorial. You don't have to set up exactly the components listed here, but it will help you follow the tutorial if you at least select components of the same type! 

Firstly, we'll set up a lever by clicking the Add button.

 On the 'Select component' page, open the 'Levers' group and select the first item in the list - 'Standard lever (Rat chamber)'. Click Next. 
 On the 'Set up connections' page, select 'Input 1' as the input for the lever and Click Next. 
 On the 'Edit port names', leave the name as 'Lever'. Click Finish. 

That's the first component set up; follow the same sequence of steps to add the following components to your interface:

 House light:  House lights -> ENV-215M - House light (Rat chamber) 
 Shocker:  Aversive stimuli -> ENV-414 - Aversive stimulator/scrambler module 
 Pellet Dispenser:  Pellet and food dispensers -> ENV-203M-20 - Pellet dispenser, modular - 20mg (Rat) 

You'll obviously need to select a different Output port for each component.

 5.When you've finished adding the components outlined above, your Operant interface configuration window should look something like this:  

  

  

Figure 1. The Configure Operant interfaces window, showing the four components that have been added.

 6.When you've done this, click Finish. You'll get a message about protocol items that need extra information, but don't worry about this - we'll cover this in a moment.  

  

More details on adding one or more operant cages to your protocol can be found here. For a full description of adding components to your ANY-maze Operant interface, see Configuring the ports of an ANY-maze Operant interface

The Operant interface inputs and outputs

Because ANY-maze already knows you are setting up a protocol for an Operant interface (since that's the mode we put it into), then it will automatically have added various I/O elements to the protocol when we added the Operant cage. These elements are:

 An input for the lever. You can see this by selecting On/off inputs in the protocol list. 
 An output for the shocker. You can see this by selecting Shockers in the protocol list. 
 An output for the Pellet dispenser. You can see this by selecting Pellet dispensers in the protocol list. 
 An output for the House light. You can see this by selecting Light controllers in the protocol list.  

  

  

Figure 2. The protocol showing the I/O ports that have been added for each of the components you set up on your ANY-maze Operant interfaces.

You'll notice that there is a image next to the 'Shockers' group (and next to the shocker within this group). This indicates that some information required by ANY-maze is missing, and you need to enter it before this item can be used. Sometimes you might see a warning image - in either case, hovering the mouse over the item in question should pop up a tool tip which will give you more information. In this instance, it's because the duration of the shock has not been specified - let's enter that now:

 Click on the Shocker, and you'll see the shocker's settings appear on the right-hand side of the protocol list.  
 Enter a value for the Default duration of the shock; since we're only creating an example, make it something like '1s' (so we'll be able to see when this is activated, when we actually run a test).  

  

  

Figure 3. The default settings for the shocker element

There are plenty of other parts to the protocol, but for the purposes of this tutorial we'll only worry about a few of them in the sections below.

Setting up stages and specifying the test duration

Another element of the protocol that is automatically included in am Operant protocol is a Stage. This is because ANY-maze requires that all protocols always include at least one stage, and the Operant protocol is no exception.

A stage is simply a test (or a group of tests) that you perform on your animals. In many cases, an experiment will simply have one stage consisting of one test (for each animal), and that's the default setting for an Operant protocol. Of course, you can change this if you wish. For example, you might have two stages in your experiment; in the first stage you test the animals without any treatment, while in the second stage you treat them and then test them again. In this case, you would simply need to add a second stage to the protocol.

To see the stage, select Stages > First stage in the protocol list; the Settings pane will then show the stage's settings.

  

  

Figure 4. The default settings for the first stage in an Operant protocol.

Full details about stages can be found here, but suffice to say that it is in the stage's settings that you specify the duration of your tests. As can be seen in figure 4, ANY-maze does not include a default duration, so you will need to set this value before you can actually perform any tests - For now, we'll just enter a test length of 1 minute. You can do this by typing '1 min' or '60s' into the Test duration field.

Throughout ANY-maze, times can be specified using units of 'ms' for milliseconds, 's' for seconds, 'min' or 'm' for minutes, 'h' for hours and 'd' for days. You can mix these units if you wish, for example '3h 30min', and you can use decimal points, for example '3.5h'.

Setting up fields to record additional information about your animals or tests

This step is optional

If you wish, you can set up 'fields' in your protocol to record additional information about your animals or tests. For example, you may be keen to differentiate between how male and female animals respond, in which case you will presumably want to record their Sex somewhere. Of course, you could just note this on a piece of paper, but instead you could set up a 'Sex' field and record the data within ANY-maze. Not only would this mean that all the data relating to the experiment would all be in one place, but you could also then use ANY-maze's analysis features to analyse the animals' sex - perhaps to check that there is no significant difference between male and female animals.

You can create any number of fields, and they can be used as either independent or dependent variables in analysis. Full details about fields and how to set them up can be found here.

Specifying if/how you will assign animals to treatment groups

ANY-maze generally expects your animals to be divided into different groups (they're called Treatment groups, since this is the most likely way that they will be grouped). You'll need to tell ANY-maze how to assign the animals between groups, so select the Treatment groups item in the protocol list now. (You'll notice that it has a marker, indicating that you're required to enter some information).

More details can be found under Treatment groups, but for now, let's just select Randomly assign the animals amongst the groups.

  

  

Figure 5. The protocol's Treatment groups page.

Setting up procedures

When we run a test in our experiment, we have two things that need to happen:

 1.The house light needs to be activated at random intervals 
 2.When the lever is activated, the animal needs to be given a reward (if the light is on) or a shock (if it is off). 

To implement this kind of functionality, ANY-maze uses procedures. A procedure is a simple list of statements that are run in sequence during a test. They can be used to wait for specific events to occur, to perform actions, or to execute complex logical operations to aid in the running of a test.

We'll write two different procedures, to perform each of these tasks. We'll outline the steps you need to take to create these procedures here, but if you want more information about procedures (including a couple of tutorials) you can refer to An introduction to procedures.

Procedure 1: Activating the house light

The first procedure we'll write will simply wait for a random time between 10 and 15 seconds, then activate the house light for 5 seconds at a time.

Create the procedure by clicking the Add item button in the ribbon bar, and then select New procedure from the menu that appears. Alongside the settings for the procedure, the Procedure editor window will appear on the right of your screen.

We'll come to the procedure editor in a moment, but first of all let's enter the name of the procedure - call it something like 'Activate light'. The name isn't particularly important in this case, but it can be important for some experiments - for example, if you were to set up a procedure that could end the test, then the 'Reason for test end' measure for the test would be the name of the procedure.

For now, we can ignore the rest of the procedure's settings, except just to make sure that the first Stage is selected in the box titled Select the stages in which this procedure should be processed.

Now we're ready to actually create the procedure. This process is fairly simple - you basically drag-and-drop the procedure's statements from the tabbed section to the left of the procedure editor, into the representation of the procedure itself which is on the right. Before we do this, we need to make sure that all the statements are available to us - if you've never used the procedure editor before, it will be in 'Simple' view, which only shows a subset of the functionality available. We need to change to 'Full' view - which you can do using the Full view button in the ribbon bar (note that if you can see the Simple view button, then you're already in full view and don't need to do anything).

  

To actually start 'writing' the procedure, click the mouse on the Repeat ... while element under the Statements tab, and while holding the mouse down, drag it to the right hand side of the procedure editor (over the text which says 'Statements dropped in this area will start to run when the test starts'). Let go of the mouse and the statement will get 'dropped' into the procedure. The procedure editor should now look like this:

  

  

Figure 6. The procedure, after dragging in the first statement.

Click on the drop-arrow next to the word 'Repeat' and select 'Forever' from the menu that appears (this just means that the statement will repeat as long as the test is running).

Next, we need to insert the set of statements that we want repeated. In this case we want to wait for a random time to elapse, so select the Events tab and drag the Time elapsed event from the 'Timers' section into the procedure, in the space inside the Repeat statement (see figure 7).

  

  

Figure 7. The procedure, after dragging the 'Time elapsed' event. ANY-maze has automatically inserted this event inside a 'Wait until' statement.

The Time elapsed event has a 'parameter' which is the amount of time that we want the procedure to wait for. This can be any numerical value, and ANY-maze will treat this value as being the number of seconds to wait. Currently, this isn't specified - it's denoted as '...'.

We want to wait for a random time, so select the Statements tab again, click on 'Maths functions & operators' to expand it, and then drag the Random (... to ...) element over the top of this '...' parameter (you should find that as you drag over the parameter, the border of the parameter changes to green - indicating that this is a valid place to drop whatever you're dragging). Drop it here, and you'll see that this Random... element has its own parameters, indicating the range of random numbers that will be generated. Type in 10 over the '...' of the first parameter, and 15 over the top of the second parameter, and your procedure should now look like the one in figure 8:

  

  

Figure 8. The procedure, including the wait for a random period of time.

Hopefully, you've now got the hang of dragging elements into the procedure, so I'll just describe each of the steps required to complete the procedure rather than showing you what it should look like each time:

 Under the Actions tab, expand 'Light controllers' then 'House light', and drag the 'Switch the light controller on' action into the procedure, under the Wait until statement. You'll notice that this action also has a parameter, but in this case it has been automatically filled in with the light controller that it's acting on.  
 Under the Events tab, expand 'Timers' and drag the Time elapsed: event into the procedure under the action. This time, type in 5s (or just the number 5) as the parameter.  
 Under the Actions tab, expand 'Light controllers' then 'House light', and drag the 'Switch the light controller off' action into the procedure, under the Wait until statement.  

That's it! Your finished procedure should look like this:

  

  

Figure 9. The finished procedure to activate the light at random intervals.

Procedure 2: Responding to a lever press

The second procedure needs to wait until the lever is pressed, and then either activate the pellet dispenser (if the light is on) or the shocker (if the light is off). Create the procedure (again using the Add item button in the ribbon bar, and then selecting New procedure from the menu). Enter a name such as 'Handle lever press'.

I won't go into too much detail in this section - hopefully you've got the hang of adding statements to a procedure from the one we've just created. Just follow these steps:

 Under the Statements tab, drag the Repeat ... While statement into your procedure, just as you did for the previous procedure, and use the drop-list to set it to 'Repeat forever'.  
 Under the Events tab, expand 'On/off inputs' then 'Lever', and drag the Lever activated event into the procedure, inside the Repeat statement.  
 Under the Statements tab, drag the If ... Then ... statement under the Wait until: statement just added. This statement checks the value of some condition, and takes an action if the condition is True (and optionally, a different action if the condition is False).  
 The 'condition' we're going to set as a parameter to the If ... statement will be whether the stimulus light is on. Information about the current state of all aspects of a test can be found under the Variables tab, so select this tab and expand 'Light controller variables' and then 'House light'. Drag the House light is on variable over the parameter of the If ... statement.  
 Click the down arrow next to the End part of the If ... statement, and select 'Else' from the menu that appears. So we now have two parts to the If ... statement - what action the procedure will take if the light is on, and what action it will take if the light is off.  
 Under the Actions tab, expand 'Pellet dispensers' and then 'Pellet dispenser'. Drag the Dispense pellet action into the procedure, into the upper 'gap' of the If ... statement.  
 Again under the Actions tab, expand 'Shockers' and then 'Shocker'. Drag the Activate the shocker action into the procedure, into the lower 'gap' of the If ... statement.  

Your finished procedure should now look like this:

  

  

Figure 10. The finished procedure to respond to the lever press.

  

That's our two procedures written. Hopefully you've got an idea of how powerful and flexible procedures can be - there's a whole Procedures section in the help dedicated to them where you can find out more about their capabilities.

Save the protocol

We've now altered the settings of the Shocker, entered a test duration, and added a couple of procedures. You might also have entered one or more Fields, or altered some of the default settings - this being the case, you will usually want to save the protocol so you can use it again in other experiments. To do this, you need to click the Save protocol button in the ribbon bar. This process should be self-explanatory, but you can find more information under Saving a protocol.

What next?

Now that you've set up your protocol, you're ready to use it in an experiment.

See also:

The topics listed below are general topics relating to ANY-maze, and may refer to features not available or not required with the ANY-maze Operant interface.
 An introductory tutorial on protocols 
 The elements of a protocol 
 Adding elements to a protocol 
 Editing the elements of a protocol 
 Deleting elements from a protocol 
 Saving and loading protocols 
 Viewing the protocol report 
 An introduction to fields 
 An introduction to procedures 

© Copyright 2003-2026 Stoelting Co. All rights reserved

ANY-maze help topic T1099