Tools for z-Tree
- labcontrol - an interface to control z-Tree and z-Leaf
- How to use z-Tree with GNU Linux
- How to use z-Tree with FreeBSD
- How to use z-Tree with Mac OS-X
- z-Tree and the statistical software R
- z-Tree and the statistical software Stata
- Reading GSF files with TreeRing
- Testing the connection between z-Leaf and z-Tree
labcontrol - an interface to control z-Tree and z-Leaf
Here is a (hopefully helpful) interface for z-Tree laboratory experiments. labcontrol was intended to be an easy tool of controlling our laboratory at university and it is still in development. Most options are configurable with Gconf.
What labcontrol provides:
- a simple GTK-GUI, which shows the state of all clients and all possible actions
- get the current state automatically and update the GUI
- start and halt clients via wake-on-LAN and SSH
- detect all installed versions of zTree
- starting zTree in the detected versions with directory-options
- start and kill a suitable version of zleaf.exe via SSH on the clients or local zleafs for testing purposes
- printing receipts immediately after zTree has written the paymentfile and creating receipts from a user-defined paymentfile
- synchronize media content required by zLeaf's Multimedia-Box via rsync
- watch the desktop of the clients via VNC
- show a picture of the laboratory's webcam and update it periodically
- Installation Guide
- User Guide
- Linux Guide
- The source of Labcontrol-1 can be downloaded at launchpad (most of Labcontrol-1 is work of our research assistant Henning Prömpers)
- The source of version 2 (Qt based) is available at github (most of Labcontrol 2 is work of our research assistant Markus Prasser)
- We are working on an even more recent version of labcontrol (still Qt based). If you are interested, please let us know.
How to use z-Tree with GNU Linux
- Install wine (from the package manager of your distribution).
- Start z-Tree with a script like the following:
#!/bin/bash /usr/bin/wine zTree.exe &
Start z-Leaf on its own client with a script like the following (or, better, use labcontrol)#!/bin/bash /usr/bin/taskset -c 0 /usr/bin/wine zLeaf.exe &
(taskset is necessary for wine version 1.5.12 and later. This is due to Bug 35041) If you are developing and you need several z-Leaf-s on a single computer, you can use something like this:#!/bin/bash if [[ $1 == "" ]]; then echo "please tell me how many leaves to start"; exit; fi x=640 y=480 for ((i=0;$i<$1;i++)); do echo $i let x=$x+10 let y=$y+10 /usr/bin/taskset -c 0 /usr/bin/wine zLeaf.exe /size ${x}x$y /name client-$i & done
- Stability: with wine before version 1.5.12 zTree is stable. With versions of wine from 1.5.12 and libX11 before 1.7.0 you may find the following problem:
It is possible that a newly started client does not show up with its name in the client table. Instead you only see an empty line. This is due to Bug 35041.
Workaround:
- Recommended: use
taskset -c 0 wine zLeaf.exe
. - Alternative: Before you start a treatment kill the zLeaf, start it again. It should now appear under its proper name.
- Recommended: use
How to use z-Tree with FreeBSD
- Install wine (from packages or from ports).
- Start z-Tree with a script like the following:
#!/usr/local/bin/bash /usr/local/bin/wine zTree.exe &
Start z-Leaf on its own client with a script like the following (or, better, use labcontrol)#!/bin/bash /usr/local/bin/wine zLeaf.exe &
If you are developing and you need several z-Leaf-s on a single computer, you can use something like this:#!/usr/local/bin/bash if [[ $1 == "" ]]; then echo "please tell me how many leaves to start"; exit; fi x=640 y=480 for ((i=0;$i<$1;i++)); do echo $i let x=$x+10 let y=$y+10 /usr/local/bin/wine zLeaf.exe /size ${x}x$y /name client-$i & done
How to use z-Tree with Mac OS-X
Jonathan Page has written a tutorial for running z-Tree on OS-X with Wine.z-Tree and the statistical software R
For those who use R, I have written a small R-package zTree to help you import data from z-Tree into R. It provides three commands,zTreeTables
, zTreeSbj
, and toLongDate
.
zTreeTables (filelist,tables=c("globals","subjects"),sep="\t")
filelist
: a vector of z-Tree (xls-) filenames.tables
: a vector of table names. If you leave this empty, globals and subjects will be read. If you settables=NULL
, all tables will be read.sep
: field separator
Example:source("/lab/zTree.R")
To read all tables from all sessions in directories below the current one:
zTT <- zTreeTables(c("080712_1412.xls","080712_1818.xls"))
with(zTT$subjects, table(Treatment,Period))
sessions<-list.files(".","[0-9]{6}_[0-9]{4}.xls",recursive=TRUE)
zTT<-zTreeTables(sessions,tables=NULL)zTreeSbj(files,sep="\t")
files
: a vector of z-Tree sbj-filenames.sep
: field separator
Example:
files <- list.files(pattern = "*.sbj$",recursive=TRUE)
fname <- sub(".*/","",files)
sbj <- zTreeSbj(aggregate(files,list(fname),function(x) x[1])$x)-
toLongDate(dates)
dates
: a vector of strings, each element an 8-digit old z-Tree date, e.g.,"091112JN"
.
Example:
toLongDate("091112JN")
options(zTree.silent=FALSE)
: set to TRUE to get more feedback.options(zTree.encoding="LATIN1")
: adjust, if you have recoded your files.
z-Tree and the statistical software Stata
For those who (still?) use Stata, Kan Takeuchi has written a utility to import data from z-Tree into Stata.Reading GSF Files
TreeRing allows you to inspect and to extract data from GSF files.Read more about z-Tree at the z-Tree-Wiki.