Heat maps


This tutorial demonstrates how to use the Zanscript language to create visualised heat maps along with any processed data file. Heat maps can be used to get a visual representation of how much time an animal spends in the different areas of the experimental environment.

The heat map .bmp files are saved to the Media directory on the Homepage of the Control Console.

Top

Commands to create a Heat Map


There are 3 DEFINE directives which need to be included in your script in order for the heat map to work. These are developmental settings and they should be placed at the top of your script prior to the ACTION MAIN.

DEFINE MAKEMAP 5682 
DEFINE COLOURMAP 5683 
DEFINE SUMSIZE 20 

DEFINE MAKEMAP 5682: setting to allow for generating heatmap

DEFINE COLOURMAP 5683: setting to allow for selecting which colourmap to use. The colourmap will be activated and selected later in the script via the SET(COLOURMAP,#) command.

DEFINE SUMSIZE 20: sets radius of the area to sum. It is measured in pixels.


SETCOLOUR(15,0.5,0.5,0.8) 
SET(COLOURMAP,0) 
SET(MAKEMAP,SUMSIZE)

SETCOLOUR(15,0.5,0.5,0.8): sets colour of area outside heat map arenas. 15 indicates the area to be coloured. The following three numbers are the percentage of Red, Green, and Blue to mix.

SET(COLOURMAP,0): This command sets the colour palette to colour in the heat map.

  • 0 = Zantiks


  • 1 = Berkeley Inferno

INFERNO.bmp#asset:4464

  • 2 = Berkeley Plasma

PLASMA.bmp#asset:4463


SET(MAKEMAP,SUMSIZE): This is the final command to generate the heatmap. This command needs to be written into the script following the final time bin that is to be included. For example, if the heatmap needs to show the entire experimental session, it will be written after all the ACTIONs are invoked.

Top

Full example script

DEFINE MAKEMAP 5682 
DEFINE COLOURMAP 5683 
DEFINE SUMSIZE 20 
 
DEFINE NUM_SAMPLES 20 
DEFINE TIME_BIN 1
 
SET(TARGET_SIZE,2) 
SET(DETECTOR_THRESHOLD,6) 
 
SET(AUTOREF_MODE,0) 
SET(AUTOREF_TIMEOUT,10)
 
ACTION MAIN
 
SETCOLOUR(15,0.5,0.5,0.8) 
SET(COLOURMAP,0) 
 
AUTOREFERENCE() 
INVOKE(SAMPLE,NUM_SAMPLES)
SET(MAKEMAP,SUMSIZE) 
 
COMPLETE
 
 
ACTION SAMPLE 
 
LOGDATA(DATA_SNAPSHOT,"begin") 
WAIT(TIME_BIN) 
LOGDATA(DATA_SNAPSHOT,"end") 
LOGDATA(DATA_SELECT,"begin") 
LOGDATA(DATA_DELTA,"end") 
 
LOGCREATE("RUNTIME|APPARATUS_ID|TEMPERATURE1") 
LOGAPPEND("COUNTER1|TEXT:TOTAL_DISTANCE|ARENA_DISTANCES*") 
LOGRUN
 
COMPLETE

Script download

To download the heat_map 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.

Script download: