Index: trunk/ppMerge/src/ppMergeLoop_Threaded.c
===================================================================
--- trunk/ppMerge/src/ppMergeLoop_Threaded.c	(revision 21183)
+++ trunk/ppMerge/src/ppMergeLoop_Threaded.c	(revision 21244)
@@ -1,2 +1,14 @@
+/** @file ppMergeLoop_Threaded.c
+ *
+ *  @brief
+ *
+ *  @ingroup ppMerge
+ *
+ *  @author IfA
+ *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2009-02-01 21:43:05 $
+ *  Copyright 2009 Institute for Astronomy, University of Hawaii
+ */
+
 #ifdef HAVE_CONFIG_H
 #include <config.h>
@@ -19,13 +31,13 @@
     assert(config);
 
-    psMetadata *arguments = config->arguments; // Arguments
-    ppMergeType type = psMetadataLookupS32(NULL, config->arguments, "TYPE"); // Type of frame
-    int numFiles = psMetadataLookupS32(NULL, arguments, "INPUTS.NUM"); // Number of input files
-    bool mdok;                          // Status of MD lookup
+    psMetadata *arguments = config->arguments; ///< Arguments
+    ppMergeType type = psMetadataLookupS32(NULL, config->arguments, "TYPE"); ///< Type of frame
+    int numFiles = psMetadataLookupS32(NULL, arguments, "INPUTS.NUM"); ///< Number of input files
+    bool mdok;                          ///< Status of MD lookup
     bool haveMasks = psMetadataLookupBool(&mdok, arguments, "INPUTS.MASKS"); // Do we have masks?
-    bool haveWeights = psMetadataLookupBool(&mdok, arguments, "INPUTS.WEIGHTS"); // Do we have weights?
-
-    psArray *inputs = ppMergeFileDataLevel(config, "PPMERGE.INPUT", PM_FPA_LEVEL_READOUT); // Input images
-    psArray *masks = NULL, *weights = NULL; // Input masks and weights
+    bool haveWeights = psMetadataLookupBool(&mdok, arguments, "INPUTS.WEIGHTS"); ///< Do we have weights?
+
+    psArray *inputs = ppMergeFileDataLevel(config, "PPMERGE.INPUT", PM_FPA_LEVEL_READOUT); ///< Input images
+    psArray *masks = NULL, *weights = NULL; ///< Input masks and weights
     if (haveMasks) {
         masks = ppMergeFileDataLevel(config, "PPMERGE.INPUT.MASK", PM_FPA_LEVEL_READOUT);
@@ -38,18 +50,18 @@
     if (!mdok) nThreads = 0;
 
-    // General combination parameters
-    int iter = psMetadataLookupS32(NULL, arguments, "ITER"); // Number of rejection iterations
-    float rej = psMetadataLookupF32(NULL, arguments, "REJ"); // Rejection level
-    float fraclow = psMetadataLookupF32(NULL, arguments, "FRACLOW"); // Reject fraction of low pixels
-    float frachigh = psMetadataLookupF32(NULL, arguments, "FRACHIGH"); // Reject fraction of hi pixels
-    int nKeep = psMetadataLookupS32(NULL, arguments, "NKEEP"); // Minimum number of values to keep
-    psStatsOptions combineStat = psMetadataLookupS32(NULL, arguments, "COMBINE"); // Combination statistic
-    bool useWeights = psMetadataLookupBool(NULL, arguments, "WEIGHTS"); // Use weights?
-
-    // Fringe parameters
-    int fringeNum = psMetadataLookupS32(NULL, arguments, "FRINGE.NUM"); // Number of fringe points
-    int fringeSize = psMetadataLookupS32(NULL, arguments, "FRINGE.SIZE"); // Size of fringe regions
-    int fringeSmoothX = psMetadataLookupS32(NULL, arguments, "FRINGE.XSMOOTH"); // Smoothing regions in x
-    int fringeSmoothY = psMetadataLookupS32(NULL, arguments, "FRINGE.YSMOOTH"); // Smoothing regions in y
+    /** General combination parameters */
+    int iter = psMetadataLookupS32(NULL, arguments, "ITER"); ///< Number of rejection iterations
+    float rej = psMetadataLookupF32(NULL, arguments, "REJ"); ///< Rejection level
+    float fraclow = psMetadataLookupF32(NULL, arguments, "FRACLOW"); ///< Reject fraction of low pixels
+    float frachigh = psMetadataLookupF32(NULL, arguments, "FRACHIGH"); ///< Reject fraction of hi pixels
+    int nKeep = psMetadataLookupS32(NULL, arguments, "NKEEP"); ///< Minimum number of values to keep
+    psStatsOptions combineStat = psMetadataLookupS32(NULL, arguments, "COMBINE"); ///< Combination statistic
+    bool useWeights = psMetadataLookupBool(NULL, arguments, "WEIGHTS"); ///< Use weights?
+
+    /** Fringe parameters */
+    int fringeNum = psMetadataLookupS32(NULL, arguments, "FRINGE.NUM"); ///< Number of fringe points
+    int fringeSize = psMetadataLookupS32(NULL, arguments, "FRINGE.SIZE"); ///< Size of fringe regions
+    int fringeSmoothX = psMetadataLookupS32(NULL, arguments, "FRINGE.XSMOOTH"); ///< Smoothing regions in x
+    int fringeSmoothY = psMetadataLookupS32(NULL, arguments, "FRINGE.YSMOOTH"); ///< Smoothing regions in y
 
     // set the mask and mark bit values based on the named masks
@@ -61,5 +73,5 @@
     }
 
