Index: trunk/ippScripts/scripts/detrend_resid_exp.pl
===================================================================
--- trunk/ippScripts/scripts/detrend_resid_exp.pl	(revision 23417)
+++ trunk/ippScripts/scripts/detrend_resid_exp.pl	(revision 23427)
@@ -124,4 +124,6 @@
     # write the normalizations to a file as a metadata config file in the form: class_id F32 value
     # XXX a possible optimization: if there is only one imfile, skip normalization
+    # Correcting the resid imfiles and stats requires us to *divide* by the normalization
+    # we do this by inverting the normalization here:
     my $normsFile;
     ($normsFile, $normsName) = tempfile( "/tmp/$exp_tag.detresid.$det_id.$iter.norms.XXXX", UNLINK => !$save_temps );
@@ -129,5 +131,5 @@
     foreach my $norm (@$normsMD) {
         my $class_id = $norm->{class_id};
-        my $normalization = $norm->{norm};
+	my $normalization = 1.0 / $norm->{norm};
 
         $norms{$class_id} = $normalization;
