Index: trunk/ippScripts/scripts/detrend_resid_imfile.pl
===================================================================
--- trunk/ippScripts/scripts/detrend_resid_imfile.pl	(revision 24741)
+++ trunk/ippScripts/scripts/detrend_resid_imfile.pl	(revision 24764)
@@ -74,4 +74,7 @@
     defined $detrend;
 
+# force det_type to be upper-case in this script
+$det_type = uc($det_type);
+
 my $ipprc = PS::IPP::Config->new( $camera ) or my_die( "Unable to set up", $det_id, $iter, $exp_id, $class_id, $PS_EXIT_CONFIG_ERROR ); # IPP configuration
 my $logDest = $ipprc->filename("LOG.IMFILE", $outroot, $class_id) or my_die( "Unable to find LOG.IMFILE", $det_id, $iter, $exp_id, $class_id, $PS_EXIT_CONFIG_ERROR );
@@ -83,7 +86,7 @@
 my $recipe;                     # Name of recipe to use
 if ($mode eq 'master') {
-    $recipe = uc($det_type) . '_RESID';
+    $recipe = $det_type . '_RESID';
 } elsif ($mode eq 'verify') {
-    $recipe = uc($det_type) . '_VERIFY';
+    $recipe = $det_type . '_VERIFY';
 } else {
     &my_die("Unrecognised mode: $mode", $det_id, $iter, $exp_id, $class_id, $PS_EXIT_PROG_ERROR);
@@ -92,28 +95,28 @@
 print "raw recipe: $recipe\n";
 my $ppimage_recipe = $ipprc->reduction($reduction, $recipe);
-my $jpeg_recipe = $ipprc->reduction($reduction, uc($det_type) . '_JPEG_RESID');
+my $jpeg_recipe = $ipprc->reduction($reduction, $det_type . '_JPEG_RESID');
 print "real recipe: $recipe\n";
 
 # Flags to specify the particular detrend to use
 use constant DETRENDS => {
-    'bias'             => '-bias',      # Specify the bias frame
-    'dark'             => '-dark',      # Specify the dark frame
-    'darktest'         => '-dark',      # Specify the dark frame
-    'dark_premask'     => '-dark',      # Specify the dark frame
-    'shutter'          => '-shutter',   # Specify the shutter frame
-    'flat_premask'     => '-flat',      # Specify the flat frame
-    'domeflat_premask' => '-flat',      # Specify the flat frame
-    'skyflat_premask'  => '-flat',      # Specify the flat frame
-    'flat_raw'         => '-flat',      # Specify the flat frame
-    'domeflat_raw'     => '-flat',      # Specify the flat frame
-    'skyflat_raw'      => '-flat',      # Specify the flat frame
-    'flat'             => '-flat',      # Specify the flat frame
-    'domeflat'         => '-flat',      # Specify the flat frame
-    'skyflat'          => '-flat',      # Specify the flat frame
-    'fringe'           => '-fringe',    # Specify the fringe frame
-    'mask'             => '-mask',      # Specify the mask frame
-    'darkmask'         => '-mask',      # Specify the mask frame
-    'flatmask'         => '-mask',      # Specify the mask frame
-    'ctemask'          => '-mask',      # Specify the mask frame
+    'BIAS'             => '-bias',      # Specify the bias frame
+    'DARK'             => '-dark',      # Specify the dark frame
+    'DARK_PREMASK'     => '-dark',      # Specify the dark frame
+    'DARKTEST'         => '-dark',      # Specify the dark frame
+    'SHUTTER'          => '-shutter',   # Specify the shutter frame
+    'FLAT_PREMASK'     => '-flat',      # Specify the flat frame
+    'DOMEFLAT_PREMASK' => '-flat',      # Specify the flat frame
+    'SKYFLAT_PREMASK'  => '-flat',      # Specify the flat frame
+    'FLAT_RAW'         => '-flat',      # Specify the flat frame
+    'DOMEFLAT_RAW'     => '-flat',      # Specify the flat frame
+    'SKYFLAT_RAW'      => '-flat',      # Specify the flat frame
+    'FLAT'             => '-flat',      # Specify the flat frame
+    'DOMEFLAT'         => '-flat',      # Specify the flat frame
+    'SKYFLAT'          => '-flat',      # Specify the flat frame
+    'FRINGE'           => '-fringe',    # Specify the fringe frame
+    'MASK'             => '-mask',      # Specify the mask frame
+    'DARKMASK'         => '-mask',      # Specify the mask frame
+    'FLATMASK'         => '-mask',      # Specify the mask frame
+    'CTEMASK'          => '-mask',      # Specify the mask frame
 };
 
@@ -174,5 +177,5 @@
 
     # Detrend to use in processing
-    my $detFlag = DETRENDS->{lc($det_type)};
+    my $detFlag = DETRENDS->{$det_type};
     &my_die("Unrecognised detrend type: $det_type", $det_id, $iter, $exp_id, $class_id, $PS_EXIT_PROG_ERROR) unless defined $detFlag;
     $command .= " $detFlag $detrend";