-    pmCombineParams *combination = pmCombineParamsAlloc(combineStat); // Combination parameters
+    pmCombineParams *combination = pmCombineParamsAlloc(combineStat); ///< Combination parameters
     combination->maskVal = maskVal;
     combination->blank = pmConfigMaskGet("BLANK", config);
@@ -71,5 +83,5 @@
     combination->weights = useWeights;
 
-    psMetadata *stats = NULL;           // Statistics for output
+    psMetadata *stats = NULL;           ///< Statistics for output
     if (psMetadataLookup(config->arguments, "STATS.NAME")) {
         stats = psMetadataAlloc();
@@ -80,6 +92,6 @@
 
     // Retrieve data placed on analysis
-    psVector *scales = NULL, *zeros = NULL; // Scale and zeroes for combination
-    psArray *shutters = NULL;           // Shutter correction data
+    psVector *scales = NULL, *zeros = NULL; ///< Scale and zeroes for combination
+    psArray *shutters = NULL;           ///< Shutter correction data
     switch (type) {
       case PPMERGE_TYPE_FRINGE:
@@ -113,6 +125,6 @@
 
     // Dark parameters
-    psArray *darkOrdinates = psMetadataLookupPtr(NULL, arguments, "DARK.ORDINATES"); // Dark info
-    psString darkNorm = psMetadataLookupStr(&mdok, arguments, "DARK.NORM"); // Dark normalisation
+    psArray *darkOrdinates = psMetadataLookupPtr(NULL, arguments, "DARK.ORDINATES"); ///< Dark info
+    psString darkNorm = psMetadataLookupStr(&mdok, arguments, "DARK.NORM"); ///< Dark normalisation
 
 
@@ -121,19 +133,19 @@
         goto ERROR;
     }
-    psString outName = ppMergeOutputFile(config); // Name of output file
-    pmFPAfile *output = psMetadataLookupPtr(NULL, config->files, outName); // Output file
+    psString outName = ppMergeOutputFile(config); ///< Name of output file
+    pmFPAfile *output = psMetadataLookupPtr(NULL, config->files, outName); ///< Output file
     psFree(outName);
     assert(output && output->fpa);
-    pmFPA *outFPA = output->fpa;        // Output FPA
-    int cellNum = 0;                    // Index of cell
+    pmFPA *outFPA = output->fpa;        ///< Output FPA
+    int cellNum = 0;                    ///< Index of cell
     if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) {
         goto ERROR;
     }
-    pmChip *outChip;                    // Chip of interest
+    pmChip *outChip;                    ///< Chip of interest
     while ((outChip = pmFPAviewNextChip(view, outFPA, 1))) {
         if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) {
             goto ERROR;
         }
-        pmCell *outCell;                // Cell of interest
+        pmCell *outCell;                ///< Cell of interest
         while ((outCell = pmFPAviewNextCell(view, outFPA, 1))) {
             if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) {
@@ -141,5 +153,5 @@
             }
 
-            pmHDU *hdu = pmHDUGetLowest(outFPA, outChip, outCell); // HDU for cell
+            pmHDU *hdu = pmHDUGetLowest(outFPA, outChip, outCell); ///< HDU for cell
             if (!hdu || hdu->blankPHU) {
                 // No data here
@@ -147,5 +159,5 @@
             }
 
