- Timestamp:
- May 8, 2025, 4:10:23 PM (15 months ago)
- Location:
- branches/eam_branches/ipp-20230313
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
ppMerge/src/ppMergeLoop.c (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20230313
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-ppmerge-20241229 (added) merged: 42770-42778,42803-42805 /trunk merged: 42763-42764,42766-42769,42779-42782,42784-42796,42798-42802,42806-42813
- Property svn:mergeinfo changed
-
branches/eam_branches/ipp-20230313/ppMerge/src/ppMergeLoop.c
r39926 r42820 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))) { … … 291 281 psAssert (fileGroups->n > 0, "no valid file groups defined"); 292 282 fileGroup = fileGroups->data[0]; 283 293 284 if (!pmDarkCombinePrepare(outCell, fileGroup->readouts, darkOrdinates, darkNorm)) { 294 285 goto ERROR; … … 305 296 psAbort("Should never get here."); 306 297 } 298 fprintf (stderr, "after pmDarkCombinePrepare / pmReadoutCombinePrepare:\n"); 299 psMemStats(true, NULL, NULL); 307 300 308 301 // Read input data by chunks … … 349 342 psArrayAdd(job->args, 1, outCell); 350 343 psArrayAdd(job->args, 1, fileGroup); 351 psArrayAdd(job->args, 1, psScalarAlloc(iter, PS_TYPE_S32)); 352 psArrayAdd(job->args, 1, psScalarAlloc(rej, PS_TYPE_F32)); 353 psArrayAdd(job->args, 1, psScalarAlloc(maskVal, PS_TYPE_IMAGE_MASK)); 344 345 // need to free the allocated scalars: 346 { psScalar *tmpVal = psScalarAlloc(iter, PS_TYPE_S32); psArrayAdd(job->args, 1, tmpVal); psFree (tmpVal); } 347 { psScalar *tmpVal = psScalarAlloc(rej, PS_TYPE_F32); psArrayAdd(job->args, 1, tmpVal); psFree (tmpVal); } 348 { psScalar *tmpVal = psScalarAlloc(maskVal, PS_TYPE_IMAGE_MASK); psArrayAdd(job->args, 1, tmpVal); psFree (tmpVal); } 354 349 355 350 // call: pmDarkCombine(outCell, fileGroup->readouts, iter, rej, maskVal); 356 351 if (!psThreadJobAddPending(job)) { 357 // goto ERROR; 358 // continue; // I don't care. 352 // CZW commented this out with a note that this was needed to allow ppMerge to work even if some inputs are invalid. 353 // EAM thinks pmDarkCombine will only return FALSE if there is a programming or setup error (see pmDark.c:pmDarkCombine) 354 // if so, we should raise an error here. 355 // goto ERROR; 359 356 } 360 357 break; … … 398 395 399 396 psFree(fileGroups); 400 // psFree(zeros);401 397 402 398 // XXX eventually need to keep both the shutter and the pattern, as we do with dark … … 539 535 } 540 536 537 // free the data used by the input files (we need to do the work ourselves) 538 for (int i = 0; i < numFiles; i++) { 539 if (!ppMergeFileFreeInput(config, view, i)) { 540 psError(PS_ERR_UNKNOWN, false, "Unable to open file %d", i); 541 goto ERROR; 542 } 543 } 544 541 545 psFree(outRO); 542 546 cellNum++; … … 545 549 goto ERROR; 546 550 } 551 552 // pmFPAfileIOList (config); 547 553 } 548 554 … … 562 568 psFree(variances); 563 569 psFree(stats); 570 psFree(zeros); 564 571 return true; 565 572 … … 571 578 psFree(variances); 572 579 psFree(stats); 580 psFree(zeros); 573 581 return false; 574 582 }
Note:
See TracChangeset
for help on using the changeset viewer.
