Index: trunk/ippScripts/scripts/detrend_stack.pl
===================================================================
--- trunk/ippScripts/scripts/detrend_stack.pl	(revision 13748)
+++ trunk/ippScripts/scripts/detrend_stack.pl	(revision 13937)
@@ -33,5 +33,5 @@
 use Pod::Usage qw( pod2usage );
 
-my ($det_id, $iter, $class_id, $det_type, $camera, $dbname, $workdir, $no_update, $no_op, $quiet);
+my ($det_id, $iter, $class_id, $det_type, $camera, $dbname, $workdir, $reduction, $no_update, $no_op, $quiet);
 GetOptions(
     'det_id|d=s'        => \$det_id,
@@ -42,4 +42,5 @@
     'dbname|d=s'        => \$dbname, # Database name
     'workdir|w=s'       => \$workdir,	# Working directory, for output files
+    'reduction=s'       => \$reduction,	# Reduction class for processing
     'no-update'         => \$no_update,
     'no-op'             => \$no_op,
@@ -58,14 +59,9 @@
 if (defined $quiet) { $verbose = 0; }
 
+$ipprc->define_camera($camera);
+
 # Recipes to use as a function of detrend type
-use constant RECIPES => {
-    'bias' => 'PPMERGE_BIAS',
-    'dark' => 'PPMERGE_DARK',
-    'shutter' => 'PPMERGE_SHUTTER',
-    'flat' => 'PPMERGE_FLAT',
-    'domeflat' => 'PPMERGE_FLAT',
-    'skyflat' => 'PPMERGE_FLAT',
-    'fringe' => 'PPMERGE_FRINGE',
-    };
+$reduction = "DETREND" unless defined $reduction;
+my $recipe = $ipprc->reduction($reduction, $det_type . '_STACK'); # Recipe name to use
 
 # Look for programs we need
@@ -77,7 +73,4 @@
     exit($PS_EXIT_CONFIG_ERROR); 
 }
-
-my $recipe = RECIPES()->{lc($det_type)}; # Recipe to use in stacking
-&my_die("Unrecognised detrend type: $det_type", $det_id, $iter, $class_id, $PS_EXIT_PROG_ERROR) unless defined $recipe;
 
 my $mdcParser = PS::IPP::Metadata::Config->new;	# Parser for metadata config files
