aboutsummaryrefslogtreecommitdiff
path: root/scripts/hit-rate
blob: 537eb568bfa61ab44e4a81072c95ed9c3d879480 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
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");