IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 14787


Ignore:
Timestamp:
Sep 7, 2007, 11:00:34 AM (19 years ago)
Author:
eugene
Message:

convert to new psImageBackground API, add option to plot histograms of background cells

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branch_20070830/psphot/src/psphotImageMedian.c

    r14729 r14787  
    8080                                 PS_STAT_FITTED_MEAN |
    8181                                 PS_STAT_FITTED_MEAN_V2 |
    82                                  PS_STAT_FITTED_MEAN_V3))) {
     82                                 PS_STAT_FITTED_MEAN_V3 |
     83                                 PS_STAT_FITTED_MEAN_V4))) {
    8384        statsOptionLocation = PS_STAT_FITTED_MEAN;
    8485    }
     
    101102    } else if (statsOptionLocation & PS_STAT_FITTED_MEAN_V3) {
    102103        statsOptionWidth = PS_STAT_FITTED_STDEV_V3;
     104    } else if (statsOptionLocation & PS_STAT_FITTED_MEAN_V4) {
     105        statsOptionWidth = PS_STAT_FITTED_STDEV_V4;
    103106    } else {
    104107        psAbort("Unable to estimate variance of selected statsOptionLocations 0x%x", statsOptionLocation);
     
    196199            // XXX don't bother trying if there are no valid pixels...
    197200
    198             if (psImageBackground(stats, subset, submask, maskVal, rng)) {
     201            psVector *sample = NULL;
     202
     203            if (psImageBackground(stats, &sample, subset, submask, maskVal, rng)) {
    199204                if (stats->options & PS_STAT_ROBUST_QUARTILE) {
    200205                    modelData[iy][ix] = stats->robustMedian;
     
    203208                }
    204209                modelStdevData[iy][ix] = psStatsGetValue(stats, statsOptionWidth);
     210
     211                // supply sample to plotting routing
     212                psphotDiagnosticPlots (config, "IMAGE.BACKGROUND.CELL.HISTOGRAM", ix, iy, modelData[iy][ix], modelStdevData[iy][ix], sample);
     213                psFree (sample);
    205214            } else {
    206215                psStatsOptions currentOptions = stats->options;
    207216                stats->options = PS_STAT_ROBUST_MEDIAN | PS_STAT_ROBUST_STDEV;
    208                 if (!psImageBackground(stats, subset, submask, maskVal, rng)) {
     217                if (!psImageBackground(stats, &sample, subset, submask, maskVal, rng)) {
    209218                    psLogMsg ("psphot", PS_LOG_WARN, "Failed to estimate background using ROBUST_MEDIAN for "
    210219                               "(%dx%d, (row0,col0) = (%d,%d)",
     
    214223                    modelData[iy][ix] = psStatsGetValue (stats, PS_STAT_ROBUST_MEDIAN);
    215224                    modelStdevData[iy][ix] = psStatsGetValue(stats, PS_STAT_ROBUST_STDEV);
     225
     226                    // supply sample to plotting routing
     227                    psphotDiagnosticPlots (config, "IMAGE.BACKGROUND.CELL.HISTOGRAM", ix, iy, modelData[iy][ix], modelStdevData[iy][ix], sample);
     228                    psFree (sample);
    216229                }
    217230                // drop errors caused by psImageBackground failures
     
    224237            psFree (submask);
    225238        }
     239    }
     240
     241    if (psTraceGetLevel("psphot") > 5) {
     242        char name[256];
     243        sprintf (name, "backraw.%02d.fits", npass);
     244        psphotSaveImage (NULL, model->image, name);
    226245    }
    227246
Note: See TracChangeset for help on using the changeset viewer.