Index: /branches/czw_branch/20101203/ippScripts/scripts/stack_skycell.pl
===================================================================
--- /branches/czw_branch/20101203/ippScripts/scripts/stack_skycell.pl	(revision 30418)
+++ /branches/czw_branch/20101203/ippScripts/scripts/stack_skycell.pl	(revision 30419)
@@ -172,5 +172,9 @@
 my $photometry = metadataLookupBool($recipe, 'PHOTOMETRY'); # perform photometry?
 my $output_nocomp = metadataLookupBool($recipe, 'OUTPUT.NOCOMP'); # change filerules to produced uncompressed output images
-
+my $output_logflux = metadataLookupBool($recipe, 'OUTPUT.LOGFLUX'); # change filerules to produce logflux compressed output images.
+
+if ($output_nocomp and $output_logflux) {
+    &my_die("Unable to not compress and logflux compress simultaneously. Check config.",$stack_id, $PS_EXIT_CONFIG_ERROR);
+}
 
 # Generate MDC file with the inputs
@@ -252,4 +256,12 @@
         $command .= " -F PPSTACK.UNCONV.EXPWT PPSTACK.UNCONV.EXPWT.NOCOMP";
     }
+    if ($output_logflux) {
+	$command .= " -R PPSTACK.OUTPUT FITS.TYPE COMP_STACK "; # Just this one output component?
+	$command .= " -R PPSTACK.OUTPUT.VARIANCE FITS.TYPE COMP_STACK "; 
+	$command .= " -R PPSTACK.OUTPUT.EXPWT FITS.TYPE COMP_STACK ";
+	$command .= " -R PPSTACK.UNCONV FITS.TYPE COMP_STACK ";
+	$command .= " -R PPSTACK.UNCONV.VARIANCE FITS.TYPE COMP_STACK ";
+	$command .= " -R PPSTACK.UNCONV.EXPWT FITS.TYPE COMP_STACK ";
+    }
     $command .= " -threads $threads" if defined $threads;
     $command .= " -debug-stack" if defined $debug;
Index: /branches/czw_branch/20101203/ippconfig/gpc1/ppStack.config
===================================================================
--- /branches/czw_branch/20101203/ippconfig/gpc1/ppStack.config	(revision 30418)
+++ /branches/czw_branch/20101203/ippconfig/gpc1/ppStack.config	(revision 30419)
@@ -20,3 +20,19 @@
 PS1_REFERENCE METADATA
     OUTPUT.NOCOMP   BOOL    TRUE
+    OUTPUT.LOGFLUX  BOOL    FALSE
 END
+
+STACK_DEEP    METADATA
+    OUTPUT.NOCOMP   BOOL    TRUE
+    OUTPUT.LOGFLUX  BOOL    FALSE
+END
+
+STACK_NIGHTLY  METADATA
+    OUTPUT.NOCOMP   BOOL    FALSE
+    OUTPUT.LOGFLUX  BOOL    FALSE
+END
+
+STACK_THREEPI  METADATA
+    OUTPUT.NOCOMP   BOOL    FALSE
+    OUTPUT.LOGFLUX  BOOL    TRUE
+END
Index: /branches/czw_branch/20101203/ippconfig/recipes/ppStack.config
===================================================================
--- /branches/czw_branch/20101203/ippconfig/recipes/ppStack.config	(revision 30418)
+++ /branches/czw_branch/20101203/ippconfig/recipes/ppStack.config	(revision 30419)
@@ -112,2 +112,14 @@
         PHOTOMETRY          BOOL  FALSE           # Do basic photometry?
 END
+
+
+# 
+
+STACK_DEEP    METADATA
+END
+
+STACK_NIGHTLY  METADATA
+END
+
+STACK_THREEPI  METADATA
+END
Index: /branches/czw_branch/20101203/ippconfig/recipes/reductionClasses.mdc
===================================================================
--- /branches/czw_branch/20101203/ippconfig/recipes/reductionClasses.mdc	(revision 30418)
+++ /branches/czw_branch/20101203/ippconfig/recipes/reductionClasses.mdc	(revision 30419)
@@ -192,4 +192,26 @@
 	JPEG_BIN1	STR	PPIMAGE_J1
 	JPEG_BIN2	STR	PPIMAGE_J2
+END
+
+# reduction classes for different stacks
+# regular stacks
+NIGHTLY_STACK         METADATA
+      STACK_PPSTACK   STR      STACK_NIGHTLY
+      STACK_PPSUB     STR      STACK
+      STACK_PSPHOT    STR      STACK
+END
+
+# deep stacks
+DEEP_STACK            METADATA
+      STACK_PPSTACK   STR      STACK_DEEP
+      STACK_PPSUB     STR      STACK
+      STACK_PSPHOT    STR      STACK
+END
+
+# three pi stacks
+THREEPI_STACK         METADATA
+      STACK_PPSTACK   STR      STACK_THREEPI
+      STACK_PPSUB     STR      STACK
+      STACK_PSPHOT    STR      STACK
 END
 
