Index: trunk/psphot/src/growthTest.c
===================================================================
--- trunk/psphot/src/growthTest.c	(revision 9839)
+++ trunk/psphot/src/growthTest.c	(revision 9867)
@@ -48,9 +48,12 @@
 	pmModel *model = pmModelFromPSF (modelRef, psf);
 
-	psRegion region = {180, 220, 180, 220};
+	// psRegion region = {180, 220, 180, 220};
+	psRegion region = {0, 0, 0, 0};
 	psImage *imageView = psImageSubset (readout->image, region);
 	psImage *maskView = psImageSubset (readout->mask, region);
-	pmModelAdd (imageView, maskView, model, false, false);
-	// imageView->data.F32[20][20] = 1000;
+
+	psImageInit (imageView, 0.0);
+	psImageInit (maskView, 0);
+	pmModelAdd (imageView, maskView, model, false, false);
 	float dx = 0.5 - model->params->data.F32[PM_PAR_XPOS] + (int)model->params->data.F32[PM_PAR_XPOS];
 	float dy = 0.5 - model->params->data.F32[PM_PAR_YPOS] + (int)model->params->data.F32[PM_PAR_YPOS];
@@ -58,4 +61,36 @@
 
 	psFits *fits;
+	fits = psFitsOpen ("unshift_tmp.fits", "w");
+	psFitsWriteImage (fits, NULL, imageView, 0, NULL);
+	psFitsClose (fits);
+	
+	fits = psFitsOpen ("shift_tmp.fits", "w");
+	psFitsWriteImage (fits, NULL, tmpImage, 0, NULL);
+	psFitsClose (fits);
+    }
+
+    // test of psImageShift (Bilinear)
+    { 
+	// assign the x and y coords to the image center
+	// create an object with center intensity of 1000
+	modelRef->params->data.F32[PM_PAR_XPOS] = 200+0.2;
+	modelRef->params->data.F32[PM_PAR_YPOS] = 200+0.6;
+	
+	// create modelPSF from this model
+	pmModel *model = pmModelFromPSF (modelRef, psf);
+
+	// psRegion region = {180, 220, 180, 220};
+	psRegion region = {0, 0, 0, 0};
+	psImage *imageView = psImageSubset (readout->image, region);
+	psImage *maskView = psImageSubset (readout->mask, region);
+
+	psImageInit (imageView, 0.0);
+	psImageInit (maskView, 0);
+	pmModelAdd (imageView, maskView, model, false, false);
+	float dx = 0.5 - model->params->data.F32[PM_PAR_XPOS] + (int)model->params->data.F32[PM_PAR_XPOS];
+	float dy = 0.5 - model->params->data.F32[PM_PAR_YPOS] + (int)model->params->data.F32[PM_PAR_YPOS];
+	psImage *tmpImage = psImageShift (NULL, imageView, dx, dy, 0.0, PS_INTERPOLATE_BILINEAR);
+
+	psFits *fits;
 	fits = psFitsOpen ("unshift.fits", "w");
 	psFitsWriteImage (fits, NULL, imageView, 0, NULL);
@@ -64,4 +99,70 @@
 	fits = psFitsOpen ("shift.fits", "w");
 	psFitsWriteImage (fits, NULL, tmpImage, 0, NULL);
+	psFitsClose (fits);
+
+	modelRef->params->data.F32[PM_PAR_XPOS] = 200+0.5;
+	modelRef->params->data.F32[PM_PAR_YPOS] = 200+0.5;
+	model = pmModelFromPSF (modelRef, psf);
+	psImageInit (imageView, 0.0);
+	psImageInit (maskView, 0);
+	pmModelAdd (imageView, maskView, model, false, false);
+
+	fits = psFitsOpen ("center.fits", "w");
+	psFitsWriteImage (fits, NULL, imageView, 0, NULL);
+	psFitsClose (fits);
+    }
+
+    // test of psImageShift 
+    { 
+	// assign the x and y coords to the image center
+	// create an object with center intensity of 1000
+	modelRef->params->data.F32[PM_PAR_XPOS] = 200+0.2;
+	modelRef->params->data.F32[PM_PAR_YPOS] = 200+0.6;
+	
+	// create modelPSF from this model
+	pmModel *model = pmModelFromPSF (modelRef, psf);
+
+	// psRegion region = {180, 220, 180, 220};
+	psRegion region = {0, 0, 0, 0};
+	psImage *imageView = psImageSubset (readout->image, region);
+	psImage *maskView = psImageSubset (readout->mask, region);
+
+	psImageInit (imageView, 0.0);
+	psImageInit (maskView, 0);
+	pmModelAdd (imageView, maskView, model, false, false);
+	float dx = 0.5 - model->params->data.F32[PM_PAR_XPOS] + (int)model->params->data.F32[PM_PAR_XPOS];
+	float dy = 0.5 - model->params->data.F32[PM_PAR_YPOS] + (int)model->params->data.F32[PM_PAR_YPOS];
+	psImage *tmpImage = psImageShift (NULL, imageView, dx, dy, 0.0, PS_INTERPOLATE_BICUBE);
+
+	psFits *fits;
+	fits = psFitsOpen ("unshift_2.fits", "w");
+	psFitsWriteImage (fits, NULL, imageView, 0, NULL);
+	psFitsClose (fits);
+	
+	fits = psFitsOpen ("shift_2.fits", "w");
+	psFitsWriteImage (fits, NULL, tmpImage, 0, NULL);
+	psFitsClose (fits);
+
+	modelRef->params->data.F32[PM_PAR_XPOS] = 200+0.5;
+	modelRef->params->data.F32[PM_PAR_YPOS] = 200+0.5;
+	model = pmModelFromPSF (modelRef, psf);
+	psImageInit (imageView, 0.0);
+	psImageInit (maskView, 0);
+	pmModelAdd (imageView, maskView, model, false, false);
+
+	fits = psFitsOpen ("center_2.fits", "w");
+	psFitsWriteImage (fits, NULL, imageView, 0, NULL);
+	psFitsClose (fits);
+
+	psImageInit (maskView, 0);
+	psImageKeepCircle (maskView, model->params->data.F32[PM_PAR_XPOS], model->params->data.F32[PM_PAR_YPOS], 2, "OR", PM_MASK_MARK);
+	fits = psFitsOpen ("mask_2.fits", "w");
+	psFitsWriteImage (fits, NULL, maskView, 0, NULL);
+	psFitsClose (fits);
+
+	psImageInit (maskView, 0);
+	psImageKeepCircle (maskView, model->params->data.F32[PM_PAR_XPOS], model->params->data.F32[PM_PAR_YPOS], 3, "OR", PM_MASK_MARK);
+	fits = psFitsOpen ("mask_3.fits", "w");
+	psFitsWriteImage (fits, NULL, maskView, 0, NULL);
 	psFitsClose (fits);
     }
