Index: trunk/psModules/src/objects/pmSource.c
===================================================================
--- trunk/psModules/src/objects/pmSource.c	(revision 19879)
+++ trunk/psModules/src/objects/pmSource.c	(revision 19906)
@@ -6,6 +6,6 @@
  *  @author EAM, IfA: significant modifications.
  *
- *  @version $Revision: 1.57 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2008-10-03 20:59:16 $
+ *  @version $Revision: 1.58 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2008-10-06 13:05:13 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -274,5 +274,6 @@
 // XXX this function should probably accept the values, not a recipe. wrap with a
 // psphot-specific function which applies the recipe values
-pmPSFClump pmSourcePSFClump(psArray *sources, psMetadata *recipe)
+// only apply selection to sources within specified region
+pmPSFClump pmSourcePSFClump(psRegion *region, psArray *sources, psMetadata *recipe)
 {
     psTrace("psModules.objects", 5, "---- begin ----\n");
@@ -329,4 +330,9 @@
                 continue;
 
+	    if (tmpSrc->peak->x < region->x0) continue;
+	    if (tmpSrc->peak->x > region->x1) continue;
+	    if (tmpSrc->peak->y < region->y0) continue;
+	    if (tmpSrc->peak->y > region->y1) continue;
+
             // Sx,Sy are limited at 0.  a peak at 0,0 is artificial
             if (fabs(tmpSrc->moments->Mxx) < 0.05)
@@ -427,4 +433,9 @@
                 continue;
 
+	    if (tmpSrc->peak->x < region->x0) continue;
+	    if (tmpSrc->peak->x > region->x1) continue;
+	    if (tmpSrc->peak->y < region->y0) continue;
+	    if (tmpSrc->peak->y > region->y1) continue;
+
             if (tmpSrc->moments->Mxx < minSx)
                 continue;
@@ -475,5 +486,5 @@
 *****************************************************************************/
 
-bool pmSourceRoughClass(psArray *sources, psMetadata *recipe, pmPSFClump clump, psMaskType maskSat)
+bool pmSourceRoughClass(psRegion *region, psArray *sources, psMetadata *recipe, pmPSFClump clump, psMaskType maskSat)
 {
     psTrace("psModules.objects", 5, "---- begin ----");
@@ -509,4 +520,9 @@
 
         pmSource *source = (pmSource *) sources->data[i];
+
+	if (source->peak->x < region->x0) continue;
+	if (source->peak->x > region->x1) continue;
+	if (source->peak->y < region->y0) continue;
+	if (source->peak->y > region->y1) continue;
 
         source->peak->type = 0;
