- Timestamp:
- Sep 6, 2021, 10:24:58 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-dev-20210817/ppImage/src/ppImageDetrendPattern.c
r41265 r41805 52 52 53 53 pmFPAfile *input = psMetadataLookupPtr(&status, config->files, "PPIMAGE.INPUT"); 54 54 55 pmFPAview *view = pmFPAviewAlloc(0); // View for local processing 55 56 *view = *inputView; … … 79 80 ESCAPE(false, "Unable to determine whether row pattern matching should be applied."); 80 81 } 81 //psWarning ("Row: %d\n", doPattern);82 82 if (!doPattern) continue; 83 83 84 // A very detailed log message. 85 const char *chipName = psMetadataLookupStr(NULL, chip->concepts, "CHIP.NAME"); 86 const char *cellName = psMetadataLookupStr(NULL, cell->concepts, "CELL.NAME"); 87 psLogMsg("ppImage", PS_LOG_INFO, "Performing row pattern correction for %s, %s\n", chipName, cellName); 88 89 // process each of the readouts 90 pmReadout *readout; // Readout from cell 91 while ((readout = pmFPAviewNextReadout (view, input->fpa, 1)) != NULL) { 92 if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) { 93 ESCAPE(false, "load failure for Readout"); 94 } 95 if (!readout->data_exists) { 96 continue; 97 } 98 99 // Perform pattern correction 100 if (!pmPatternRow(readout, options->patternRowOrder, options->patternRowIter, 101 options->patternRowRej, options->patternRowThresh, options->patternRowMean, 102 options->patternRowStdev, options->maskValue, options->darkMask)) { 103 psFree(view); 104 return(false); 105 } 106 } 107 108 } 84 // switch to test threaded version 85 if (true) { 86 // I need to allocate a view here to be freed by the 87 // called function below. 88 pmFPAview *myView = pmFPAviewAlloc(0); // View for local processing 89 *myView = *view; 90 91 // allocate a job, construct the arguments for this job 92 psThreadJob *job = psThreadJobAlloc("PPIMAGE_PATTERN_ROW_CELL"); 93 psArrayAdd(job->args, 1, config); 94 psArrayAdd(job->args, 1, input->fpa); 95 psArrayAdd(job->args, 1, chip); 96 psArrayAdd(job->args, 1, cell); 97 psArrayAdd(job->args, 1, myView); 98 psArrayAdd(job->args, 1, options); 99 if (!psThreadJobAddPending(job)) { 100 return false; 101 } 102 } else { 103 // bump the counter since it must be freed by the function below. 104 psMemIncrRefCounter (view); // View for local processing 105 if (!ppImageDetrendPatternApplyCell (config, input->fpa, chip, cell, view, options)) { 106 return false; 107 } 108 } 109 110 } 111 112 // wait here for the threaded jobs to finish 113 // if no threads are allocated, this 114 if (!psThreadPoolWait(true, true)) { 115 psError(PS_ERR_UNKNOWN, false, "Unable to apply bias correction."); 116 return false; 117 } 118 109 119 psMetadataAddBool(hdu->header, PS_LIST_TAIL, "PTRN_ROW",PS_META_REPLACE,"PATTERN.ROW correction applied",true); 110 120 psFree(view); … … 266 276 return false; 267 277 } 278 279 bool ppImageDetrendPatternApplyCell (pmConfig *config, pmFPA *fpa, pmChip *chip, pmCell *cell, const pmFPAview *view, const ppImageOptions *options) { 280 281 // A very detailed log message. 282 const char *chipName = psMetadataLookupStr(NULL, chip->concepts, "CHIP.NAME"); 283 const char *cellName = psMetadataLookupStr(NULL, cell->concepts, "CELL.NAME"); 284 psLogMsg("ppImage", PS_LOG_INFO, "Performing row pattern correction for %s, %s\n", chipName, cellName); 285 286 // process each of the readouts 287 pmReadout *readout; // Readout from cell 288 while ((readout = pmFPAviewNextReadout (view, fpa, 1)) != NULL) { 289 if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) { 290 ESCAPE(false, "load failure for Readout"); 291 } 292 if (!readout->data_exists) { 293 continue; 294 } 295 296 // Perform pattern correction 297 if (!pmPatternRow(readout, options->patternRowOrder, options->patternRowIter, 298 options->patternRowRej, options->patternRowThresh, options->patternRowMean, 299 options->patternRowStdev, options->maskValue, options->darkMask)) { 300 psFree (view); 301 return(false); 302 } 303 } 304 psFree (view); // supplied view must be freeable 305 }
Note:
See TracChangeset
for help on using the changeset viewer.
