Index: trunk/psphot/src/psphotSourceSize.c
===================================================================
--- trunk/psphot/src/psphotSourceSize.c	(revision 34750)
+++ trunk/psphot/src/psphotSourceSize.c	(revision 34769)
@@ -11,4 +11,6 @@
     float nSigmaMoments;
     float nSigmaCR;
+    bool altDiffExt;
+    float altDiffExtThresh;
     float soft;
     int grow;
@@ -120,4 +122,11 @@
     assert (status);
 
+    // Optional extended source measurement algorithm to improve diff image trails
+    options.altDiffExt = psMetadataLookupBool(&status, recipe, "PSPHOT.EXT.DIFF.ALTERNATE");
+    assert (status);
+    // Threshold for this alternate method
+    options.altDiffExtThresh = psMetadataLookupF32(&status, recipe, "PSPHOT.EXT.DIFF.ALTERNATE.THRESH");
+    assert (status);
+    
     // location of a single test source
     options.xtest = psMetadataLookupS32 (&status, recipe, "PSPHOT.CRMASK.XTEST");
@@ -601,5 +610,24 @@
             continue;
         }
-
+	// Alternate extended source limit calculation
+	if (options->altDiffExt) {
+	  // ratio of major to minor axes
+	  // MRV = Major / Minor
+	  // MRV = (0.5 * (Mxx + Myy) + 0.5 * sqrt( (Mxx + Myy)^2 + 4 Mxy^2)) /
+	  //       (0.5 * (Mxx + Myy) - 0.5 * sqrt( (Mxx + Myy)^2 + 4 Mxy^2))
+	  // MRV = (2 * 0.5 * (Mxx + Myy) - Minor) / Minor
+	  float momentRatioVeres = (Mxx + Myy - Mminor) / Mminor;
+	  bool  isAltEXT = (momentRatioVeres > options->altDiffExtThresh);
+	  if (isAltEXT) {
+	    psTrace("psphotSourceClassRegion.EXT",4,"CLASS: %g %g\t%g %g\t%g %g\t%g %g\t%g ALTEXT\t%g %g\n",
+                    source->peak->xf, source->peak->yf, Mminor, kMag, dMag, nSigmaMAG, options->sizeLimitCR, options->magLimitCR, options->nSigmaApResid,
+		    momentRatioVeres,options->altDiffExtThresh);
+            source->mode |= PM_SOURCE_MODE_EXT_LIMIT;
+            source->tmpFlags |= PM_SOURCE_TMPF_SIZE_MEASURED;
+            Next ++;
+            continue;
+	  }
+	}
+	
         // Everything else should just be treated as a PSF
 	psTrace("psphotSourceClassRegion.PSF",4,"CLASS: %g %g\t%g %g\t%g %g\t%g %g\t%g PSF\n",
