IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 32321


Ignore:
Timestamp:
Sep 5, 2011, 9:00:15 AM (15 years ago)
Author:
eugene
Message:

define target seeing up front as a vector; use this downstream to choose convolutions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20110710/psphot/src/psphotStackMatchPSFs.c

    r31154 r32321  
    2525    }
    2626
    27     // loop over the available readouts (ignore chisq image)
     27    // loop over the available readouts
    2828    for (int i = 0; i < num; i++) {
     29        // set up the PSF-matching parameters describing the input images
    2930        if (!psphotStackMatchPSFsPrepare (config, view, options, i)) {
    3031            psError (PSPHOT_ERR_CONFIG, false, "failed to set PSF matching options for entry %d", i);
     
    3334    }
    3435
    35     // Generate target PSF
     36    // XXX convolve == false might not be valid at the moment
    3637    if (options->convolve) {
    37         options->psf = psphotStackPSF(config, options->numCols, options->numRows, options->psfs, options->inputMask);
    38         if (!options->psf) {
     38        // Determine the 1st target PSF (either AUTO or defined by PSPHOT.STACK.TARGET.PSF.FWHM)
     39        // NOTE: this also set the full list of target FWHMs (options->targetSeeing)
     40        if (!psphotStackPSF(config, options)) {
    3941            psError(psErrorCodeLast(), false, "Unable to determine output PSF.");
    4042            return false;
    4143        }
    42         psMetadataAddPtr(config->arguments, PS_LIST_TAIL, "PSF.TARGET", PS_DATA_UNKNOWN, "Target PSF for stack", options->psf);
    43         options->targetSeeing = pmPSFtoFWHM(options->psf, 0.5 * options->numCols, 0.5 * options->numRows); // FWHM for target
    44         psLogMsg("psphotStack", PS_LOG_INFO, "Target seeing FWHM: %f\n", options->targetSeeing);
    45 
    46         // XXX is this needed to supply the psf to psphot??
    47         // pmChip *outChip = pmFPAfileThisChip(config->files, view, "PPSTACK.TARGET.PSF"); // Output chip
    48         // psMetadataAddPtr(outChip->analysis, PS_LIST_TAIL, "PSPHOT.PSF", PS_DATA_UNKNOWN, "Target PSF", options->psf);
    49         // outChip->data_exists = true;
    5044    }
    5145
     
    6357
    6458// convolve the image to match desired PSF
     59// XXX is this code consistent with 'convolve' = false?
    6560bool psphotStackMatchPSFsReadout (pmConfig *config, const pmFPAview *view, psphotStackOptions *options, int index) {
    6661
     
    109104        saveMatchData(readoutOut, options, index);
    110105    }
    111     rescaleData(readoutOut, config, options, index);
     106
     107    // renormalize the stack variances to have sigma = 1.0
     108    if (!psphotStackRenormaliseVariance(config, readoutOut)) {
     109        psError(psErrorCodeLast(), false, "Unable to renormalise variance.");
     110        return false;
     111    }
    112112
    113113    // save the output fwhm values in the readout->analysis.  we may have / will have multiple output PSF sizes,
    114114    // so we save this in a vector.  if the vector is not yet defined, create it
    115     bool mdok = false;
    116     psVector *fwhmValues = psMetadataLookupVector(&mdok, readoutOut->analysis, "STACK.PSF.FWHM.VALUES");
    117     if (!fwhmValues) {
    118         fwhmValues = psVectorAllocEmpty(10, PS_TYPE_F32);
    119         psMetadataAddVector(readoutOut->analysis, PS_LIST_TAIL, "STACK.PSF.FWHM.VALUES", PS_META_REPLACE, "PSF sizes", fwhmValues);
    120         psFree(fwhmValues); // drops the extra copy
     115    // NOTE: fwhmValues as defined here has 1 + nMatched PSF : 0 == unmatched
     116    psVector *fwhmValues = psVectorAllocEmpty(10, PS_TYPE_F32);
     117    psVectorAppend(fwhmValues, NAN); // XXX this corresponds to the unmatched image set
     118    for (int i = 0; i < options->targetSeeing->n; i++) {
     119        psVectorAppend(fwhmValues, options->targetSeeing->data.F32[i]);
    121120    }
    122     psVectorAppend(fwhmValues, options->targetSeeing);
     121    psMetadataAddVector(readoutSrc->analysis, PS_LIST_TAIL, "STACK.PSF.FWHM.VALUES", PS_META_REPLACE, "PSF sizes", fwhmValues);
     122    psMetadataAddVector(readoutOut->analysis, PS_LIST_TAIL, "STACK.PSF.FWHM.VALUES", PS_META_REPLACE, "PSF sizes", fwhmValues);
     123    psFree(fwhmValues); // drops the extra copy
    123124
    124125    return true;
Note: See TracChangeset for help on using the changeset viewer.