- Timestamp:
- May 3, 2010, 8:41:49 AM (16 years ago)
- Location:
- branches/tap_branches
- Files:
-
- 4 edited
-
. (modified) (1 prop)
-
psphot (modified) (1 prop)
-
psphot/src (modified) (1 prop)
-
psphot/src/psphotExtendedSourceAnalysis.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/tap_branches
- Property svn:mergeinfo changed
-
branches/tap_branches/psphot
-
Property svn:mergeinfo
set to (toggle deleted branches)
/trunk/psphot merged eligible /branches/eam_branches/stackphot.20100406/psphot 27622-27655 /branches/pap_delete/psphot 27530-27595
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
branches/tap_branches/psphot/src
- Property svn:ignore
-
old new 19 19 psphotMomentsStudy 20 20 psphotPetrosianStudy 21 psphotForced 22 psphotMakePSF 23 psphotStack
-
- Property svn:ignore
-
branches/tap_branches/psphot/src/psphotExtendedSourceAnalysis.c
r25755 r27838 1 1 # include "psphotInternal.h" 2 2 3 // for now, let's store the detections on the readout->analysis for each readout 4 bool psphotExtendedSourceAnalysis (pmConfig *config, const pmFPAview *view) 5 { 6 bool status = true; 7 8 // select the appropriate recipe information 9 psMetadata *recipe = psMetadataLookupPtr (&status, config->recipes, PSPHOT_RECIPE); 10 psAssert (recipe, "missing recipe?"); 11 12 // perform full non-linear fits / extended source analysis? 13 if (!psMetadataLookupBool (&status, recipe, "EXTENDED_SOURCE_ANALYSIS")) { 14 psLogMsg ("psphot", PS_LOG_INFO, "skipping extended source measurements\n"); 15 return true; 16 } 17 18 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 19 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 20 21 // loop over the available readouts 22 for (int i = 0; i < num; i++) { 23 if (!psphotExtendedSourceAnalysisReadout (config, view, "PSPHOT.INPUT", i, recipe)) { 24 psError (PSPHOT_ERR_CONFIG, false, "failed on measure extended source aperture-like parameters for PSPHOT.INPUT entry %d", i); 25 return false; 26 } 27 } 28 return true; 29 } 30 3 31 // aperture-like measurements for extended sources 4 bool psphotExtendedSourceAnalysis (pmReadout *readout, psArray *sources, psMetadata *recipe) {32 bool psphotExtendedSourceAnalysisReadout (pmConfig *config, const pmFPAview *view, const char *filename, int index, psMetadata *recipe) { 5 33 6 34 bool status; … … 11 39 int Nkron = 0; 12 40 41 psTimerStart ("psphot.extended"); 42 43 // find the currently selected readout 44 pmFPAfile *file = pmFPAfileSelectSingle(config->files, filename, index); // File of interest 45 psAssert (file, "missing file?"); 46 47 pmReadout *readout = pmFPAviewThisReadout(view, file->fpa); 48 psAssert (readout, "missing readout?"); 49 50 pmDetections *detections = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.DETECTIONS"); 51 psAssert (detections, "missing detections?"); 52 53 psArray *sources = detections->allSources; 54 psAssert (sources, "missing sources?"); 55 56 if (!sources->n) { 57 psLogMsg ("psphot", PS_LOG_INFO, "no sources, skipping source size"); 58 return true; 59 } 60 13 61 // user-defined masks to test for good/bad pixels (build from recipe list if not yet set) 14 62 psImageMaskType maskVal = psMetadataLookupImageMask(&status, recipe, "MASK.PSPHOT"); // Mask value for bad pixels 15 63 assert (maskVal); 16 17 // perform full non-linear fits / extended source analysis?18 if (!psMetadataLookupBool (&status, recipe, "EXTENDED_SOURCE_ANALYSIS")) {19 psLogMsg ("psphot", PS_LOG_INFO, "skipping extended source measurements\n");20 return true;21 }22 64 23 65 // XXX require petrosian analysis for non-linear fits? … … 25 67 // XXX temporary user-supplied systematic sky noise measurement (derive from background model) 26 68 float skynoise = psMetadataLookupF32 (&status, recipe, "SKY.NOISE"); 27 28 # if (0)29 // if backModel or backStdev are missing, the values of sky and/or skyErr will be set to NAN30 // XXX use this to set skynoise31 pmReadout *backModel = psphotSelectBackground (config, view);32 pmReadout *backStdev = psphotSelectBackgroundStdev (config, view);33 # endif34 69 35 70 // S/N limit to perform full non-linear fits … … 41 76 bool doAnnuli = psMetadataLookupBool (&status, recipe, "EXTENDED_SOURCE_ANNULI"); 42 77 bool doKron = psMetadataLookupBool (&status, recipe, "EXTENDED_SOURCE_KRON"); 78 79 # if (0) 80 // if backModel or backStdev are missing, the values of sky and/or skyErr will be set to NAN 81 // XXX use this to set skynoise 82 pmReadout *backModel = psphotSelectBackground (config, view); 83 pmReadout *backStdev = psphotSelectBackgroundStdev (config, view); 84 # endif 43 85 44 86 // source analysis is done in S/N order (brightest first) … … 79 121 Next ++; 80 122 123 // force source image to be a bit larger... 124 float radius = source->peak->xf - source->pixels->col0; 125 radius = PS_MAX (radius, source->peak->yf - source->pixels->row0); 126 radius = PS_MAX (radius, source->pixels->numRows - source->peak->yf + source->pixels->row0); 127 radius = PS_MAX (radius, source->pixels->numCols - source->peak->xf + source->pixels->col0); 128 pmSourceRedefinePixels (source, readout, source->peak->xf, source->peak->yf, 1.5*radius); 129 81 130 // if we request any of these measurements, we require the radial profile 82 131 if (doPetrosian || doIsophotal || doAnnuli || doKron) { … … 94 143 if (doPetrosian) { 95 144 if (!psphotPetrosian (source, recipe, skynoise, maskVal)) { 96 psTrace ("psphot", 5, " measuredpetrosian flux & radius for source at %7.1f, %7.1f", source->moments->Mx, source->moments->My);145 psTrace ("psphot", 5, "FAILED petrosian flux & radius for source at %7.1f, %7.1f", source->moments->Mx, source->moments->My); 97 146 } else { 98 147 psTrace ("psphot", 5, "measured petrosian flux & radius for source at %7.1f, %7.1f", source->moments->Mx, source->moments->My); … … 129 178 130 179 if (source->extpars) { 131 pmSourceRadialProfileFreeVectors(source->extpars->profile); 180 psFree(source->extpars->radFlux); 181 psFree(source->extpars->ellipticalFlux); 132 182 } 133 183 } 134 184 135 psLogMsg ("psphot", PS_LOG_INFO, "extended source analysis: %f sec for %d objects\n", psTimerMark ("psphot "), Next);185 psLogMsg ("psphot", PS_LOG_INFO, "extended source analysis: %f sec for %d objects\n", psTimerMark ("psphot.extended"), Next); 136 186 psLogMsg ("psphot", PS_LOG_INFO, " %d petrosian\n", Npetro); 137 187 psLogMsg ("psphot", PS_LOG_INFO, " %d isophotal\n", Nisophot);
Note:
See TracChangeset
for help on using the changeset viewer.