Index: /branches/czw_branch/20101203/psLib/src/fits/psFits.h
===================================================================
--- /branches/czw_branch/20101203/psLib/src/fits/psFits.h	(revision 30418)
+++ /branches/czw_branch/20101203/psLib/src/fits/psFits.h	(revision 30419)
@@ -50,10 +50,10 @@
     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)
     PS_FITS_SCALE_LOG_RANGE,            ///< Take logarithm, Auto-scale to preserve dynamic range
     PS_FITS_SCALE_LOG_STDEV_POSITIVE,   ///< Take logarithm, Auto-scale to sample stdev, place mean at lower limit
     PS_FITS_SCALE_LOG_STDEV_NEGATIVE,   ///< Take logarithm, Auto-scale to sample stdev, place mean at upper limit
     PS_FITS_SCALE_LOG_STDEV_BOTH,       ///< Take logarithm, Auto-scale to sample stdev, place mean at middle
-
-    PS_FITS_SCALE_MANUAL                ///< Manual scaling (use specified BSCALE and BZERO)
+    PS_FITS_SCALE_LOG_MANUAL            ///< Manual scaling (use specified BSCALE, BZERO, and BOFFSET)
 } psFitsScaling;
 
@@ -71,4 +71,5 @@
     bool fuzz;                          ///< Fuzz the values when quantising floating-point values?
     double bscale, bzero;               ///< Manually specified BSCALE and BZERO (for SCALE_MANUAL)
+    double boffset;                     ///< Manually specified BOFFSET (for SCALE_MANUAL)
     double mean, stdev;                 ///< Mean and standard deviation of image
     int stdevBits;                      ///< Number of bits to sample a standard deviation (for SCALE_STDEV_*)
Index: /branches/czw_branch/20101203/psLib/src/fits/psFitsImage.c
===================================================================
--- /branches/czw_branch/20101203/psLib/src/fits/psFitsImage.c	(revision 30418)
+++ /branches/czw_branch/20101203/psLib/src/fits/psFitsImage.c	(revision 30419)
@@ -692,4 +692,5 @@
     // Remove any BOFFSET values that exist in the header if we are not using that scaling anymore
     if (options&&(!((options->scaling == PS_FITS_SCALE_LOG_RANGE)||
+		    (options->scaling == PS_FITS_SCALE_LOG_MANUAL)||
 		   (options->scaling == PS_FITS_SCALE_LOG_STDEV_POSITIVE)||
 		   (options->scaling == PS_FITS_SCALE_LOG_STDEV_NEGATIVE)||
@@ -718,4 +719,5 @@
                            "Scaling: TRUE = BZERO + BSCALE * DISK", &status);
 	if (options&&(((options->scaling == PS_FITS_SCALE_LOG_RANGE)||
+		       (options->scaling == PS_FITS_SCALE_LOG_MANUAL)||
 		       (options->scaling == PS_FITS_SCALE_LOG_STDEV_POSITIVE)||
 		       (options->scaling == PS_FITS_SCALE_LOG_STDEV_NEGATIVE)||
Index: /branches/czw_branch/20101203/psLib/src/fits/psFitsScale.c
===================================================================
--- /branches/czw_branch/20101203/psLib/src/fits/psFitsScale.c	(revision 30418)
+++ /branches/czw_branch/20101203/psLib/src/fits/psFitsScale.c	(revision 30419)
@@ -539,4 +539,9 @@
         *bzero = options->bzero;
         break;
+      case PS_FITS_SCALE_LOG_MANUAL:
+        *bscale = options->bscale;
+        *bzero = options->bzero;
+	*boffset = options->boffset;
+        break;
       default:
         psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Unrecognised FITS scaling method: %x",
@@ -616,4 +621,5 @@
 	      ps##INTYPE value; \
 	      if ((options->scaling == PS_FITS_SCALE_LOG_RANGE)||	\
+		(options->scaling == PS_FITS_SCALE_LOG_MANUAL)||        \
 		  (options->scaling == PS_FITS_SCALE_LOG_STDEV_POSITIVE)|| \
 		  (options->scaling == PS_FITS_SCALE_LOG_STDEV_NEGATIVE)|| \
@@ -756,4 +762,5 @@
     if (strcasecmp(string, "STDEV_BOTH") == 0)     return PS_FITS_SCALE_STDEV_BOTH;
     if (strcasecmp(string, "LOG_RANGE") == 0)      return PS_FITS_SCALE_LOG_RANGE;
+    if (strcasecmp(string, "LOG_MANUAL") == 0)      return PS_FITS_SCALE_LOG_MANUAL;
     if (strcasecmp(string, "LOG_STDEV_POSITIVE") == 0) return PS_FITS_SCALE_LOG_STDEV_POSITIVE;
     if (strcasecmp(string, "LOG_STDEV_NEGATIVE") == 0) return PS_FITS_SCALE_LOG_STDEV_NEGATIVE;
Index: /branches/czw_branch/20101203/psModules/src/camera/pmFPAfileDefine.c
===================================================================
--- /branches/czw_branch/20101203/psModules/src/camera/pmFPAfileDefine.c	(revision 30418)
+++ /branches/czw_branch/20101203/psModules/src/camera/pmFPAfileDefine.c	(revision 30419)
@@ -312,4 +312,9 @@
                 options->bzero = parseOptionDouble(scheme, "BZERO", source); // Zero point
                 break;
+	    case PS_FITS_SCALE_LOG_MANUAL:
+	      options->bscale = parseOptionDouble(scheme, "BSCALE", source); // Scaling
+	      options->bzero = parseOptionDouble(scheme, "BZERO", source); // Zero point
+	      options->boffset = parseOptionDouble(scheme, "BOFFSET", source); // Log offset
+	      break;	      
               default:
                 psAbort("Should never get here.");
