#!/usr/local/bin/perl # ~/bin/ignorance.p gamma-energies sub bynumber { $a <=> $b; } $rescale = 0 ; $f=1; $t=2; $w=7; $th=-1.0; $show=0; $left=0; $smallest=0; $abs=0; $out="counts" ; $endnewline = 0 ; # How to override min and max values with command line eval "\$$1=\$2" while @ARGV && $ARGV[0]=~ /^(\w+)=(.*)/ && shift; $f--; $t--; if ($t<$f) { $t = $f ; } $num = $t - $f + 1 ; if($th > 0.0 || $show > 0 ) { $spacer = "." x ($w) ; } $white = " " x ($w) ; while (<>) { if ($rescale != 0 ) { $_ = sprintf("%10.6f", $_ * $rescale ) ; } if ($_ ne "\n") { # throw away decimal point s/0\.0*//g; s/\.//g; @fields = split('',$_); $string = "" ; for ( $i = $f ; $i <= $t ; $i++) { print $fields[$i] ; print " "; $string .= $fields[$i] ; $c{$i,$fields[$i]} ++ ; } print $string ; $c{$string} ++ ; $tot ++ ; } print "\n" ; } if ( $endnewline ) { print "\n" ; } open (O,"> $out") ; for ( $i = 10 ; $i <= 99 ; $i ++ ) { $f = sprintf("%10.4f", $c{$i} / $tot ) ; $p = sprintf("%10.4f", log(($i+1.0)/($i))/log(10.0) * $tot ) ; print O "$i $c{$i} $f\n" ; }