IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 8, 2023, 11:57:40 AM (3 years ago)
Author:
eugene
Message:

merge from eam_branches/ipp-20220316. add code for PatternDeadCells, fix organization of DetrendPattern, handle psphotModelBackground failure

Location:
trunk/ppImage
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppImage

  • trunk/ppImage/src/ppImageDetrendReadout.c

    r42340 r42382  
    6363    // psLogMsg ("ppImage", 6, "check video: %f sec\n", psTimerMark ("detrend.readout"));
    6464
     65    // XXX for GPC2, there are some bizzare cell levels that need to be filtered out
     66    // Here I measure the median background before overscan subtraction, but an alternative
     67    // is to use the overscan-subtracted image.
     68    // XX if (0) {
     69    // XX       psStats *stats = psStatsAlloc (PS_STAT_ROBUST_MEDIAN);
     70    // XX       psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS);
     71    // XX       psImageBackground (stats, NULL, input->image, NULL, 0xffff, rng);
     72    // XX       readoutBackground = stats->robustMedian;
     73    // XX }
     74
    6575    // Masking on the basis of pixel value needs to be done before anything else, so the values are pristine.
    6676    if (options->doMaskBuild) {
     
    113123      }
    114124      // psLogMsg ("ppImage", 6, "subtract overscan: %f sec\n", psTimerMark ("detrend.readout"));
     125    }
     126
     127    // measure the overscan-subtracted readoutBackground here (or subtract the overscan value?)
     128    // XXX this is the measurements and should be independent of the pattern masking
     129    if (options->doPatternDeadCells) {
     130        psStats *stats = psStatsAlloc (PS_STAT_ROBUST_MEDIAN | PS_STAT_ROBUST_STDEV);
     131        psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS);
     132        psImageBackground (stats, NULL, input->image, NULL, 0xffff, rng);
     133
     134        // save this value somewhere
     135        pmHDU *hdu = pmHDUFromReadout(input);  // HDU of interest
     136        psMetadataAddF32(hdu->header, PS_LIST_TAIL, "BACK_VAL", PS_META_REPLACE, "Median cell background", stats->robustMedian);
     137        psMetadataAddF32(hdu->header, PS_LIST_TAIL, "BACK_ERR", PS_META_REPLACE, "Stdev of cell background", stats->robustStdev);
     138        psFree (stats);
     139        psFree (rng);
    115140    }
    116141
Note: See TracChangeset for help on using the changeset viewer.