aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2011-02-28 15:39:53 +0100
committerThomas White <taw@physics.org>2012-02-22 15:27:16 +0100
commit0d2fd58266f87fb20aceb017c68b0e455ab4baee (patch)
tree1a6b90357611e45e129fe8041d522aa4f1e77179 /scripts
parentdf361eb4219d01c450a9b8ef808cf8017bb945fd (diff)
Update geometry files
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/update-geometry76
1 files changed, 76 insertions, 0 deletions
diff --git a/scripts/update-geometry b/scripts/update-geometry
new file mode 100755
index 00000000..82f961ba
--- /dev/null
+++ b/scripts/update-geometry
@@ -0,0 +1,76 @@
+#!/usr/bin/perl -w
+
+use strict;
+
+open(FH, $ARGV[0]);
+
+my $done = 0;
+my $cx = 0.0;
+my $cy = 0.0;
+my $pan = 10000000;
+my $min_x;
+my $min_y;
+
+while ( my $line = <FH> ) {
+
+ chomp $line;
+
+ if ( $line =~ /^([0-9]+)\/min_x\ =\ ([0-9,\.\-e]+)$/ ) {
+
+ $pan = $1;
+ $min_x = $2;
+ printf("%i/min_fs = %i\n", $pan, $min_x);
+
+ } elsif ( $line =~ /^([0-9]+)\/min_y\ =\ ([0-9,\.\-e]+)$/ ) {
+
+ if ( $1 != $pan ) {
+ printf(STDERR "Error!\n");
+ exit(1);
+ }
+ $min_y = $2;
+ printf("%i/min_ss = %i\n", $pan, $min_y);
+
+ } elsif ( $line =~ /^([0-9]+)\/max_x\ =\ ([0-9,\.\-e]+)$/ ) {
+
+ if ( $1 != $pan ) {
+ printf(STDERR "Error!\n");
+ exit(1);
+ }
+ printf("%i/max_fs = %i\n", $pan, $2);
+
+ } elsif ( $line =~ /^([0-9]+)\/max_y\ =\ ([0-9,\.\-e]+)$/ ) {
+
+ if ( $1 != $pan ) {
+ printf(STDERR "Error!\n");
+ exit(1);
+ }
+ printf("%i/max_ss = %i\n", $pan, $2);
+
+ } elsif ( $line =~ /^([0-9]+)\/cx\ =\ ([0-9,\.\-e]+)$/ ) {
+
+ $cx = $2;
+ if ( $1 != $pan ) {
+ printf(STDERR "Error!\n");
+ exit(1);
+ }
+
+ } elsif ( $line =~ /^([0-9]+)\/cy\ =\ ([0-9,\.\-e]+)$/ ) {
+
+ $cy = $2;
+ if ( $1 != $pan ) {
+ printf(STDERR "Error!\n");
+ exit(1);
+ }
+
+ printf("%i/corner_x = %5.2f\n", $pan, $min_x - $cx);
+ printf("%i/corner_y = %5.2f\n", $pan, $min_y - $cy);
+ printf("%i/fs = x\n", $pan);
+ printf("%i/ss = y\n", $pan);
+
+ } else {
+ printf("%s\n", $line);
+ }
+
+}
+
+exit($done);