IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 13371


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

Works with POIS kernels!

Location:
trunk/ppSub/src
Files:
3 edited

Legend:

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

    r13362 r13371  
    6565
    6666    // Output image
    67     pmFPAfile *output = pmFPAfileDefineOutput(config, NULL, "PPSUB.OUTPUT");
     67    pmFPAfile *output = pmFPAfileDefineOutput(config, input->fpa, "PPSUB.OUTPUT");
    6868    if (!output) {
    6969        psError(PS_ERR_IO, false, _("Unable to generate output file from PPSUB.OUTPUT"));
     
    7474        return false;
    7575    }
    76     output->fpa = pmFPAConstruct(output->camera);
    7776
    7877    // Output mask
  • trunk/ppSub/src/ppSubLoop.c

    r13360 r13371  
    102102
    103103            pmReadout *inRO;           // Readin of interest
    104             while ((inRO = pmFPAviewNextReadout(view, input->fpa, 1)) != NULL) {
     104            while ((inRO = pmFPAviewNextReadout(view, input->fpa, 1))) {
    105105                if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) {
    106106                    return false;
    107107                }
    108108                pmReadout *refRO = pmFPAviewThisReadout(view, reference->fpa);// Reference readout of interest
    109                 if ((!inRO->data_exists && refRO->data_exists) ||
     109                if (!refRO || (!inRO->data_exists && refRO->data_exists) ||
    110110                    (inRO->data_exists && !refRO->data_exists)) {
    111111                    psError(PS_ERR_BAD_PARAMETER_VALUE, true,
  • 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.