Index: trunk/psModules/src/objects/pmSourcePhotometry.c
===================================================================
--- trunk/psModules/src/objects/pmSourcePhotometry.c	(revision 14962)
+++ trunk/psModules/src/objects/pmSourcePhotometry.c	(revision 15000)
@@ -3,6 +3,6 @@
  *  @author EAM, IfA; GLG, MHPCC
  *
- *  @version $Revision: 1.31 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2007-09-21 02:46:46 $
+ *  @version $Revision: 1.32 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2007-09-24 21:27:58 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -81,6 +81,8 @@
     // we must have a valid model
     model = pmSourceGetModel (&isPSF, source);
-    if (model == NULL)
-        return false;
+    if (model == NULL) {
+	psTrace ("psModules.objects", 3, "fail mag : no valid model");
+        return false;
+    }
 
     if (model->dparams->data.F32[PM_PAR_I0] > 0) {
@@ -102,5 +104,4 @@
 	    source->psfMag = NAN;
 	}
-	fprintf (stderr, ".");
     } else {
 	status = pmSourcePhotometryModel (&source->psfMag, source->modelPSF);
@@ -109,12 +110,14 @@
     // measure EXT model photometry
     status = pmSourcePhotometryModel (&source->extMag, source->modelEXT);
+
     // for PSFs, correct both apMag and psfMag to same system, consistent with infinite flux star in aperture RADIUS
-    if ((mode & PM_SOURCE_PHOT_APCORR) && isPSF && psf) {
-        // convert to the equivalent 2D model?
+    if ((mode & PM_SOURCE_PHOT_APCORR) && isPSF && psf && psf->ApTrend) {
         source->psfMag += pmTrend2DEval (psf->ApTrend, x, y);
     }
 
-    if (!isfinite(SN) || (SN < AP_MIN_SN))
-        return false;
+    if (!isfinite(SN) || (SN < AP_MIN_SN)) {
+	psTrace ("psModules.objects", 3, "fail mag : bad SN: %f (limit: %f)", SN, AP_MIN_SN);
+        return false;
+    }
 
     // replace source flux
@@ -209,4 +212,5 @@
     status = pmSourcePhotometryAper  (&source->apMag, model, flux, source->maskObj, maskVal);
     if (!status) {
+	psTrace ("psModules.objects", 3, "fail mag : bad Ap Mag");
         psErrorCode last = psErrorCodeLast();
         if (last == PM_ERR_PHOTOM) {
