IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 11, 2007, 5:51:36 PM (19 years ago)
Author:
Paul Price
Message:

Works with POIS kernels!

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppSub/src/ppSubReadout.c

    r13363 r13371  
    1616    pmReadout *inRO = pmFPAfileThisReadout(config->files, view, "PPSUB.INPUT"); // Input readout
    1717    pmReadout *refRO = pmFPAfileThisReadout(config->files, view, "PPSUB.REF"); // Reference readout
     18#if 0
    1819    pmCell *outCell = pmFPAfileThisCell(config->files, view, "PPSUB.OUTPUT"); // Output cell
    1920    pmReadout *outRO = pmReadoutAlloc(outCell); // Output readout
     21#endif
    2022
    2123    psImage *input = inRO->image;       // Input image
     
    8789    psVector *solution = NULL;          // Solution to match PSF
    8890
    89     for (int i = 0, numRejected = 0; i < iter && numRejected != 0; i++) {
     91    int numRejected = -1;               // Number of rejected stamps in each iteration
     92    for (int i = 0; i < iter && numRejected != 0; i++) {
    9093        stamps = pmSubtractionFindStamps(stamps, refRO->image, stampMask, MASK_BAD, MASK_STAMP,
    91                                          threshold, spacing, footprint);
     94                                         threshold, spacing, size + footprint);
    9295        if (!stamps) {
    9396            psError(PS_ERR_UNKNOWN, false, "Unable to find stamps on reference image.");
     
    116119    }
    117120
    118     if (!pmSubtractionConvolve(&outRO->image, &outRO->weight, &outRO->mask,
     121    psImage *convImage = NULL, *convWeight = NULL, *convMask = NULL; // Convolved images
     122    if (!pmSubtractionConvolve(&convImage, &convWeight, &convMask,
    119123                               refRO->image, refRO->weight, refRO->mask,
    120124                               MASK_BAD, maskBlank, solution, kernels)) {
     
    125129    // Do the subtraction
    126130    if (reverse) {
    127         (void)psBinaryOp(outRO->image, outRO->image, "-", inRO->image);
     131        (void)psBinaryOp(inRO->image, convImage, "-", inRO->image);
    128132    } else {
    129         (void)psBinaryOp(outRO->image, inRO->image, "-", outRO->image);
     133        (void)psBinaryOp(inRO->image, inRO->image, "-", convImage);
    130134    }
    131     (void)psBinaryOp(outRO->mask, outRO->mask, "|", inRO->mask);
    132     (void)psBinaryOp(outRO->weight, outRO->weight, "+", inRO->weight);
     135    (void)psBinaryOp(inRO->mask, convMask, "|", inRO->mask);
     136    (void)psBinaryOp(inRO->weight, convWeight, "+", inRO->weight);
     137
     138    psFree(convImage);
     139    psFree(convMask);
     140    psFree(convWeight);
    133141
    134142#if 0
    135143    // Generate image with convolution kernels
    136     int fullSize = 2 * size + 1;        // Full size of kernel
     144    int fullSize = 2 * size + 1 + 1;    // Full size of kernel
    137145    psImage *convKernels = psImageAlloc(5 * fullSize, 5 * fullSize, PS_TYPE_F32);
     146    psImageInit(fullSize, NAN);
    138147    for (int j = -2; j <= 2; j++) {
    139148        for (int i = -2; i <= 2; i++) {
     
    156165
    157166    // XXX What do we do with this image?
     167
     168    psFits *kernelFile = psFitsOpen("kernel.fits", "w");
     169    (void)psFitsWriteImage(kernelFile, NULL, convKernels, 0, NULL);
     170    psFitsClose(kernelFile);
     171
    158172    psFree(convKernels);
    159173#endif
     
    163177        psFree(stamps);
    164178        psFree(solution);
    165         psFree(outRO);
    166179        return true;
    167180
     
    170183        psFree(stamps);
    171184        psFree(solution);
    172         psFree(outRO);
    173185        return false;
    174186}
Note: See TracChangeset for help on using the changeset viewer.