+#!/bin/bash
+
+output=$2
+if [ "$output" != "" ]; then
+ output="set term postscript colour; set output \"$output\""
+fi
+
+field=$1
+if [ "$field" == "" ]; then
+ field="main.dat"
+fi
+
+plot="set contour base; set cntrparam level incremental -20,20,380; unset surface; set table \"cont.dat\"; splot \"$field\" u 1:2:3; unset table;"
+plot="$plot $output; set xrange [0:500]; set yrange [0:377]; set zrange [-1:1]; set title \"TCS Electron Gun\"; unset key; set palette rgbformulae 33,13,10; plot \"$field\" w image, \"cont.dat\" w l lt -1 lw 1"
+ #plot \"../egun.png\" binary filetype=png flipy w rgbimage"
+
+if false; then
+count=1
+for i in electron*.dat; do
+ if [ $count -eq 0 ]; then
+ plot="$plot plot"
+ count=1
+ else
+ plot="$plot,"
+ fi
+ plot="$plot \"$i\" u 2:3 w l lt -1 lw 1"
+done
+fi
+gnuplot --persist -e "$plot"