Index: /trunk/stac/src/Makefile
===================================================================
--- /trunk/stac/src/Makefile	(revision 2750)
+++ /trunk/stac/src/Makefile	(revision 2751)
@@ -1,5 +1,5 @@
 SHELL = /bin/sh
 CC = gcc
-CFLAGS += -O2 -g -std=c99 -I/home/mithrandir/price/psLib3/psLib/include -DCRFLUX -DTESTING
+CFLAGS += -O2 -g -std=c99 -I/home/mithrandir/price/psLib3/psLib/include # -DCRFLUX -DTESTING
 PSLIB += -L/home/mithrandir/price/psLib3/psLib/lib/ -lpslib -lgsl -lgslcblas -lfftw3f -lsla -lcfitsio -lm
 LDFLAGS += $(PSLIB)
Index: /trunk/stac/src/stac.c
===================================================================
--- /trunk/stac/src/stac.c	(revision 2750)
+++ /trunk/stac/src/stac.c	(revision 2751)
@@ -2,8 +2,19 @@
 #include "pslib.h"
 #include "stac.h"
+#include <sys/time.h>
+
+double getTime(void)
+/* Gets the current time.  Got this from Nick Kaiser's fetchpix.c */
+{
+    struct timeval tv;
+    gettimeofday(&tv, NULL);
+    return(tv.tv_sec + 1.e-6 * tv.tv_usec);
+}
 
 
 int main(int argc, char **argv)
 {
+
+    double startTime = getTime();
 
 #if 0
@@ -24,4 +35,6 @@
     psTraceSetLevel("stac.combine",10);
     psTraceSetLevel("stac.rejection",10);
+    psTraceSetLevel("stac.time",10);
+    
 
     // Set logging level
@@ -46,4 +59,6 @@
     psArray *transformedErrors = NULL;
     psArray *transformed = stacTransform(inputs, inverseMaps, errors, &transformedErrors, NULL, config);
+
+    psTrace("stac.time",1,"Transformation completed at %f seconds\n", getTime() - startTime);
 
     // Combine with rejection
@@ -87,5 +102,7 @@
     psFree(combined);
 
-    // Check memory for leaks, corruption
+    psTrace("stac.time",1,"Combination completed at %f seconds\n", getTime() - startTime);
+
+   // Check memory for leaks, corruption
     stacCheckMemory();
 }
Index: /trunk/stac/src/stacRejection.c
===================================================================
--- /trunk/stac/src/stacRejection.c	(revision 2750)
+++ /trunk/stac/src/stacRejection.c	(revision 2751)
@@ -162,4 +162,5 @@
 #endif
 
+#ifdef TESTING
 		// Check gradient
 		float meanGrads = 0.0;
@@ -184,4 +185,8 @@
 		    meanGrads = 0;
 		}
+#else
+		float meanGrads = 10000.0;
+#endif
+
 		
 #ifdef TESTING
@@ -197,6 +202,6 @@
 			fprintf(crs, "%d %d --> %f %f %f\n", x, y, ((psImage*)(inputs->data[i]))->data.F32[y][x],
 				maskVal, stacGradient(inputs->data[i], x, y));
+#endif
 		    }
-#endif
 		} else {
 		    mask->data.U8[y][x] = 0;
Index: /trunk/stac/src/stacTransform.c
===================================================================
--- /trunk/stac/src/stacTransform.c	(revision 2750)
+++ /trunk/stac/src/stacTransform.c	(revision 2751)
@@ -176,4 +176,7 @@
 	psImage *outError = psImageAlloc(nx, ny, PS_TYPE_F32);
 	psTrace("stac.transform", 5, "Allocating space for transformed image, %dx%d\n", nx, ny);
+
+#if 0
+	// No need for initialisation, since we iterate over the entire output image.
 	for (int y = 0; y < ny; y++) {
 	    for (int x = 0; x < nx; x++) {
@@ -182,4 +185,5 @@
 	    }
 	}
+#endif
 
 	// Mask
@@ -201,5 +205,4 @@
 	    for (int x = 0; x < nx; x++) {
 		// Transform!
-		// Could no doubt make this quicker by calculating derivatives and incrementing by those.
 		sky->x = (double)x + 0.5;
 		sky->y = (double)y + 0.5;
