From be49b97c792edc33d908965823f73f33b830d557 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Tue, 15 Mar 2011 10:41:35 +0100 Subject: More work on new stream format --- scripts/check-near-bragg | 23 ++++++++++--------- scripts/check-peak-detection | 54 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+), 11 deletions(-) create mode 100755 scripts/check-peak-detection (limited to 'scripts') diff --git a/scripts/check-near-bragg b/scripts/check-near-bragg index 6c46fde6..17141fc4 100755 --- a/scripts/check-near-bragg +++ b/scripts/check-near-bragg @@ -14,36 +14,37 @@ while ( $line = ) { chomp $line; my $handled = 0; - if ( $line =~ /^\s*[0-9\-]+\s+[0-9\-]+\s+[0-9\-]+\s+[0-9\.\-]+/ ) { + if ( $in_image ) { printf(TMP "%s\n", $line); $handled = 1; } - if ( $line =~ /^\s*[0-9\-\.]+\s+[0-9\-\.]+\s+[0-9\-\.]+\s+[0-9\.\-]+/ ) { - printf(TMP "%s\n", $line); + if ( $line =~ /^Reflections\ measured\ after\ indexing$/ ) { + $in_image = 1; $handled = 1; } - if ( $line =~ /^Reflections\ from\ indexing\ in\ (.+)$/ ) { + if ( $line =~ /^Image\ filename:\ (.+)$/ ) { $filename = $1; $handled = 1; } - if ( $line =~ /^Peaks\ from\ peak search\ in\ (.+)$/ ) { - $filename = $1; - $handled = 1; - } + if ( $line =~ /^End\ of\ reflections$/ ) { - if ( $line =~ /^$/ ) { close(TMP); - #$filename = "images-old/".basename($filename); + + # Example of how to do "basename" and "prefix": + # $filename = "images-old/".basename($filename); + printf(STDERR "Viewing %s\n", $filename); system("hdfsee ".$filename. - " --peak-overlay=list.tmp --binning=1 --int-boost=10"); + " --peak-overlay=list.tmp --binning=2 --int-boost=10"); if ( $? != 0 ) { exit; } unlink("list.tmp"); open(TMP, "> list.tmp"); $handled = 1; + $in_image = 0; + } if ( !$handled ) { diff --git a/scripts/check-peak-detection b/scripts/check-peak-detection new file mode 100755 index 00000000..16fe53d3 --- /dev/null +++ b/scripts/check-peak-detection @@ -0,0 +1,54 @@ +#!/usr/bin/perl -w + +use strict; +use File::Basename; + +open(FH, $ARGV[0]); +open(TMP, "> list.tmp"); + +my $in_image = 0; +my $line; +my $filename; +while ( $line = ) { + + chomp $line; + my $handled = 0; + + if ( $in_image ) { + printf(TMP "%s\n", $line); + $handled = 1; + } + + if ( $line =~ /^Peaks\ from\ peak\ search$/ ) { + $in_image = 1; + $handled = 1; + } + + if ( $line =~ /^Image\ filename:\ (.+)$/ ) { + $filename = $1; + $handled = 1; + } + + if ( $line =~ /^End\ of\ peak\ list$/ ) { + + close(TMP); + + # Example of how to do "basename" and "prefix": + # $filename = "images-old/".basename($filename); + + printf(STDERR "Viewing %s\n", $filename); + system("hdfsee ".$filename. + " --peak-overlay=list.tmp --binning=2 --int-boost=10"); + if ( $? != 0 ) { exit; } + unlink("list.tmp"); + open(TMP, "> list.tmp"); + $handled = 1; + $in_image = 0; + + } + + if ( !$handled ) { + printf(STDERR "Unhandled: '%s'\n", $line); + } + +} -- cgit v1.2.3