IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 5, 2012, 4:04:34 PM (14 years ago)
Author:
eugene
Message:

merge changes from trunk

Location:
branches/eam_branches/ipp-20120805/psphot
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20120805/psphot

  • branches/eam_branches/ipp-20120805/psphot/src

  • branches/eam_branches/ipp-20120805/psphot/src/psphotStackMatchPSFs.c

    r34136 r34399  
    44{
    55    bool status = true;
     6
     7    psLogMsg ("psphot", PS_LOG_INFO, "--- psphotStack Match PSFs ---");
    68
    79    psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, "PSPHOT");
     
    5759
    5860// convolve the image to match desired PSF
    59 // XXX is this code consistent with 'convolve' = false?
     61// XXX is this code consistent with 'convolve' = false?  XXX: No
    6062bool psphotStackMatchPSFsReadout (pmConfig *config, const pmFPAview *view, psphotStackOptions *options, int index) {
    6163
    6264    psImageMaskType maskValue;
    6365    psImageMaskType markValue;
     66
     67    psLogMsg("psphot", PS_LOG_DETAIL, "-- starting PSF matching for readout %d --", index);
    6468
    6569    // get the PSPHOT.MASK value from the config
     
    102106        saveMatchData(readoutOut, options, index);
    103107    }
     108    bool notMatched = psMetadataLookupBool(NULL, readoutOut->analysis, "NOT.PSF.MATCHED");
     109    if (notMatched) {
     110        if (!readoutOut->image) {
     111            // our images got freed in the matching process. Recreate them so that they
     112            // are available when sources are copied to this readout.
     113            readoutOut->image = psImageCopy(NULL, readoutSrc->image, PS_TYPE_F32);
     114            if (readoutSrc->variance) {
     115                psFree(readoutOut->variance);
     116                readoutOut->variance = psImageCopy(NULL, readoutSrc->variance, PS_TYPE_F32);
     117            }
     118            if (readoutSrc->mask) {
     119                psFree(readoutOut->mask);
     120                readoutOut->mask = psImageCopy(NULL, readoutSrc->mask, PS_TYPE_IMAGE_MASK);
     121            }
     122        }
     123    }
    104124
    105125    // renormalize the stack variances to have sigma = 1.0
     
    111131    // save the output fwhm values in the readout->analysis.  we may have / will have multiple output PSF sizes,
    112132    // so we save this in a vector.  if the vector is not yet defined, create it
    113     // Skip this if the readout deconvolution fraction was over the limit.
     133    // Skip this if psf matching failed for this readout. For example if deconvolution fraction was over the limit.
    114134    // NOTE: fwhmValues as defined here has 1 + nMatched PSF : 0 == unmatched
    115135    psVector *fwhmValues = psVectorAllocEmpty(10, PS_TYPE_F32);
    116136    psVectorAppend(fwhmValues, NAN); // XXX this corresponds to the unmatched image set
    117137
    118     bool overLimit = psMetadataLookupBool(NULL, readoutOut->analysis, "DECONV.OVERLIMIT");
    119     if (!overLimit) {
     138    if (!notMatched) {
    120139        for (int i = 0; i < options->targetSeeing->n; i++) {
    121140            psVectorAppend(fwhmValues, options->targetSeeing->data.F32[i]);
     
    124143    psMetadataAddVector(readoutSrc->analysis, PS_LIST_TAIL, "STACK.PSF.FWHM.VALUES", PS_META_REPLACE, "PSF sizes", fwhmValues);
    125144    psMetadataAddVector(readoutOut->analysis, PS_LIST_TAIL, "STACK.PSF.FWHM.VALUES", PS_META_REPLACE, "PSF sizes", fwhmValues);
    126     psFree(fwhmValues); // drops the extra copy
     145    psFree(fwhmValues); // drops this function's reference
    127146
    128147    return true;
Note: See TracChangeset for help on using the changeset viewer.