IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 23406


Ignore:
Timestamp:
Mar 18, 2009, 3:51:09 PM (17 years ago)
Author:
eugene
Message:

re-work CTE map I/O: replace values in input image rather than creating esoteric output file

Location:
branches/eam_branches/eam_branch_20090312/ppImage/src
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/eam_branch_20090312/ppImage/src/ppImageCheckCTE.c

    r23320 r23406  
    55#include "ppImage.h"
    66
     7// XXX I originally coded this to create a new pmFPAfile, but in retrospect it makes more sense
     8// to treat this function as an operation on the input image
     9
     10// XXX make the choice of stats optional
    711bool ppImageCheckCTE(pmConfig *config, ppImageOptions *options, pmFPAview *view)
    812{
     
    3438    psImageBinningSetSkip(binning, image);
    3539
    36     pmCell *inCell  = pmFPAfileThisCell (config->files, view, "PPIMAGE.INPUT");
    37     pmCell *outCell = pmFPAfileThisCell (config->files, view, "PPIMAGE.CTEMAP");
    38     if (!pmCellCopyStructure(outCell, inCell, binning->nXbin, binning->nYbin)) {
    39         psError(PS_ERR_UNKNOWN, false, "Unable to copy cell structure.");
    40         return false;
    41     }
     40    psStats *stats = psStatsAlloc (PS_STAT_ROBUST_MEDIAN);
     41    psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS);
     42    psImageBackground (stats, NULL, image, mask, 0xffff, rng);
     43    float cellMedian = stats->robustMedian;
     44    psFree (stats);
    4245
    43     pmReadout *outRO = pmFPAfileThisReadout(config->files, view, "PPIMAGE.CTEMAP");
    44     psImage *output = outRO->image;
     46    // stats = psStatsAlloc (PS_STAT_SAMPLE_STDEV);
     47    // psStats *statsDefaults = psStatsAlloc (PS_STAT_SAMPLE_STDEV);
    4548
    46     // Don't care about the bias: get rid of it, if present
    47     psFree(outRO->bias);
    48     outRO->bias = psListAlloc(NULL);
    49     psMetadataItem *biassec = psMetadataLookup(outCell->concepts, "CELL.BIASSEC");
    50     psFree(biassec->data.V);
    51     biassec->data.V = psListAlloc(NULL);
    52 
    53     psStats *stats = psStatsAlloc (PS_STAT_SAMPLE_MEDIAN | PS_STAT_SAMPLE_STDEV);
    54     psStats *statsDefaults = psStatsAlloc (PS_STAT_SAMPLE_MEDIAN | PS_STAT_SAMPLE_STDEV);
     49    stats = psStatsAlloc (PS_STAT_ROBUST_STDEV);
     50    psStats *statsDefaults = psStatsAlloc (PS_STAT_ROBUST_STDEV);
    5551
    5652    // measure median and variance for subimages
    5753    psRegion ruffRegion = {0,0,0,0};
    5854    psRegion fineRegion = {0,0,0,0};
    59     for (int iy = 0; iy < output->numRows; iy++) {
    60         for (int ix = 0; ix < output->numCols; ix++) {
     55    for (int iy = 0; iy < binning->nYruff; iy++) {
     56        for (int ix = 0; ix < binning->nXruff; ix++) {
    6157
    6258            // convert the ruff grid cell to the equivalent fine grid cell
     
    8480            statsDefaults->tmpData = NULL;
    8581
    86             psImageStats (stats, subset, submask, 0);
     82            psImageStats (stats, subset, submask, 0xffff);
    8783
    88             // XXX need to apply the gain as well
    89             output->data.F32[iy][ix] = PS_SQR(stats->sampleStdev) / stats->sampleMedian;
     84            // XXX need to apply the gain as well
     85            float normVariance = PS_SQR(stats->robustStdev) / cellMedian;
     86            // float normVariance = PS_SQR(stats->sampleStdev) / cellMedian;
     87
     88            // apply resulting value to the input pixels
     89            for (int jy = fineRegion.y0; jy < fineRegion.y1; jy++) {
     90              for (int jx = fineRegion.x0; jx < fineRegion.x1; jx++) {
     91                image->data.F32[jy][jx] = normVariance;
     92              }
     93            }
    9094
    9195            psFree (subset);
     
    9498    }
    9599
     100    psFree (rng);
    96101    psFree (binning);
    97102    psFree (stats);
  • branches/eam_branches/eam_branch_20090312/ppImage/src/ppImageParseCamera.c

    r23316 r23406  
    154154    }
    155155
    156     if (options->checkCTE) {
     156    if (options->checkCTE && false) {
    157157        int DX = psMetadataLookupS32 (&status, recipe, "CTE.XBIN");
    158158        int DY = psMetadataLookupS32 (&status, recipe, "CTE.YBIN");
Note: See TracChangeset for help on using the changeset viewer.