Index: trunk/Ohana/src/opihi/cmd.data/threshold.c
===================================================================
--- trunk/Ohana/src/opihi/cmd.data/threshold.c	(revision 42277)
+++ trunk/Ohana/src/opihi/cmd.data/threshold.c	(revision 42389)
@@ -3,9 +3,10 @@
 int QUIET = FALSE;
 
-void _threshold_set_values (double value, int Nbin, double level) {
+void _threshold_set_values (double value, int Nbin, double level, int thresherr) {
 
   set_variable ("threshval", value);
   set_int_variable ("threshbin", Nbin);
   set_variable ("threshold", level);
+  set_int_variable ("thresherr", thresherr);
 
   if (!QUIET) gprint (GP_LOG, "theshold %f (bin %d is %f)\n", level, Nbin, value);
@@ -117,9 +118,9 @@
     if (vecy[0].elements.Flt[BinMin] > value) {
       if (SATURATE) {
-	_threshold_set_values (vecy[0].elements.Flt[BinMin], BinMin, vecx[0].elements.Flt[BinMin]);
+	_threshold_set_values (vecy[0].elements.Flt[BinMin], BinMin, vecx[0].elements.Flt[BinMin], 1);
 	return TRUE;
       } else {
 	gprint (GP_ERR, "ERROR: all values above threshold\n");
-	_threshold_set_values (NAN, -1, NAN);
+	_threshold_set_values (NAN, -1, NAN, 1);
 	return FALSE;
       }
@@ -127,9 +128,9 @@
     if (vecy[0].elements.Flt[BinMax] < value) {
       if (SATURATE) {
-	_threshold_set_values (vecy[0].elements.Flt[BinMax], BinMax, vecx[0].elements.Flt[BinMax]);
+	_threshold_set_values (vecy[0].elements.Flt[BinMax], BinMax, vecx[0].elements.Flt[BinMax], 1);
 	return TRUE;
       } else {
 	gprint (GP_ERR, "ERROR: all values below threshold\n");
-	_threshold_set_values (NAN, -1, NAN);
+	_threshold_set_values (NAN, -1, NAN, 1);
 	return FALSE;
       }
@@ -156,9 +157,9 @@
     if (vecy[0].elements.Flt[BinMin] < value) {
       if (SATURATE) {
-	_threshold_set_values (vecy[0].elements.Flt[BinMin], BinMin, vecx[0].elements.Flt[BinMin]);
+	_threshold_set_values (vecy[0].elements.Flt[BinMin], BinMin, vecx[0].elements.Flt[BinMin], 1);
 	return TRUE;
       } else {
 	gprint (GP_ERR, "ERROR: all values below threshold\n");
-	_threshold_set_values (NAN, -1, NAN);
+	_threshold_set_values (NAN, -1, NAN, 1);
 	return FALSE;
       }
@@ -166,9 +167,9 @@
     if (vecy[0].elements.Flt[BinMax] > value) {
       if (SATURATE) {
-	_threshold_set_values (vecy[0].elements.Flt[BinMax], BinMax, vecx[0].elements.Flt[BinMax]);
+	_threshold_set_values (vecy[0].elements.Flt[BinMax], BinMax, vecx[0].elements.Flt[BinMax], 1);
 	return TRUE;
       } else {
 	gprint (GP_ERR, "ERROR: all values above threshold\n");
-	_threshold_set_values (NAN, -1, NAN);
+	_threshold_set_values (NAN, -1, NAN, 1);
 	return FALSE;
       }
@@ -219,5 +220,5 @@
   }
 
-  _threshold_set_values (y1, Nhi, Xvalue);
+  _threshold_set_values (y1, Nhi, Xvalue, 0);
   return (TRUE);
 }
