- Timestamp:
- Sep 19, 2009, 8:49:41 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/20090715/psphot/src/psphotExtendedSourceAnalysis.c
r21519 r25452 21 21 } 22 22 23 // option to limit analysis to a specific region 24 char *region = psMetadataLookupStr (&status, recipe, "ANALYSIS_REGION"); 25 psRegion AnalysisRegion = psRegionForImage (readout->image, psRegionFromString (region)); 26 if (psRegionIsNaN (AnalysisRegion)) psAbort("analysis region mis-defined"); 23 // XXX require petrosian analysis for non-linear fits? 24 25 // XXX temporary user-supplied systematic sky noise measurement (derive from background model) 26 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 NAN 30 // XXX use this to set skynoise 31 pmReadout *backModel = psphotSelectBackground (config, view); 32 pmReadout *backStdev = psphotSelectBackgroundStdev (config, view); 33 # endif 27 34 28 35 // S/N limit to perform full non-linear fits … … 38 45 sources = psArraySort (sources, pmSourceSortBySN); 39 46 40 // XXX some init functions for the extended source recipe options? 47 // option to limit analysis to a specific region 48 char *region = psMetadataLookupStr (&status, recipe, "ANALYSIS_REGION"); 49 psRegion AnalysisRegion = psRegionForImage (readout->image, psRegionFromString (region)); 50 if (psRegionIsNaN (AnalysisRegion)) psAbort("analysis region mis-defined"); 41 51 42 52 // choose the sources of interest … … 49 59 if (source->type == PM_SOURCE_TYPE_DEFECT) continue; 50 60 if (source->type == PM_SOURCE_TYPE_SATURATED) continue; 61 if (source->mode & PM_SOURCE_MODE_DEFECT) continue; 62 if (source->mode & PM_SOURCE_MODE_SATSTAR) continue; 63 if (!(source->mode & PM_SOURCE_MODE_EXT_LIMIT)) continue; 51 64 52 65 // limit selection to some SN limit … … 68 81 // if we request any of these measurements, we require the radial profile 69 82 if (doPetrosian || doIsophotal || doAnnuli || doKron) { 70 if (!psphotRadialProfile (source, recipe, maskVal)) {83 if (!psphotRadialProfile (source, recipe, skynoise, maskVal)) { 71 84 // all measurements below require the radial profile; skip them all 72 85 // re-subtract the object, leave local sky … … 79 92 } 80 93 94 // Petrosian Mags 95 if (doPetrosian) { 96 if (!psphotPetrosian (source, recipe, skynoise, maskVal)) { 97 psTrace ("psphot", 5, "measured petrosian flux & radius for source at %7.1f, %7.1f", source->moments->Mx, source->moments->My); 98 } else { 99 psTrace ("psphot", 5, "measured petrosian flux & radius for source at %7.1f, %7.1f", source->moments->Mx, source->moments->My); 100 Npetro ++; 101 source->mode |= PM_SOURCE_MODE_EXTENDED_STATS; 102 } 103 } 104 105 # if (0) 81 106 // Isophotal Mags 82 107 if (doIsophotal) { … … 89 114 } 90 115 } 91 92 // Petrosian Mags93 if (doPetrosian) {94 if (!psphotPetrosian (source, recipe, maskVal)) {95 psTrace ("psphot", 5, "measured petrosian flux & radius for source at %7.1f, %7.1f", source->moments->Mx, source->moments->My);96 } else {97 psTrace ("psphot", 5, "measured petrosian flux & radius for source at %7.1f, %7.1f", source->moments->Mx, source->moments->My);98 Npetro ++;99 source->mode |= PM_SOURCE_MODE_EXTENDED_STATS;100 }101 }102 103 116 // Kron Mags 104 117 if (doKron) { … … 111 124 } 112 125 } 113 114 // Radial Annuli 115 if (doAnnuli) { 116 if (!psphotAnnuli (source, recipe, maskVal)) { 117 psError(PSPHOT_ERR_UNKNOWN, false, "failure in Annuli analysis"); 118 return false; 119 } 120 psTrace ("psphot", 5, "measured annuli for source at %7.1f, %7.1f", source->moments->Mx, source->moments->My); 121 Nannuli ++; 122 source->mode |= PM_SOURCE_MODE_EXTENDED_STATS; 123 } 126 # endif 124 127 125 128 // re-subtract the object, leave local sky 126 129 pmSourceSub (source, PM_MODEL_OP_FULL, maskVal); 127 130 source->tmpFlags |= PM_SOURCE_TMPF_SUBTRACTED; 131 132 if (source->extpars) { 133 pmSourceRadialProfileFreeVectors(source->extpars->profile); 134 } 128 135 } 129 136 … … 133 140 psLogMsg ("psphot", PS_LOG_INFO, " %d annuli\n", Nannuli); 134 141 psLogMsg ("psphot", PS_LOG_INFO, " %d kron\n", Nkron); 142 143 psphotVisualShowResidualImage (readout); 144 145 if (doPetrosian) { 146 psphotVisualShowPetrosians (sources); 147 } 148 135 149 return true; 136 150 }
Note:
See TracChangeset
for help on using the changeset viewer.
