Index: trunk/ippScripts/scripts/detrend_calc_norm.pl
===================================================================
--- trunk/ippScripts/scripts/detrend_calc_norm.pl	(revision 9092)
+++ 	(revision )
@@ -1,113 +1,0 @@
-#!/usr/bin/env perl
-
-use warnings;
-use strict;
-
-use IPC::Cmd qw( can_run );
-use IPC::Run qw ( run );
-use PS::IPP::Metadata::Config;
-use PS::IPP::Metadata::List qw( parse_md_list );
-use Data::Dumper;
-
-use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt );
-use Pod::Usage qw( pod2usage );
-
-
-# Parse command-line arguments
-my ($detId,			# Detrend id
-    $iter,			# Iteration
-    $no_update			# Don't update the database?
-    );
-GetOptions(
-	'det_id|d=s'	=> \$detId,
-	'iteration|i=s'	=> \$iter,
-        'no-update'     => \$no_update
-	) or pod2usage( 2 );
-
-pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
-pod2usage( -msg => "Required options --det_id --iteration --camera --det_type",
-	   -exitval => 3,
-	   ) unless defined $detId
-    and defined $iter;
-
-
-use constant STATISTIC => 'bg'; # Background statistic to use from the database
-
-# Look for programs we need
-my $missing_tools;
-my $dettool = can_run('dettool') or (warn "Can't find dettool" and $missing_tools = 1);
-my $ppNormCalc = can_run('ppNormCalc') or (warn "Can't find ppNormCalc" and $missing_tools = 1);
-die "Can't find required tools.\n" if $missing_tools;
-
-my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files
-
-# Get the list of inputs
-my $files;			# The input files
-{
-    my $command = "$dettool -processed -unmask -det_id $detId -iteration $iter"; # Command to run
-    my @command = split /\s+/, $command;
-    my ( $stdin, $stdout, $stderr ); # Buffers for running program
-    print "Running [$command]...\n";
-    run \@command, \$stdin, \$stdout, \$stderr or
-	die "Unable to perform dettool -processed -unmask on detrend $detId/$iter: $?";
-    print $stdout . "\n";
-    
-    # Parse the output
-    my $metadata = $mdcParser->parse($stdout)
-        or die "unable to parse metadata config doc";
-    $files = parse_md_list($metadata);
-}
-
-my %matrix; # Matrix of statistics as a function of exposures and classes
-foreach my $file (@$files) {
-    my $expId = $file->{'exp_id'}; # Exposure ID
-    my $classId = $file->{'class_id'}; # Class ID
-    my $stat = $file->{STATISTIC()}; # Statistic of interest
-
-    # Create matrix elements
-    $matrix{$expId} = {} if not defined $matrix{$expId};
-    $matrix{$expId}->{$classId} = $stat;
-}
-
-# Generate the input for ppNormCalc
-my $normData;			# Normalisation data
-foreach my $expId (keys %matrix) {
-    $normData .= "$expId\tMETADATA\n";
-    foreach my $classId (keys %{$matrix{$expId}}) {
-	$normData .= "\t" . $classId . "\tF32\t" . $matrix{$expId}->{$classId} . "\n";
-    }
-    $normData .= "END\n\n";
-}
-
-# Run ppNormCalc
-my $norms;
-{
-    my ( $stdout, $stderr ); # Buffers for running program
-    my @command = split /\s+/, $ppNormCalc;
-    print "Running [$ppNormCalc]...\n";
-    run \@command, \$normData, \$stdout, \$stderr or
-	die "Unable to perform ppNormCalc: $?";
-    print $stdout . "\n";
-
-    # Parse the output
-    $norms = $mdcParser->parse($stdout)
-        or die "unable to parse metadata config doc";
-}
-
-# Process output normalisations
-unless ($no_update) {
-    foreach my $normItem (@$norms) {
-	my $className = $normItem->{name}; # Name of component
-	my $normalisation = $normItem->{value}; # Normalisation for component
-
-	my $command = "$dettool -addnormstat -det_id $detId -iteration $iter -class_id $className ".
-	    "-norm $normalisation"; # Command to run
-	my @command = split /\s+/, $command;
-
-	my ( $stdin, $stdout, $stderr ); # Buffers for running program
-	print "Running [$command]...\n";
-	run \@command, \$stdin, \$stdout, \$stderr or
-	    die "Unable to perform dettool -addnormstat for $className: $?";
-	print $stdout . "\n";
-    }
-}
Index: trunk/ippScripts/scripts/detrend_norm_calc.pl
===================================================================
--- trunk/ippScripts/scripts/detrend_norm_calc.pl	(revision 9093)
+++ trunk/ippScripts/scripts/detrend_norm_calc.pl	(revision 9093)
@@ -0,0 +1,113 @@
+#!/usr/bin/env perl
+
+use warnings;
+use strict;
+
+use IPC::Cmd qw( can_run );
+use IPC::Run qw ( run );
+use PS::IPP::Metadata::Config;
+use PS::IPP::Metadata::List qw( parse_md_list );
+use Data::Dumper;
+
+use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt );
+use Pod::Usage qw( pod2usage );
+
+
+# Parse command-line arguments
+my ($detId,			# Detrend id
+    $iter,			# Iteration
+    $no_update			# Don't update the database?
+    );
+GetOptions(
+	'det_id|d=s'	=> \$detId,
+	'iteration|i=s'	=> \$iter,
+        'no-update'     => \$no_update
+	) or pod2usage( 2 );
+
+pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
+pod2usage( -msg => "Required options --det_id --iteration --camera --det_type",
+	   -exitval => 3,
+	   ) unless defined $detId
+    and defined $iter;
+
+
+use constant STATISTIC => 'bg'; # Background statistic to use from the database
+
+# Look for programs we need
+my $missing_tools;
+my $dettool = can_run('dettool') or (warn "Can't find dettool" and $missing_tools = 1);
+my $ppNormCalc = can_run('ppNormCalc') or (warn "Can't find ppNormCalc" and $missing_tools = 1);
+die "Can't find required tools.\n" if $missing_tools;
+
+my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files
+
+# Get the list of inputs
+my $files;			# The input files
+{
+    my $command = "$dettool -processed -unmask -det_id $detId -iteration $iter"; # Command to run
+    my @command = split /\s+/, $command;
+    my ( $stdin, $stdout, $stderr ); # Buffers for running program
+    print "Running [$command]...\n";
+    run \@command, \$stdin, \$stdout, \$stderr or
+	die "Unable to perform dettool -processed -unmask on detrend $detId/$iter: $?";
+    print $stdout . "\n";
+    
+    # Parse the output
+    my $metadata = $mdcParser->parse($stdout)
+        or die "unable to parse metadata config doc";
+    $files = parse_md_list($metadata);
+}
+
+my %matrix; # Matrix of statistics as a function of exposures and classes
+foreach my $file (@$files) {
+    my $expId = $file->{'exp_id'}; # Exposure ID
+    my $classId = $file->{'class_id'}; # Class ID
+    my $stat = $file->{STATISTIC()}; # Statistic of interest
+
+    # Create matrix elements
+    $matrix{$expId} = {} if not defined $matrix{$expId};
+    $matrix{$expId}->{$classId} = $stat;
+}
+
+# Generate the input for ppNormCalc
+my $normData;			# Normalisation data
+foreach my $expId (keys %matrix) {
+    $normData .= "$expId\tMETADATA\n";
+    foreach my $classId (keys %{$matrix{$expId}}) {
+	$normData .= "\t" . $classId . "\tF32\t" . $matrix{$expId}->{$classId} . "\n";
+    }
+    $normData .= "END\n\n";
+}
+
+# Run ppNormCalc
+my $norms;
+{
+    my ( $stdout, $stderr ); # Buffers for running program
+    my @command = split /\s+/, $ppNormCalc;
+    print "Running [$ppNormCalc]...\n";
+    run \@command, \$normData, \$stdout, \$stderr or
+	die "Unable to perform ppNormCalc: $?";
+    print $stdout . "\n";
+
+    # Parse the output
+    $norms = $mdcParser->parse($stdout)
+        or die "unable to parse metadata config doc";
+}
+
+# Process output normalisations
+unless ($no_update) {
+    foreach my $normItem (@$norms) {
+	my $className = $normItem->{name}; # Name of component
+	my $normalisation = $normItem->{value}; # Normalisation for component
+
+	my $command = "$dettool -addnormstat -det_id $detId -iteration $iter -class_id $className ".
+	    "-norm $normalisation"; # Command to run
+	my @command = split /\s+/, $command;
+
+	my ( $stdin, $stdout, $stderr ); # Buffers for running program
+	print "Running [$command]...\n";
+	run \@command, \$stdin, \$stdout, \$stderr or
+	    die "Unable to perform dettool -addnormstat for $className: $?";
+	print $stdout . "\n";
+    }
+}
