Index: trunk/ippScripts/scripts/staticsky.pl
===================================================================
--- trunk/ippScripts/scripts/staticsky.pl	(revision 31164)
+++ trunk/ippScripts/scripts/staticsky.pl	(revision 31247)
@@ -32,5 +32,7 @@
 my $staticskytool = can_run('staticskytool') or (warn "Can't find staticskytool" and $missing_tools = 1);
 my $psphotStack = can_run('psphotStack') or (warn "Can't find psphotStack" and $missing_tools = 1);
+my $psphot = can_run('psphot') or (warn "Can't find psphot" and $missing_tools = 1);
 my $ppStatsFromMetadata = can_run('ppStatsFromMetadata') or (warn "Can't find ppStatsFromMetadata" and $missing_tools = 1);
+my $ppConfigDump = can_run('ppConfigDump') or (warn "Can't find ppConfigDump" and $missing_tools = 1);
 if ($missing_tools) {
     warn("Can't find required tools.");
@@ -96,54 +98,4 @@
 }
 
-# generate the input 
-print $listFile "INPUT   MULTI\n";
-my $nInputs = @$files;
-
-my $configuration = $ipprc->filename("PSPHOT.STACK.CONFIG", $outroot);
-
-foreach my $file (@$files) {
-    print $listFile "INPUT   METADATA\n";
-
-    # XXX if we take the input from 'warp', we will need to make different selections here
-    my $path_base = $file->{path_base};
-    print "input: $path_base\n";
-
-    my $imageCnv  = $ipprc->filename("PPSTACK.OUTPUT",          $path_base ); # Image name
-    my $maskCnv   = $ipprc->filename("PPSTACK.OUTPUT.MASK",     $path_base ); # Mask name
-    my $weightCnv = $ipprc->filename("PPSTACK.OUTPUT.VARIANCE", $path_base ); # Weight name
-
-    my $imageRaw  = $ipprc->filename("PPSTACK.UNCONV",          $path_base ); # Image name
-    my $maskRaw   = $ipprc->filename("PPSTACK.UNCONV.MASK",     $path_base ); # Mask name
-    my $weightRaw = $ipprc->filename("PPSTACK.UNCONV.VARIANCE", $path_base ); # Weight name
-
-    my $sources   = $ipprc->filename("PSPHOT.OUT.CMF.MEF",      $path_base ); # Sources name
-
-    # XXX is this the correct PSF file?
-    my $psfCnv    = $ipprc->filename("PPSTACK.TARGET.PSF",      $path_base ); # PSF name
-
-    # XXX we could make some different choices if some inputs do not exist...
-    &my_die("Couldn't find input: $imageRaw",  $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$imageRaw");
-    &my_die("Couldn't find input: $maskRaw",   $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$maskRaw");
-    &my_die("Couldn't find input: $weightRaw", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$weightRaw");
-    &my_die("Couldn't find input: $imageCnv",  $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$imageCnv");
-    &my_die("Couldn't find input: $maskCnv",   $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$maskCnv");
-    &my_die("Couldn't find input: $weightCnv", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$weightCnv");
-    &my_die("Couldn't find input: $psfCnv",    $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$psfCnv");
-    &my_die("Couldn't find input: $sources",   $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$sources");
-
-    print $listFile "  RAW:IMAGE     STR  " . $imageRaw  . "\n";
-    print $listFile "  RAW:MASK      STR  " . $maskRaw   . "\n";
-    print $listFile "  RAW:VARIANCE  STR  " . $weightRaw . "\n";
-
-    print $listFile "  CNV:IMAGE     STR  " . $imageCnv  . "\n";
-    print $listFile "  CNV:MASK      STR  " . $maskCnv   . "\n";
-    print $listFile "  CNV:VARIANCE  STR  " . $weightCnv . "\n";
-    print $listFile "  CNV:PSF       STR  " . $psfCnv    . "\n";
-
-    print $listFile "  SOURCES       STR  " . $sources   . "\n";
-
-    print $listFile "END\n\n";
-}
-
 # Recipes to use based on reduction class
 $reduction = 'DEFAULT' unless defined $reduction;
@@ -160,79 +112,251 @@
 print "recipe_ppstack: $recipe_ppstack\n";
 
-# my $cmdflags;
-
-# Perform stack photometry analysis
-{
-    my $command = "$psphotStack $outroot";
-    $command .= " -input $listName";
-    $command .= " -threads $threads" if defined $threads;
-    $command .= " -recipe PSPHOT  $recipe_psphot";
-    $command .= " -recipe PPSUB   $recipe_ppsub";
-    $command .= " -recipe PPSTACK $recipe_ppstack";
-    $command .= " -dumpconfig $configuration";
-    $command .= " -tracedest $traceDest -log $logDest";
-    # $command .= " -dbname $dbname" if defined $dbname;
-    # $command .= " -image_id $diff_skyfile_id" if defined $diff_skyfile_id;
-    # $command .= " -source_id $source_id" if defined $source_id;
-
-    unless ($no_op) {
-	my ( $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 psphotStack: $error_code", $sky_id, $error_code);
-	}
-
-        # my $outputStatsReal = $ipprc->file_resolve($outputStats);
-        # &my_die("Couldn't find expected output file: $outputStats", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputStatsReal);
-
-        # measure chip stats
-        # $command = "$ppStatsFromMetadata $outputStatsReal - DIFF_SKYCELL";
-        # ( $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", $sky_id, $error_code);
-        # }
-        # foreach my $line (@$stdout_buf) {
-        #     $cmdflags .= " $line";
-        # }
-        # chomp $cmdflags;
-
-        # my ($quality) = $cmdflags =~ /-quality (\d+)/; # Quality flag
-
-	my $quality = 0;
-        if (!$quality) {
-
-	    # Get the output filenames
-	    # we have one set of output files per input file set
-	    for (my $i = 0; $i < @$files; $i++) {
-		my $outputName     = $ipprc->filename("PSPHOT.STACK.OUTPUT.IMAGE", $outroot, $i);
-		my $outputMask     = $ipprc->filename("PSPHOT.STACK.OUTPUT.MASK", $outroot, $i);
-		my $outputVariance = $ipprc->filename("PSPHOT.STACK.OUTPUT.VARIANCE", $outroot, $i);
-		my $outputSources  = $ipprc->filename("PSPHOT.STACK.OUTPUT", $outroot, $i);
-
-		# XXX these are optional and not generated by default
-		# &my_die("Couldn't find expected output file: $outputName", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputName);
-		# &my_die("Couldn't find expected output file: $outputMask", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputMask);
-		# &my_die("Couldn't find expected output file: $outputVariance", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputVariance);
-		&my_die("Couldn't find expected output file: $outputSources", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputSources);
-	    }
-
-	    #my $configuration  = $ipprc->filename("PPSUB.CONFIG", $outroot);
-	    #my $outputStats    = $ipprc->filename("SKYCELL.STATS", $outroot);
-	    #my $traceDest      = $ipprc->filename("TRACE.EXP", $outroot);
-
-	    my $chisqName     = $ipprc->filename("PSPHOT.CHISQ.IMAGE", $outroot);
-	    my $chisqMask     = $ipprc->filename("PSPHOT.CHISQ.MASK", $outroot);
-	    my $chisqVariance = $ipprc->filename("PSPHOT.CHISQ.VARIANCE", $outroot);
-
-	    # XXX check the recipe -- should we expect these to exist?
-            # &my_die("Couldn't find expected output file: $chisqName", 	  $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($chisqName);
-            # &my_die("Couldn't find expected output file: $chisqMask", 	  $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($chisqMask);
-            # &my_die("Couldn't find expected output file: $chisqVariance", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($chisqVariance);
-        }
-    } else {
-        print "Not executing: $command\n";
-    }
+
+# generate the input 
+print $listFile "INPUT   MULTI\n";
+my $nInputs = @$files;
+
+if ($nInputs > 1) {
+        my $configuration = $ipprc->filename("PSPHOT.STACK.CONFIG", $outroot);
+
+        foreach my $file (@$files) {
+            print $listFile "INPUT   METADATA\n";
+
+            # XXX if we take the input from 'warp', we will need to make different selections here
+            my $path_base = $file->{path_base};
+            print "input: $path_base\n";
+
+            my $imageCnv  = $ipprc->filename("PPSTACK.OUTPUT",          $path_base ); # Image name
+            my $maskCnv   = $ipprc->filename("PPSTACK.OUTPUT.MASK",     $path_base ); # Mask name
+            my $weightCnv = $ipprc->filename("PPSTACK.OUTPUT.VARIANCE", $path_base ); # Weight name
+
+            my $imageRaw  = $ipprc->filename("PPSTACK.UNCONV",          $path_base ); # Image name
+            my $maskRaw   = $ipprc->filename("PPSTACK.UNCONV.MASK",     $path_base ); # Mask name
+            my $weightRaw = $ipprc->filename("PPSTACK.UNCONV.VARIANCE", $path_base ); # Weight name
+
+            my $sources   = $ipprc->filename("PSPHOT.OUT.CMF.MEF",      $path_base ); # Sources name
+
+            # XXX is this the correct PSF file?
+            my $psfCnv    = $ipprc->filename("PPSTACK.TARGET.PSF",      $path_base ); # PSF name
+
+            # XXX we could make some different choices if some inputs do not exist...
+            &my_die("Couldn't find input: $imageRaw",  $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$imageRaw");
+            &my_die("Couldn't find input: $maskRaw",   $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$maskRaw");
+            &my_die("Couldn't find input: $weightRaw", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$weightRaw");
+            &my_die("Couldn't find input: $imageCnv",  $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$imageCnv");
+            &my_die("Couldn't find input: $maskCnv",   $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$maskCnv");
+            &my_die("Couldn't find input: $weightCnv", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$weightCnv");
+            &my_die("Couldn't find input: $psfCnv",    $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$psfCnv");
+            &my_die("Couldn't find input: $sources",   $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$sources");
+
+            print $listFile "  RAW:IMAGE     STR  " . $imageRaw  . "\n";
+            print $listFile "  RAW:MASK      STR  " . $maskRaw   . "\n";
+            print $listFile "  RAW:VARIANCE  STR  " . $weightRaw . "\n";
+
+            print $listFile "  CNV:IMAGE     STR  " . $imageCnv  . "\n";
+            print $listFile "  CNV:MASK      STR  " . $maskCnv   . "\n";
+            print $listFile "  CNV:VARIANCE  STR  " . $weightCnv . "\n";
+            print $listFile "  CNV:PSF       STR  " . $psfCnv    . "\n";
+
+            print $listFile "  SOURCES       STR  " . $sources   . "\n";
+
+            print $listFile "END\n\n";
+        }
+
+        # my $cmdflags;
+
+        # Perform stack photometry analysis
+        {
+            my $command = "$psphotStack $outroot";
+            $command .= " -input $listName";
+            $command .= " -threads $threads" if defined $threads;
+            $command .= " -recipe PSPHOT  $recipe_psphot";
+            $command .= " -recipe PPSUB   $recipe_ppsub";
+            $command .= " -recipe PPSTACK $recipe_ppstack";
+            $command .= " -dumpconfig $configuration";
+            $command .= " -tracedest $traceDest -log $logDest";
+            # $command .= " -dbname $dbname" if defined $dbname;
+            # $command .= " -image_id $diff_skyfile_id" if defined $diff_skyfile_id;
+            # $command .= " -source_id $source_id" if defined $source_id;
+
+            unless ($no_op) {
+                my ( $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 psphotStack: $error_code", $sky_id, $error_code);
+                }
+
+                # my $outputStatsReal = $ipprc->file_resolve($outputStats);
+                # &my_die("Couldn't find expected output file: $outputStats", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputStatsReal);
+
+                # measure chip stats
+                # $command = "$ppStatsFromMetadata $outputStatsReal - DIFF_SKYCELL";
+                # ( $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", $sky_id, $error_code);
+                # }
+                # foreach my $line (@$stdout_buf) {
+                #     $cmdflags .= " $line";
+                # }
+                # chomp $cmdflags;
+
+                # my ($quality) = $cmdflags =~ /-quality (\d+)/; # Quality flag
+
+                my $quality = 0;
+                if (!$quality) {
+
+                    # Get the output filenames
+                    # we have one set of output files per input file set
+                    for (my $i = 0; $i < @$files; $i++) {
+                        my $outputName     = $ipprc->filename("PSPHOT.STACK.OUTPUT.IMAGE", $outroot, $i);
+                        my $outputMask     = $ipprc->filename("PSPHOT.STACK.OUTPUT.MASK", $outroot, $i);
+                        my $outputVariance = $ipprc->filename("PSPHOT.STACK.OUTPUT.VARIANCE", $outroot, $i);
+                        my $outputSources  = $ipprc->filename("PSPHOT.STACK.OUTPUT", $outroot, $i);
+
+                        # XXX these are optional and not generated by default
+                        # &my_die("Couldn't find expected output file: $outputName", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputName);
+                        # &my_die("Couldn't find expected output file: $outputMask", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputMask);
+                        # &my_die("Couldn't find expected output file: $outputVariance", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputVariance);
+                        &my_die("Couldn't find expected output file: $outputSources", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputSources);
+                    }
+
+                    #my $configuration  = $ipprc->filename("PPSUB.CONFIG", $outroot);
+                    #my $outputStats    = $ipprc->filename("SKYCELL.STATS", $outroot);
+                    #my $traceDest      = $ipprc->filename("TRACE.EXP", $outroot);
+
+                    my $chisqName     = $ipprc->filename("PSPHOT.CHISQ.IMAGE", $outroot);
+                    my $chisqMask     = $ipprc->filename("PSPHOT.CHISQ.MASK", $outroot);
+                    my $chisqVariance = $ipprc->filename("PSPHOT.CHISQ.VARIANCE", $outroot);
+
+                    # XXX check the recipe -- should we expect these to exist?
+                    # &my_die("Couldn't find expected output file: $chisqName", 	  $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($chisqName);
+                    # &my_die("Couldn't find expected output file: $chisqMask", 	  $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($chisqMask);
+                    # &my_die("Couldn't find expected output file: $chisqVariance", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($chisqVariance);
+                }
+            } else {
+                print "Not executing: $command\n";
+            }
+        }
+} else {
+        # single input. Run psphot
+        my $configuration = $ipprc->filename("PSPHOT.STACK.CONFIG", $outroot);
+
+        my $file = $files->[0];
+
+        # XXX if we take the input from 'warp', we will need to make different selections here
+        my $path_base = $file->{path_base};
+        print "input: $path_base\n";
+
+        # examine the recipe to determine whether to analyze the "raw" or convolved images
+        my $command = "$ppConfigDump -camera $camera -dump-recipe PSPHOT -recipe PSPHOT $recipe_psphot -";
+        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
+        run(command => $command, verbose => 0);
+        unless ($success) {
+            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
+            &my_die("Unable to perform ppConfigDump: $error_code", $sky_id, $PS_EXIT_SYS_ERROR);
+        }
+        my $recipeData = $mdcParser->parse(join "", @$stdout_buf) or
+            &my_die("Unable to parse metadata config doc", $sky_id, $PS_EXIT_SYS_ERROR);
+
+        my $use_raw = metadataLookupBool($recipeData, 'PSPHOT.STACK.USE.RAW');
+
+        my ($image, $mask, $variance);
+        if ($use_raw) {
+            $image  = $ipprc->filename("PPSTACK.UNCONV",          $path_base ); # Image name
+            $mask   = $ipprc->filename("PPSTACK.UNCONV.MASK",     $path_base ); # Mask name
+            $variance = $ipprc->filename("PPSTACK.UNCONV.VARIANCE", $path_base ); # Weight name
+        } else {
+            $image  = $ipprc->filename("PPSTACK.OUTPUT",          $path_base ); # Image name
+            $mask   = $ipprc->filename("PPSTACK.OUTPUT.MASK",     $path_base ); # Mask name
+            $variance = $ipprc->filename("PPSTACK.OUTPUT.VARIANCE", $path_base ); # Weight name
+        }
+
+        my $sources   = $ipprc->filename("PSPHOT.OUT.CMF.MEF",      $path_base ); # Sources name
+
+        # XXX is this the correct PSF file?
+        my $psfCnv    = $ipprc->filename("PPSTACK.TARGET.PSF",      $path_base ); # PSF name
+
+        # XXX we could make some different choices if some inputs do not exist...
+        &my_die("Couldn't find input: $image",  $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$image");
+        &my_die("Couldn't find input: $mask",   $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$mask");
+        &my_die("Couldn't find input: $variance", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$variance");
+        &my_die("Couldn't find input: $psfCnv",    $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$psfCnv");
+        &my_die("Couldn't find input: $sources",   $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$sources");
+
+        # my $cmdflags;
+
+        # Perform stack photometry analysis
+        {
+            my $command = "$psphot $outroot";
+            $command .= " -file $image";
+            $command .= " -mask $mask";
+            $command .= " -variance $variance";
+            $command .= " -threads $threads" if defined $threads;
+            $command .= " -recipe PSPHOT  $recipe_psphot";
+            $command .= " -dumpconfig $configuration" if $configuration;
+            $command .= " -tracedest $traceDest -log $logDest";
+
+            unless ($no_op) {
+                my ( $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 psphotStack: $error_code", $sky_id, $error_code);
+                }
+
+                # my $outputStatsReal = $ipprc->file_resolve($outputStats);
+                # &my_die("Couldn't find expected output file: $outputStats", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputStatsReal);
+
+                # measure chip stats
+                # $command = "$ppStatsFromMetadata $outputStatsReal - DIFF_SKYCELL";
+                # ( $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", $sky_id, $error_code);
+                # }
+                # foreach my $line (@$stdout_buf) {
+                #     $cmdflags .= " $line";
+                # }
+                # chomp $cmdflags;
+
+                # my ($quality) = $cmdflags =~ /-quality (\d+)/; # Quality flag
+
+                my $quality = 0;
+                if (0 and !$quality) {
+
+                    # Get the output filenames
+                    # we have one set of output files per input file set
+                    for (my $i = 0; $i < @$files; $i++) {
+                        my $outputName     = $ipprc->filename("PSPHOT.STACK.OUTPUT.IMAGE", $outroot, $i);
+                        my $outputMask     = $ipprc->filename("PSPHOT.STACK.OUTPUT.MASK", $outroot, $i);
+                        my $outputVariance = $ipprc->filename("PSPHOT.STACK.OUTPUT.VARIANCE", $outroot, $i);
+                        my $outputSources  = $ipprc->filename("PSPHOT.STACK.OUTPUT", $outroot, $i);
+
+                        # XXX these are optional and not generated by default
+                        # &my_die("Couldn't find expected output file: $outputName", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputName);
+                        # &my_die("Couldn't find expected output file: $outputMask", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputMask);
+                        # &my_die("Couldn't find expected output file: $outputVariance", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputVariance);
+                        &my_die("Couldn't find expected output file: $outputSources", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputSources);
+                    }
+
+                    #my $configuration  = $ipprc->filename("PPSUB.CONFIG", $outroot);
+                    #my $outputStats    = $ipprc->filename("SKYCELL.STATS", $outroot);
+                    #my $traceDest      = $ipprc->filename("TRACE.EXP", $outroot);
+
+                    my $chisqName     = $ipprc->filename("PSPHOT.CHISQ.IMAGE", $outroot);
+                    my $chisqMask     = $ipprc->filename("PSPHOT.CHISQ.MASK", $outroot);
+                    my $chisqVariance = $ipprc->filename("PSPHOT.CHISQ.VARIANCE", $outroot);
+
+                    # XXX check the recipe -- should we expect these to exist?
+                    # &my_die("Couldn't find expected output file: $chisqName", 	  $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($chisqName);
+                    # &my_die("Couldn't find expected output file: $chisqMask", 	  $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($chisqMask);
+                    # &my_die("Couldn't find expected output file: $chisqVariance", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($chisqVariance);
+                }
+            } else {
+                print "Not executing: $command\n";
+            }
+        }
 }
 
