Changeset 41838 for branches/eam_branches/ipp-dev-20210817
- Timestamp:
- Oct 12, 2021, 7:09:14 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-dev-20210817/psModules/src/detrend/pmPattern.c
r41817 r41838 164 164 psImageMaskType maskVal, psImageMaskType maskBad) { 165 165 166 //bool status = pmPatternRowBinned(ro, order, iter, rej, thresh, clipMean, clipStdev, maskVal, maskBad);167 bool status = pmPatternRowUnbinned(ro, order, iter, rej, thresh, clipMean, clipStdev, maskVal, maskBad);166 bool status = pmPatternRowBinned(ro, order, iter, rej, thresh, clipMean, clipStdev, maskVal, maskBad); 167 // bool status = pmPatternRowUnbinned(ro, order, iter, rej, thresh, clipMean, clipStdev, maskVal, maskBad); 168 168 return status; 169 169 } … … 480 480 psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS); // Random number generator 481 481 if (!psImageBackground(stats, NULL, ro->image, ro->mask, maskVal, rng)) { 482 psWarning("Unable to calculate statistics on readout; masking entire readout.");482 psWarning("Unable to calculate statistics on readout; skipping pattern correction."); 483 483 psErrorClear(); 484 484 psFree(stats); 485 485 psFree(rng); 486 psImageInit(image, NAN); 487 if (mask) { 488 psBinaryOp(mask, mask, "|", psScalarAlloc(maskBad, PS_TYPE_IMAGE_MASK)); 489 } 490 if (ro->variance) { 491 psImageInit(image, NAN); 492 } 486 487 // EAM 20211011 : we used to mask cells which fail the above, but this seems excessive 488 // psImageInit(image, NAN); 489 // if (mask) { 490 // psBinaryOp(mask, mask, "|", psScalarAlloc(maskBad, PS_TYPE_IMAGE_MASK)); 491 // } 492 // if (ro->variance) { 493 // psImageInit(image, NAN); 494 // } 493 495 return true; 494 496 } … … 520 522 // so smaller by a factor of 1.4 than what we predict, which is not very large 521 523 522 # define READNOISE 10 524 // retrieve noise and gain from 'concepts' if possible 525 # define READNOISE 10 /* arbitrary number */ 523 526 float sigma = sqrt(stats->robustMedian + PS_SQR(READNOISE)); 524 float delta = PS_MIN (thresh * sigma, 40); 527 float delta = PS_MIN (thresh * sigma, 40); // XXX EAM : arbitrary number 525 528 float lower = stats->robustMedian - delta; // Lower bound for data 526 529 float upper = stats->robustMedian + delta; // Upper bound for data 527 530 float background = stats->robustMedian; 528 # endif 531 532 // find the nominal signal amplitude (check the ghost and/or crosstalk recipe file) 533 float nominalAmplitude = 20; // XXX EAM : arbitrary number 534 535 // if the noise from the background is too large 536 float significance = nominalAmplitude / sigma; 537 if (significance < 0.5) return true; // XXX EAM : arbitrary number 529 538 530 539 pmCell *cell = ro->parent; 531 540 const char *cellName = psMetadataLookupStr(NULL, cell->concepts, "CELL.NAME"); // Name of cell 532 fprintf (stderr, "pattern row background %s: %f - %f - %f\n", cellName,lower, background, upper); 533 534 535 // XXX add code to skip fit if background stdev is large compared to expected signal 536 // XXX add a constraint to the fit so the |amplitude| < x (x ~ 20 - 25) 541 fprintf (stderr, "pattern row background %s: %f - %f - %f\n", cellName, lower, background, upper); 542 # endif 537 543 538 544 psFree(stats); … … 637 643 if (num < validNmin) { 638 644 // Not enough points to fit 639 patternMaskRow(ro, y, maskBad); 645 // EAM 20211011 : we used to mask rows which could not be fit, but this is excessive. just skip. 646 // patternMaskRow(ro, y, maskBad); 640 647 // Ignore this row in our subsequent fits, because the fit failed. 641 648 yaxisMask->data.PS_TYPE_VECTOR_MASK_DATA[y] = 0xFF; … … 646 653 psWarning("Unable to fit polynomial to row %d", y); 647 654 psErrorClear(); 648 patternMaskRow(ro, y, maskBad); 655 // EAM 20211011 : we used to mask rows which could not be fit, but this is excessive. just skip. 656 // patternMaskRow(ro, y, maskBad); 649 657 // Ignore this row in our subsequent fits, because the fit failed. 650 658 yaxisMask->data.PS_TYPE_VECTOR_MASK_DATA[y] = 0xFF; … … 661 669 psWarning("Unable to evaluate polynomial for row %d", y); 662 670 psErrorClear(); 663 patternMaskRow(ro, y, maskBad); 671 // EAM 20211011 : we used to mask rows which could not be fit, but this is excessive. just skip. 672 // patternMaskRow(ro, y, maskBad); 664 673 yaxisMask->data.PS_TYPE_VECTOR_MASK_DATA[y] = 0xFF; 665 674 continue;
Note:
See TracChangeset
for help on using the changeset viewer.
