Discrimination / reversal learning script explanation for zebrafish


This demo script shows how to run the final step in a two-choice discrimination task for zebrafish in the AD unit. It captures data during the experiment by using the LOGFIELD function.

There are a total of five steps in this experiment: four shaping steps and this final testing step. See the discrimination reversal learning protocol page for details of each step in the procedure.

Top

Script explanation

This script below demonstrates how to capture real-time results from a simple 2-choice assay. The script behaves in the following manner:

  1. Waits 5 minutes before the trials begin (habituation time)
  2. Runs 30 trials in total
  3. The fish must 'initiate' the trials by swimming into the initiator zone (light/detector 6)
  4. The position of the stimuli are randomised for the left and right locations
  5. If the 'correct' zone is entered, a food reward is given
  6. If the 'incorrect' zone is entered, all lights turn off and a intertrial interval begins before the next trial

This script output's the following results into a .csv file:

  1. Total trials run
  2. Total number of initiator zone visits
  3. Total correct responses
  4. Total incorrect responses
  5. Total number of initial feeder zone visits
  6. Time the lights are presented (initiator, stimuli and feeder lights)
  7. Time the light zones are entered (initiator, stimuli and feeder lights)
  8. The current conditioned stimulus colour
  9. Total time spent in the feeder zone
  10. Total number of times the conditioned stimulus is presented on the left or right-hand side.
  11. Total correct responses in the left and right-hand zones
  12. Total incorrect responses in the left and right-hand zones
  13. The total distance moved within the entire arena
Top

Settings and definitions portion:

INCLUDE zsys
DEFINE CIRCLE 1 
DEFINE SQUARE 2
 
# define experiment requirements 
DEFINE FEED_TIME 20 
DEFINE LIGHT_TIME 20 
DEFINE INTERTRIAL_TIME 60 
DEFINE HABITUATION_TIME 300 
DEFINE CHOICE_TIME 20 
DEFINE TRIALS 30
 
# define the animal model tracking requirments (dependent on animal size) 
SET(DETECTOR_THRESHOLD,2) 
SET(SEARCH_DISTANCE,50) 
SET(SEARCH_STEP,7) 
SET(FILTER_RADIUS,15)
 
# define auto reference tracking requirements 
SET(AUTOREF_MODE,1) 
SET(AUTOREF_TIMEOUT,20)
 
# set light stimuli coordinates on the screen 
SETLIGHT(LIGHT2,SQUARE,1475,300,140) 
SETLIGHT(LIGHT4,SQUARE,1475,700,140) 
SETLIGHT(LIGHT6,SQUARE,325,500,140) 
SETLIGHT(LIGHT7,SQUARE,150,500,140)
 
# loads tracking assets 
LOAD(DETECTORS,"operant5hole.bmp")
 
# sets the counters for throughout the script 
SET(COUNTER1,COUNTER_ZERO) # trials
SET(COUNTER2,COUNTER_ZERO) # initiated trials while the initiator light is on
SET(COUNTER3,COUNTER_ZERO) # total correct choices made
SET(COUNTER4,COUNTER_ZERO) # correct choices on the left side
SET(COUNTER5,COUNTER_ZERO) # correct choices on the right side
SET(COUNTER6,COUNTER_ZERO) # total incorrect choices
SET(COUNTER7,COUNTER_ZERO) # incorrect choices on the left side
SET(COUNTER8,COUNTER_ZERO) # incorrect choices on the right side
SET(COUNTER9,COUNTER_ZERO) # feeder visits
SET(COUNTER10,COUNTER_ZERO) # times the rewarded stimulus displayed on the left side
SET(COUNTER11,COUNTER_ZERO) # times the rewarded stimulus displayed on the right side

