#!/bin/sh
#
# process3.sh
#
# Create venn diagram of analyzable data for S4.

# Shourov K. Chatterji
# shourov@ligo.caltech.edu

# $Id: process3.sh,v 1.1 2007/05/15 15:48:31 shourov Exp $

# start with template fig file
cp venn.template venn.fig

# get list of networks, livetimes, and duty cycles
entries=`awk ' { printf "%s%s:%s\n", $1, $2, $3 } ' livetime.txt`

# begin loop over networks
for entry in ${entries}; do

  # extract network name, livetime, and duty cycle
  network=`echo ${entry} | sed -e 's|^\([^:]*\):\([^:]*\):\([^:]*\)$|\1|'`
  livetime=`echo ${entry} | sed -e 's|^\([^:]*\):\([^:]*\):\([^:]*\)$|\2|'`
  dutycycle=`echo ${entry} | sed -e 's|^\([^:]*\):\([^:]*\):\([^:]*\)$|\3|'`

  # update template for this network
  cp venn.fig venn.fig.tmp
  sed -e "s|<${network}_livetime>|${livetime}|" \
      -e "s|<${network}_dutycycle>|${dutycycle}|" \
      venn.fig.tmp >venn.fig

# end loop over networks
done

# remove temporary file
rm -f venn.fig.tmp

# create png and eps figures
fig2dev -L png -m 1.5 -S 4 venn.fig venn.png
fig2dev -L eps -m 1.5 venn.fig venn.eps

