aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2010-05-25 11:50:08 +0200
committerThomas White <taw@physics.org>2010-05-25 11:50:08 +0200
commitecd7ed542623f3329d8e63a17f2b1d9383051147 (patch)
tree24d8ec0bc26f4d96e179fd4ef59ed923d1944962
parentd1dcc80ba6d6c5f5c0293adc6cdb05ee10f16327 (diff)
Histogram of double hit FoM
-rwxr-xr-xscripts/double-hit27
1 files changed, 27 insertions, 0 deletions
diff --git a/scripts/double-hit b/scripts/double-hit
index 831e2df6..55a95ee1 100755
--- a/scripts/double-hit
+++ b/scripts/double-hit
@@ -10,6 +10,16 @@ my $line;
my $filename;
my $full_filename;
+my $hsteps = 128;
+my @hist;
+my $hmin = 0;
+my $hmax = 5;
+my $hstep = ($hmax - $hmin)/$hsteps;
+
+for ( my $i=0; $i<$hsteps; $i++ ) {
+ $hist[$i] = 0;
+}
+
while ( $line = <FH> ) {
if ( $line =~ /^Reflections\ from\ indexing\ in\ (.+)$/ ) {
@@ -50,6 +60,9 @@ while ( $line = <FH> ) {
if ( $div == 1.0 ) {
printf("Single hit: %s\n", $full_filename);
}
+
+ my $bin = int(($div-$hmin)/$hstep);
+ $hist[$bin]++;
}
}
@@ -58,6 +71,7 @@ close(FH);
close(OFH);
open(GP, "| gnuplot");
+
print(GP "set term postscript enhanced font \"Helvetica,20\"\n");
print(GP "set output \"doublehit.ps\"\n");
print(GP "set xtics nomirror out rotate by -60\n");
@@ -66,6 +80,19 @@ 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] \"doublehit.dat\" u 1:2 w points\n");
+
+open(OFH, "> doublehit-hist.dat");
+for ( my $i=0; $i<$hsteps; $i++ ) {
+ printf(OFH "%f %f\n", $hmin+$hstep*$i+($hstep/2), $hist[$i]);
+}
+close(OFH);
+
+print(GP "set xtics nomirror out rotate by 0\n");
+print(GP "unset xdata\n");
+print(GP "set format x \"% g\"\n");
+print(GP "unset key\n");
+print(GP "plot [] [0:1000] \"doublehit-hist.dat\" u 1:2 w histeps\n");
+
close(GP);
system("ps2pdf doublehit.ps");