Index: branches/2dbias/psModules/src/detrend/pmOverscan.c
===================================================================
--- branches/2dbias/psModules/src/detrend/pmOverscan.c	(revision 42679)
+++ branches/2dbias/psModules/src/detrend/pmOverscan.c	(revision 42715)
@@ -209,5 +209,5 @@
 
 		// Reduce the overscans
-		psVector *reduced = pmOverscanVector(&chi2, overscanOpts->primary, pixels);
+		psVector *reduced = pmOverscanVector(&chi2, overscanOpts->primary, pixels, false);
 		psFree(pixels);
 		if (!reduced)
@@ -293,5 +293,5 @@
 
 		// Reduce the overscans
-		psVector *reduced = pmOverscanVector(&chi2, overscanOpts->primary, pixels);
+		psVector *reduced = pmOverscanVector(&chi2, overscanOpts->primary, pixels, false);
 		psFree(pixels);
 		if (!reduced)
@@ -415,5 +415,5 @@
 		// Reduce the overscans
 		// XXX need to save 2 different chi-square values
-		psVector *yReduced = pmOverscanVector(&chi2, overscanOpts->primary, yscanPixels);
+		psVector *yReduced = pmOverscanVector(&chi2, overscanOpts->primary, yscanPixels, false);
 		psFree(yscanPixels);
 		if (!yReduced)
@@ -430,5 +430,5 @@
 		// Reduce the overscans
 		// XXX need to save 2 different chi-square values
-		psVector *xReduced = pmOverscanVector(&chi2, overscanOpts->secondary, xscanPixels);
+		psVector *xReduced = pmOverscanVector(&chi2, overscanOpts->secondary, xscanPixels, true);
 		psFree(xscanPixels);
 		if (!xReduced)
@@ -560,6 +560,6 @@
 psVector *pmOverscanVector(float *chi2,							// chi^2 from fit
 						   pmOverscanStatOptions *overscanOpts, // Overscan statistic options
-						   const psArray *pixels				// Array of vectors containing the pixel values
-)
+						   const psArray *pixels,				// Array of vectors containing the pixel values
+						   bool robust)							// Use robust statistics for boxcar smoothing
 {
 	assert(overscanOpts);
@@ -611,5 +611,5 @@
 	if (overscanOpts->boxcar > 0)
 	{
-		psVector *smoothed = psVectorBoxcar(NULL, reduced, overscanOpts->boxcar); // Smoothed vector
+		psVector *smoothed = psVectorBoxcar(NULL, reduced, overscanOpts->boxcar, robust); // Smoothed vector
 		psFree(reduced);
 		reduced = smoothed;
Index: branches/2dbias/psModules/src/detrend/pmOverscan.h
===================================================================
--- branches/2dbias/psModules/src/detrend/pmOverscan.h	(revision 42679)
+++ branches/2dbias/psModules/src/detrend/pmOverscan.h	(revision 42715)
@@ -18,9 +18,10 @@
 
 /// Type of fit to perform
-typedef enum {
-    PM_FIT_NONE,                        ///< No fit
-    PM_FIT_POLY_ORD,                    ///< Fit ordinary polynomial
-    PM_FIT_POLY_CHEBY,                  ///< Fit Chebyshev polynomial
-    PM_FIT_SPLINE                       ///< Fit cubic splines
+typedef enum
+{
+    PM_FIT_NONE,       ///< No fit
+    PM_FIT_POLY_ORD,   ///< Fit ordinary polynomial
+    PM_FIT_POLY_CHEBY, ///< Fit Chebyshev polynomial
+    PM_FIT_SPLINE      ///< Fit cubic splines
 } pmFit;
 
@@ -35,14 +36,14 @@
 {
     // Inputs
-    pmFit fitType;                      ///< Type of fit to overscan
-    unsigned int order;                 ///< Order of polynomial, or number of spline pieces
-    psStats *stat;                      ///< Statistic to use when reducing the minor direction
-    int boxcar;                         ///< Boxcar smoothing radius
-    float gauss;                        ///< Gaussian smoothing sigma
+    pmFit fitType;      ///< Type of fit to overscan
+    unsigned int order; ///< Order of polynomial, or number of spline pieces
+    psStats *stat;      ///< Statistic to use when reducing the minor direction
+    int boxcar;         ///< Boxcar smoothing radius
+    float gauss;        ///< Gaussian smoothing sigma
 
     // These are used to carry the fitted functions, but are only used to generate
-    // an updated reduced vector 
-    psPolynomial1D *poly;               ///< Result of polynomial fit
-    psSpline1D *spline;                 ///< Result of spline fit
+    // an updated reduced vector
+    psPolynomial1D *poly; ///< Result of polynomial fit
+    psSpline1D *spline;   ///< Result of spline fit
 } pmOverscanStatOptions;
 
@@ -57,11 +58,11 @@
 {
     // Inputs
-    bool single;                        ///< Reduce all overscan regions to a single value?
-    bool constant;			///< use a supplied constant value (do not measure region)
-    bool TwoD;  		      ///< use a supplied constant value (do not measure region)
-    float value;			///< supplied value if needed (per above)
-    float minValid;			///< if overscan is too low, readout is dead : mask
-    float maxValid;			///< if overscan is too high, readout is dead : mask
-    psImageMaskType maskVal;            ///< Mask value to give dead readouts
+    bool single;             ///< Reduce all overscan regions to a single value?
+    bool constant;           ///< use a supplied constant value (do not measure region)
+    bool TwoD;               ///< use a supplied constant value (do not measure region)
+    float value;             ///< supplied value if needed (per above)
+    float minValid;          ///< if overscan is too low, readout is dead : mask
+    float maxValid;          ///< if overscan is too high, readout is dead : mask
+    psImageMaskType maskVal; ///< Mask value to give dead readouts
 
     pmOverscanStatOptions *primary;
@@ -74,14 +75,14 @@
 pmOverscanStatOptions *pmOverscanStatOptionsAlloc(void);
 
-psVector *pmOverscanVector(float *chi2, // chi^2 from fit
-			   pmOverscanStatOptions *overscanOpts, // Overscan options
-			   const psArray *pixels // Array of vectors containing the pixel values
-    );
+psVector *pmOverscanVector(float *chi2,                         // chi^2 from fit
+                           pmOverscanStatOptions *overscanOpts, // Overscan options
+                           const psArray *pixels,               // Array of vectors containing the pixel values
+                           bool robust                          // use robust statistics for boxcar smoothing
+);
 
 // bool pmOverscanUpdateHeader (pmHDU *hdu, pmOverscanOptions *overscanOpts, float chi2);
 
-bool pmOverscanSubtract (pmReadout *input, pmOverscanOptions *overscanOpts, bool doTwoDOverscan);
+bool pmOverscanSubtract(pmReadout *input, pmOverscanOptions *overscanOpts, bool doTwoDOverscan);
 
 /// @}
 #endif
-
