Changeset 17336
- Timestamp:
- Apr 6, 2008, 10:12:23 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branch_20080324/psphot/src/psphotExtendedSourceAnalysis.c
r17276 r17336 1 # include "psphot .h"1 # include "psphotInternal.h" 2 2 3 3 // aperture-like measurements for extended sources … … 6 6 bool status; 7 7 int Next = 0; 8 int Nconvolve = 0;9 8 int Npetro = 0; 10 9 int Nisophot = 0; … … 44 43 for (int i = 0; i < sources->n; i++) { 45 44 46 pmSource *source = sources->data[i];45 pmSource *source = sources->data[i]; 47 46 48 // skip PSF-like and non-astronomical objects49 if (source->type == PM_SOURCE_TYPE_STAR) continue;50 if (source->type == PM_SOURCE_TYPE_DEFECT) continue;51 if (source->type == PM_SOURCE_TYPE_SATURATED) continue;47 // skip PSF-like and non-astronomical objects 48 if (source->type == PM_SOURCE_TYPE_STAR) continue; 49 if (source->type == PM_SOURCE_TYPE_DEFECT) continue; 50 if (source->type == PM_SOURCE_TYPE_SATURATED) continue; 52 51 53 // limit selection to some SN limit54 assert (source->peak); // how can a source not have a peak?55 if (source->peak->SN < SN_LIM) continue;52 // limit selection to some SN limit 53 assert (source->peak); // how can a source not have a peak? 54 if (source->peak->SN < SN_LIM) continue; 56 55 57 // limit selection by analysis region58 if (source->peak->x < AnalysisRegion.x0) continue;59 if (source->peak->y < AnalysisRegion.y0) continue;60 if (source->peak->x > AnalysisRegion.x1) continue;61 if (source->peak->y > AnalysisRegion.y1) continue;56 // limit selection by analysis region 57 if (source->peak->x < AnalysisRegion.x0) continue; 58 if (source->peak->y < AnalysisRegion.y0) continue; 59 if (source->peak->x > AnalysisRegion.x1) continue; 60 if (source->peak->y > AnalysisRegion.y1) continue; 62 61 63 // replace object in image64 if (source->mode & PM_SOURCE_MODE_SUBTRACTED) {65 pmSourceAdd (source, PM_MODEL_OP_FULL, maskVal);66 }67 Next ++;62 // replace object in image 63 if (source->mode & PM_SOURCE_MODE_SUBTRACTED) { 64 pmSourceAdd (source, PM_MODEL_OP_FULL, maskVal); 65 } 66 Next ++; 68 67 69 68 // if we request any of these measurements, we require the radial profile 70 69 if (doPetrosian || doIsophotal || doAnnuli || doKron) { 71 if (!psphotRadialProfile (source, recipe, maskVal)) { 72 psError(PSPHOT_ERR_UNKNOWN, false, "failure to generate radial profile"); 73 return false; 74 } 70 if (!psphotRadialProfile (source, recipe, maskVal)) { 71 // all measurements below require the radial profile; skip them all 72 // re-subtract the object, leave local sky 73 psTrace ("psphot", 5, "failed to extract radial profile for source at %7.1f, %7.1f", source->moments->x, source->moments->y); 74 pmSourceSub (source, PM_MODEL_OP_FULL, maskVal); 75 source->mode |= PM_SOURCE_MODE_SUBTRACTED; 76 continue; 77 } 75 78 } 76 77 // XXX probably should not give up if we fail on any of the measurements unless it is due to78 // a programming error.79 79 80 80 // Isophotal Mags 81 81 if (doIsophotal) { 82 if (!psphotIsophotal (source, recipe, maskVal)) {83 psError(PSPHOT_ERR_UNKNOWN, false, "failure in Isophotal analysis");84 return false;85 }86 psTrace ("psphot", 5, "measure isophotal mags for source at %7.1f, %7.1f", source->moments->x, source->moments->y);87 Nisophot ++;82 if (!psphotIsophotal (source, recipe, maskVal)) { 83 psTrace ("psphot", 5, "failed to measure isophotal mags for source at %7.1f, %7.1f", source->moments->x, source->moments->y); 84 } else { 85 psTrace ("psphot", 5, "measured isophotal mags for source at %7.1f, %7.1f", source->moments->x, source->moments->y); 86 Nisophot ++; 87 } 88 88 } 89 89 90 90 // Petrosian Mags 91 91 if (doPetrosian) { 92 if (!psphotPetrosian (source, recipe, maskVal)) {93 psError(PSPHOT_ERR_UNKNOWN, false, "failure in Petrosian analysis");94 return false;95 }96 psTrace ("psphot", 5, "measured petrosian flux & radius for source at %7.1f, %7.1f", source->moments->x, source->moments->y);97 Npetro ++;92 if (!psphotPetrosian (source, recipe, maskVal)) { 93 psTrace ("psphot", 5, "measured petrosian flux & radius for source at %7.1f, %7.1f", source->moments->x, source->moments->y); 94 } else { 95 psTrace ("psphot", 5, "measured petrosian flux & radius for source at %7.1f, %7.1f", source->moments->x, source->moments->y); 96 Npetro ++; 97 } 98 98 } 99 99 100 100 // Kron Mags 101 101 if (doKron) { 102 if (!psphotKron (source, recipe, maskVal)) {103 psError(PSPHOT_ERR_UNKNOWN, false, "failure in Kron analysis");104 return false;105 }106 psTrace ("psphot", 5, "measure kron mags for source at %7.1f, %7.1f", source->moments->x, source->moments->y);107 Nkron ++;102 if (!psphotKron (source, recipe, maskVal)) { 103 psTrace ("psphot", 5, "failed to measure kron mags for source at %7.1f, %7.1f", source->moments->x, source->moments->y); 104 } else { 105 psTrace ("psphot", 5, "measure kron mags for source at %7.1f, %7.1f", source->moments->x, source->moments->y); 106 Nkron ++; 107 } 108 108 } 109 109 110 110 // Radial Annuli 111 111 if (doAnnuli) { 112 if (!psphotAnnuli (source, recipe, maskVal)) {113 psError(PSPHOT_ERR_UNKNOWN, false, "failure in Annuli analysis");114 return false;115 }116 psTrace ("psphot", 5, "measured annuli for source at %7.1f, %7.1f", source->moments->x, source->moments->y);117 Nannuli ++;112 if (!psphotAnnuli (source, recipe, maskVal)) { 113 psError(PSPHOT_ERR_UNKNOWN, false, "failure in Annuli analysis"); 114 return false; 115 } 116 psTrace ("psphot", 5, "measured annuli for source at %7.1f, %7.1f", source->moments->x, source->moments->y); 117 Nannuli ++; 118 118 } 119 119 120 // re-subtract the object, leave local sky121 pmSourceSub (source, PM_MODEL_OP_FULL, maskVal);122 source->mode |= PM_SOURCE_MODE_SUBTRACTED;120 // re-subtract the object, leave local sky 121 pmSourceSub (source, PM_MODEL_OP_FULL, maskVal); 122 source->mode |= PM_SOURCE_MODE_SUBTRACTED; 123 123 } 124 124
Note:
See TracChangeset
for help on using the changeset viewer.
