Index: /branches/pap_branch_080117/psLib/src/fits/psFits.c
===================================================================
--- /branches/pap_branch_080117/psLib/src/fits/psFits.c	(revision 16130)
+++ /branches/pap_branch_080117/psLib/src/fits/psFits.c	(revision 16131)
@@ -7,6 +7,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.76.2.1 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2008-01-18 01:04:21 $
+ *  @version $Revision: 1.76.2.2 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2008-01-18 03:37:50 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -174,5 +174,5 @@
     fits->mean = NAN;
     fits->stdev = NAN;
-    fits->stdevBits = 8;
+    fits->stdevBits = 4;
     fits->stdevNum = 5.0;
 
Index: /branches/pap_branch_080117/psLib/src/fits/psFits.h
===================================================================
--- /branches/pap_branch_080117/psLib/src/fits/psFits.h	(revision 16130)
+++ /branches/pap_branch_080117/psLib/src/fits/psFits.h	(revision 16131)
@@ -4,6 +4,6 @@
  * @author Robert DeSonia, MHPCC
  *
- * @version $Revision: 1.35.2.1 $ $Name: not supported by cvs2svn $
- * @date $Date: 2008-01-18 01:04:21 $
+ * @version $Revision: 1.35.2.2 $ $Name: not supported by cvs2svn $
+ * @date $Date: 2008-01-18 03:37:50 $
  * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
  */
@@ -47,7 +47,7 @@
     PS_FITS_SCALE_NONE,                 ///< No auto-scaling to be applied (BSCALE = 1, BZERO = 0)
     PS_FITS_SCALE_RANGE,                ///< Auto-scale to preserve dynamic range
-    PS_FITS_SCALE_STDEV_LOWER,          ///< Auto-scale to sample stdev, place mean at lower limit
-    PS_FITS_SCALE_STDEV_UPPER,          ///< Auto-scale to sample stdev, place mean at upper limit
-    PS_FITS_SCALE_STDEV_MIDDLE,         ///< Auto-scale to sample stdev, place mean at middle
+    PS_FITS_SCALE_STDEV_POSITIVE,       ///< Auto-scale to sample stdev, place mean at lower limit
+    PS_FITS_SCALE_STDEV_NEGATIVE,       ///< Auto-scale to sample stdev, place mean at upper limit
+    PS_FITS_SCALE_STDEV_BOTH,           ///< Auto-scale to sample stdev, place mean at middle
     PS_FITS_SCALE_MANUAL                ///< Manual scaling (use specified BSCALE and BZERO)
 } psFitsScaling;
Index: /branches/pap_branch_080117/psLib/src/fits/psFitsScale.c
===================================================================
--- /branches/pap_branch_080117/psLib/src/fits/psFitsScale.c	(revision 16130)
+++ /branches/pap_branch_080117/psLib/src/fits/psFitsScale.c	(revision 16131)
@@ -113,5 +113,5 @@
 
     long range = 1 << fits->stdevBits;  // Range of values to carry standard deviation
-    *bscale = fits->stdev / (double) range;
+    *bscale = stdev / (double) range;
 
     int bitpix = fits->bitpix;          // Bits per pixel
@@ -119,15 +119,15 @@
     long diskVal;                       // Corresponding value on disk
     switch (fits->scaling) {
-      case PS_FITS_SCALE_STDEV_LOWER:
+      case PS_FITS_SCALE_STDEV_POSITIVE:
         // Put (mean - N sigma) at the lowest possible value: predominantly positive images
         imageVal = mean - fits->stdevNum * stdev;
         diskVal = - (1 << (bitpix - 1));
         break;
-      case PS_FITS_SCALE_STDEV_UPPER:
+      case PS_FITS_SCALE_STDEV_NEGATIVE:
         // Put (mean + N sigma) at the highest possible value: predominantly negative images
         imageVal = mean + fits->stdevNum * stdev;
         diskVal = (1 << (bitpix - 1)) - 1;
         break;
-      case PS_FITS_SCALE_STDEV_MIDDLE:
+      case PS_FITS_SCALE_STDEV_BOTH:
         // Put mean right in the middle: images with an equal abundance of positive and negative values
         imageVal = mean;
@@ -165,7 +165,7 @@
     // If we don't have a RNG, we will allocate one
 
-    if (fits->scaling != PS_FITS_SCALE_STDEV_LOWER &&
-        fits->scaling != PS_FITS_SCALE_STDEV_UPPER &&
-        fits->scaling != PS_FITS_SCALE_STDEV_MIDDLE) {
+    if (fits->scaling != PS_FITS_SCALE_STDEV_POSITIVE &&
+        fits->scaling != PS_FITS_SCALE_STDEV_NEGATIVE &&
+        fits->scaling != PS_FITS_SCALE_STDEV_BOTH) {
         // No need to do anything
         return true;
@@ -238,7 +238,7 @@
         }
         break;
-      case PS_FITS_SCALE_STDEV_LOWER:
-      case PS_FITS_SCALE_STDEV_UPPER:
-      case PS_FITS_SCALE_STDEV_MIDDLE:
+      case PS_FITS_SCALE_STDEV_POSITIVE:
+      case PS_FITS_SCALE_STDEV_NEGATIVE:
+      case PS_FITS_SCALE_STDEV_BOTH:
         if (!scaleStdev(bscale, bzero, image, fits)) {
             psError(PS_ERR_UNKNOWN, false, "Unable to set BSCALE and BZERO from stdev");
