Index: trunk/archive/scripts/src/phase2/papPhase2.c
===================================================================
--- trunk/archive/scripts/src/phase2/papPhase2.c	(revision 5583)
+++ trunk/archive/scripts/src/phase2/papPhase2.c	(revision 5621)
@@ -16,4 +16,5 @@
 #include "pmNonLinear.h"
 #include "pmSubtractBias.h"
+#include "pmChipMosaic.h"
 
 // Phase 2 needs to:
@@ -81,5 +82,5 @@
 #endif
 
-    psTraceSetLevel("pmConfigCameraFromHeader", 10);
+    psTimerStart("phase2");
 
     // Parse the configurations
@@ -276,4 +277,6 @@
 	psLogMsg("phase2", PS_LOG_INFO, "Operating only on chip %d\n", chipNum);
     }
+
+    psLogMsg("phase2", PS_LOG_INFO, "Setup completed after %f sec.\n", psTimerMark("phase2"));
 
     // Read in the input pixels
@@ -447,4 +450,6 @@
     }
     
+    psLogMsg("phase2", PS_LOG_INFO, "Input completed after %f sec.\n", psTimerMark("phase2"));
+
     psArray *inputChips = input->chips; // Array of chips in input image
     psArray *biasChips = bias->chips;	// Array of chips in bias image
@@ -766,4 +771,5 @@
 		// XXX: Temporary: until the other functions are altered to do this themselves.
 		// Trim, so that flat, fringe etc computations are faster.
+#if 0
 #ifndef PRODUCTION
 		psRegion *trimRegion = psMetadataLookupPtr(NULL, inputCell->concepts, "CELL.TRIMSEC");
@@ -772,5 +778,5 @@
 		inputReadout->image = trimmed;
 #endif
-
+#endif
 		// Flat-field correction
 		if (doFlat) {
@@ -804,7 +810,20 @@
 		}
 
+
 	    } // Iterating over readouts
 	} // Iterating over cells
+
+	// Testing pmChipMosaic
+	{
+	    psImage *mosaic = pmChipMosaic(inputChip, 1, 1); // Mosaic of chip
+	    psFits *mosaicFile = psFitsAlloc("mosaic.fits"); // FITS file to which to write
+	    psFitsWriteImage(mosaicFile, NULL, mosaic, 0);
+	    psFree(mosaicFile);
+	    psFree(mosaic);		
+	}
+ 
     } // Iterating over chips
+
+    psLogMsg("phase2", PS_LOG_INFO, "Processing completed after %f sec.\n", psTimerMark("phase2"));
 
     // Write the output
@@ -812,4 +831,6 @@
     pmFPAWriteMask(input, outputFile);
     pmFPAWriteWeight(input, outputFile);
+
+    psLogMsg("phase2", PS_LOG_INFO, "Output completed after %f sec.\n", psTimerMark("phase2"));
 
 #ifdef PRODUCTION
@@ -831,4 +852,7 @@
     psFree(overscanFit);
     psFree(overscanStats);
+
+    psLogMsg("phase2", PS_LOG_INFO, "Cleanup completed after %f sec.\n", psTimerMark("phase2"));
+    psTimerStop();
 
 #if 1
