- Timestamp:
- Dec 29, 2024, 4:02:56 PM (19 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-ppmerge-20241229/ppMerge/src/ppMergeLoop.c
r42764 r42776 39 39 bool haveVariances = psMetadataLookupBool(&mdok, arguments, "INPUTS.VARIANCES"); // Do we have variances? 40 40 41 psArray *inputs = ppMergeFileDataLevel(config, "PPMERGE.INPUT", PM_FPA_LEVEL_READOUT); // Input images 42 psArray *masks = NULL, *variances = NULL; // Input masks and variances 43 if (haveMasks) { 44 masks = ppMergeFileDataLevel(config, "PPMERGE.INPUT.MASK", PM_FPA_LEVEL_READOUT); 45 } 46 if (haveVariances) { 47 variances = ppMergeFileDataLevel(config, "PPMERGE.INPUT.VARIANCE", PM_FPA_LEVEL_READOUT); 48 } 41 psArray *inputs = ppMergeFileDataLevel(config, "PPMERGE.INPUT"); // Input images 42 psArray *masks = haveMasks ? ppMergeFileDataLevel(config, "PPMERGE.INPUT.MASK") : NULL; // Input masks 43 psArray *variances = haveVariances ? ppMergeFileDataLevel(config, "PPMERGE.INPUT.VARIANCE") : NULL; // Input variances 49 44 50 45 int nThreads = psMetadataLookupS32 (&mdok, arguments, "NTHREADS"); … … 135 130 psString darkNorm = psMetadataLookupStr(&mdok, arguments, "DARK.NORM"); ///< Dark normalisation 136 131 137 138 132 if (!ppMergeFileActivate(config, PPMERGE_FILES_ALL, true)) { 139 133 psError(PS_ERR_UNKNOWN, false, "Unable to activate files."); … … 152 146 } 153 147 154 155 148 // Average concepts across inputs 156 149 { … … 180 173 { 181 174 psList *inChips = psListAlloc(NULL); 182 for (int i =0; i < numFiles; i++) {175 for (int i = 0; i < numFiles; i++) { 183 176 pmChip *chip = pmFPAviewThisChip(view, ((pmFPAfile *)inputs->data[i])->fpa); 184 177 psListAdd(inChips, PS_LIST_TAIL, chip); … … 193 186 194 187 pmCell *outCell; ///< Cell of interest 195 196 // XXX TEST : force a single loop197 // outCell = pmFPAviewNextCell(view, outFPA, 1); {198 188 199 189 while ((outCell = pmFPAviewNextCell(view, outFPA, 1))) { … … 305 295 psAbort("Should never get here."); 306 296 } 297 // XXX EAM : for testing purposes 298 fprintf (stderr, "after pmDarkCombinePrepare / pmReadoutCombinePrepare:\n"); 299 psMemStats(true, NULL, NULL); 307 300 308 301 // Read input data by chunks … … 320 313 break; 321 314 } 315 316 322 317 323 318 // Start a job … … 357 352 // call: pmDarkCombine(outCell, fileGroup->readouts, iter, rej, maskVal); 358 353 if (!psThreadJobAddPending(job)) { 359 // goto ERROR; 360 // continue; // I don't care. 354 // CZW commented this out with a note that this was needed to allow ppMerge to work even if some inputs are invalid. 355 // EAM thinks pmDarkCombine will only return FALSE if there is a programming or setup error (see pmDark.c:pmDarkCombine) 356 // if so, we should raise an error here. 357 // goto ERROR; 361 358 } 362 359 break; … … 400 397 401 398 psFree(fileGroups); 402 // psFree(zeros);403 399 404 400 // XXX eventually need to keep both the shutter and the pattern, as we do with dark … … 541 537 } 542 538 539 // free the data used by the input files (we need to do the work ourselves) 540 for (int i = 0; i < numFiles; i++) { 541 if (!ppMergeFileFreeInput(config, view, i)) { 542 psError(PS_ERR_UNKNOWN, false, "Unable to open file %d", i); 543 goto ERROR; 544 } 545 } 546 543 547 psFree(outRO); 544 548 cellNum++; … … 547 551 goto ERROR; 548 552 } 553 554 pmFPAfileIOList (config); 549 555 } 550 556 … … 564 570 psFree(variances); 565 571 psFree(stats); 572 psFree(zeros); 566 573 return true; 567 574 … … 573 580 psFree(variances); 574 581 psFree(stats); 582 psFree(zeros); 575 583 return false; 576 584 }
Note:
See TracChangeset
for help on using the changeset viewer.
