From f0cab41a28bf5da5e922e4c86fa3a08f3bfccdc5 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Thu, 29 Apr 2010 18:43:37 +0200 Subject: Add scripts/double-hit --- scripts/double-hit | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100755 scripts/double-hit (limited to 'scripts') diff --git a/scripts/double-hit b/scripts/double-hit new file mode 100755 index 00000000..a3d4eb07 --- /dev/null +++ b/scripts/double-hit @@ -0,0 +1,72 @@ +#!/usr/bin/perl -w + +use strict; +use File::Basename; + +open(FH, $ARGV[0]); +open(OFH, "> doublehit.dat"); + +my $line; +my $filename; + +while ( $line = ) { + + if ( $line =~ /^Reflections\ from\ indexing\ in\ (.+)$/ ) { + $filename = basename($1); + } + + if ( $line =~ /^Peak\ statistics:\ (\d+)\ .*\ (\d+)\ .*\ (\d+)\ / ) { + + my $found = $1; + my $close = $2; + my $hits = $3; + + $filename =~ /LCLS_(\d+)_([A-Za-z]+)(\d+)_r\d+_(\d+)_/; + my $year = $1; + my $month = $2; + my $day = $3; + my $time = $4; + + # Yeah, I know. + if ( $month eq "Jan" ) { $month = "01"; } + if ( $month eq "Feb" ) { $month = "02"; } + if ( $month eq "Mar" ) { $month = "03"; } + if ( $month eq "Apr" ) { $month = "04"; } + if ( $month eq "May" ) { $month = "05"; } + if ( $month eq "Jun" ) { $month = "06"; } + if ( $month eq "Jul" ) { $month = "07"; } + if ( $month eq "Aug" ) { $month = "08"; } + if ( $month eq "Sep" ) { $month = "09"; } + if ( $month eq "Oct" ) { $month = "10"; } + if ( $month eq "Nov" ) { $month = "11"; } + if ( $month eq "Dec" ) { $month = "12"; } + + my $div; + + if ( $close > 0 ) { + $div = $found / $close; + } else { + $div = 0.0; + } + + printf(OFH "%s%s%s%s %f\n", $year, $month, $day, $time, + $div); + } + +} + +close(FH); +close(OFH); + +open(GP, "| gnuplot"); +printf(GP "set term postscript enhanced font \"Helvetica,20\"\n"); +printf(GP "set output \"doublehit.ps\"\n"); +printf(GP "set xtics nomirror out rotate by -60\n"); +print(GP "set format x \"%15.0f\"\n"); +printf(GP "unset key\n"); +printf(GP "plot [] [1:4] \"doublehit.dat\" u 1:2 w points\n"); +close(GP); + +system("ps2pdf doublehit.ps"); +unlink("doublehit.dat"); +unlink("doublehit.ps"); -- cgit v1.2.3