Changeset 24951 for branches/czw_branch/cleanup/ppMerge/src/ppMergeLoop.c
- Timestamp:
- Jul 30, 2009, 5:20:29 PM (17 years ago)
- Location:
- branches/czw_branch/cleanup
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
ppMerge/src/ppMergeLoop.c (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/czw_branch/cleanup
- Property svn:mergeinfo changed
/trunk (added) merged: 24714-24742,24744-24784,24786-24798,24801-24824,24827-24834,24836-24859,24861-24901,24903-24912,24914-24939
- Property svn:mergeinfo changed
-
branches/czw_branch/cleanup/ppMerge/src/ppMergeLoop.c
r24118 r24951 65 65 int fringeSmoothX = psMetadataLookupS32(NULL, arguments, "FRINGE.XSMOOTH"); // Smoothing regions in x 66 66 int fringeSmoothY = psMetadataLookupS32(NULL, arguments, "FRINGE.YSMOOTH"); // Smoothing regions in y 67 bool fringeSmooth = psMetadataLookupBool(NULL, arguments, "FRINGE.SMOOTH"); // Smooth the output image? 68 float fringeSmoothSigma = psMetadataLookupF32(NULL, arguments, "FRINGE.SMOOTH.SIGMA"); // Smooth the output image? 67 69 68 70 // set the mask and mark bit values based on the named masks … … 94 96 psVector *scales = NULL, *zeros = NULL; ///< Scale and zeroes for combination 95 97 psArray *shutters = NULL; ///< Shutter correction data 98 psImage *zeroSet = NULL; 96 99 switch (type) { 97 100 case PPMERGE_TYPE_FRINGE: 98 zero s= psMetadataLookupPtr(NULL, arguments, "ZEROS");99 if (!zero s) {101 zeroSet = psMetadataLookupPtr(NULL, arguments, "ZEROS"); 102 if (!zeroSet) { 100 103 psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to find ZEROS"); 101 104 goto ERROR; 102 105 } 106 // the zeros vector is passed to pmReadoutCombine for each set of inputs per cell 107 zeros = psVectorAlloc(zeroSet->numRows, PS_TYPE_F32); 103 108 // Flow through 104 109 case PPMERGE_TYPE_FLAT: … … 140 145 pmFPA *outFPA = output->fpa; ///< Output FPA 141 146 pmHDU *lastHDU = NULL; // Last HDU that was updated 147 142 148 int cellNum = 0; ///< Index of cell 143 149 if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) { … … 146 152 pmChip *outChip; ///< Chip of interest 147 153 while ((outChip = pmFPAviewNextChip(view, outFPA, 1))) { 154 if (!outChip->process || !outChip->file_exists) { 155 continue; 156 } 148 157 if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) { 149 158 goto ERROR; … … 155 164 156 165 while ((outCell = pmFPAviewNextCell(view, outFPA, 1))) { 166 if (!outCell->process || !outCell->file_exists) { 167 continue; 168 } 157 169 if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) { 158 170 goto ERROR; … … 194 206 } 195 207 208 if (zeroSet) { 209 for (int i = 0; i < zeroSet->numRows; i++) { 210 zeros->data.F32[i] = zeroSet->data.F32[i][cellNum]; 211 } 212 } 213 214 int rows = psMetadataLookupS32(NULL, config->arguments, "ROWS"); // Number of rows to read per chunk 215 if (!rows && nThreads) { 216 psError(PS_ERR_UNKNOWN, false, "Invalid combination of threads > 0 and ROWS == 0 (ie, multiple threads working on the full array...)"); 217 goto ERROR; 218 } 219 196 220 ppMergeFileGroup *fileGroup = NULL; 197 221 psArray *fileGroups = psArrayAlloc(nThreads + 1); … … 203 227 pmFPAfile *input = pmFPAfileSelectSingle(config->files, "PPMERGE.INPUT", j); 204 228 pmCell *inCell = pmFPAviewThisCell(view, input->fpa); ///< Input cell 205 readouts->data[j] = pmReadoutAlloc(inCell); 229 pmReadout *readout = pmReadoutAlloc(inCell); 230 readout->process = true; // until proven otherwise, attempt to process this readout 231 readouts->data[j] = readout; 206 232 } 207 233 … … 335 361 336 362 psFree(fileGroups); 363 psFree(zeros); 337 364 338 365 // XXX eventually need to keep both the shutter and the pattern, as we do with dark … … 397 424 // Put the new readout into the cell after the existing readouts. 398 425 if (type == PPMERGE_TYPE_FRINGE && outRO) { 399 pmFringeRegions *regions = pmFringeRegionsAlloc(fringeNum, fringeSize, fringeSize, 400 fringeSmoothX, fringeSmoothY); 426 if (fringeSmooth) { 427 if (outRO->mask) { 428 psImage *smoothed = psImageSmoothMask (NULL, outRO->image, outRO->mask, maskVal, fringeSmoothSigma, 3, 0.2); 429 psFree (outRO->image); 430 outRO->image = smoothed; 431 } else { 432 psImageSmooth (outRO->image, fringeSmoothSigma, 3); 433 } 434 } 435 436 pmFringeRegions *regions = pmFringeRegionsAlloc(fringeNum, fringeSize, fringeSize, fringeSmoothX, fringeSmoothY); 401 437 pmFringeStats *fringe = pmFringeStatsMeasure(regions, outRO, maskVal); 402 438 psFree(regions); … … 410 446 fringes->data[0] = fringe; 411 447 412 pmFringesFormat(outCell, NULL, fringes); 448 // XXX replaced this : pmFringesFormat(outCell, NULL, fringes); 449 if (!psMetadataAdd(outCell->analysis, PS_LIST_TAIL, "FRINGE.MEASUREMENTS", PS_DATA_ARRAY, "Fringes", fringes)) { 450 psError(PS_ERR_UNKNOWN, false, "Unable to add fringe to analysis metadata\n"); 451 goto ERROR; 452 } 413 453 psFree(fringes); // Drop reference 414 454 }
Note:
See TracChangeset
for help on using the changeset viewer.
