Changeset 31154 for trunk/psphot/src/psphotExtendedSourceAnalysis.c
- Timestamp:
- Apr 4, 2011, 1:12:39 PM (15 years ago)
- Location:
- trunk/psphot
- Files:
-
- 2 edited
-
. (modified) (2 props)
-
src/psphotExtendedSourceAnalysis.c (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot
- Property svn:ignore
-
old new 19 19 psphot-config 20 20 Doxyfile 21 a.out.dSYM
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
trunk/psphot/src/psphotExtendedSourceAnalysis.c
r30624 r31154 1 1 # include "psphotInternal.h" 2 2 3 // ?? these cannot happen here --> we would need to do this in psphotExtendedSourceAnalysis 4 // XXX option to choose a consistent position 5 // XXX option to choose a consistent elliptical contour 6 // XXX SDSS uses the r-band petrosian radius to measure petrosian fluxes in all bands 7 // XXX consistent choice of extendedness... 3 // measure the elliptical radial profile and use this to measure the petrosian parameters for the sources 4 // XXX this function needs to be threaded 8 5 9 6 // for now, let's store the detections on the readout->analysis for each readout … … 40 37 int Next = 0; 41 38 int Npetro = 0; 42 int Nisophot = 0;43 39 int Nannuli = 0; 44 int Nkron = 0;45 40 46 41 psTimerStart ("psphot.extended"); … … 68 63 assert (maskVal); 69 64 70 // XXX require petrosian analysis for non-linear fits? 71 72 // XXX temporary user-supplied systematic sky noise measurement (derive from background model) 73 float skynoise = psMetadataLookupF32 (&status, recipe, "SKY.NOISE"); 65 // get the sky noise from the background analysis; if this is missing, get the user-supplied value 66 float skynoise = psMetadataLookupF32 (&status, readout->analysis, "SKY_STDEV"); 67 if (!status) { 68 skynoise = psMetadataLookupF32 (&status, recipe, "SKY.NOISE"); 69 psWarning ("failed to get sky noise level from background analysis; defaulting to user supplied value of %f\n", skynoise); 70 } 74 71 75 72 // S/N limit to perform full non-linear fits … … 78 75 // which extended source analyses should we perform? 79 76 bool doPetrosian = psMetadataLookupBool (&status, recipe, "EXTENDED_SOURCE_PETROSIAN"); 80 bool doIsophotal = psMetadataLookupBool (&status, recipe, "EXTENDED_SOURCE_ISOPHOTAL");81 77 bool doAnnuli = psMetadataLookupBool (&status, recipe, "EXTENDED_SOURCE_ANNULI"); 82 bool doKron = psMetadataLookupBool (&status, recipe, "EXTENDED_SOURCE_KRON"); 83 84 # if (0) 85 // if backModel or backStdev are missing, the values of sky and/or skyErr will be set to NAN 86 // XXX use this to set skynoise 87 pmReadout *backModel = psphotSelectBackground (config, view); 88 pmReadout *backStdev = psphotSelectBackgroundStdev (config, view); 89 # endif 78 bool doPetroStars = psMetadataLookupBool (&status, recipe, "PETROSIAN_FOR_STARS"); 90 79 91 80 // source analysis is done in S/N order (brightest first) 92 sources = psArraySort (sources, pmSourceSortBy SN);81 sources = psArraySort (sources, pmSourceSortByFlux); 93 82 94 83 // option to limit analysis to a specific region … … 103 92 104 93 // skip PSF-like and non-astronomical objects 105 if (source->type == PM_SOURCE_TYPE_STAR) continue;106 94 if (source->type == PM_SOURCE_TYPE_DEFECT) continue; 107 95 if (source->type == PM_SOURCE_TYPE_SATURATED) continue; 108 96 if (source->mode & PM_SOURCE_MODE_DEFECT) continue; 109 97 if (source->mode & PM_SOURCE_MODE_SATSTAR) continue; 110 if (!(source->mode & PM_SOURCE_MODE_EXT_LIMIT)) continue; 98 99 // optionally allow non-extended objects to get petrosians as well 100 if (!doPetroStars) { 101 if (!(source->mode & PM_SOURCE_MODE_EXT_LIMIT)) continue; 102 if (source->type == PM_SOURCE_TYPE_STAR) continue; 103 } 111 104 112 105 // limit selection to some SN limit 113 106 assert (source->peak); // how can a source not have a peak? 114 if (s ource->peak->SN< SN_LIM) continue;107 if (sqrt(source->peak->detValue) < SN_LIM) continue; 115 108 116 109 // limit selection by analysis region … … 119 112 if (source->peak->x > AnalysisRegion.x1) continue; 120 113 if (source->peak->y > AnalysisRegion.y1) continue; 121 122 // fprintf (stderr, "xsrc: %f, %f : %f\n", source->peak->xf, source->peak->yf, source->peak->SN);123 114 124 115 // replace object in image … … 136 127 137 128 // if we request any of these measurements, we require the radial profile 138 if (doPetrosian || do Isophotal || doAnnuli || doKron) {129 if (doPetrosian || doAnnuli) { 139 130 if (!psphotRadialProfile (source, recipe, skynoise, maskVal)) { 140 131 // all measurements below require the radial profile; skip them all … … 144 135 continue; 145 136 } 137 Nannuli ++; 146 138 source->mode |= PM_SOURCE_MODE_RADIAL_FLUX; 147 139 } … … 169 161 psLogMsg ("psphot", PS_LOG_INFO, "extended source analysis: %f sec for %d objects\n", psTimerMark ("psphot.extended"), Next); 170 162 psLogMsg ("psphot", PS_LOG_INFO, " %d petrosian\n", Npetro); 171 psLogMsg ("psphot", PS_LOG_INFO, " %d isophotal\n", Nisophot);172 163 psLogMsg ("psphot", PS_LOG_INFO, " %d annuli\n", Nannuli); 173 psLogMsg ("psphot", PS_LOG_INFO, " %d kron\n", Nkron);174 164 175 165 psphotVisualShowResidualImage (readout, false);
Note:
See TracChangeset
for help on using the changeset viewer.
