diff options
Diffstat (limited to 'scripts/hit-rate')
-rwxr-xr-x | scripts/hit-rate | 49 |
1 files changed, 26 insertions, 23 deletions
diff --git a/scripts/hit-rate b/scripts/hit-rate index 537eb568..14a75d9f 100755 --- a/scripts/hit-rate +++ b/scripts/hit-rate @@ -7,7 +7,7 @@ open(FH, $ARGV[0]); open(OFH, "> hitrate.dat"); my $line; -my $filename; +my $filename = ""; my $full_filename; my $np; @@ -16,34 +16,37 @@ while ( $line = <FH> ) { chomp($line); if ( $line =~ /^Peaks\ from\ peak\ search\ in\ (.+)$/ ) { + $full_filename = $1; - $filename = basename($full_filename); - $np = 0; - } - if ( $line =~ /^\s+[0-9\.]+\s+[0-9\.]+\s+[0-9\.]+\s+[0-9\.]+$/ ) { - $np++; - } + # Process last image + if ( $filename ) { - # Blank line - if ( $line =~ /^$/ ) { + unless ( $filename =~ /LCLS_(\d+)_([A-Za-z]+)(\d+)_(\d\d)(\d\d)(\d\d)_/ ) { + printf(STDERR "Wrong filename format '%s'!\n", $filename); + exit(1); + } + my $year = $1; + my $month = $2; + my $day = $3; + my $hour = $4; + my $min = $5; + my $sec = $6; - $filename =~ /LCLS_(\d+)_([A-Za-z]+)(\d+)_r\d+_(\d\d)(\d\d)(\d\d)_/; - my $year = $1; - my $month = $2; - my $day = $3; - my $hour = $4; - my $min = $5; - my $sec = $6; + printf(OFH "%s/%s/%s-%s:%s:%s %f\n", $year, $month, $day, + $hour, $min, $sec, + $np); + printf("%s: %i peaks\n", $filename, $np); - my $div; + } - $np + $filename = basename($full_filename); + $np = 0; - printf(OFH "%s/%s/%s-%s:%s:%s %f\n", $year, $month, $day, - $hour, $min, $sec, - $val); + } + if ( $line =~ /^\s+[0-9\.]+\s+[0-9\.]+\s+[0-9\.]+\s+[0-9\.]+$/ ) { + $np++; } } @@ -54,12 +57,12 @@ close(OFH); open(GP, "| gnuplot"); print(GP "set term postscript enhanced font \"Helvetica,20\"\n"); print(GP "set output \"hitrate.ps\"\n"); -print(GP "set xtics nomirror out rotate by -60\n"); +print(GP "set xtics nomirror rotate by -60\n"); print(GP "set xdata time\n"); print(GP "set timefmt \"%Y/%b/%d-%H:%M:%S\"\n"); print(GP "set format x \"%d/%b %H:%M\"\n"); print(GP "unset key\n"); -print(GP "plot [] [0:5] \"hitrate.dat\" u 1:2 w points\n"); +print(GP "plot [] [] \"hitrate.dat\" u 1:2 w points\n"); close(GP); system("ps2pdf hitrate.ps"); |