Index: trunk/ppMerge/src/ppMergeScaleZero.c
===================================================================
--- trunk/ppMerge/src/ppMergeScaleZero.c	(revision 21183)
+++ trunk/ppMerge/src/ppMergeScaleZero.c	(revision 21244)
@@ -1,20 +1,34 @@
+/** @file ppMergeScaleZero.c
+ *
+ *  @brief
+ *
+ *  @ingroup ppMerge
+ *
+ *  @author IfA
+ *  @version $Revision: 1.29 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2009-02-01 21:43:05 $
+ *  Copyright 2009 Institute for Astronomy, University of Hawaii
+ */
+
 #include "ppMerge.h"
 
-// Get the scale and zero for each chip of each input
+/**
+ * Get the scale and zero for each chip of each input
+ */
 bool ppMergeScaleZero(pmConfig *config)
 {
     assert(config);
 
-    ppMergeType type = psMetadataLookupS32(NULL, config->arguments, "TYPE"); // Type of frame
-    int numInputs = psMetadataLookupS32(NULL, config->arguments, "INPUTS.NUM"); // Number of inputs
-    int numCells = psMetadataLookupS32(NULL, config->arguments, "INPUTS.CELLS"); // Number of cells
-    psStatsOptions meanStat = psMetadataLookupS32(NULL, config->arguments, "MEAN"); // Statistic for mean
-    psStatsOptions stdevStat = psMetadataLookupS32(NULL, config->arguments, "STDEV"); // Statistic for stdev
-    int shutterSize = psMetadataLookupS32(NULL, config->arguments, "SHUTTER.SIZE"); // Size of shutter region
-
-    psVector *gains = NULL;             // Gains for each cell
-    psArray *shutters = NULL;           // Shutter data for each cell
-    psStats *stats = NULL;              // Statistics for background
-    psImage *background = NULL;         // Background measurements per cell per file
+    ppMergeType type = psMetadataLookupS32(NULL, config->arguments, "TYPE"); ///< Type of frame
+    int numInputs = psMetadataLookupS32(NULL, config->arguments, "INPUTS.NUM"); ///< Number of inputs
+    int numCells = psMetadataLookupS32(NULL, config->arguments, "INPUTS.CELLS"); ///< Number of cells
+    psStatsOptions meanStat = psMetadataLookupS32(NULL, config->arguments, "MEAN"); ///< Statistic for mean
+    psStatsOptions stdevStat = psMetadataLookupS32(NULL, config->arguments, "STDEV"); ///< Statistic for stdev
+    int shutterSize = psMetadataLookupS32(NULL, config->arguments, "SHUTTER.SIZE"); ///< Size of shutter region
+
+    psVector *gains = NULL;             ///< Gains for each cell
+    psArray *shutters = NULL;           ///< Shutter data for each cell
+    psStats *stats = NULL;              ///< Statistics for background
+    psImage *background = NULL;         ///< Background measurements per cell per file
 
     switch (type) {
@@ -37,18 +51,18 @@
         break;
     }
-    psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS, 0); // Random number generator
-    pmFPAview *view = NULL;             // View into FPA
+    psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS, 0); ///< Random number generator
+    pmFPAview *view = NULL;             ///< View into FPA
 
     for (int i = 0; i < numInputs; i++) {
         pmFPAfileActivate(config->files, false, NULL);
-        psArray *files = ppMergeFileActivateSingle(config, PPMERGE_FILES_INPUT, true, i); // Activated files
-        pmFPAfile *input = files->data[0]; // Representative file; should be the image (not mask or weight)
-        pmFPA *fpa = input->fpa;        // FPA of interest
-        view = pmFPAviewAlloc(0);       // View to component of interest
-        int cellNum = 0;                // Index for cell
+        psArray *files = ppMergeFileActivateSingle(config, PPMERGE_FILES_INPUT, true, i); ///< Activated files
+        pmFPAfile *input = files->data[0]; ///< Representative file; should be the image (not mask or weight)
+        pmFPA *fpa = input->fpa;        ///< FPA of interest
+        view = pmFPAviewAlloc(0);       ///< View to component of interest
+        int cellNum = 0;                ///< Index for cell
         if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) {
             goto ERROR;
         }
-        pmChip *chip;                   // Chip of interest
+        pmChip *chip;                   ///< Chip of interest
         while ((chip = pmFPAviewNextChip(view, fpa, 1))) {
             if (!chip->file_exists) {
@@ -59,5 +73,5 @@
             }
 
-            pmCell *cell;               // Cell of interest
+            pmCell *cell;               ///< Cell of interest
             while ((cell = pmFPAviewNextCell(view, fpa, 1))) {
                 if (!cell->file_exists) {
@@ -78,7 +92,8 @@
                     goto ERROR;
                 }
-                pmReadout *readout = cell->readouts->data[0]; // Readout of interest
-
-                psImageMaskType maskVal = pmConfigMaskGet("MASK.VALUE", config); // Value to mask
+                pmReadout *readout = cell->readouts->data[0]; ///< Readout of interest
+
+                psImageMaskType maskVal = pmConfigMaskGet("MASK.VALUE", config); ///< Value to mask
+                psImageMaskType maskVal = pmConfigMaskGet("MASK.VALUE", config); 
 
                 switch (type) {
@@ -86,5 +101,5 @@
                   case PPMERGE_TYPE_FRINGE: {
                       // Extract the gain
-                      float gain = psMetadataLookupF32(NULL, cell->concepts, "CELL.GAIN"); // Cell gain
+                      float gain = psMetadataLookupF32(NULL, cell->concepts, "CELL.GAIN"); ///< Cell gain
                       if (!isfinite(gain)) {
                         // psError(PS_ERR_BAD_PARAMETER_VALUE, false,
@@ -110,5 +125,5 @@
                   }
                   case PPMERGE_TYPE_SHUTTER: {
-                      pmShutterCorrectionData *shutter = shutters->data[cellNum]; // Shutter correction data
+                      pmShutterCorrectionData *shutter = shutters->data[cellNum]; ///< Shutter correction data
                       if (!shutter) {
                           shutter = pmShutterCorrectionDataAlloc(readout->image->numCols,
@@ -174,5 +189,5 @@
               }
           }
-          psVector *fluxes = NULL;        // Solution to fluxes
+          psVector *fluxes = NULL;        ///< Solution to fluxes
           if (!pmFlatNormalize(&fluxes, &gains, background)) {
               psError(PS_ERR_UNKNOWN, false, "Normalisation failed to converge --- continuing anyway.");
