#! /bin/csh -f # Last edited on 2008-02-04 20:51:22 by stolfi set usage = "$0 DIR HAXIS VAXIS > PLOT.gif" # Reads two files DIR/HAXIS.projs and DIR/VAXIS.projs, each with entries # in the format # # 1 2 # COORD FNUM # # where COORD is a real number and FNUM is a page's f-number. # Ouputs a plot (GIF image) of the (H.COORD,V.COORD) pairs, # with consecutive pages connected by lines. if ( $#argv != 3 ) then echo "usage: ${usage}"; exit 1 endif set dir = "$1"; shift; set haxis = "$1"; shift; set vaxis = "$1"; shift; set tmp = "/tmp/$$" set dfile = "${tmp}.datsp" set pfile = "${tmp}.plt" set mfile = "${tmp}.ppm" join \ -a 1 -a 2 -e '+0.0000' \ -j1 2 -j2 2 \ -o 1.1,2.1,0 \ ${dir}/${haxis}.projs \ ${dir}/${vaxis}.projs \ | map-field \ -v inField=3 \ -v outField=4 \ -v table=fnum-to-plot.tbl \ -v default='?' \ | map-field \ -v inField=3 \ -v outField=5 \ -v table=fnum-to-pnum.tbl \ -v default='000' \ > ${dfile} # Sort by section and p-number. # Then insert single blank line at gaps, # write separate file by subsection. cat ${dfile} \ | sort +3 -4 +4 -5n \ | gawk -v tmp="${tmp}" \ ' BEGIN{s="";sf="";} \ //{ if($4!=s) \ { if(s!=""){ close(sf);} \ s=$4; sf=(tmp "." s); p=-1; \ } \ if(($5!=p)&&(p!=-1)) { printf "\n" > sf; } \ print > sf; p = $5+1; \ } \ ' \ > ${pfile} /bin/rm -f rm ${mfile} gnuplot <