Index: trunk/ippScripts/scripts/detrend_process_imfile.pl
===================================================================
--- trunk/ippScripts/scripts/detrend_process_imfile.pl	(revision 13748)
+++ trunk/ippScripts/scripts/detrend_process_imfile.pl	(revision 13937)
@@ -32,5 +32,5 @@
 use Pod::Usage qw( pod2usage );
 
-my ($det_id, $exp_tag, $class_id, $det_type, $input_uri, $camera, $dbname, $workdir, $no_update, $no_op);
+my ($det_id, $exp_tag, $class_id, $det_type, $input_uri, $camera, $dbname, $workdir, $reduction, $no_update, $no_op);
 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
     'no-update'         => \$no_update,
     'no-op'             => \$no_op,
@@ -60,14 +61,6 @@
 $ipprc->define_camera($camera);
 
-# Recipes to use, as a function of the detrend type
-use constant RECIPES => {
-    'bias'     => 'PPIMAGE_O',	  # Overscan only
-    'dark'     => 'PPIMAGE_OB',	  # Overscan and bias only
-    'shutter'  => 'PPIMAGE_OBD',  # Overscan, bias and dark only
-    'flat'     => 'PPIMAGE_OBDS', # Overscan, bias, dark and shutter only
-    'domeflat' => 'PPIMAGE_OBDS', # Overscan, bias, dark and shutter only
-    'skyflat'  => 'PPIMAGE_OBDS', # Overscan, bias, dark and shutter only
-    'fringe'   => 'PPIMAGE_OBDSF',# Overscan, bias, dark, shutter and flat only
-};
+$reduction = "DETREND" unless defined $reduction;
+my $recipe = $ipprc->reduction($reduction, $det_type . '_PROCESS'); # Recipe name to use
 
 # Look for programs we need
@@ -80,11 +73,4 @@
 }
 $ppImage .= " -dbname $dbname" if defined $dbname;
-
-# Recipe to use in processing
-my $recipe = RECIPES->{lc($det_type)};
-unless (defined $recipe) {
-    warn("Unrecognised detrend type: $det_type");
-    exit($PS_EXIT_CONFIG_ERROR);
-}
 
 $workdir = caturi( $workdir, "$camera.$det_type.$det_id" ) if defined $workdir;
