Index: trunk/psastro/src/psastroConvert.c
===================================================================
--- trunk/psastro/src/psastroConvert.c	(revision 15365)
+++ trunk/psastro/src/psastroConvert.c	(revision 15636)
@@ -49,5 +49,9 @@
     // we are going to select the brighter Nmax subset for astrometry 
     int nMax = psMetadataLookupS32 (&status, recipe, "PSASTRO.MAX.NRAW");
-    if (!status || !nMax) nMax = inStars->n; // 10 is really somewhat absurd as a lower limit
+    if (!status || !nMax) nMax = inStars->n;
+
+    // we are going to select the brighter Nmax subset for astrometry 
+    float iMagMax = psMetadataLookupF32 (&status, recipe, "PSASTRO.MAX.INST.MAG.RAW");
+    float iMagMin = psMetadataLookupF32 (&status, recipe, "PSASTRO.MIN.INST.MAG.RAW");
 
     // choose the first nMax sources
@@ -58,4 +62,6 @@
 	pmSource *source = sources->data[n];
 	if (source->mode & PM_SOURCE_MODE_SATSTAR) continue;
+	if ((iMagMax != 0.0) && (source->psfMag > iMagMax)) continue;
+	if ((iMagMin != 0.0) && (source->psfMag < iMagMin)) continue;
 	rawStars->data[j] = psMemIncrRefCounter (inStars->data[n]);
 	j++;
