IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 23320


Ignore:
Timestamp:
Mar 13, 2009, 5:19:16 PM (17 years ago)
Author:
Paul Price
Message:

pmFPAGenerateReadout and pmCellCopyStructure were both applying the
binning to the TRIMSEC, resulting in an image down by a factor of
binning2.

File:
1 edited

Legend:

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

    r23316 r23320  
    1111    // this step is complete optional.
    1212    if (!options->checkCTE) {
    13         return true;
     13        return true;
    1414    }
    1515
     
    3434    psImageBinningSetSkip(binning, image);
    3535
    36     pmFPAfile *input = psMetadataLookupPtr (&status, config->files, "PPIMAGE.INPUT");
    37     pmReadout *modelReadout = pmFPAGenerateReadout(config, view, "PPIMAGE.CTEMAP", input->fpa, binning);
    38     psImage *output = modelReadout->image;
    39 
    4036    pmCell *inCell  = pmFPAfileThisCell (config->files, view, "PPIMAGE.INPUT");
    4137    pmCell *outCell = pmFPAfileThisCell (config->files, view, "PPIMAGE.CTEMAP");
    42     if (!pmCellCopyStructure (outCell, inCell, binning->nXbin, binning->nYbin)) {
     38    if (!pmCellCopyStructure(outCell, inCell, binning->nXbin, binning->nYbin)) {
    4339        psError(PS_ERR_UNKNOWN, false, "Unable to copy cell structure.");
    4440        return false;
    4541    }
    4642
    47     // Binned version of image
    48     // psImage *output = psImageAlloc(binning->nXruff, binning->nYruff, PS_TYPE_F32);
     43    pmReadout *outRO = pmFPAfileThisReadout(config->files, view, "PPIMAGE.CTEMAP");
     44    psImage *output = outRO->image;
     45
     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);
    4952
    5053    psStats *stats = psStatsAlloc (PS_STAT_SAMPLE_MEDIAN | PS_STAT_SAMPLE_STDEV);
     
    5760        for (int ix = 0; ix < output->numCols; ix++) {
    5861
    59             // convert the ruff grid cell to the equivalent fine grid cell
     62            // convert the ruff grid cell to the equivalent fine grid cell
    6063            ruffRegion = psRegionSet (ix, ix + 1, iy, iy + 1);
    6164            fineRegion = psImageBinningSetFineRegion (binning, ruffRegion);
    6265            fineRegion = psRegionForImage (image, fineRegion);
     66            if (fineRegion.x0 >= image->numCols || fineRegion.x1 >= image->numCols ||
     67                fineRegion.y0 >= image->numRows || fineRegion.y1 >= image->numRows) {
     68                continue;
     69            }
    6370
    6471            psImage *subset  = psImageSubset (image, fineRegion);
     
    6875            }
    6976            psImage *submask = NULL;
    70             if (mask) {
    71                 submask = psImageSubset (mask, fineRegion);
    72             }
     77            if (mask) {
     78                submask = psImageSubset (mask, fineRegion);
     79            }
    7380
    7481            // reset the default values
    75             statsDefaults->tmpData = stats->tmpData; // XXX this is fairly hackish: tmpData is internal storage for stats; the assign drops the reference...
     82            statsDefaults->tmpData = stats->tmpData; // XXX this is fairly hackish: tmpData is internal storage for stats; the assign drops the reference...
    7683            *stats = *statsDefaults;
    77             statsDefaults->tmpData = NULL;
    78            
    79             psImageStats (stats, subset, submask, 0);
     84            statsDefaults->tmpData = NULL;
    8085
    81             // XXX need to apply the gain as well
    82             output->data.F32[iy][ix] = PS_SQR(stats->sampleStdev) / stats->sampleMedian;
    83            
    84             psFree (subset);
    85             psFree (submask);
    86         }
     86            psImageStats (stats, subset, submask, 0);
     87
     88            // XXX need to apply the gain as well
     89            output->data.F32[iy][ix] = PS_SQR(stats->sampleStdev) / stats->sampleMedian;
     90
     91            psFree (subset);
     92            psFree (submask);
     93        }
    8794    }
    88    
     95
    8996    psFree (binning);
    9097    psFree (stats);
Note: See TracChangeset for help on using the changeset viewer.