Index: trunk/ippScripts/scripts/chip_imfile.pl
===================================================================
--- trunk/ippScripts/scripts/chip_imfile.pl	(revision 20099)
+++ trunk/ippScripts/scripts/chip_imfile.pl	(revision 20369)
@@ -64,13 +64,4 @@
 $ipprc->redirect_output($logDest) if $redirect;
 
-# Recipes to use based on reduction class
-# the CHIP recipe should not perform astrometry anymore (2008.04.08)
-
-$reduction = 'DEFAULT' unless defined $reduction;
-my $recipe = $ipprc->reduction($reduction, 'CHIP'); # Recipe to use
-unless ($recipe) {
-    &my_die("Couldn't find selected reduction for CHIP: $reduction\n", $exp_id, $chip_id, $class_id, $PS_EXIT_CONFIG_ERROR);
-}
-
 # Look for programs we need
 my $missing_tools;
@@ -84,4 +75,12 @@
 }
 
+# Recipes to use based on reduction class
+$reduction = 'DEFAULT' unless defined $reduction;
+my $recipe_ppImage = $ipprc->reduction($reduction, 'CHIP_PPIMAGE'); # Recipe to use for ppImage
+my $recipe_psphot  = $ipprc->reduction($reduction, 'CHIP_PSPHOT'); # Recipe to use for psphot
+unless ($recipe_ppImage and $recipe_psphot) {
+    &my_die("Couldn't find selected reduction for CHIP_PPIMAGE and CHIP_PSPHOT: $reduction\n", $exp_id, $chip_id, $class_id, $PS_EXIT_CONFIG_ERROR);
+}
+
 my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files
 
@@ -120,5 +119,6 @@
     if ($run_state eq "new") {
         $command  = "$ppImage -file $uri $outroot";
-        $command .= " -recipe PPIMAGE $recipe";
+        $command .= " -recipe PPIMAGE $recipe_ppImage";
+        $command .= " -recipe PSPHOT $recipe_psphot";
         $command .= " -threads $threads" if defined $threads;
         $command .= " -dbname $dbname" if defined $dbname;
@@ -147,5 +147,5 @@
 
     ## get the ppImage recipe for this camera and CHIP reduction
-    $command = "$ppConfigDump -camera $camera -dump-recipe PPIMAGE -recipe PPIMAGE $recipe -";
+    $command = "$ppConfigDump -camera $camera -dump-recipe PPIMAGE -recipe PPIMAGE $recipe_ppImage -";
     ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
         run(command => $command, verbose => $verbose);
@@ -177,19 +177,19 @@
 
     if ($do_stats) {
-	my $outputStatsReal = $ipprc->file_resolve($outputStats);
-	&my_die("Couldn't find expected output file: $outputStats", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless -f $outputStatsReal;
-
-	# measure chip stats
-	$command = "$ppStatsFromMetadata $outputStatsReal - CHIP_IMFILE";
-	( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
-	    run(command => $command, verbose => $verbose);
-	unless ($success) {
-	    $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
-	    &my_die("Unable to perform ppStatsFromMetadata: $error_code", $exp_id, $chip_id, $class_id, $error_code);
-	}
-	foreach my $line (@$stdout_buf) {
-	    $cmdflags .= " $line";
-	}
-	chomp $cmdflags;
+        my $outputStatsReal = $ipprc->file_resolve($outputStats);
+        &my_die("Couldn't find expected output file: $outputStats", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless -f $outputStatsReal;
+
+        # measure chip stats
+        $command = "$ppStatsFromMetadata $outputStatsReal - CHIP_IMFILE";
+        ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
+            run(command => $command, verbose => $verbose);
+        unless ($success) {
+            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
+            &my_die("Unable to perform ppStatsFromMetadata: $error_code", $exp_id, $chip_id, $class_id, $error_code);
+        }
+        foreach my $line (@$stdout_buf) {
+            $cmdflags .= " $line";
+        }
+        chomp $cmdflags;
     }
 }
