IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 4, 2022, 4:01:04 PM (4 years ago)
Author:
eugene
Message:

test code to measure and record the background level (robust median) for each cell

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20220316/ppImage/src/ppImageDetrendReadout.c

    r39501 r42158  
    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    if (1) {
     129        psStats *stats = psStatsAlloc (PS_STAT_ROBUST_MEDIAN);
     130        psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS);
     131        psImageBackground (stats, NULL, input->image, NULL, 0xffff, rng);
     132
     133        // save this value somewhere
     134        pmHDU *hdu = pmHDUFromReadout(input);  // HDU of interest
     135        psMetadataAddF32(hdu->header, PS_LIST_TAIL, "BACK_VAL", PS_META_REPLACE, "Median cell background", stats->robustMedian);
     136        psFree (stats);
     137        psFree (rng);
    115138    }
    116139
Note: See TracChangeset for help on using the changeset viewer.