aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2010-06-11 16:13:49 -0700
committerThomas White <taw@bitwiz.org.uk>2010-06-11 16:13:49 -0700
commit963c0525e99e2782d8d22482e913f45451284bbf (patch)
tree713d226643699890e95a73a87a042d56fb58fb6f /scripts
parentd88796d69537a2b720e84dbad6fb4d501a59fbd1 (diff)
Add scripts/hit-rate for plotting hit rate as f(t)
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/hit-rate67
1 files changed, 67 insertions, 0 deletions
diff --git a/scripts/hit-rate b/scripts/hit-rate
new file mode 100755
index 00000000..537eb568
--- /dev/null
+++ b/scripts/hit-rate
@@ -0,0 +1,67 @@
+#!/usr/bin/perl -w
+
+use strict;
+use File::Basename;
+
+open(FH, $ARGV[0]);
+open(OFH, "> hitrate.dat");
+
+my $line;
+my $filename;
+my $full_filename;
+my $np;
+
+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++;
+ }
+
+ # Blank line
+ if ( $line =~ /^$/ ) {
+
+ $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;
+
+ my $div;
+
+ $np
+
+ printf(OFH "%s/%s/%s-%s:%s:%s %f\n", $year, $month, $day,
+ $hour, $min, $sec,
+ $val);
+
+ }
+
+}
+
+close(FH);
+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 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");
+close(GP);
+
+system("ps2pdf hitrate.ps");
+unlink("hitrate.dat");
+unlink("hitrate.ps");