#!/bin/sh -e # -*- shell -*- # Survey all the CR* files in the current directory BASE=`basename $0` SOC="SPlot" BROWSE="browse -f -" CAL="calcurve" PLOT="c_plot -z" RTLM="rtlm -a -t -r -" TMP="tsv.$$" TSV="tsv -c -t" TSV_All="tsv -t" # These are the mnemonic sets MBias="BiasCurrentD1 BiasCurrentD2 BiasCurrentD3 BiasCurrentD4 BiasCurrentD5 BiasCurrentD6" MCal="CalAmp" MLLD="LLDThick LLDThin" MTemp="Tdigital Tpower Tanalog Ttelescope Tref" MVolts="V5digital V5plus V5neg BiasVoltThick BiasVoltThin" MSingles="Single1 Single2 Single3 Single4 Single5 Single6" Cleanup() { echo -n ">>> Delete working tsv file? yes/[no] " read foo case $foo in [yY]*) rm $TMP echo ">>> $TMP removed" ;; *) echo ">>> Leaving $TMP in place" ;; esac } Help() { echo "Usage $BASE [-f] [-h] [-b] [-c] [-l] [-r] [-s] [-t] [-z] [file1] ... [filen]" echo " plots the engineering values of the various categoies" echo "Flags: -f Fancy, leaves color Postscript files [b/w]" echo " -h This help message" echo " -b Bias Currents" echo " -c Calibration Amplitude" echo " -l LLD Values" echo " -r Regulated Voltages" echo " -s Singles Counts" echo " -t Temperatures" echo " -z Zap actual time; count SS packets" echo "If no flag is given, -t is assumed" echo "If no filename is given, all *.hk in current directory are used" } PlotIt() { echo ">>> Generating engineering data plots" $PLOT $fancy $TMP } Reduce() { echo ">>> Generating the TSV file" if [ $BASE = $SOC ] then cat $files | $TSV $mnemonics $zap >$TMP else $BROWSE $files | $RTLM | $CAL | $TSV $mnemonics $zap >$TMP fi } ######################################################################### # Program starts here # NB this isn't a "setup" subroutine, 'cause you can't process input # args that way ######################################################################### while [ "$1" != "" ] do case $1 in -[hH]*) Help exit 0 ;; -[fF]*) fancy="-c" ;; -[bB]*) mnemonics="$mnemonics $MBias" ;; -[cC]*) mnemonics="$mnemonics $MCal" ;; -[lL]*) mnemonics="$mnemonics $MLLD" ;; -[rR]*) mnemonics="$mnemonics $MVolts" ;; -[sS]*) mnemonics="$MSingles" TSV=$TSV_All ;; -[tT]*) mnemonics="$mnemonics $MTemp" ;; -[zZ]*) zap="-b" ;; -*) echo "Unknown flag: $1" Help exit 1 ;; *) files="$files $1" ;; esac shift done if [ "$files" = "" ] then files="*.hk" # if no arg given, use all we have fi Reduce # generate the tsv file PlotIt # plot the result Cleanup # be neat exit 0 ######################################################################## # Pod follows ######################################################################## =for html