#!/usr/local/bin/perl # goes through a code/cg report file and creates separate # gnuplot files with scatterplots for # successes, failures, and pseudo-successes. $labels = 0 ; # label axes. $allow_oks = 0 ; # don't use the ok facility (because score screwed up) $show_true_err = 1 ; $show_true_fs = 1 ; $corr = "go/corr" ; $ok = "go/ok" ; $wrong = "go/wrong" ; $t = 0.0 ; # threshold, could be set to +10.0 for example $perturb = 1 ; $cyclex = 3 ; $stepx = 0.01 ; $cycley = 3 ; $stepy = 0.01 ; $fAnum = 1 ; # whether to display fA as an average number (fA * N) $xmax = 0 ; # whether to have a range from 0:xmax $ymax = 0 ; # whether to have a range from 0:ymax $ymin = 0 ; $xmin = 0 ; $size="0.6"; $sizex="0.5"; $omitw=0; # whether to omit the wrongs from the plot $dotw=1; # whether to use dots for wrongs $show_ok = 0 ; eval "\$$1=\$2" while @ARGV && $ARGV[0]=~ /^(\w+)=(.*)/ && shift; $psfile = $ARGV[0] ; $psfile =~ s/r/g/g ; $psfile .= ".ps" ; $x0 = ($cyclex -1) / 2 ; $x = - $x0 ; $y0 = ($cycley -1) / 2 ; $y = - $y0 ; open ( CORR , ">$corr" ) ; open ( OK , ">$ok" ) ; open ( WRONG , ">$wrong" ) ; while (<>) { if ( /^\#/ ) { continue ; } s/^\s*// ; ( $count , $score , $n , $t , $fs , $err , $bstl, $seed, $tr_fs , $tr_err, $beta ) = split ; $out = $fs."\t".$err."\t".$tr_fs."\t".$tr_err."\n" ; if ( $count == 0 ) { print CORR $out ; } elsif ( $score < $t && $allow_oks ) { print OK $out ; } else { print WRONG $out ; } } close ( CORR ) ; close ( OK ) ; close ( WRONG ) ; print "# gnuplot\n" ; print "set nokey\n" ; if ( $labels ) { print "set xlabel 'fs'\n" ; print "set ylabel 'noise level'\n" ; } if ( $xmax) { print "set xrange [$xmin:$xmax]\n" ; } if ( $ymax) { print "set yrange [$ymin:$ymax]\n" ; } print "set size $sizex,$size\n" ; print "set term post \n" ; # print "set ytics 0,0.1 \n" ; print "set output '$psfile'\n" ; print "# gnuplot\n" ; if ( $show_true_err ) { $errcol = 4 ; } else { $errcol = 2 ; } if ( $show_true_fs ) { $fscol = 3 ; } else { $fscol = 1 ; } $colstring = "$fscol:$errcol" ; print "plot '$corr' u $colstring t 'correct' w p 3 3"; if ( $show_ok ) { print ", '$ok' u $colstring t 'ok' w p 6 6" ; } else { if ( $dotw ) { $wstyle = "w d 4" ; } else { $wstyle = "w p 4 4" ; } print ", '$wrong' u $colstring t 'wrong' $wstyle" ; } print "\n" ;