IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 6, 2005, 6:43:52 PM (21 years ago)
Author:
Paul Price
Message:

Importing current working PAP version (many bug fixes since this branch) straight on top of this version, and tidying up a bit

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/pois/src/poisCalculateDeviations.c

    r3798 r5717  
    4646        int y = stamp->y;               // Stamp y coord
    4747        if (stamp->status == POIS_STAMP_USED) {
    48             psImage *refStamp = psImageSubset(refImage, x - xSize, y - ySize, x + xSize, y + ySize);
    49             psImage *inStamp = psImageSubset(inImage, x - xSize, y - ySize, x + xSize, y + ySize);
    50             psImage *maskStamp = psImageSubset(mask, x - xSize, y - ySize, x + xSize, y + ySize);
     48            psRegion stampRegion = {x - xSize, x + xSize, y - ySize, y + ySize};
     49            psImage *refStamp = psImageSubset(refImage, stampRegion);
     50            psImage *inStamp = psImageSubset(inImage, stampRegion);
     51            psImage *maskStamp = psImageSubset(mask, stampRegion);
    5152            psImage *convRefStamp = poisConvolveImage(refStamp, maskStamp, solution, kernelParams, config);
    5253            // Calculate chi^2
    5354            (void)psBinaryOp(subStamp, inStamp, "-", convRefStamp);
     55            (void)psBinaryOp(subStamp, subStamp, "*", subStamp);
    5456            (void)psBinaryOp(subStamp, subStamp, "/", inStamp);
    55             (void)psBinaryOp(subStamp, subStamp, "*", subStamp);
    56             psImage *subStampTrim = psImageSubset(subStamp, config->xKernel, config->yKernel,
    57                                                   config->xKernel + 2 * footprint,
    58                                                   config->yKernel + 2 * footprint);
    59             psImage *maskStampTrim = psImageSubset(maskStamp, config->xKernel, config->yKernel,
    60                                                    config->xKernel + 2 * footprint,
    61                                                    config->yKernel + 2 * footprint);
     57            psRegion stampTrim = { config->xKernel, config->xKernel + 2 * footprint, config->yKernel,
     58                                   config->yKernel + 2 * footprint };
     59            psImage *subStampTrim = psImageSubset(subStamp, stampTrim);
     60            psImage *maskStampTrim = psImageSubset(maskStamp, stampTrim);
    6261            // Copy image to workaround bug 305
    6362            psImage *tempImage = psImageCopy(NULL, subStampTrim, PS_TYPE_F32);
     
    6968            psFree(tempMask);
    7069           
    71             deviations->data.F32[s] = stats->sampleMean * (float)footprint * (float)footprint * 4.0;
     70            deviations->data.F32[s] = sqrtf(stats->sampleMean / 2.0);
    7271            psTrace("pois.calculateDeviations", 5, "Deviation of stamp %d (%d,%d) is %f\n", s, x, y,
    7372                    deviations->data.F32[s]);
     
    7776            snprintf(stampName, MAXCHAR, "stamp%d.fits", s);
    7877            psFits *stampFile = psFitsAlloc(stampName);
    79             if (!psFitsWriteImage(stampFile, NULL, subStampTrim, 0, NULL)) {
     78            if (!psFitsWriteImage(stampFile, NULL, subStampTrim, 0)) {
    8079                psErrorStackPrint(stderr, "Unable to write stamp: %s\n", stampName);
    8180            }
     
    8382#endif
    8483
     84#if 0
    8585            psFree(convRefStamp);
    8686            psFree(maskStampTrim);
     
    8989            psFree(refStamp);
    9090            psFree(inStamp);
     91#endif
    9192        }
    9293    }
Note: See TracChangeset for help on using the changeset viewer.