Zanscripts & services


In order to run an experiment in a Zantiks unit you need to write a script in Zantiks' proprietary software language, Zanscript. All scripts must then be "built" so that it can be added as a service on the home console page.

This manual will explain where to find key elements from the home console page for running experiments. How to find the Zanscript directory. How to create new scripts, upload scripts from the website and how to edit existing scripts. This manual will also explain how to load Zanscripts into your services directory in order to run experiments, and where to find your assets for running experiments.

Top

Zanscript Directory


The Zanscript link, located at the bottom centre of the Zantiks Control Console page, brings up the Zanscript directory. This page lists all of the zanscripts saved on the unit. 

From the Zanscript directory you can:  

  • Edit existing Zanscripts 
  • Download Zanscripts (.zs file) to any networked device
  • Delete unwanted Zanscripts (NOTE this is irreversible) 
  • Create a new Zanscript 
  • Upload a Zanscript (.zs file) from the website, another user or the Zantiks support team.

Video walkthrough of the Zanscript directory page

Top

Pre-loaded Zanscripts


The Zantiks units come with a set of pre-loaded Zanscripts. These scripts cover a range of functions, such as demonstrating the various commands to present stimuli (i.e., lights, audio, vibration) and calibrating the unit for asset drawing. The scripts are designed to help illustrate how how to write and structure commands and to test that the unit has been set-up correctly. 


All Zantiks systems will come with the following stimuli and scripts pre-loaded:

Stimuli files can be found in the Assets directory

  1. Audio stimuli 
    1. stereo.wav
    2. tone.wav
    3. mono.wav
  2. Visual stimuli (only available for the LT) 
    1. danio_small.bmp
    2. 5_CHOICE_LT.bmp

Zanscripts can be found in the Zanscript directory

  1. calibration.zs: This is a necessary line of code to run a system calibration in order to draw and create assets. For this script to work, the calibration plate will need to be inserted into the system.
  2. all_lights_off.zs: This is a script to quickly switch off all the lights in the system. There are times when the light stimulation plate, overhead lights, or screen lights are left on after an experiment is completed. The script can be used to shut them off.
  3. runthrough.zs: This script takes you through a sequence of commands used to control stimuli.
    1. Invoke commands used for both the MWP and the LT: 
      1. INVOKE(OVERHEAD_LIGHTS_CN3B,1): This code for the overhead lights when plugged into CN3B on the upper board of the top box. The commands operate via a GPO commands. This ACTION cycles through the LED colours available as overhead lighting.
      2. INVOKE(VIBRATIONS,1): This code is for the vibration stimulus. They control the motor that invokes tactile stimuli. This is useful for behaviours such as startle response.
      3. INVOKE(AUDIO,1): This code shows how to play audio from the system. The audio stimuli are required and should be loaded in the Assets directory. NOTE: Remember to power up amplifier, and connect the audio cable.
    2. Additional invoke commands used for the MWP only:
      1. INVOKE(LIGHT_STIM,1): This is only relevant for the MWP and is used for the light stimulation stand. The Z2 loop driver needs to be plugged into CN4 and 5 on the lower board of the top box and CN3A on the upper board. The code turns the LSP LEDs off and on.
    3. Additional invoke commands used for the LT only. Some are hashed # out because certain stimuli need to be specifically plugged into the outputs to work. You can un-hash the commands after plugging the desired stimuli
      1. #INVOKE(OVERHEAD_LIGHTS_CN8,1): This code for the overhead lights when plugged into CN8 on the upper board of the top box. The commands operate via the LIGHT16 command. It cycles through the LED colours available as overhead lighting.
      2. INVOKE(AD_LT_FISH,1): These commands illustrate how to display a sprite image and move it on the screen.
      3. INVOKE(AD_LT_SCREEN_LIGHTS,1): These commands present stimuli on the built in screen in the locations set through the LOAD(LIGHTING,"5_CHOICE_LT") command in ACTION LT_SCREEN_SPRITE_SETUP. It will cycle through the various colours and locations.
      4. INVOKE(EXTERNAL_LIGHTS_CN7,1): This code turns on and off the external light, which is plugged into CN7 on the top box. It will cycle through the available LED colours. 
      5. #INVOKE(AD_LT_POWDER_FEEDER,1): This code will rotate the brass feeder to deliver powder food (typically used for fish experiments). There is a command for a "false feed" as well. This produces the same noise as when the feeder delivers food, but without the food delivery.
      6. #INVOKE(AD_LT_PELLET_FEEDER,1): This is the command to rotate the pellet feeder in order to delivery a food pellet.
      7. #INVOKE(AD_LT_PERISTALTIC_PUMP,100): This is the command to rotate the peristaltic pump one full rotation.
      8. #INVOKE(AD_LT_SHOCK,10): This is the code to set the voltage level and delivery a mild electric shock with the steel plates are plugged into CN5.

