Index: /trunk/stac/src/Makefile
===================================================================
--- /trunk/stac/src/Makefile	(revision 3386)
+++ /trunk/stac/src/Makefile	(revision 3387)
@@ -12,4 +12,7 @@
 
 FITTRANS = fitTrans.o fitTransConfig.o fitTransRead.o stacCheckMemory.o fitTransSolve.o
+
+TEST_SHIFT = testShift.o stacConfig.o stacRead.o stacErrorImages.o stacTransform.o stacCheckMemory.o \
+	stacInvertMaps.o
 
 .PHONY: tags clean empty test profile optimise
@@ -36,4 +39,7 @@
 		$(CC) $(CFLAGS) -o $@ $(FITTRANS) $(LDFLAGS) $(OPTFLAGS)
 
+testShift:	$(TEST_SHIFT)
+		$(CC) $(CFLAGS) -o $@ $(TEST_SHIFT) $(LDFLAGS) $(OPTFLAGS)
+
 clean:
 		-$(RM) *.o gmon.* profile.txt
@@ -51,6 +57,10 @@
 		-$(RM) test_[0-3].fits.shiftrej
 		-$(RM) test_[0-3].fits.shifterr.*
+		-$(RM) test_[0-3].fits.grad
+		-$(RM) test_[0-3].fits.region
+		-$(RM) test_[0-3].fits.rejmap
 		-$(RM) leaks.dat
-		./stac -v -k 2.5 -f 0.5 -G 0.96 testout.fits test_0.fits test_1.fits test_2.fits test_3.fits
+#		./stac -v -k 2.5 -f 0.5 -G 0.96 testout.fits test_0.fits test_1.fits test_2.fits test_3.fits
+		./stac -v testout.fits test_0.fits test_1.fits test_2.fits test_3.fits
 
 # Run profiling.
Index: /trunk/stac/src/stacConfig.c
===================================================================
--- /trunk/stac/src/stacConfig.c	(revision 3386)
+++ /trunk/stac/src/stacConfig.c	(revision 3387)
@@ -41,9 +41,9 @@
     config->outnx = 512;
     config->outny = 512;
-    config->saturated = 65536.0;
+    config->saturated = 65535.0;
     config->bad = 0.0;
-    config->reject = 3.5;
+    config->reject = 3.0;
     config->frac = 0.5;
-    config->grad = 0.4;
+    config->grad = 0.6;
     config->nReject = 2;
 
Index: /trunk/stac/src/stacRejection.c
===================================================================
--- /trunk/stac/src/stacRejection.c	(revision 3386)
+++ /trunk/stac/src/stacRejection.c	(revision 3387)
@@ -110,6 +110,6 @@
 		if (region->data.U8[y][x]) {
 
-		    inCoords->x = (double)x;
-		    inCoords->y = (double)y;
+		    inCoords->x = (double)x + 0.5;
+		    inCoords->y = (double)y + 0.5;
 		    (void)psPlaneTransformApply(outCoords, map, inCoords);
 		    float maskVal = (float)psImagePixelInterpolate(reject, outCoords->x, outCoords->y,
Index: /trunk/stac/src/stacTransform.c
===================================================================
--- /trunk/stac/src/stacTransform.c	(revision 3386)
+++ /trunk/stac/src/stacTransform.c	(revision 3387)
@@ -190,5 +190,4 @@
 	for (int y = 0; y < ny; y++) {
 	    for (int x = 0; x < nx; x++) {
-
 		// Only transform those pixels requested
 		if (!region || (region && region->data.U8[y][x])) {
@@ -199,11 +198,11 @@
 		    
 		    // Change PS_INTERPOLATE_BILINEAR to best available technique.
-		    outImage->data.F32[y][x] = (psF32)psImagePixelInterpolate(image, detector->x + 0.5,
-									      detector->y + 0.5, mask, 1, 0.0,
+		    outImage->data.F32[y][x] = (psF32)psImagePixelInterpolate(image, detector->x,
+									      detector->y, mask, 1, 0.0,
 									      PS_INTERPOLATE_BILINEAR);
 		    // Error is actually the variance
 		    outError->data.F32[y][x] = (psF32)p_psImageErrorInterpolateBILINEAR_F32(error,
-											    detector->x + 0.5,
-											    detector->y + 0.5,
+											    detector->x,
+											    detector->y,
 											    mask, 1, 0.0);
 		} // Pixels of interest
