Changeset 32348 for trunk/psphot/src/psphotStackMatchPSFsNext.c
- Timestamp:
- Sep 6, 2011, 1:32:31 PM (15 years ago)
- Location:
- trunk/psphot
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot
-
trunk/psphot/src
- Property svn:ignore
-
old new 22 22 psphotMakePSF 23 23 psphotStack 24 psphotModelTest
-
- Property svn:ignore
-
trunk/psphot/src/psphotStackMatchPSFsNext.c
r30624 r32348 1 1 # include "psphotInternal.h" 2 3 // NOTE : element 0 of fwhmValues if the unmatched image, 4 5 int psphotStackMatchPSFsEntries (pmConfig *config, const pmFPAview *view, const char *filerule) { 6 7 int nRadialEntries = 0; 8 9 // find the currently selected readout 10 pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, 0); // File of interest 11 psAssert (file, "missing file?"); 12 13 pmReadout *readout = pmFPAviewThisReadout(view, file->fpa); 14 psAssert (readout, "missing readout?"); 15 16 bool status = false; 17 psVector *fwhmValues = psMetadataLookupVector(&status, readout->analysis, "STACK.PSF.FWHM.VALUES"); 18 if (!fwhmValues) { 19 return 1; 20 } 21 22 nRadialEntries = fwhmValues->n; 23 return nRadialEntries; 24 } 2 25 3 26 // smooth the input image to match the next target PSF … … 5 28 // and that the smoothing can use a 1D Gaussian kernel of width sqrt(TARGET^2 - CURRENT^2) 6 29 // each subsequent call 7 bool psphotStackMatchPSFsNext( bool *smoothAgain,pmConfig *config, const pmFPAview *view, const char *filerule, int lastSize)30 bool psphotStackMatchPSFsNext(pmConfig *config, const pmFPAview *view, const char *filerule, int lastSize) 8 31 { 9 bool status = true;10 11 // select the appropriate recipe information12 psMetadata *recipe = psMetadataLookupPtr (&status, config->recipes, PSPHOT_RECIPE);13 psAssert (recipe, "missing recipe?");14 15 psVector *fwhmValues = psMetadataLookupVector(&status, recipe, "PSPHOT.STACK.TARGET.PSF.FWHM"); // Magnitude offsets16 if (!status) {17 // must not be a vector, only one value requested18 *smoothAgain = false;19 return true;20 }21 22 if (lastSize + 1 >= fwhmValues->n) {23 // all done with target FWHM values24 *smoothAgain = false;25 return true;26 }27 28 32 int num = psphotFileruleCount(config, filerule); 29 33 … … 33 37 // loop over the available readouts 34 38 for (int i = 0; i < num; i++) { 35 if (!psphotStackMatchPSFsNextReadout (config, view, filerule, i, recipe, fwhmValues,lastSize)) {36 psError (PSPHOT_ERR_CONFIG, false, "failed to smooth image %s (%d) to target PSF %f", filerule, i, fwhmValues->data.F32[lastSize+1]);39 if (!psphotStackMatchPSFsNextReadout (config, view, filerule, i, lastSize)) { 40 psError (PSPHOT_ERR_CONFIG, false, "failed to smooth image %s (%d) to target PSF", filerule, i); 37 41 psImageConvolveSetThreads(oldThreads); 38 42 return false; … … 44 48 } 45 49 46 bool psphotStackMatchPSFsNextReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe, psVector *fwhmValues,int lastSize) {50 bool psphotStackMatchPSFsNextReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, int lastSize) { 47 51 48 52 bool status = false; … … 58 62 psphotVisualShowImage(readout); 59 63 64 // select the appropriate recipe information 65 psMetadata *recipe = psMetadataLookupPtr (&status, config->recipes, PSPHOT_RECIPE); 66 psAssert (recipe, "missing recipe?"); 67 60 68 // user-defined masks to test for good/bad pixels (build from recipe list if not yet set) 61 69 psImageMaskType maskVal = psMetadataLookupImageMask(&status, recipe, "MASK.PSPHOT"); // Mask value for bad pixels … … 66 74 psWarning("PEAKS_MIN_GAUSS is not set in recipe; using default value"); 67 75 minGauss = 0.5; 76 } 77 78 psVector *fwhmValues = psMetadataLookupVector(&status, readout->analysis, "STACK.PSF.FWHM.VALUES"); 79 psAssert (fwhmValues, "need target PSFs"); 80 81 if (lastSize + 1 >= fwhmValues->n) { 82 return true; 68 83 } 69 84 … … 128 143 // psMetadataAddF32(readout->analysis, PS_LIST_TAIL, "SIGNIFICANCE_SCALE_FACTOR", PS_META_REPLACE, "Signicance scale factor", factor); 129 144 130 // save the output fwhm values in the readout->analysis. we may have / will have multiple output PSF sizes,131 // so we save this in a vector. if the vector is not yet defined, create it132 133 psVector *fwhmValuesOut = psMetadataLookupVector(&status, readout->analysis, "STACK.PSF.FWHM.VALUES");134 psAssert(fwhmValuesOut, "should already exist..");135 psVectorAppend(fwhmValuesOut, targetFWHM);136 137 145 // do not generate a PSF if we already were supplied one 138 146 pmPSF *psfOld = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.PSF");
Note:
See TracChangeset
for help on using the changeset viewer.
