Changeset 32321
- Timestamp:
- Sep 5, 2011, 9:00:15 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20110710/psphot/src/psphotStackMatchPSFs.c
r31154 r32321 25 25 } 26 26 27 // loop over the available readouts (ignore chisq image)27 // loop over the available readouts 28 28 for (int i = 0; i < num; i++) { 29 // set up the PSF-matching parameters describing the input images 29 30 if (!psphotStackMatchPSFsPrepare (config, view, options, i)) { 30 31 psError (PSPHOT_ERR_CONFIG, false, "failed to set PSF matching options for entry %d", i); … … 33 34 } 34 35 35 // Generate target PSF36 // XXX convolve == false might not be valid at the moment 36 37 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)) { 39 41 psError(psErrorCodeLast(), false, "Unable to determine output PSF."); 40 42 return false; 41 43 } 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 target44 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 chip48 // psMetadataAddPtr(outChip->analysis, PS_LIST_TAIL, "PSPHOT.PSF", PS_DATA_UNKNOWN, "Target PSF", options->psf);49 // outChip->data_exists = true;50 44 } 51 45 … … 63 57 64 58 // convolve the image to match desired PSF 59 // XXX is this code consistent with 'convolve' = false? 65 60 bool psphotStackMatchPSFsReadout (pmConfig *config, const pmFPAview *view, psphotStackOptions *options, int index) { 66 61 … … 109 104 saveMatchData(readoutOut, options, index); 110 105 } 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 } 112 112 113 113 // save the output fwhm values in the readout->analysis. we may have / will have multiple output PSF sizes, 114 114 // 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]); 121 120 } 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 123 124 124 125 return true;
Note:
See TracChangeset
for help on using the changeset viewer.
