Index: trunk/psphot/src/psphotDefinePixels.c
===================================================================
--- trunk/psphot/src/psphotDefinePixels.c	(revision 5134)
+++ trunk/psphot/src/psphotDefinePixels.c	(revision 5980)
@@ -16,6 +16,52 @@
     mySource->weight = psImageSubset(imdata->weight, srcRegion);
     mySource->mask   = psImageSubset(imdata->mask,  srcRegion);
+    mySource->region = srcRegion;
 
-    return(mySource);
+    return true;
 }
 
+bool psphotRedefinePixels(pmSource *mySource, 
+			  const eamReadout *imdata,
+			  psF32 x, 
+			  psF32 y,
+			  psF32 Radius)
+{
+    bool extend;
+    psRegion newRegion;
+
+    if (Radius == 0) return false;
+
+    // check to see if new region is completely contained within old region
+    newRegion = psRegionForSquare (x, y, Radius);
+    newRegion = psRegionForImage (imdata->image, newRegion);
+
+    extend = false;
+    extend |= (int)(newRegion.x0) < (int)(mySource->region.x0);
+    extend |= (int)(newRegion.x1) > (int)(mySource->region.x1);
+    extend |= (int)(newRegion.y0) < (int)(mySource->region.y0);
+    extend |= (int)(newRegion.y1) > (int)(mySource->region.y1);
+
+    extend |= (mySource->pixels == NULL);
+    extend |= (mySource->weight == NULL);
+    extend |= (mySource->mask == NULL);
+
+    // extend = true;
+    if (extend) {
+	// Grab a new subimage
+	// psFree (mySource->pixels);
+	// psFree (mySource->weight);
+	// psFree (mySource->mask);
+
+	// fprintf (stderr, "extend %f,%f\n", x, y);
+	mySource->pixels = psImageSubset(imdata->image,  newRegion);
+	mySource->weight = psImageSubset(imdata->weight, newRegion);
+	mySource->mask   = psImageSubset(imdata->mask,   newRegion);
+	mySource->region = newRegion;
+    }
+
+    return extend;
+}
+
+
+//**** this function was ALWAYS restricting to model->radius
+//     should have left it larger (PSF_FIT_RAD) for the faint sources