This first part of the script includes:

  • INCLUDE zsys: this is a necessary directive you must include in any script you write. It includes the background software commands into your script.
  • DEFINE CIRCLE 1 / DEFINE SQUARE 2: these two commands define the usable stimuli shapes used later in the script as circle and square.
  • DEFINE FEED_TIME 20 / DEFINE LIGHT_TIME 20 / DEFINE INTERTRIAL_TIME 60 / DEFINE HABITUATION_TIME 300 / DEFINE CHOICE_TIME 20 / DEFINE TRIALS 30: these DEFINE commands specify time values (in seconds) and repetition amounts that are used in the script.
  • SET(DETECTOR_THRESHOLD,2) / SET(SEARCH_DISTANCE,50) / SET(SEARCH_STEP,7) / SET(FILTER_RADIUS,15): these commands give the software the parameters / size of the model organism that you want to track (these example settings are for adult zebrafish).
  • SET(AUTOREF_MODE,1) / SET(AUTOREF_TIMEOUT,20): these commands set the type of tracking to enable and the amount of time the software is allowed to capture the reference image (i.e., (AUTOREF_TIMEOUT,20) indicates the system will gather the reference image across 20 seconds); this time can be edited.
  • SETLIGHT(LIGHT2,SQUARE,1475,300,140) / SETLIGHT(LIGHT4,SQUARE,1475,700,140) / SETLIGHT(LIGHT6,SQUARE,325,500,140) / SETLIGHT(LIGHT7,SQUARE,150,500,140): four square lights are are set at the same size (140 pixels) and positioned on the screen (their centre co-ordinates are the first two numbers) and named as LIGHT2, LIGHT4, LIGHT6, LIGHT7. For more details on how the screen co-ordinates work see illustration 'Screen co-ordinates on the Zantiks AD' found in the Functions section of the manual page, Zanscript syntax.
  • LOAD(DETECTORS,"operant5hole.bmp"): detector zones are loaded as detailed in the image saved as operant5hole.bmp in the Assets directory. For more details on assets see the Assets section on the manual page, Zanscripts and services.
  • SET(COUNTER1,COUNTER_ZERO) / SET(COUNTER2,COUNTER_ZERO) / SET(COUNTER3,COUNTER_ZERO) / SET(COUNTER4,COUNTER_ZERO) / SET(COUNTER5,COUNTER_ZERO) / SET(COUNTER6,COUNTER_ZERO) / SET(COUNTER7,COUNTER_ZERO) / SET(COUNTER8,COUNTER_ZERO) / SET(COUNTER9,COUNTER_ZERO) / SET(COUNTER10,COUNTER_ZERO) / SET(COUNTER11,COUNTER_ZERO): 11 counters will be used in the script, each one is set to count from zero and can record how many times different elements of the script are actioned.
Top

ACTION MAIN

ACTION MAIN
 
 LIGHTS(ALL,OFF) 
 
 LOGCREATE("RUNTIME|TEXT:TRIAL|TEXT:INITIATOR_VISIT")
 LOGAPPEND("TEXT:TIME_INITIATOR_ON|TEXT:REWARDED_COLOUR")
 LOGAPPEND("TEXT:TIME_OF_INI_VISIT|TEXT:CHOICE ACCURACY")
 LOGAPPEND("TEXT:TIME_OF_STIM_VISIT|TEXT:FEEDER_VISIT")
 LOGAPPEND("TEXT:TIME_OF_FIRST_FEEDER_VISIT|TEXT:FEEDER_ENTRIES")
 LOGAPPEND("TEXT:TOTAL_TIME_AT_FEEDER|TEXT:REWARDED_SIDE|TEXT:LEFT_CORRECT")
 LOGAPPEND("TEXT:LEFT_INCORRECT|TEXT:RIGHT_CORRECT|TEXT:RIGHT_INCORRECT")
 LOGRUN()
 
 AUTOREFERENCE()
 WAIT(HABITUATION_TIME)
 VIDEO(3000,"Green_discrimination")
 
 LOGDATA(DATA_SNAPSHOT,"BEGIN")
 INVOKE(TWO_CHOICE_DISCRIMINATION,TRIALS)
 
 LOGDATA(DATA_SNAPSHOT,"AFTER")
 LOGDATA(DATA_SELECT,"BEGIN")
 LOGDATA(DATA_DELTA,"AFTER")
 
 LIGHTS(ALL,OFF)
 
 LOGCREATE("TEXT:|TEXT:---SUMMARY---")
 LOGRUN()
 
 LOGCREATE("RUNTIME:|TEXT:TOTAL_TRIALS")
 LOGAPPEND("TEXT:TOTAL_OF_INITIATOR_VISITS|TEXT:|TEXT:|TEXT:")
 LOGAPPEND("TEXT:TOTAL_CORRECT|TEXT:TOTAL_INCORRECT")
 LOGAPPEND("TEXT:TOTAL_FEEDER_TRIGGERS|TEXT:|TEXT:")
 LOGAPPEND("TEXT:TOTAL_STIM_ON_LEFT|TEXT:TOTAL_STIM_ON_RIGHT")
 LOGAPPEND("TEXT:TOTAL_LEFT_CORRECT|TEXT:TOTAL_LEFT_INCORRECT")
 LOGAPPEND("TEXT:TOTAL_RIGHT_CORRECT|TEXT:TOTAL_RIGHT_INCORRECT")
 LOGAPPEND("TEXT:TOTAL_ARENA_DISTANCE")
 LOGRUN()
 
 LOGCREATE("RUNTIME|COUNTER1|COUNTER2|TEXT:|TEXT:")
 LOGAPPEND("TEXT:|COUNTER3|COUNTER6|COUNTER9|TEXT:")
 LOGAPPEND("TEXT:|COUNTER10|COUNTER11|COUNTER4|COUNTER7")
 LOGAPPEND("COUNTER5|COUNTER8|ARENA_DISTANCES:A1")
 LOGRUN()
