#!/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 CRaTER -- CPlot/SPlot =head2 NAME B -- Plot engineering values versus time =head2 USAGE CPlot [-f] [-h] [-b] [-c] [-l] [-r] [-t] [-z] [file1] ... [filen] =head2 FLAGS -f (fancy) leaves color Postscript plot files [b/w] -h prints full help message -b Bias Currents -c Calibration Amplitude -l LLD Values -r Regulated Voltages -t Temperatures -z Zap time; use SS sequence numbers =head2 DESCRIPTION As CPlot this shell script invokes B on the given binary data file names of, by default, any files in the current directory with a ".hk" suffix. The engineering values are computed with B and fed to B to generate a tab-separated-value data file. The results are then plotted using B. If no flags are given, the B<-t> flag is assumed. If no file names are given, all files with suffix .hk in the current directory are scanned. As SPlot this shell script bypasses the input pipe and plots from ASCII data files in the B format, presumably generated from the SData program. The Calibration Amplitude, LLD Values, and Regulated Voltages tend to change neither with time nor temperature, the casual user will find little of interest in using these flags; they are provided solely for the sake of completeness. =head4 Mnemonics invoked (see B) -b BiasCurrentD[1-6] -c CalAmp -l LLDThin, LLDThick -t Tanalog, Tdigital, Tpower, Tref, Ttelescope -v V5digital, V5plus, V5neg =head2 BUGS Really should allow passing a -v flag =head2 SEE ALSO rtlm, calcurve, tsv, c_plot, gnuplot =head2 AUTHOR Bob Goeke =head2 RCS Information $Id: CPlot,v 2.1 2009/04/22 13:01:08 goeke Exp goeke $ =cut ######################################################################## # history follows ######################################################################## # $Log: CPlot,v $ # Revision 2.1 2009/04/22 13:01:08 goeke # Make it compatible with SData output; linked CPlot<->SPlot # # Revision 1.2 2008/11/24 18:38:26 goeke # Rename Plot to CPlot; add flag to pass flag to tsv for using sequence numbers instead of time. # # Revision 1.1 2008/11/04 16:18:34 goeke # Initial revision #