Index: trunk/magic/remove/src/streaksremove.c
===================================================================
--- trunk/magic/remove/src/streaksremove.c	(revision 26457)
+++ trunk/magic/remove/src/streaksremove.c	(revision 26477)
@@ -20,4 +20,6 @@
 static long censorPixels(streakFiles *sfiles, psImage * pixels, bool checkNonDiffedPixels, psU16 maskStreak);
 
+char *streaksProgram = "streaksremove";
+
 // Note: For clarity the flow of this program is in main().
 // There is not a lot of error checking is done in main.
@@ -109,4 +111,5 @@
     psF64 cs_t = 0;
     psF64 wi_t = 0;
+    psF64 ua_t = 0;
     // Iterate through each component of the input (except for raw images there is only one)
     do {
@@ -182,5 +185,9 @@
             // chip processed files with the data calcuated by psastro at the camera stage
             // (actually we use a linear approximation)
+            psTimerStart("UPDATE_ASTROMETRY");
             updateAstrometry(sfiles);
+            ua_t += psTimerClear("UPDATE_ASTROMETRY");
+            psMetadataAddF32(sfiles->stats, PS_LIST_TAIL, "UPDATE_ASTROMETRY", PS_META_REPLACE, "", ua_t);
+            psLogMsg("streaksremove", PS_LOG_INFO, "time to update astrometry: %f\n", ua_t);
         }
 
@@ -544,22 +551,19 @@
 updateAstrometry(streakFiles *sf)
 {
-    // XXX: why do I check this here? Shouldn't it be just around the call to linearizeTransforms?
     if (sf->bilevelAstrometry) {
-
         if (!linearizeTransforms(sf->astrom)) {
-            // fit failed, leave the astrometry unchanged
+            // fit failed, leave the transform in the file unchanged
             return;
         }
-
-        if (!pmAstromWriteWCS(sf->outImage->header, sf->inAstrom->fpa, sf->chip, 0.001)) {
-            psError(PS_ERR_UNKNOWN, false, "failed to update astrometry for extension %d", sf->extnum);
-            streaksExit("", PS_EXIT_UNKNOWN_ERROR);
-        }
-        if (sf->outMask) {
-            pmAstromWriteWCS(sf->outMask->header, sf->inAstrom->fpa, sf->chip, 0.001);
-        }
-        if (sf->outWeight) {
-            pmAstromWriteWCS(sf->outWeight->header, sf->inAstrom->fpa, sf->chip, 0.001);
-        }
+    }
+    if (!pmAstromWriteWCS(sf->outImage->header, sf->inAstrom->fpa, sf->chip, 0.001)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to update astrometry for extension %d", sf->extnum);
+        streaksExit("", PS_EXIT_UNKNOWN_ERROR);
+    }
+    if (sf->outMask) {
+        pmAstromWriteWCS(sf->outMask->header, sf->inAstrom->fpa, sf->chip, 0.001);
+    }
+    if (sf->outWeight) {
+        pmAstromWriteWCS(sf->outWeight->header, sf->inAstrom->fpa, sf->chip, 0.001);
     }
 }
@@ -579,5 +583,4 @@
 readAndCopyToOutput(streakFiles *sf, bool exciseAll)
 {
-    bool    updateAstrometry = false;
     if (sf->inImage->pmfile) {
         // image data from pmFPAfile (diff or warp file)
@@ -597,15 +600,4 @@
         streaksExit("", PS_EXIT_UNKNOWN_ERROR);
     }
-    // For the chip level files, copy the WCS from the astrometry file to the header
-    // XXX: do we want to do this for raw images as well?
-    if (sf->stage == IPP_STAGE_CHIP) {
-        if (!sf->bilevelAstrometry) {
-            updateAstrometry = true;
-            if (!pmAstromWriteWCS(sf->inImage->header, sf->inAstrom->fpa, sf->chip, 0.001)) {
-                psError(PS_ERR_UNKNOWN, false, "failed to update astrometry for extension %d", sf->extnum);
-                streaksExit("", PS_EXIT_UNKNOWN_ERROR);
-            }
-        }
-    }
     sf->outImage->header =  psMemIncrRefCounter(sf->inImage->header);
     if (sf->recImage) {
@@ -640,7 +632,4 @@
             }
             addDestreakKeyword(sf->outMask->header);
-            if (updateAstrometry) {
-                pmAstromWriteWCS(sf->outMask->header, sf->inAstrom->fpa, sf->chip, 0.001);
-            }
             // Note: we don't excise the mask pixels even if exciseAll is true.
             setupImageRefs(sf->outMask, sf->recMask, sf->inMask, sf->extnum, false);
@@ -675,7 +664,4 @@
         }
         addDestreakKeyword(sf->outWeight->header);
-        if (updateAstrometry) {
-            pmAstromWriteWCS(sf->inWeight->header, sf->inAstrom->fpa, sf->chip, 0.001);
-        }
         setupImageRefs(sf->outWeight, sf->recWeight, sf->inWeight, sf->extnum, exciseAll);
 