The MWP comes with the following additional scripts:

  1. set_record_temp.zs: This script demonstrates how to quickly set the temperature in the MWP for the standard temperature control. NOTE: It is essential the fan is working - please ensure it is plugged in and working.
  2. light_stand_stim_Z2.zs: This script demonstrates how to operate the light stimulation stand LEDs. It runs through combinations of ZCOMMANDs, GPO and VOLTAGE commands. It will pulse light at full power for increasing duration, turn the light off for increasing duration, turn the light to half power for increasing duration, turn the light to full power for increasing duration and changes voltage level which controls brightness. 
Top

Create a new Zanscript

When learning to write a Zanscript, it is often easiest to use parts of code from the demo Zanscripts we provide. For instructions on where to find existing codes and how to adapt Zanscripts, go to the Writing and Adapting Zanscripts manual. To create a new Zanscript: 

  1. From the Home Console page, select Zanscript directory.
  2. From the Zanscript directory page, click Create New. 
  3. Enter a new file name and click Create file (file names are case sensitive and cannot include spaces or brackets). 
  4. This brings up the Zanscript Online Development page and a scripting box.
  5. You can write an entirely new script, or copy and paste elements from other demo Zanscripts.

Important things to note include:

  • The script will not autosave as you write. Take care to occasionally save at regular intervals. 
  • Including spaces or brackets in a file name will result in the error message: "Error processing script" and "Script processing error" (see image below)
Error processing script
error message if trying to build a Zanscript with spaces and/or brackets in the name

Below we include a video runthrough for creating a new Zanscript 

Video demonstration for creating a new Zanscript

Top

Create and load a new service

Once a new Zanscript has been created or an existing .zs file has been uploaded into the Zanscript directory it MUST be built. This will convert it into a .zex file which can be found in the Services Directory. 

  1. Once a script is complete click the Build button. This can be found at both the top and bottom of the page. If you have uploaded a pre-written Zanscript (.zs file) you must select Edit and then Build.  
  2. This saves and compiles the script and brings up the Zanscript Compiler page. The compiler page details any errors or warnings found in the script including which line of code the error was found. It also tells you whether the build is successful or not.
  3. If your Zanscript has an errors or warnings, the Edit/Rebuild link at the bottom of the page will take you back into the script so that you can correct them.
  4. If the script has built successfully, navigate back to the control console using the Home link at the bottom of the page.
  5. To upload a new service, select Settings from the control console. 
  6. The 20 numbered slots below the Zanscript shortcuts heading are used to load scripts to the control console. Type the script's name (remember that this is case sensitive) in one of the numbered boxes and click Set.
  7. The system will bring up a new page indicating a successful or unsuccessful link.
  8. Select Home to navigate back to the control console page, where the new service will be found under the relevant slot.

Video example of how to build a script and load a service

Top

Edit a service

If at any time you want to change any of the elements in the service/experiment: 

  1. From the Control Console select Zanscript directory
  2. Click on the Edit button for the relevant experimental script
  3. In the Zanscript Online Development page, make any edits and select Build
  4. This will update the Zanscript and it will automatically update the service, so that when you next run the experiment it will take into account your changes
Top

Run a Service 

To run a service:

  1. From the Control Console, select the service that you would like to run. The name of the service should appear as the Current service on the top left of the page
  2. Select Live Video found at the bottom centre of the Control Console page to see a live feed of the test environment. The clock at the bottom of the live feed shows GMT (Greenwich Mean Time). When no service is running, the bottom centre shows the status as *IDLE*.
  3. Click Run at the bottom right of the live video display page to start the experiment (You can also select Run from the control console page). The system's status will change to *RUNNING* in a pink bar. A time on the live video will change to show the running time of the experiment in seconds.
  4. To stop the experiment at any time, click the Stop button at the bottom right of the screen. This terminates the experiment. Clicking Run again starts the experiment from the beginning. There is no pause button.

