IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 18, 2008, 2:39:33 PM (18 years ago)
Author:
Paul Price
Message:

Calculate and record the variance factor (required for transforming between variances on large scales and small scales)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/pswarp/src/pswarpTransformReadout_Opt.c

    r17780 r18179  
    8686
    8787    // Iterate over the output image pixels (parent frame)
    88     bool goodPixels = false;            // Any input pixels landing on the output image?
     88    long goodPixels = 0;                // Number of input pixels landing on the output image
    8989    for (int y = minY; y < maxY; y++) {
    9090        if (y >= nextGridY) {
     
    117117            if (inPix->y - inRow0 >= inImage->numRows) continue;
    118118
    119             goodPixels = true;
     119            goodPixels++;
    120120
    121121            // XXX include mask
     
    146146    psFree(grid);
    147147
     148    // Store the variance factor and number of good pixels
     149    if (goodPixels > 0) {
     150        float varFactor = psImageInterpolateVarianceFactor(output->image->numCols, output->image->numRows,
     151                                                           interp); // Variance factor: large --> small scale
     152        psMetadataItem *vfItem = psMetadataLookup(output->analysis, PSWARP_ANALYSIS_VARFACTOR);
     153        if (vfItem) {
     154            psMetadataItem *goodpixItem = psMetadataLookup(output->analysis, PSWARP_ANALYSIS_GOODPIX);
     155            psAssert(goodpixItem, "It should be where we left it!");
     156            psAssert(vfItem->type == PS_TYPE_F32 && goodpixItem->type == PS_TYPE_S64,
     157                     "Should be the type we said.");
     158
     159            vfItem->data.F32 += varFactor * goodPixels;
     160            goodpixItem->data.S64 += goodPixels;
     161        } else {
     162            psMetadataAddF32(output->analysis, PS_LIST_TAIL, PSWARP_ANALYSIS_VARFACTOR, 0,
     163                             "Variance factor weighted by the good pixels", varFactor * goodPixels);
     164            psMetadataAddS64(output->analysis, PS_LIST_TAIL, PSWARP_ANALYSIS_GOODPIX, 0,
     165                             "Number of good pixels", goodPixels);
     166        }
     167    }
     168
    148169    // Transform sources
    149170    psArray *inSources = psMetadataLookupPtr(&mdok, input->analysis, "PSPHOT.SOURCES"); // Sources in source
    150     if (goodPixels && mdok && inSources) {
     171    if (goodPixels > 0 && mdok && inSources) {
    151172        pswarpMapGrid *sourceGrid = pswarpMapGridFromImage(output, input, nGridX, nGridY); // Grid for sources
    152173
Note: See TracChangeset for help on using the changeset viewer.