@@ -164,23 +265,9 @@
 		float dX = 0.5 - model->params->data.F32[PM_PAR_XPOS] + (int)model->params->data.F32[PM_PAR_XPOS];
 		float dY = 0.5 - model->params->data.F32[PM_PAR_YPOS] + (int)model->params->data.F32[PM_PAR_YPOS];
-		psImage *tmpImage = tmp_psImageShift (imageView, dX, dY);
+		psImage *tmpImage = psImageShift (NULL, imageView, dX, dY, 0.0, PS_INTERPOLATE_BICUBE);
+		// psImage *tmpImage = tmp_psImageShift (imageView, dX, dY);
 
 		psImageKeepCircle (maskView, 200+dx+dX, 200+dy+dY, radius, "OR", PM_MASK_MARK);
-		pmSourcePhotometryAper (&apMag, model, imageView, maskView);
-
-		# if 0
-		char name[64];
-		psFits *fits;
-		sprintf (name, "im.%.1f.fits", dx);
-		fits = psFitsOpen (name, "w");
-		psFitsWriteImage (fits, NULL, tmpImage, 0, NULL);
-		psFitsClose (fits);
-
-		sprintf (name, "mk.%.1f.fits", dx);
-		fits = psFitsOpen (name, "w");
-		psFitsWriteImage (fits, NULL, maskView, 0, NULL);
-		psFitsClose (fits);
-		# endif
-
+		pmSourcePhotometryAper (&apMag, model, tmpImage, maskView);
 		psImageKeepCircle (maskView, 200+dx+dX, 200+dy+dY, radius, "AND", PS_NOT_U8(PM_MASK_MARK));
 
