Index: /branches/eam_branches/20091113/psastro/src/psastroChipAstrom.c
===================================================================
--- /branches/eam_branches/20091113/psastro/src/psastroChipAstrom.c	(revision 26135)
+++ /branches/eam_branches/20091113/psastro/src/psastroChipAstrom.c	(revision 26136)
@@ -56,16 +56,19 @@
 
                 // select the raw objects for this readout
-                psArray *rawstars = psMetadataLookupPtr (&status, readout->analysis, "PSASTRO.RAWSTARS");
-                if (rawstars == NULL) { continue; }
+                psArray *rawstarsAll = psMetadataLookupPtr (&status, readout->analysis, "PSASTRO.RAWSTARS");
+                if (rawstarsAll == NULL) { continue; }
+		psArray *rawstars = psastroRemoveClumpsIterate(rawstarsAll, 150, 3);
 
                 // select the raw objects for this readout
-                psArray *refstars = psMetadataLookupPtr (&status, readout->analysis, "PSASTRO.REFSTARS");
-                if (refstars == NULL) { continue; }
+                psArray *refstarsAll = psMetadataLookupPtr (&status, readout->analysis, "PSASTRO.REFSTARS");
+                if (refstarsAll == NULL) { continue; }
+		psArray *refstars = psastroRemoveClumpsIterate(refstarsAll, 150, 2);
 
                 // the absolute minimum number of stars is 4 (for order = 1)
                 if ((rawstars->n < 4) || (refstars->n < 4)) {
                     readout->data_exists = false;
-                    psLogMsg ("psastro", 3, "insufficient rawstars (%ld) or refstars (%ld)",
-                              rawstars->n, refstars->n);
+                    psLogMsg ("psastro", 3, "insufficient rawstars (%ld) or refstars (%ld)", rawstars->n, refstars->n);
+		    psFree (rawstars);
+		    psFree (refstars);
                     continue;
                 }
@@ -84,4 +87,6 @@
                     readout->data_exists = false;
                     psLogMsg ("psastro", 3, "failed to find a solution\n");
+		    psFree (rawstars);
+		    psFree (refstars);
                     continue;
                 }
@@ -90,6 +95,11 @@
                     readout->data_exists = false;
                     psLogMsg ("psastro", 3, "failed to find a solution\n");
+		    psFree (rawstars);
+		    psFree (refstars);
                     continue;
                 }
+
+		psFree (rawstars);
+		psFree (refstars);
 
                 numGoodRO++;
