Index: /branches/eam_branch_20071212/psModules/src/detrend/pmMaskBadPixels.c
===================================================================
--- /branches/eam_branch_20071212/psModules/src/detrend/pmMaskBadPixels.c	(revision 15807)
+++ /branches/eam_branch_20071212/psModules/src/detrend/pmMaskBadPixels.c	(revision 15808)
@@ -81,5 +81,5 @@
 
 psImage *pmMaskFlagSuspectPixels(psImage *out, const pmReadout *readout, float rej,
-                                 psMaskType maskVal, float frac, psRandom *rng)
+                                 psMaskType maskVal, float median, float stdev)
 {
     PS_ASSERT_PTR_NON_NULL(readout, NULL);
@@ -103,26 +103,4 @@
     psImage *mask = readout->mask;      // Corresponding mask
 
-    if (rng) {
-        psMemIncrRefCounter(rng);
-    } else {
-        rng = psRandomAlloc(PS_RANDOM_TAUS, 0);
-    }
-
-    // XXX note that this now will accept any of several stats options
-    psStats *stats = psStatsAlloc(PS_STAT_ROBUST_MEDIAN | PS_STAT_ROBUST_STDEV);
-    stats->nSubsample = frac * image->numCols * image->numRows;
-    if (!psImageBackground(stats, NULL, image, mask, maskVal, rng) ||
-            !isfinite(stats->robustMedian) || !isfinite(stats->robustUQ) || !isfinite(stats->robustLQ)) {
-        psError(PS_ERR_UNKNOWN, false, "Unable to measure image statistics.\n");
-        psFree(stats);
-        psFree(rng);
-        return NULL;
-    }
-    psFree(rng);
-
-    float median = stats->robustMedian; // Median value
-    float stdev = stats->robustStdev; // Estimate of the standard deviation
-    psFree(stats);
-
     if (!out) {
         out = psImageAlloc(image->numCols, image->numRows, PS_TYPE_S32);
Index: /branches/eam_branch_20071212/psModules/src/detrend/pmMaskBadPixels.h
===================================================================
--- /branches/eam_branch_20071212/psModules/src/detrend/pmMaskBadPixels.h	(revision 15807)
+++ /branches/eam_branch_20071212/psModules/src/detrend/pmMaskBadPixels.h	(revision 15808)
@@ -5,6 +5,6 @@
  * @author Eugene Magnier, IfA
  *
- * @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
- * @date $Date: 2007-03-30 21:12:56 $
+ * @version $Revision: 1.13.20.1 $ $Name: not supported by cvs2svn $
+ * @date $Date: 2007-12-13 17:54:08 $
  * Copyright 2004 Institute for Astronomy, University of Hawaii
  */
@@ -31,14 +31,14 @@
 /// Find pixels outlying from the background, flagging suspect pixels
 ///
-/// Pixels more than "rej" standard deviations from the background level (in flat-fielded,
-/// background-subtracted images) have the corresponding pixel in the "suspect pixels" image incremented.
-/// After accumulating over a suitable sample of images, bad pixels should have a high value in the suspect
-/// pixels image, allowing them to be identified.  The suspect pixels image is of type S32.
-psImage *pmMaskFlagSuspectPixels(psImage *out, ///< Suspected bad pixels image, or NULL
+/// Pixels more than "rej" standard deviations from the median level have the corresponding pixel in
+/// the "suspect pixels" image incremented.  After accumulating over a suitable sample of images,
+/// bad pixels should have a high value in the suspect pixels image, allowing them to be identified.
+/// The suspect pixels image is of type S32.  This function is best applied to residual images. 
+psImage *pmMaskFlagSuspectPixels(psImage *out,	  ///< Suspected bad pixels image, or NULL
                                  const pmReadout *readout, ///< Readout to inspect
                                  float rej, ///< Rejection threshold (standard deviations)
                                  psMaskType maskVal, ///< Mask value for statistics
-                                 float frac, ///< Fraction of pixels to consider
-                                 psRandom *rng ///< Random number generator
+                                 float median, ///< reference median for the image
+                                 float stdev ///< reference stdev for the image
                                 );
 
