- Timestamp:
- Sep 5, 2011, 9:02:13 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20110710/psphot/src/psphotRadialApertures.c
r32238 r32322 3 3 bool psphotRadialAperturesSortFlux (psVector *radius, psVector *pixFlux, psVector *pixVar); 4 4 5 // this function measures the radial aperture fluxes for the set of readouts. this function 6 // may be called multiple times, presumably for different versions of PSF-matched or unmatched images. 7 5 8 // for now, let's store the detections on the readout->analysis for each readout 6 bool psphotRadialApertures (pmConfig *config, const pmFPAview *view, const char *filerule )9 bool psphotRadialApertures (pmConfig *config, const pmFPAview *view, const char *filerule, int entry) 7 10 { 8 11 bool status = true; 12 13 fprintf (stdout, "\n"); 14 psLogMsg ("psphot", PS_LOG_INFO, "--- psphot Radial Apertures ---"); 9 15 10 16 // select the appropriate recipe information … … 22 28 // loop over the available readouts 23 29 for (int i = 0; i < num; i++) { 24 if (!psphotRadialAperturesReadout (config, view, filerule, i, recipe )) {30 if (!psphotRadialAperturesReadout (config, view, filerule, i, recipe, entry)) { 25 31 psError (PSPHOT_ERR_CONFIG, false, "failed on measure extended source aperture-like parameters for %s entry %d", filerule, i); 26 32 return false; … … 32 38 // aperture-like measurements for extended sources 33 39 // flux in simple, circular apertures 34 bool psphotRadialAperturesReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe) { 40 // 'entry' tells us which of the matched-PSF images we are working on (0 == unmatched image, also non-stack psphot) 41 bool psphotRadialAperturesReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe, int entry) { 35 42 36 43 bool status; … … 72 79 // XXX are we getting the objects out of order? does it matter? 73 80 sources = psArraySort (sources, pmSourceSortByFlux); 81 82 // XXX make this consistent with entry 0 == unmatched 83 int nEntry = 1; 84 psVector *fwhmValues = psMetadataLookupVector(&status, readout->analysis, "STACK.PSF.FWHM.VALUES"); 85 if (fwhmValues) { 86 psAssert (entry < fwhmValues->n, "inconsistent matched-PSF entry"); 87 nEntry = fwhmValues->n; 88 } 89 if (entry > 0) { 90 psLogMsg ("psphot", PS_LOG_DETAIL, "Radial Apertures for matched image %s : PSF FWHM = %f pixels\n", file->name, fwhmValues->data.F32[entry]); 91 } else { 92 psLogMsg ("psphot", PS_LOG_DETAIL, "Radial Apertures for unmatched image %s\n", file->name); 93 } 74 94 75 95 // option to limit analysis to a specific region … … 98 118 psArrayAdd(job->args, 1, AnalysisRegion); 99 119 psArrayAdd(job->args, 1, recipe); 120 121 PS_ARRAY_ADD_SCALAR(job->args, entry, PS_TYPE_S32); 122 PS_ARRAY_ADD_SCALAR(job->args, nEntry, PS_TYPE_S32); 100 123 101 124 PS_ARRAY_ADD_SCALAR(job->args, 0, PS_TYPE_S32); // this is used as a return value for Nradial … … 115 138 } 116 139 psScalar *scalar = NULL; 117 scalar = job->args->data[ 4];140 scalar = job->args->data[6]; 118 141 Nradial += scalar->data.S32; 119 142 psFree(job); … … 135 158 } else { 136 159 psScalar *scalar = NULL; 137 scalar = job->args->data[ 4];160 scalar = job->args->data[6]; 138 161 Nradial += scalar->data.S32; 139 162 } … … 159 182 psMetadata *recipe = job->args->data[3]; 160 183 184 int entry = PS_SCALAR_VALUE(job->args->data[4],S32); // which psf-matched image are we working on? (0 == unmatched) 185 int nEntry = PS_SCALAR_VALUE(job->args->data[5],S32); // total number of psf-matched images + 1 unmatched 186 161 187 // radMax stores the upper bounds of the annuli 162 188 // XXX keep the same name here as for the petrosian / elliptical apertures? … … 198 224 199 225 // allocate pmSourceExtendedParameters, if not already defined 200 if (!source->radialAper) { 201 source->radialAper = psArrayAlloc(1); 226 // XXX check that nPSFsizes is consistent with targets 227 if (source->parent) { 228 if (!source->parent->radialAper) { 229 source->parent->radialAper = psArrayAlloc(nEntry); 230 } 231 } else { 232 if (!source->radialAper) { 233 source->radialAper = psArrayAlloc(nEntry); 234 } 202 235 } 203 236 … … 219 252 pmSourceRedefinePixels (source, readout, source->peak->xf, source->peak->yf, outerRadius + 2); 220 253 221 if (!psphotRadialApertureSource (source, recipe, maskVal, radMax, 0)) {254 if (!psphotRadialApertureSource (source, recipe, maskVal, radMax, entry)) { 222 255 psTrace ("psphot", 5, "failed to extract radial profile for source at %7.1f, %7.1f", source->moments->Mx, source->moments->My); 223 256 } else { … … 233 266 pmSourceSub (source, PM_MODEL_OP_FULL, maskVal); 234 267 } 235 psScalar *scalar = job->args->data[ 4];268 psScalar *scalar = job->args->data[6]; 236 269 scalar->data.S32 = Nradial; 237 270
Note:
See TracChangeset
for help on using the changeset viewer.
