Index: trunk/ippScripts/scripts/detrend_resid_exp.pl
===================================================================
--- trunk/ippScripts/scripts/detrend_resid_exp.pl	(revision 19627)
+++ trunk/ippScripts/scripts/detrend_resid_exp.pl	(revision 19652)
@@ -82,9 +82,6 @@
 $reduction = 'DETREND' unless defined $reduction;
 
-my $recipe1 = $ipprc->reduction($reduction, 'JPEG_BIN1_RESID_' . uc($det_type)); # Recipe to use
-&my_die("Unrecognised detrend type: $det_type", $det_id, $iter, $PS_EXIT_PROG_ERROR) unless defined $recipe1;
-
-my $recipe2 = $ipprc->reduction($reduction, 'JPEG_BIN2_RESID_' . uc($det_type)); # Recipe to use
-&my_die("Unrecognised detrend type: $det_type", $det_id, $iter, $PS_EXIT_PROG_ERROR) unless defined $recipe2;
+my $recipe = $ipprc->reduction($reduction, uc($det_type) . '_JPEG_RESID'); # Recipe to use
+&my_die("Unrecognised detrend type: $det_type", $det_id, $iter, $PS_EXIT_PROG_ERROR) unless defined $recipe;
 
 # Look for programs we need
@@ -129,5 +126,5 @@
     my ($statFile, $statName) = tempfile( "/tmp/$exp_tag.detresid.$det_id.$iter.stats.XXXX", UNLINK => !$save_temps );
     foreach my $line (@$stdout_buf) {
-	print $statFile $line;
+        print $statFile $line;
     }
     close $statFile;
@@ -143,5 +140,5 @@
 
     foreach my $line (@$stdout_buf) {
-	$cmdflags .= " $line";
+        $cmdflags .= " $line";
     }
     print "cmdflags: $cmdflags\n";
@@ -173,5 +170,7 @@
 unless ($no_op) {
     # Make the jpeg for binning 1
-    $command = "$ppImage -list $list1Name $outroot -recipe PPIMAGE $recipe1"; # Command to run
+    $command = "$ppImage -list $list1Name $outroot"; # Command to run
+    $command .= " -recipe PPIMAGE PPIMAGE_N";
+    $comamnd .= " -recipe JPEG $recipe";
     $command .= " -dbname $dbname" if defined $dbname;
     ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
@@ -184,5 +183,7 @@
 
     # Make the jpeg for binning 2
-    $command = "$ppImage -list $list2Name $outroot -recipe PPIMAGE $recipe2"; # Command to run
+    $command = "$ppImage -list $list2Name $outroot"; # Command to run
+    $command .= " -recipe PPIMAGE PPIMAGE_N";
+    $command .= " -recipe JPEG $recipe";
     $command .= " -dbname $dbname" if defined $dbname;
     ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
@@ -530,5 +531,5 @@
 
 
-sub value_for_flag 
+sub value_for_flag
 {
     my $cmdflags = shift;
@@ -537,5 +538,5 @@
     my $value = 0.0;
     if ($cmdflags =~ m|$flag|) {
-	($value) = $cmdflags =~ m|$flag\s+(\S+)|;
+        ($value) = $cmdflags =~ m|$flag\s+(\S+)|;
     }
     $value;