INSERT VIDEO SELECTING & RUNNING A SERVICE

Video demonstration of how to select and run a service

Top

Download a Zanscript

If you want to share a Zanscript with someone you can download the .zs file from the Zanscript directory

To download a Zanscript as a .zs file right click on the script and select "Save File As" or "Save Link As" or "Download file as" or "Download linked file as" This will be dependant on both the system you are using (i.e. Windows or MacOS) and the browser (e.g. Chrome, Safari, Firefox etc.). Left clicking on the script name hyperlink will open a read-only version of the script. 

If you require support with your script writing you can download your Zanscript as a .zs file and send them to one of the Zantiks support team. In this case you must save files from the Zanscript directory. This is the only way to save files as a .zs file. Trying to save files from the Services directory will save them as a .zex file which is a file that cannot be read/edited. 

Top

Assets directory

Assets are bitmap files used to assign detection arenas for tracking or create visual stimuli on the screen. These files need to be uploaded into the Assets directory (in the 'Administration section' at the bottom of the Control Console page) on the Zantiks unit in order for your script to execute correctly. Assets are automatically loaded into the asset directory when built using one of our asset building scripts.


Building assets

In order to build assets, you will first need to calibrate you system. Detailed instructions on how to do this can be found in the calibrating your Zantiks unit manual

Once you have successfully calibrated your system you can start to build your own assets. Instructions on how to do this plus the necessary script downloads can be found in the following manuals:

Asset building in the MWP unit

Asset building in the AD unit

Asset building in the LT unit

Top

Zantiks Live Video Display page

The Live Video Display page gives you a live feed of the experimental chamber. There are some advanced controls which enable you to check that the correct arena or zone assets are loaded in your script. First you need to select the service you want to use on the Home page, navigate to the Live Video page and then click 'Run'. The script will load and then you can check the assets are correct. (N.b. if you click to check the arena and zone assets before running the service, the assets loaded in the last experiment will be shown).

Checking the assets before you run a service is especially important with the MWP unit - you need to ensure that the arenas asset matches the wellplate. If the there seems to be a little misalignment the diffuser stand may need to be pushed to the left and to the back in the recessed area of the chamber, and that the wellplate needs to be pushed similarly in the diffuser stand.

Zantiks Live Video Display Screenshot
Zantiks Live Video Display page in the AD unit with a fake mouse

The screenshot above shows the Zantiks Live Video Display page during an experiment.

  1. The current service is called 'Mariana_memorytask' (ringed in blue oval) and it is 'RUNNING' (see 'RUNNING' is displayed in a pink box).
  2. The Live video screen shows a live image of the arena - at this point there are zones switched on (see colour blocks) and the unit is tracking a 'fake mouse'.
  3. The image displayed is small as the camera has been reprogrammed to accommodate a bigger animal, and the camera is taking 15 frames per second (see the line at the bottom of the image 'Target frame rate: 15FPS'. If a smaller animal is being tracked the camera is on its default setting and the live video displays a larger image and the camera takes 30 frames per second.
  4. The screen is showing the advanced controls - hence the link (ringed in red) says 'Hide advanced controls' - click on this link and you can hide the advanced controls.
  5. The five advanced controls are marked by the red arrows, if you click on the link boxes you can change the display on both the video recording (if a service is live and programmed to record one), and on the Live video screen accordingly:

- Timestamp: click on this and the timestamp will not display.

Lighting: click on this and the overlays (i.e. the visualisations of the zones currently programmed) will not appear.

- Arenas: click on this and the arena asset will appear.

- Zones: click on this and the zone asset will appear.

- Reset: click on this and the default settings will display - with timestamp and with overlays appearing when they are programmed to appear.

For descriptions of the Zanscript syntax visit the manual here.

For an explanation on how to navigate the website to find all of the various types of scripting support pages and codes and examples of how to edit existing scripts, visit the Learning how to Zanscript support page here.