-            float shutterRef = NAN;     // Reference shutter correction
+            float shutterRef = NAN;     ///< Reference shutter correction
             pmReadout *pattern = NULL;
             if (type == PPMERGE_TYPE_SHUTTER) {
@@ -169,8 +181,8 @@
             // Generate readouts for each input file in each file group
             for (int i = 0; i < fileGroups->n; i++) {
-                psArray *readouts = psArrayAlloc(numFiles); // Input readouts
+                psArray *readouts = psArrayAlloc(numFiles); ///< Input readouts
                 for (int j = 0; j < numFiles; j++) {
                     pmFPAfile *input = pmFPAfileSelectSingle(config->files, "PPMERGE.INPUT", j);
-                    pmCell *inCell = pmFPAviewThisCell(view, input->fpa); // Input cell
+                    pmCell *inCell = pmFPAviewThisCell(view, input->fpa); ///< Input cell
                     readouts->data[j] = pmReadoutAlloc(inCell);
                 }
@@ -234,5 +246,5 @@
                   case PPMERGE_TYPE_FLAT:
                   case PPMERGE_TYPE_FRINGE: {
-                      psThreadJob *job = psThreadJobAlloc("PPMERGE_READOUT_COMBINE"); // Job to start
+                      psThreadJob *job = psThreadJobAlloc("PPMERGE_READOUT_COMBINE"); ///< Job to start
 
                       // Construct the arguments for this job
@@ -250,5 +262,5 @@
                   }
                   case PPMERGE_TYPE_DARK: {
-                      psThreadJob *job = psThreadJobAlloc ("PPMERGE_DARK_COMBINE"); // Job to start
+                      psThreadJob *job = psThreadJobAlloc ("PPMERGE_DARK_COMBINE"); ///< Job to start
 
                       // construct the arguments for this job
@@ -311,5 +323,5 @@
             for (int i = 0; i < numFiles; i++) {
                 pmFPAfile *input = pmFPAfileSelectSingle(config->files, "PPMERGE.INPUT", i);
-                pmCell *inCell = pmFPAviewThisCell(view, input->fpa); // Input cell
+                pmCell *inCell = pmFPAviewThisCell(view, input->fpa); ///< Input cell
                 psListAdd(inCells, PS_LIST_TAIL, inCell);
             }
@@ -325,5 +337,5 @@
             {
                 pmCell *countsCell = pmFPAfileThisCell(config->files, view, "PPMERGE.OUTPUT.COUNT");
-                pmReadout *countsRO = pmReadoutAlloc(countsCell); // Readout with count of inputs per pixel
+                pmReadout *countsRO = pmReadoutAlloc(countsCell); ///< Readout with count of inputs per pixel
                 psImage *counts = psMetadataLookupPtr(NULL, outRO->analysis, PM_READOUT_STACK_ANALYSIS_COUNT);
                 countsRO->image = psImageCopy(countsRO->image, counts, PS_TYPE_F32);
@@ -341,5 +353,5 @@
 
                 pmCell *sigmaCell = pmFPAfileThisCell(config->files, view, "PPMERGE.OUTPUT.SIGMA");
-                pmReadout *sigmaRO = pmReadoutAlloc(sigmaCell); // Readout with stdev per pixel
+                pmReadout *sigmaRO = pmReadoutAlloc(sigmaCell); ///< Readout with stdev per pixel
                 psImage *sigma = psMetadataLookupPtr(NULL, outRO->analysis, PM_READOUT_STACK_ANALYSIS_SIGMA);
                 sigmaRO->image = psImageCopy(sigmaRO->image, sigma, PS_TYPE_F32);
@@ -375,5 +387,5 @@
                 }
 
-                psArray *fringes = psArrayAlloc(1); // Array of fringes
+                psArray *fringes = psArrayAlloc(1); ///< Array of fringes
                 fringes->data[0] = fringe;
 
@@ -414,7 +426,7 @@
 
     // Get list of FPAs for concepts averaging
-    psList *inFPAs = psListAlloc(NULL); // List of FPAs
+    psList *inFPAs = psListAlloc(NULL); ///< List of FPAs
     for (int i = 0; i < numFiles; i++) {
-        pmFPAfile *input = inputs->data[i]; // Input file
+        pmFPAfile *input = inputs->data[i]; ///< Input file
         psListAdd(inFPAs, PS_LIST_TAIL, input->fpa);
     }
