Using logdata, logcreate and logrun


When writing a script to track the activity of animals in different zones, during different time bins you will need to include the LOGCREATE, LOGDATA and LOGRUN functions.

This tutorial, in two parts, helps demonstrate how to obtain processed results from your experiments in a Zantiks unit. The data file will include distance travelled in arenas, in different zones; time spent in different zones; and the number of times different zones are entered.

In this example we have used a sample scototaxis script in the AD unit, which illuminates half of the chamber from the built-in screen below the tank. The chamber is set up with two arenas, for two singly housed animals, and each arena has two zones.

Top

Video tutorials

Part 1: Using LOGDATA, LOGCREATE and LOGRUN: runs through the set up for the experiment, including the stimuli, as well as illustrating how to use the LOGDATA, LOGCREATE and LOGRUN functions in your script.

Part 2: Using LOGDATA, LOGCREATE and LOGRUN: illustrates the use of LOGDATA, LOGCREATE, LOGAPPEND and LOGRUN, going through a section of the script, in this case called ACTION WRITEDATA, which is used to output the data at different stages during the experiment. It also shows how the results data, downloaded in a .csv file, can be displayed in a spreadsheet.

Top

Example script

For your reference below is a copy of the script used in this tutorial.

Scotataxis script for two arenas

INCLUDE ZSYS
 
DEFINE COLOUR WHITE
DEFINE CIRCLE 1
DEFINE SQUARE 2
 
DEFINE UNIT_TIME 6 
DEFINE NUM_BINS 3
 
SET(COUNTER1,COUNTER_ZERO)
 
ACTION MAIN
 
 SET(AUTOREF_MODE,1)
 SET(AUTOREF_TIMEOUT,10)
 SET(DETECTOR_THRESHOLD,2)
 SET(SEARCH_DISTANCE,50)
 SET(SEARCH_STEP,7)
 SET(FILTER_RADIUS,20)
 
 SETLIGHT(LIGHT1,SQUARE,300,500,1000)
 SETLIGHT(LIGHT2,SQUARE,1300,500,1000)
 
 LOAD(DETECTORS,"arenas2w")
 LOAD(ARENAS,"arenas2l")
 LIGHTS(ALL,OFF)
 
 AUTOREFERENCE()
 INVOKE(LIGHT_DARK,1)
 LIGHTS(ALL,OFF)
 
COMPLETE
 
ACTION LIGHT_DARK
 
 LOGDATA(DATA_SNAPSHOT,"BEGIN")
 
 INVOKE(DATA_BINS,NUM_BINS)
 
 LOGDATA(DATA_SNAPSHOT,"END")
 LOGDATA(DATA_SELECT,"BEGIN")
 LOGDATA(DATA_DELTA,"END")
 
 LOGCREATE("TEXT:|TEXT:|TEXT:|TEXT:|TEXT:|TEXT:TOTALS")
 LOGAPPEND("TEXT:VARIABLE|TEXT:ARENA1|TEXT:ARENA2")
 LOGRUN()
 
 LOGCREATE("RUNTIME|TEXT:|TEXT:|TEXT:|TEXT:|TEXT:|TEXT:TOTAL_ARENA_DISTANCES")
 LOGAPPEND("ARENA_DISTANCES:A1,2")
 LOGRUN()
 
COMPLETE
 
ACTION DATA_BINS
 
 SET(COUNTER1,COUNTER_INC)
 LIGHTS(LIGHT1,WHITE)
 LIGHTS(LIGHT2,OFF)
 
 LOGDATA(DATA_SNAPSHOT,"BEGIN1UNIT")
 WAIT(UNIT_TIME)
 LOGDATA(DATA_SNAPSHOT,"AFTER1UNIT")
 LOGDATA(DATA_SELECT,"BEGIN1UNIT")
 LOGDATA(DATA_DELTA,"AFTER1UNIT")
 
 LOGCREATE("RUNTIME|TEXT:|TEXT:|TEXT:|TEXT:BASELINE|TEXT:UNIT")
 LOGAPPEND("TEXT:VARIABLE|TEXT:ARENA1_ZONE1_WHITE|TEXT:ARENA1_ZONE2_DARK")
 LOGAPPEND("TEXT:ARENA2_ZONE1_WHITE|TEXT:ARENA2_ZONE2_DARK")
 LOGRUN()
 
 INVOKE(WRITEDATA,1)
 
COMPLETE 
 
ACTION WRITEDATA
 
 LOGCREATE("RUNTIME|TEXT:|TEXT:|TEXT:|TEXT:|COUNTER1|TEXT:ZONE_DISTANCES")
 LOGAPPEND("ZONE_DISTANCES:A1,2 Z1,2")
 LOGRUN()
 
 LOGCREATE("RUNTIME|TEXT:|TEXT:|TEXT:|TEXT:|COUNTER1|TEXT:ZONE_TIMERS")
 LOGAPPEND("ZONE_TIMERS:A1,2 Z1,2")
 LOGRUN()
 
 LOGCREATE("RUNTIME|TEXT:|TEXT:|TEXT:|TEXT:|COUNTER1|TEXT:ZONE_COUNTERS")
 LOGAPPEND("ZONE_COUNTERS:A1,2 Z1,2")
 LOGRUN()
 
 LOGCREATE("RUNTIME|TEXT:|TEXT:|TEXT:|TEXT:|COUNTER1|TEXT:|TEXT:ARENA1|TEXT:ARENA2")
 LOGRUN()
 
 LOGCREATE("RUNTIME|TEXT:|TEXT:|TEXT:|TEXT:|COUNTER1|TEXT:TOTAL_ARENA_DISTANCES")
 LOGAPPEND("ARENA_DISTANCES:A1,2")
 LOGRUN()
 
COMPLETE


Top

Tips

Explanations for the syntax, LOGCREATE, LOGAPPEND and LOGRUN can be found in the Zanscript syntax manual.

  • The command LOGRUN() will tell the unit to output the last line of data as detailed in the previous LOGCREATE command, so if there are two LOGRUN() commands the previous LOGCREATE command will be outputted twice in the data file.