IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 11, 2008, 6:12:42 PM (18 years ago)
Author:
Paul Price
Message:

Correcting stack variances for the imperfect convolution. Changed (again) the way the deviations are calculated; they're now straight chi2, which allows us to estimate how the variance factor needs to be changed in order to correct for it. Moving additional values into pmSubtractionKernels so that this can be calculated from a kernel that has been read in (very useful for debugging, also nice to have a record of the quality of the fit).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppStack/src/ppStackLoop.c

    r19505 r19532  
    390390    psVector *inputMask = psVectorAlloc(num, PS_TYPE_U8); // Mask for inputs
    391391    psVectorInit(inputMask, 0);
     392    psVector *matchChi2 = psVectorAlloc(num, PS_TYPE_F32); // chi^2 for stamps when matching
     393    psVectorInit(matchChi2, NAN);
    392394    for (int i = 0; i < num; i++) {
    393395        psTrace("ppStack", 2, "Convolving input %d of %d to target PSF....\n", i, num);
     
    402404            psFree(rng);
    403405            psFree(inputMask);
     406            psFree(matchChi2);
    404407            return false;
    405408        }
     
    419422            psFree(rng);
    420423            psFree(inputMask);
     424            psFree(matchChi2);
    421425            return false;
    422426        }
     
    425429        psArray *regions = NULL, *kernels = NULL; // Regions and kernels used in subtraction
    426430        psArray *sources = haveSources ? globalSources : indSources->data[i]; // Sources for matching
    427         if (!ppStackMatch(readout, &regions, &kernels, sources, targetPSF, rng, config)) {
     431        if (!ppStackMatch(readout, &regions, &kernels, &matchChi2->data.F32[i],
     432                          sources, targetPSF, rng, config)) {
    428433            psErrorStackPrint(stderr, "Unable to match image %d --- ignoring.", i);
    429434            inputMask->data.U8[i] = PPSTACK_MASK_MATCH;
     
    459464        psFree(cells);
    460465        psFree(inputMask);
     466        psFree(inputMask);
     467        psFree(matchChi2);
    461468        return false;
    462469    }
     
    473480    memDump("preinitial");
    474481
    475     // Stack the convolvd files
     482    // Stack the convolved files
    476483    psTrace("ppStack", 1, "Initial stack of convolved images....\n");
    477484    pmReadout *outRO = NULL;            // Output readout
     
    489496            psFree(stack);
    490497            psFree(inputMask);
     498            psFree(matchChi2);
    491499            psFree(exptimes);
    492500            psFree(cells);
     
    502510            psFree(stack);
    503511            psFree(inputMask);
     512            psFree(matchChi2);
    504513            psFree(exptimes);
    505514            psFree(cells);
     
    518527            psFree(stack);
    519528            psFree(inputMask);
     529            psFree(matchChi2);
    520530            psFree(view);
    521531            psFree(outRO);
     
    546556        psFree(cellList);
    547557
    548     psFree(cells);
     558        psFree(cells);
    549559
    550560        bool status;                    // Status of read
     
    559569                psFree(stack);
    560570                psFree(inputMask);
     571                psFree(matchChi2);
    561572                psFree(view);
    562573                psFree(outRO);
     
    576587            psArrayAdd(job->args, 1, subRegions);
    577588            psArrayAdd(job->args, 1, subKernels);
     589            psArrayAdd(job->args, 1, matchChi2);
    578590            if (!psThreadJobAddPending(job)) {
    579591                psFree(job);
     
    582594                psFree(stack);
    583595                psFree(inputMask);
     596                psFree(matchChi2);
    584597                psFree(view);
    585598                psFree(outRO);
     
    596609            psFree(stack);
    597610            psFree(inputMask);
     611            psFree(matchChi2);
    598612            psFree(view);
    599613            psFree(outRO);
     
    601615            return false;
    602616        }
     617        psFree(matchChi2);
    603618
    604619        // Harvest the jobs, gathering the inspection lists
Note: See TracChangeset for help on using the changeset viewer.