COMPLETE

The ACTION MAIN of the script sets out the outline for the experiment and labels and values are detailed for the results which will be recorded in a .csv file:

  • LIGHTS(ALL,OFF): command ensures all stimulus lights are off to begin the experiment.
  • LOGCREATE("RUNTIME|TEXT:TRIAL|TEXT:INITIATOR_VISIT") etc.: this command writes a lines of data to the .csv file.
    • |RUNTIME|: the first cell will output the actual time (RUNTIME) that the line is recorded.
    • |TEXT:|: fills a cell with the text following the ':' (e.g., "TRIAL" and "INITIATOR_VISIT will be written in cells 2 & 3) or a blank cell will be written in cells 4 & 5.
    • |COUNTER1|: the final count that COUNTER1 reached will be written in cell 2.
  • LOGAPPEND("TEXT:TIME_INITIATOR_ON|TEXT:REWARDED_COLOUR") / LOGAPPEND("COUNTER5|COUNTER8|ARENA_DISTANCES:A1") etc.: LOGAPPEND enables the line of commands to exceed the character limit for a line of code. All of the variables and text will be written to one line on the .csv file.
    • |ARENA_DISTANCES:A1|: writes the total distance travelled in the entire tank during the entire experiment.
  • LOGRUN(): tells the software to now write the data from the previous LOGCREATE and LOGAPPEND commands.
  • AUTOREFERENCE(): this command initiates imaging the background image, which allows for tracking the animal targets. Needed for tracking and can be used more than once in the script to update the image.
  • WAIT(HABITUATION_TIME): the unit waits for a period of time as defined above (HABITUATION_TIME) in the settings and definitions portion.
  • VIDEO(3000,"Green_discrimination"): this command begins a recording of a video from this point for 3000 seconds and names the file "Green_discrimination". You can change the number in this command for the amount of time needed for your video or change the name of the file.
  • INVOKE(TWO_CHOICE_DISCRIMINATION,TRIALS): the ACTION 'TWO_CHOICE_DISCRIMINATION' (defined later in the script) is invoked for the number of times as defined above (TRIALS) in the settings and definitions portion.
  • LIGHTS(ALL,OFF): command ensures all stimulus lights are off at the end of the experiment.

The system keeps a continuous record of the current measure of various variables (e.g., distance travelled in each detector zone, number of visits to detector zones). LOGDATA commands allow one to record to memory the current values using the commands below.

  • LOGDATA(DATA_SNAPSHOT,"BEGIN"): records information at this point of the script, and it is given the name ‘BEGIN’. If the command was run again the data would be overwritten with the new current values.
  • LOGDATA(DATA_SNAPSHOT,"AFTER"): records information at this point of the script, and it is given the name ‘AFTER’.
  • LOGDATA(DATA_SELECT,"BEGIN"): pulls the data from the named SNAPSHOT ‘BEGIN’ above.
  • LOGDATA(DATA_DELTA,"AFTER"): calculates the change of values between the DATA_SNAPSHOT,"BEGIN" and the DATA_SNAPSHOT,"AFTER".
Top

ACTION TWO_CHOICE_DISCRIMINATION

ACTION TWO_CHOICE_DISCRIMINATION
 
 SET(COUNTER1,COUNTER_INC)
 LIGHTS(LIGHT6,WHITE)
 LOGFIELD(1," ")
 LOGFIELD(2,COUNTER1)
 LOGFIELD(3,"OMISSION")
 LOGFIELD(4,RUNTIME)
 LOGFIELD(5,"OMISSION")
 
 LOGDATA(DATA_SNAPSHOT,"BEGINdiscrimination")
 DETECTOR(DETECTOR6,CHOOSE_LOCATION) 
 WAIT(LIGHT_TIME)
 LOGDATA(DATA_SNAPSHOT,"AFTERdiscrimination")
 LOGDATA(DATA_SELECT,"BEGINdiscrimination")
 LOGDATA(DATA_DELTA,"AFTERdiscrimination")
 
 LOGFIELD(COMMIT)
 LOGCREATE("TEXT:|TEXT:|TEXT:|COUNTER1|TEXT:")
 LOGAPPEND("TEXT:|TEXT:|TEXT:|TEXT:|TEXT:|TEXT:")
 LOGAPPEND("TEXT:|ZONE_COUNTERS:Z7|ZONE_TIMERS:Z7")
 LOGRUN()
 
 LIGHTS(LIGHT6,OFF)
 WAIT(INTERTRIAL_TIME)
COMPLETE

The ACTION TWO_CHOICE_DISCRIMINATION writes data for this point in the experiment and activates the initiator detector which starts the ACTION CHOOSE_LOCATION if triggered within the intertrial interval time.

  • SET(COUNTER1,COUNTER_INC): sets COUNTER1 to start counting incrementally (COUNTER1 counts each trial).
  • LIGHTS(LIGHT6,WHITE): this commands turns LIGHT6 as white, this is also in the same position as the DETECTOR6 (LIGHT6 AND DETECTOR6 are detailed in the settings and definitions portion).
  • LOGFIELD(1," ") / LOGFIELD(2,COUNTER1) / LOGFIELD(3,"OMISSION") / LOGFIELD(4,RUNTIME) / LOGFIELD(5,"OMISSION"): the LOGFIELD commands prepare, in the memory, data for each cell in a new column; the first number in the brackets details which cell to write the data in.
    • Please note: the LOGFIELD cell numbers start from the third cell in the row of data (i.e., 1 is actually the 3rd cell; 2 is actually the 4th cell, etc).
    • LOGFIELD(1," "): indicates that the 3rd cell in the row of data will be empty (there is a space between the inverted commas).
    • LOGFIELD(2,COUNTER1): writes the current number the COUNTER1 has counted to at that point in the 4th cell.
    • LOGFIELD(3,"OMISSION") / LOGFIELD(5,"OMISSION"): writes the text OMISSION in the 5th and 7th cells (this can be over written if another ACTION is triggered).
    • LOGFIELD(4,RUNTIME): writes the current time in the 6th cell.
  • LOGFIELD(COMMIT): tells the system to write the contents of the fields as specified by earlier LOGFIELD commands (after the previous COMMIT). It then clears the contents of the fields.
  • DETECTOR(DETECTOR6,CHOOSE_LOCATION): if DETECTOR6 is triggered (i.e., the organism enters the DETECTOR6 zone, which is where LIGHT6 appears on the screen) the ACTION CHOOSE_LOCATION now occurs.
  • WAIT(LIGHT_TIME) / WAIT(INTERTRIAL_TIME): the unit waits for a period of time as defined above (LIGHT_TIME or INTERTRIAL_TIME) in the settings and definitions portion.
  • LOGAPPEND("TEXT:|ZONE_COUNTERS:Z7|ZONE_TIMERS:Z7"):
    • |ZONE_COUNTERS:Z7|: writes the total entries into zone7 during this portion of the trial.
    • |ZONE_TIMERS:Z7|: writes the total time spent in zone7 during this portion of the trial.
  • LIGHTS(LIGHT6,OFF): command ensures LIGHT6 is turned off at this point in the trial.
Top

ACTION CHOOSE_LOCATION

ACTION CHOOSE_LOCATION
 LIGHTS(LIGHT6,OFF)
 SELECT(GREEN_LEFT,GREEN_RIGHT)
COMPLETE

If the model organism moves over the DETECTOR ZONE 6 as detailed earlier in ACTION TWO_CHOICE_DISCRIMINATION, this ACTION CHOOSE_LOCATION takes place, in which:

  • LIGHTS(LIGHT6,OFF): this commands turns off LIGHT6.
  • SELECT(GREEN_LEFT,GREEN_RIGHT): the system will randomly choose between ACTION GREEN_LEFT OR ACTION GREEN_RIGHT with a 50/50 probability. The ACTIONs will be detailed later in the script.
Top

ACTION GREEN_LEFT & ACTION GREEN_RIGHT

ACTION GREEN_LEFT
 LIGHTS(ALL,OFF)
 
 LOGFIELD(6,RUNTIME)
 LOGFIELD(3,"TRIGGERED")
 
 SET(COUNTER2,COUNTER_INC)
 LOGFIELD(5,"GREEN")
 LOGFIELD(13,"LEFT")
 
 SET(COUNTER10,COUNTER_INC)
 LIGHTS(LIGHT2,GREEN)
 LIGHTS(LIGHT4,BLUE)
 
 DETECTOR(DETECTOR2,GREEN_LEFT_CORRECT)
 DETECTOR(DETECTOR4,BLUE_RIGHT_INCORRECT)
 
 WAIT(CHOICE_TIME)
 LIGHTS(ALL,OFF)
COMPLETE
ACTION GREEN_RIGHT
 LIGHTS(ALL,OFF)
 LOGFIELD(6,RUNTIME)
 LOGFIELD(3,"TRIGGERED")
 SET(COUNTER2,COUNTER_INC)
 LOGFIELD(5,"GREEN")
 LOGFIELD(13,"RIGHT")
 
 SET(COUNTER11,COUNTER_INC)
 LIGHTS(LIGHT2,BLUE)
 LIGHTS(LIGHT4,GREEN)
 
 DETECTOR(DETECTOR2,BLUE_LEFT_INCORRECT)
 DETECTOR(DETECTOR4,GREEN_RIGHT_CORRECT)
 WAIT(CHOICE_TIME)
 LIGHTS(ALL,OFF)
COMPLETE

These ACTIONs begin after the conditioned stimulus light's position is chosen during the SELECT(GREEN_LEFT,GREEN_RIGHT) command. Only one of these two ACTIONs starts.

  • LOGFIELD(6,RUNTIME) / LOGFIELD(3,"TRIGGERED") / LOGFIELD(5,"GREEN") / LOGFIELD(13,"LEFT"): the LOGFIELD commands prepare, in the memory, data for each cell in a new column; the first number in the brackets details the data to write that cell.
    • Please note: the LOGFIELD cell numbers start from the third cell in the row of data. (i.e., 1 is actually the 3rd cell; 2 is actually the 4th cell, etc.
    • LOGFIELD(3,"TRIGGERED"): writes the text TRIGGERED in the 5th cell (this can be over written if another ACTION is triggered.
    • LOGFIELD(3,"TRIGGERED"): writes the text TRIGGERED in the 5th cell (this can be over written if another ACTION is triggered.
    • LOGFIELD(5,"GREEN"): writes the text GREEN in the 7th cell.
    • LOGFIELD(6,RUNTIME): writes the current time in the 8th cell.
    • LOGFIELD(13,"LEFT"): writes the text LEFT in the 15th cell.
  • SET(COUNTER2,COUNTER_INC) / SET(COUNTER10,COUNTER_INC): sets COUNTER2 and COUNTER10 to start counting incrementally (here COUNTER2 counts all initiated trials and COUNTER10 counts the number of times the conditioned stimulus is on the left-hand side).
  • LIGHTS(LIGHT2,GREEN) / LIGHTS(LIGHT4,BLUE): these commands turns on LIGHT2 as green, this is in the same position as the DETECTOR2 and turns on LIGHT4 as blue, this is in the same position as the DETECTOR4 (LIGHTs AND DETECTORs are detailed in the settings and definitions portion).
  • DETECTOR(DETECTOR2,GREEN_LEFT_CORRECT): if DETECTOR2 is triggered (i.e., the organism enters the DETECTOR2 zone, which is where LIGHT2 appears on the screen) the ACTION GREEN_LEFT_CORRECT now occurs. (This action will be detailed in the script below.)
  • DETECTOR(DETECTOR4,BLUE_RIGHT_INCORRECT): if DETECTOR4 is triggered (i.e., the organism enters the DETECTOR4 zone, which is where LIGHT4 appears on the screen) the ACTION BLUE_RIGHT_INCORRECT now occurs. (This action will be detailed in the script below.)
  • WAIT(CHOICE_TIME): the unit waits for a period of time as defined above (CHOICE_TIME) in the settings and definitions portion.

Both ACTIONs behave in the same manner, with the exception that the LIGHT colours' positions are reversed and the LOGFIELD labels are altered.

Top

ACTION GREEN_LEFT_CORRECT & ACTION GREEN_RIGHT_CORRECT

ACTION GREEN_LEFT_CORRECT
 SET(COUNTER3,COUNTER_INC)
 SET(COUNTER4,COUNTER_INC)
 
 LIGHTS(ALL,OFF)
 
 LOGFIELD(8,RUNTIME)
 LOGFIELD(7,"CORRECT")
 LOGFIELD(14,"1")
 
 LIGHTS(LIGHT7,WHITE)
 FEEDER(1)
 
 DETECTOR(DETECTOR7,ATFEEDER)
 WAIT(FEED_TIME)
 LIGHTS(ALL,OFF)
COMPLETE
ACTION GREEN_RIGHT_CORRECT
 
 SET(COUNTER3,COUNTER_INC)
 SET(COUNTER5,COUNTER_INC)
 
 LIGHTS(ALL,OFF)
 
 LOGFIELD(8,RUNTIME)
 LOGFIELD(7,"CORRECT")
 LOGFIELD(16,"1") 
 
 LIGHTS(LIGHT7,WHITE)
 FEEDER(1)
 
 DETECTOR(DETECTOR7,ATFEEDER)
 WAIT(FEED_TIME)
 LIGHTS(ALL,OFF)
COMPLETE

These ACTIONs begin after the detectors of the conditioned stimulus are triggered in the DETECTOR(DETECTOR2,GREEN_LEFT_CORRECT or DETECTOR(DETECTOR4,GREEN_RIGHT_CORRECT) commands. Only one of these two ACTIONs starts.

  • SET(COUNTER3,COUNTER_INC) / SET(COUNTER4,COUNTER_INC): sets COUNTER3 and COUNTER4 to start counting incrementally (here COUNTER3 counts the total correct trials and COUNTER4 counts the total of correct choices on the left side).
  • LOGFIELD(8,RUNTIME) / LOGFIELD(7,"CORRECT") / LOGFIELD(14,"1"): the LOGFIELD commands prepare, in the memory, data for each cell in a new column; the first number in the brackets details the data to write that cell.
    • Please note: the LOGFIELD cell numbers start from the third cell in the row of data (i.e., 1 is actually the 3rd cell; 2 is actually the 4th cell, etc).
    • LOGFIELD(8,RUNTIME): writes the current time in the 10th cell.
    • LOGFIELD(7,"CORRECT"): writes the text CORRECT in the 9th cell.
    • LOGFIELD(14,"1"): writes the text 1 in the 16th cell.
  • LIGHTS(LIGHT7,WHITE): this commands turns LIGHT7 as white, this is also in the same position as the DETECTOR7 (LIGHT7 AND DETECTOR7 are detailed in the settings and definitions portion).
  • FEEDER(1): turns the motor on, which turns the brass feeder mechanism to drop food reward into the tank.
  • DETECTOR(DETECTOR7,ATFEEDER): if DETECTOR7 is triggered (i.e., the organism enters the DETECTOR7 zone, which is where LIGHT7 appears on the screen) the ACTION ATFEEDER now occurs. (This action will be detailed in the script below.)
  • WAIT(FEED_TIME): the unit waits for a period of time as defined above (FEED_TIME) in the settings and definitions portion.

Both ACTIONs behave in the same manner.

Top

ACTION BLUE_LEFT_INCORRECT & ACTION BLUE_RIGHT_INCORRECT

ACTION BLUE_LEFT_INCORRECT
 SET(COUNTER6,COUNTER_INC)
 SET(COUNTER7,COUNTER_INC)
 LIGHTS(ALL,OFF)
 
 LOGFIELD(8,RUNTIME)
 LOGFIELD(7,"INCORRECT")
 LOGFIELD(15,"1")
 WAIT(FEED_TIME)
COMPLETE
ACTION BLUE_RIGHT_INCORRECT
 SET(COUNTER6,COUNTER_INC)
 SET(COUNTER8,COUNTER_INC)
 LIGHTS(ALL,OFF)
 LOGFIELD(8,RUNTIME)
 LOGFIELD(7,"INCORRECT")
 LOGFIELD(17,"1")
 
 WAIT(FEED_TIME)
COMPLETE

These ACTIONs begin after the detectors of the non-rewarded stimulus are triggered in the DETECTOR(DETECTOR2,BLUE_LEFT_INCORRECT or DETECTOR(DETECTOR4,BLUE_RIGHT_INCORRECT) commands. Only one of these two ACTIONs starts.

  • SET(COUNTER6,COUNTER_INC) / SET(COUNTER7,COUNTER_INC): sets COUNTER6 and COUNTER7 to start counting incrementally (here COUNTER6 counts the total incorrect choices and COUNTER7 counts the total incorrect choices on the left-hand side).
  • LOGFIELD(8,RUNTIME) / LOGFIELD(7,"CORRECT") / LOGFIELD(14,"1"): the LOGFIELD commands prepare, in the memory, data for each cell in a new column; the first number in the brackets details the data to write that cell.
    • Please note: the LOGFIELD cell numbers start from the third cell in the row of data. (i.e., 1 is actually the 3rd cell; 2 is actually the 4th cell, etc).
    • LOGFIELD(8,RUNTIME): writes the current time in the 8th cell.
    • LOGFIELD(7,"INCORRECT"): writes the text INCORRECT in the 9th cell.
    • LOGFIELD(15,"1"): writes the text 1 in the 17th cell.
  • WAIT(FEED_TIME): the unit waits for a period of time as defined above (FEED_TIME) in the settings and definitions portion.

Both ACTIONs behave in the same manner.

Top

ACTION ATFEEDER

ACTION ATFEEDER
 SET(COUNTER9,COUNTER_INC)
 
 LOGFIELD(10,RUNTIME) 
 LOGFIELD(9,"TRIGGERED") 
 
 WAIT(FEED_TIME)
 LIGHTS(ALL,OFF)
COMPLETE

If DETECTOR7 is triggered (the detector for the feeding arena) the ACTION ATFEEDER will begin.

  • SET(COUNTER9,COUNTER_INC): sets COUNTER9 to start counting incrementally (here the first initial entry into the feeding arena following a correct response are counted).
  • LOGFIELD(10,RUNTIME) / LOGFIELD(9,"TRIGGERED"): the LOGFIELD commands prepare, in the memory, data for each cell in a new column; the first number in the brackets details the data to write that cell.
    • Please note: the LOGFIELD cell numbers start from the third cell in the row of data (i.e., 1 is actually the 3rd cell; 2 is actually the 4th cell, etc).
    • LOGFIELD(10,RUNTIME): writes the current time in the 12th cell.
    • LOGFIELD(9,"TRIGGERED"): writes the text TRIGGERED in the 11th cell (this can be over written if another ACTION is triggered.
  • WAIT(FEED_TIME): the unit waits for a period of time as defined above (FEED_TIME) in the settings and definitions portion.
  • LIGHTS(ALL,OFF): command ensures all stimulus lights are off to end the trial.
Top

Script download

To download this two-choice assay demo script as a .zs file (file type Zantiks software reads), choose the Save File As option in the right-click dialogue box. Clicking on the script name hyperlink will open a read-only version of the script.

You will also need to save the assets which are used in this script into the unit's Asset directory. Make sure that the name of the assets exactly matches the name you use in the script (upper and lower case).

Script download: 5_two_choice_discrimination_green.zs

Asset download: operant5hole.bmp

Top

Run the service

Build as a service - Once written, the zanscript is built (.zex file) and loaded on the Settings page in one of the 20 slots a service.

Run the demo service - The experiment can now be operated from the home page.