Index: trunk/ippScripts/scripts/chip_imfile.pl
===================================================================
--- trunk/ippScripts/scripts/chip_imfile.pl	(revision 34750)
+++ trunk/ippScripts/scripts/chip_imfile.pl	(revision 34771)
@@ -150,4 +150,5 @@
 $outputStats   = prepare_output("PPIMAGE.STATS",         $outroot, $class_id, 1);
 my $do_binned_images = 1;
+
 if ($run_state eq 'new') {
     # prepare the files that are only created for a new run
@@ -586,5 +587,7 @@
 
 # check whether psphot outputs should be regenerated.
-# Whether we need to or not is a somewhat complicated question.
+# Whether we need to or not was a somewhat complicated question. Since we clean cmfs now we only rerun
+# photometry if the psf file has gone missing since it is needed to run warps
+
 sub rerun_photometry
 {
@@ -594,4 +597,6 @@
                     or &my_die("Missing entry from camera config: PSPHOT.OUTPUT", $exp_id, $chip_id, $class_id, $PS_EXIT_CONFIG_ERROR);
 
+    my $update_sources_if_gone = 0; # set this to regenerate sources if gone. 
+                                    # We no longer do this as of 2012-12
     my $make_sources = 0;
     my $sources_available = 0;
@@ -599,15 +604,17 @@
         $sources_available = 1;
     } else {
-        carp "WARNING: photometry sources file $outputSources is not available";
-        my $gone;
-        if (storage_object_exists($outputSources, \$gone)) {
-            # check whether the file is permanantely or temporarily gone
-            if ($gone) {
-                carp "WARNING: photometry sources storage object exists but all instances are permanently gone";
+        if ($update_sources_if_gone) {
+            carp "WARNING: photometry sources file $outputSources is not available";
+            my $gone;
+            if (storage_object_exists($outputSources, \$gone)) {
+                # check whether the file is permanantely or temporarily gone
+                if ($gone) {
+                    carp "WARNING: photometry sources storage object exists but all instances are permanently gone";
+                    $make_sources = 1;
+                }
+            } else {
+                # storage object must have been deleted
                 $make_sources = 1;
             }
-        } else {
-            # storage object must have been deleted
-            $make_sources = 1;
         }
     }
@@ -616,5 +623,7 @@
     my $psf_available = 0;
     my $outputPsf = $ipprc->filename("PSPHOT.PSF.SAVE",       $outroot, $class_id)
-                    or &my_die("Missing entry from camera config: PSPHOT.PSF.SAVE", $exp_id, $chip_id, $class_id, $PS_EXIT_CONFIG_ERROR);
+                    or &my_die("Missing entry from camera config: PSPHOT.PSF.SAVE",
+                                $exp_id, $chip_id, $class_id, $PS_EXIT_CONFIG_ERROR);
+
     if ($ipprc->file_exists($outputPsf)) {
         $psf_available = 1;
@@ -638,10 +647,12 @@
     }
 
-    # if either of the files are gone rerun photometry unless the other file is temporarily not available
-
-    if (!$sources_available && !$make_sources) {
-        # destreak will die if the sources is not available
-        &my_die("PSPHOT.SOURCES is missing but we cannot regenerate it", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR);
-    }
+    if ($update_sources_if_gone) {
+        if (!$sources_available && !$make_sources) {
+            # destreak will die if the sources is not available
+            # but magic is dead....
+            &my_die("PSPHOT.SOURCES is missing but we cannot regenerate it", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR);
+        }
+    }
+
     if (!$psf_available && !$make_psf) {
         # warp updates need the psf file
