IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 17157


Ignore:
Timestamp:
Mar 27, 2008, 2:59:07 PM (18 years ago)
Author:
Paul Price
Message:

Adding count and sigma files as outputs.

Location:
branches/pap_branch_080320/ppMerge/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/pap_branch_080320/ppMerge/src/ppMergeArguments.c

    r17083 r17157  
    244244    // Shutter construction parameters
    245245    VALUE_ARG_RECIPE_INT("-shutter-size",  "SHUTTER.SIZE", S32, 0);
    246     VALUE_ARG_RECIPE_INT("-shutter-iter",  "SHUTTER.ITER", S32, 0);
    247     VALUE_ARG_RECIPE_FLOAT("-shutter-rej", "SHUTTER.REJECT", F32);
    248246
    249247    // Mask construction parameters
  • branches/pap_branch_080320/ppMerge/src/ppMergeCamera.c

    r17090 r17157  
    55#include <stdio.h>
    66#include <string.h>
     7#include <assert.h>
    78#include <pslib.h>
    89#include <psmodules.h>
     
    1011#include "ppMerge.h"
    1112
     13// Define an output file, with its own FPA
     14bool outputFile(pmConfig *config,       // Configuration
     15                const char *name,       // Name of output file
     16                pmFPAfileType type,     // Type of file
     17                const char *description, // Description of file
     18                psMetadata *format,     // Camera format
     19                pmFPAview *view         // View for PHU
     20    )
     21{
     22    assert(config);
     23    assert(name && strlen(name) > 0);
     24    assert(view);
     25
     26    // Output image
     27    pmFPA *fpa = pmFPAConstruct(config->camera); // FPA to contain the output
     28    if (!fpa) {
     29        psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to construct an FPA from camera configuration.");
     30        return false;
     31    }
     32
     33    pmFPAfile *output = pmFPAfileDefineOutput(config, fpa, name);
     34    psFree(fpa);                        // Drop reference
     35    if (!output) {
     36        psError(PS_ERR_IO, false, "Unable to generate output file from %s", name);
     37        return false;
     38    }
     39    if (output->type != type) {
     40        psError(PS_ERR_IO, true, "%s is not of type %s", name, pmFPAfileStringFromType(type));
     41        return false;
     42    }
     43    output->save = true;
     44
     45    if (!pmFPAAddSourceFromView(fpa, description, view, format)) {
     46        psError(PS_ERR_UNKNOWN, false, "Unable to generate output FPA.");
     47        return false;
     48    }
     49
     50    return true;
     51}
    1252
    1353
     
    191231                    psFree(cell->concepts);
    192232                    cell->concepts = NULL;
     233                    cell->data_exists = false;
     234                    cell->file_exists = false;
    193235                    culled++;
    194236                }
     
    197239                psFree(chip->concepts);
    198240                chip->concepts = NULL;
     241                chip->data_exists = false;
     242                chip->file_exists = false;
    199243            }
    200244        }
     
    256300    }
    257301
    258     pmFPAfile *output = pmFPAfileDefineOutput(config, fpa, outName);
    259     psFree(fpa);                        // Drop reference
    260     if (!output) {
    261         psError(PS_ERR_IO, false, _("Unable to generate output file from %s"), outName);
     302    if (!outputFile(config, outName, fileType, "Merged detrend", format, phuView)) {
    262303        psFree(outName);
    263         return false;
    264     }
    265     if (output->type != fileType) {
    266         psError(PS_ERR_IO, true, "%s is not of type %s", outName, pmFPAfileStringFromType(fileType));
    267         psFree(outName);
    268         return false;
    269     }
    270     output->save = true;
     304        psFree(phuView);
     305        return false;
     306    }
    271307    psFree(outName);
    272308
    273     if (!pmFPAAddSourceFromView(fpa, "Merged detrend", phuView, format)) {
    274         psError(PS_ERR_UNKNOWN, false, "Unable to generate output FPA.");
    275         psFree(fpa);
    276         return false;
    277     }
     309    if (!outputFile(config, "PPMERGE.OUTPUT.SIGMA", fileType, "Merge sigma", format, phuView)) {
     310        psFree(phuView);
     311        return false;
     312    }
     313
     314    if (!outputFile(config, "PPMERGE.OUTPUT.COUNT", fileType, "Merged count", format, phuView)) {
     315        psFree(phuView);
     316        return false;
     317    }
     318
    278319    psFree(phuView);
    279320
  • branches/pap_branch_080320/ppMerge/src/ppMergeFiles.c

    r17083 r17157  
    1111
    1212const char *allFiles[] = { "PPMERGE.INPUT", "PPMERGE.INPUT.MASK", "PPMERGE.INPUT.WEIGHT",
    13                            "PPMERGE.OUTPUT", NULL };      // All files
     13                           "PPMERGE.OUTPUT", "PPMERGE.OUTPUT.COUNT", "PPMERGE.OUTPUT.SIGMA",
     14                           NULL };      // All files
    1415const char *inputFiles[] = { "PPMERGE.INPUT", "PPMERGE.INPUT.MASK", "PPMERGE.INPUT.WEIGHT",
    1516                             NULL };    // Input files
    16 const char *outputFiles[] = { "PPMERGE.OUTPUT", NULL };   // Output files
     17const char *outputFiles[] = { "PPMERGE.OUTPUT", "PPMERGE.OUTPUT.COUNT", "PPMERGE.OUTPUT.SIGMA",
     18                              NULL };   // Output files
    1719
    1820// Select file list based on enum
  • branches/pap_branch_080320/ppMerge/src/ppMergeLoop.c

    r17083 r17157  
    4949    int fringeSmoothY = psMetadataLookupS32(NULL, arguments, "FRINGE.YSMOOTH"); // Smoothing regions in y
    5050
    51     // Shutter parameters
    52     int shutterIter = psMetadataLookupS32(NULL, arguments, "SHUTTER.ITER"); // Number of shutter iterations
    53     float shutterRej = psMetadataLookupF32(NULL, arguments, "SHUTTER.REJ"); // Rejection limit for shutter
    54 
    5551    pmCombineParams *combination = pmCombineParamsAlloc(combineStat); // Combination parameters
    5652    combination->maskVal = maskVal;
     
    152148            }
    153149
    154             if (type == PPMERGE_TYPE_MASK) {
    155                 psAbort("Can't do masks yet.");
    156 #if 0
    157                 ppMergeMask(readouts, config);
    158 #endif
    159             } else {
    160                 float shutterRef = NAN;     // Reference shutter correction
    161                 if (type == PPMERGE_TYPE_SHUTTER) {
    162                     shutterRef = pmShutterCorrectionReference(shutters->data[cellNum]);
    163                 }
    164 
    165                 // Read convolutions by chunks
    166                 bool more = true;               // More to read?
    167                 for (int numChunk = 0; more; numChunk++) {
    168                     psTrace("ppStack", 2, "Initial stack of chunk %d....\n", numChunk);
    169                     for (int i = 0; i < numFiles; i++) {
    170                         pmReadout *inRO = readouts->data[i]; // Input readout
    171 
    172                         // Read a chunk from a file
    173                         #define READ_CHUNK(NAME,TYPE) { \
    174                             pmFPAfile *file = pmFPAfileSelectSingle(config->files, NAME, i); \
    175                             if (!pmReadoutReadChunk##TYPE(inRO, file->fits, 0, rows, 0)) { \
    176                                 psError(PS_ERR_IO, false, "Unable to read chunk %d for file %s %d", \
    177                                         numChunk, NAME, i); \
    178                                 psFree(readouts); \
    179                                 psFree(outRO); \
    180                                 psFree(view); \
    181                                 return false; \
    182                             } \
    183                         }
    184 
    185                         READ_CHUNK("PPMERGE.INPUT", /* Blank */);
    186                         if (haveMasks) {
    187                             READ_CHUNK("PPMERGE.INPUT.MASK", Mask);
    188                         }
    189                         if (haveWeights) {
    190                             READ_CHUNK("PPMERGE.INPUT.WEIGHT", Weight);
    191                         }
    192                     }
    193 
    194                     switch (type) {
    195                       case PPMERGE_TYPE_SHUTTER:
    196                         pmShutterCorrectionGenerate(outRO, NULL, readouts, shutterRef,
    197                                                     shutters->data[cellNum], shutterIter, shutterRej,
    198                                                     maskVal);
    199                         break;
    200                       case PPMERGE_TYPE_DARK:
    201                         pmDarkCombine(outCell, readouts, darkOrdinates, darkNorm, iter, rej, maskVal);
    202                         break;
    203                       case PPMERGE_TYPE_BIAS:
    204                       case PPMERGE_TYPE_FLAT:
    205                       case PPMERGE_TYPE_FRINGE:
    206                         pmReadoutCombine(outRO, readouts, zeros, scales, combination);
    207                         break;
    208                       default:
    209                         psAbort("Should never get here.");
    210                     }
    211 
    212 
    213                     for (int i = 0; i < numFiles && more; i++) {
    214                         pmReadout *inRO = readouts->data[i];
    215 
    216                         // Check to see if there's more chunks to read
    217                         #define MORE_CHUNK(NAME,TYPE) { \
    218                             pmFPAfile *file = pmFPAfileSelectSingle(config->files, NAME, i); \
    219                             more &= pmReadoutMore##TYPE(inRO, file->fits, 0, rows); \
    220                         }
    221 
    222                         MORE_CHUNK("PPMERGE.INPUT", /* Blank */);
    223                         if (haveMasks) {
    224                             MORE_CHUNK("PPMERGE.INPUT.MASK", Mask);
    225                         }
    226                         if (haveWeights) {
    227                             MORE_CHUNK("PPMERGE.INPUT.WEIGHT", Weight);
    228                         }
     150            float shutterRef = NAN;     // Reference shutter correction
     151            if (type == PPMERGE_TYPE_SHUTTER) {
     152                shutterRef = pmShutterCorrectionReference(shutters->data[cellNum]);
     153            }
     154
     155            // Read convolutions by chunks
     156            bool more = true;               // More to read?
     157            for (int numChunk = 0; more; numChunk++) {
     158                psTrace("ppStack", 2, "Initial stack of chunk %d....\n", numChunk);
     159                for (int i = 0; i < numFiles; i++) {
     160                    pmReadout *inRO = readouts->data[i]; // Input readout
     161
     162                    // Read a chunk from a file
     163                    #define READ_CHUNK(NAME,TYPE) { \
     164                        pmFPAfile *file = pmFPAfileSelectSingle(config->files, NAME, i); \
     165                        if (!pmReadoutReadChunk##TYPE(inRO, file->fits, 0, rows, 0)) { \
     166                            psError(PS_ERR_IO, false, "Unable to read chunk %d for file %s %d", \
     167                                    numChunk, NAME, i); \
     168                            psFree(readouts); \
     169                            psFree(outRO); \
     170                            psFree(view); \
     171                            return false; \
     172                        } \
     173                    }
     174
     175                    READ_CHUNK("PPMERGE.INPUT", /* Blank */);
     176                    if (haveMasks) {
     177                        READ_CHUNK("PPMERGE.INPUT.MASK", Mask);
     178                    }
     179                    if (haveWeights) {
     180                        READ_CHUNK("PPMERGE.INPUT.WEIGHT", Weight);
     181                    }
     182                }
     183
     184                switch (type) {
     185                  case PPMERGE_TYPE_SHUTTER:
     186                    pmShutterCorrectionGenerate(outRO, NULL, readouts, shutterRef,
     187                                                shutters->data[cellNum], iter, rej,
     188                                                maskVal);
     189                    break;
     190                  case PPMERGE_TYPE_DARK:
     191                    pmDarkCombine(outCell, readouts, darkOrdinates, darkNorm, iter, rej, maskVal);
     192                    break;
     193                  case PPMERGE_TYPE_BIAS:
     194                  case PPMERGE_TYPE_FLAT:
     195                  case PPMERGE_TYPE_FRINGE:
     196                    pmReadoutCombine(outRO, readouts, zeros, scales, combination);
     197                    break;
     198                  default:
     199                    psAbort("Should never get here.");
     200                }
     201
     202
     203                for (int i = 0; i < numFiles && more; i++) {
     204                    pmReadout *inRO = readouts->data[i];
     205
     206                    // Check to see if there's more chunks to read
     207                    #define MORE_CHUNK(NAME,TYPE) { \
     208                        pmFPAfile *file = pmFPAfileSelectSingle(config->files, NAME, i); \
     209                        more &= pmReadoutMore##TYPE(inRO, file->fits, 0, rows); \
     210                    }
     211
     212                    MORE_CHUNK("PPMERGE.INPUT", /* Blank */);
     213                    if (haveMasks) {
     214                        MORE_CHUNK("PPMERGE.INPUT.MASK", Mask);
     215                    }
     216                    if (haveWeights) {
     217                        MORE_CHUNK("PPMERGE.INPUT.WEIGHT", Weight);
    229218                    }
    230219                }
    231220            }
    232221            psFree(readouts);
     222
     223            // Plug supplementary images into their own FPAs
     224            {
     225                pmCell *countsCell = pmFPAfileThisCell(config->files, view, "PPMERGE.OUTPUT.COUNT");
     226                pmReadout *countsRO = pmReadoutAlloc(countsCell); // Readout with count of inputs per pixel
     227                psImage *counts = psMetadataLookupPtr(NULL, outRO->analysis, PM_READOUT_STACK_ANALYSIS_COUNT);
     228                countsRO->image = psImageCopy(countsRO->image, counts, PS_TYPE_F32);
     229                psMetadataRemoveKey(outRO->analysis, PM_READOUT_STACK_ANALYSIS_COUNT);
     230                countsRO->data_exists = countsCell->data_exists = countsCell->parent->data_exists = true;
     231                psFree(countsRO);
     232
     233                pmCell *sigmaCell = pmFPAfileThisCell(config->files, view, "PPMERGE.OUTPUT.SIGMA");
     234                pmReadout *sigmaRO = pmReadoutAlloc(sigmaCell); // Readout with stdev per pixel
     235                psImage *sigma = psMetadataLookupPtr(NULL, outRO->analysis, PM_READOUT_STACK_ANALYSIS_SIGMA);
     236                sigmaRO->image = psImageCopy(sigmaRO->image, sigma, PS_TYPE_F32);
     237                psMetadataRemoveKey(outRO->analysis, PM_READOUT_STACK_ANALYSIS_SIGMA);
     238                sigmaRO->data_exists = sigmaCell->data_exists = sigmaCell->parent->data_exists = true;
     239                psFree(sigmaRO);
     240            }
    233241
    234242            // Measure the fringes for this cell
  • branches/pap_branch_080320/ppMerge/src/ppMergeMask.c

    r17083 r17157  
    4444
    4545    // For each input file, get the statistics, which can be calculated at the chip or cell levels
    46     psArray *suspects = psArrayAlloc(outChip->cells->n); // Images with suspected pixels
    4746    psVector *values = psVectorAlloc(sample, PS_TYPE_F32); // Pixel values for statistics
    4847    pmFPAview *inView = pmFPAviewAlloc(0); // View for input
     
    10099            }
    101100
    102             psImage *outMask = NULL;    // Output mask image (for iterative generation of mask)
    103101            pmCell *outCell = pmFPAfileThisCell(config->files, inView, "PPMERGE.OUTPUT.MASK"); // Output cell
     102            pmReadout *outRO = NULL;    // Output readout
    104103            if (outCell->readouts && outCell->readouts->n == 1) {
    105                 pmReadout *outRO = outCell->readouts->data[0]; // Output readout
    106                 if (outRO) {
    107                     outMask = outRO->mask;
    108                 }
    109             }
     104                outRO = psMemIncrRefCounter(outCell->readouts->data[0]);
     105            } else {
     106                outRO = pmReadoutAlloc(outCell);
     107            }
     108            psImage *outMask = outRO->mask;    // Output mask image (for iterative generation of mask)
    110109
    111110            psImage *image = readout->image, *mask = readout->mask; // Image and mask
     
    139138                }
    140139
    141                 psMetadataAddF32(readout->analysis, PS_LIST_TAIL, PM_MASK_ANALYSIS_MEAN, PS_META_REPLACE,
    142                                  "Mean value of readout", psStatsGetValue(statistics, meanStat));
    143                 psMetadataAddF32(readout->analysis, PS_LIST_TAIL, PM_MASK_ANALYSIS_STDEV, PS_META_REPLACE,
    144                                  "Stdev value of readout", psStatsGetValue(statistics, stdevStat));
    145                 suspects->data[inView->cell] = pmMaskFlagSuspectPixels(suspects->data[inView->cell],
    146                                                                        readout, maskSuspect, maskVal);
     140                if (!pmMaskFlagSuspectPixels(outRO, readout, psStatsGetValue(statistics, meanStat),
     141                                             psStatsGetValue(statistics, stdevStat), maskSuspect, maskVal)) {
     142                    psError(PS_ERR_UNKNOWN, false, "Unable to find suspect values in file %d", i);
     143                    psFree(inView);
     144                    psFree(readout);
     145                    goto MERGE_MASK_ERROR;
     146                }
    147147                pmCellFreeData(inCell);
    148148
     
    154154            }
    155155            psFree(readout);
     156            psFree(outRO);
    156157        }
    157158
     
    172173                pmReadout *readout = inCell->readouts->data[0]; // Readout of interest
    173174
    174                 psMetadataAddF32(readout->analysis, PS_LIST_TAIL, PM_MASK_ANALYSIS_MEAN, PS_META_REPLACE,
    175                                  "Mean value of chip", psStatsGetValue(statistics, meanStat));
    176                 psMetadataAddF32(readout->analysis, PS_LIST_TAIL, PM_MASK_ANALYSIS_STDEV, PS_META_REPLACE,
    177                                  "Stdev value of chip", psStatsGetValue(statistics, stdevStat));
    178                 suspects->data[inView->cell] = pmMaskFlagSuspectPixels(suspects->data[inView->cell],
    179                                                                        readout, maskSuspect, maskVal);
     175                inView->readout = 0;
     176                pmReadout *outRO = pmFPAfileThisReadout(config->files, inView, "PPMERGE.OUTPUT.MASK");
     177
     178                if (!pmMaskFlagSuspectPixels(outRO, readout, psStatsGetValue(statistics, meanStat),
     179                                             psStatsGetValue(statistics, stdevStat), maskSuspect, maskVal)) {
     180                    psError(PS_ERR_UNKNOWN, false, "Unable to find suspect values in file %d", i);
     181                    goto MERGE_MASK_ERROR;
     182                }
    180183                pmCellFreeData(inCell);
    181184
     
    210213        psTrace("ppMerge", 1, "Getting bad pixels for chip %d cell %d", outView->chip, outView->cell);
    211214
    212         pmReadout *outRO = NULL;    // Output readout
    213         if (outCell->readouts && outCell->readouts->n == 1) {
    214             outRO = psMemIncrRefCounter(outCell->readouts->data[0]);
    215         } else {
    216             outRO = pmReadoutAlloc(outCell);
    217         }
    218 
    219         psImage *mask = pmMaskIdentifyBadPixels(suspects->data[outView->cell], maskVal, numFiles, maskBad,
    220                                                 maskMode);
    221         psFree(suspects->data[outView->cell]);
    222         suspects->data[outView->cell] = NULL;
     215        assert(outCell->readouts && outCell->readouts->n == 1);
     216        pmReadout *outRO = outCell->readouts->data[0]; // Output readout
     217        if (!pmMaskIdentifyBadPixels(outRO, maskVal, maskBad, maskMode)) {
     218            psError(PS_ERR_UNKNOWN, false, "Unable to mask bad pixels");
     219            goto MERGE_MASK_ERROR;
     220        }
     221
     222        // Supplementary outputs
     223        {
     224            // The counts image is fairly useless, but it preserves the model
     225            pmCell *countsCell = pmFPAfileThisCell(config->files, view, "PPMERGE.OUTPUT.COUNT");
     226            pmReadout *countsRO = pmReadoutAlloc(countsCell); // Readout with count of inputs per pixel
     227            countsRO->image = psImageAlloc(outRO->image->numCols, outRO->image->numRows, PS_TYPE_F32);
     228            psImageInit(countsRO->image, numFiles);
     229            countsRO->data_exists = countsCell->data_exists = countsCell->parent->data_exists = true;
     230            psFree(countsRO);
     231
     232            pmCell *sigmaCell = pmFPAfileThisCell(config->files, view, "PPMERGE.OUTPUT.SIGMA");
     233            pmReadout *sigmaRO = pmReadoutAlloc(sigmaCell); // Readout with suspect image
     234            psImage *suspect = psMetadataLookupPtr(NULL, outRO->analysis, PM_MASK_ANALYSIS_SUSPECT);
     235            sigmaRO->image = psImageCopy(sigmaRO->image, suspect, PS_TYPE_F32);
     236            psMetadataRemoveKey(outRO->analysis, PM_MASK_ANALYSIS_SUSPECT);
     237            sigmaRO->data_exists = sigmaCell->data_exists = sigmaCell->parent->data_exists = true;
     238            psFree(sigmaRO);
     239        }
     240
    223241        if (maskGrowVal > 0) {
    224             outRO->mask = psImageGrowMask(outRO->mask, mask, maskVal, maskGrow, maskGrowVal);
    225             psFree(mask);
    226         } else {
     242            psImage *grown = psImageGrowMask(NULL, outRO->mask, maskVal, maskGrow, maskGrowVal); // Grown mask
    227243            psFree(outRO->mask);
    228             outRO->mask = mask;
     244            outRO->mask = grown;
    229245        }
    230246
     
    278294    ppMergeFileActivate(config, PPMERGE_FILES_ALL, true);
    279295
    280     psFree(suspects);
    281296    return true;
    282297
    283298
    284299MERGE_MASK_ERROR:
    285     psFree(suspects);
    286300    psFree(statistics);
    287301    psFree(values);
  • branches/pap_branch_080320/ppMerge/src/ppMergeScaleZero.c

    r17140 r17157  
    2323    psMaskType maskVal = psMetadataLookupU8(NULL, config->arguments, "MASKVAL"); // Value to mask
    2424    int shutterSize = psMetadataLookupS32(NULL, config->arguments, "SHUTTER.SIZE"); // Size of shutter region
    25     int sample = psMetadataLookupS32(NULL, config->arguments, "SAMPLE"); // Maximum size of sample
    26     bool chipStats = false;             // Do statistics on full chip instead of cell?
    2725
    2826    psVector *gains = NULL;             // Gains for each cell
     
    4745        break;
    4846      case PPMERGE_TYPE_MASK:
    49         stats = psStatsAlloc(meanStat | stdevStat);
    5047      default:
    5148        break;
     
    5350    psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS, 0); // Random number generator
    5451    pmFPAview *view = NULL;             // View into FPA
    55 
    56     psVector *values = psVectorAlloc(sample, PS_TYPE_F32); // Values for statistics
    5752
    5853    for (int i = 0; i < numInputs; i++) {
     
    7469                goto ERROR;
    7570            }
    76 
    77             int valueIndex = 0;         // Index into values vector
    7871
    7972            pmCell *cell;               // Cell of interest
     
    138131                      break;
    139132                  }
    140                   case PPMERGE_TYPE_MASK: {
    141                       psImage *image = readout->image, *mask = readout->mask; // Image and mask
    142                       int numCols = readout->image->numCols, numRows = readout->image->numRows; // Image size
    143                       int numPix = numCols * numRows; // Number of pixels
    144                       int numCells = chipStats ? readout->parent->parent->cells->n : 1; // Number of cells
    145                       int num = PS_MIN(numPix, sample / numCells); // Number of values to add
    146                       if (!chipStats) {
    147                           valueIndex = 0;
    148                       }
    149                       for (int i = 0; i < num; i++) {
    150                           int pixel = numPix * psRandomUniform(rng);
    151                           int x = pixel % numCols;
    152                           int y = pixel / numCols;
    153                           if ((mask && (mask->data.PS_TYPE_MASK_DATA[y][x] & maskVal)) ||
    154                               !isfinite(image->data.F32[y][x])) {
    155                               continue;
    156                           }
    157 
    158                           values->data.F32[valueIndex++] = image->data.F32[y][x];
    159                       }
    160 
    161                       if (!chipStats) {
    162                           if (!psVectorStats(stats, values, NULL, NULL, 0)) {
    163                               psError(PS_ERR_UNKNOWN, false, "Unable to do statistics on readout.");
    164                               goto ERROR;
    165                           }
    166 
    167                           psMetadataAddF32(cell->analysis, PS_LIST_TAIL, PM_MASK_ANALYSIS_MEAN, 0,
    168                                            "Mean value of readout", psStatsGetValue(stats, meanStat));
    169                           psMetadataAddF32(cell->analysis, PS_LIST_TAIL, PM_MASK_ANALYSIS_STDEV, 0,
    170                                            "Stdev value of readout", psStatsGetValue(stats, stdevStat));
    171                       }
    172                       break;
    173                   }
     133                  case PPMERGE_TYPE_MASK:
    174134                  default:
    175135                    psAbort("Should never get here.");
     
    178138                cellNum++;
    179139
    180                 if ((type != PPMERGE_TYPE_MASK || !chipStats) &&
    181                     !pmFPAfileIOChecks(config, view, PM_FPA_AFTER)) {
     140                if (!pmFPAfileIOChecks(config, view, PM_FPA_AFTER)) {
    182141                    goto ERROR;
    183                 }
    184             }
    185 
    186             // Additional run through cells if we want chip-level statistics for masks
    187             if (type == PPMERGE_TYPE_MASK && chipStats) {
    188                 if (!psVectorStats(stats, values, NULL, NULL, 0)) {
    189                     psError(PS_ERR_UNKNOWN, false, "Unable to do statistics on chip.");
    190                     goto ERROR;
    191                 }
    192                 while ((cell = pmFPAviewNextCell(view, fpa, 1))) {
    193                     if (!cell->data_exists) {
    194                         continue;
    195                     }
    196                     psMetadataAddF32(cell->analysis, PS_LIST_TAIL, PM_MASK_ANALYSIS_MEAN, 0,
    197                                      "Mean value of chip", psStatsGetValue(stats, meanStat));
    198                     psMetadataAddF32(cell->analysis, PS_LIST_TAIL, PM_MASK_ANALYSIS_STDEV, 0,
    199                                      "Stdev value of chip", psStatsGetValue(stats, stdevStat));
    200                     if (!pmFPAfileIOChecks(config, view, PM_FPA_AFTER)) {
    201                         goto ERROR;
    202                     }
    203142                }
    204143            }
     
    256195                           "Shutter data", shutters);
    257196        break;
     197      case PPMERGE_TYPE_MASK:
    258198      default:
    259199        psAbort("Should never get here.");
Note: See TracChangeset for help on using the changeset viewer.