Changeset 37066 for branches/eam_branches/ipp-ops-20130712/psphot/src/psphotExtendedSourceAnalysis.c
- Timestamp:
- Jul 17, 2014, 12:30:45 PM (12 years ago)
- Location:
- branches/eam_branches/ipp-ops-20130712/psphot
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-ops-20130712/psphot
- Property svn:mergeinfo deleted
-
branches/eam_branches/ipp-ops-20130712/psphot/src
- Property svn:ignore
-
old new 24 24 psphotModelTest 25 25 psphotMinimal 26 psphotFullForce 27 psmakecff 28 psphotFullForceSummary
-
- Property svn:mergeinfo deleted
- Property svn:ignore
-
branches/eam_branches/ipp-ops-20130712/psphot/src/psphotExtendedSourceAnalysis.c
r34404 r37066 1 1 # include "psphotInternal.h" 2 3 // measure the elliptical radial profile and use this to measure the petrosian parameters for the sources 2 void psphotRadialProfileShowSkips (); 3 4 // measure the petrosian parameters for the sources 4 5 5 6 // for now, let's store the detections on the readout->analysis for each readout … … 15 16 psAssert (recipe, "missing recipe?"); 16 17 17 // perform full non-linear fits / extended source analysis? 18 if (!psMetadataLookupBool (&status, recipe, "EXTENDED_SOURCE_ANALYSIS")) { 18 bool doPetrosian = psMetadataLookupBool (&status, recipe, "EXTENDED_SOURCE_PETROSIAN"); 19 bool doAnnuli = psMetadataLookupBool (&status, recipe, "EXTENDED_SOURCE_ANNULI"); 20 21 // measure petrosians? 22 if (!doPetrosian && !doAnnuli) { 19 23 psLogMsg ("psphot", PS_LOG_INFO, "skipping extended source measurements\n"); 20 24 return true; … … 33 37 } 34 38 39 /*** for the moment, this test code : it is not thread safe ***/ 40 int Nall = 0; 41 int Nskip1 = 0; 42 int Nskip2 = 0; 43 int Nskip3 = 0; 44 int Nskip4 = 0; 45 int Nskip5 = 0; 46 int Nskip6 = 0; 47 48 # define SKIP(VALUE) { VALUE++; continue; } 49 35 50 // aperture-like measurements for extended sources 36 51 bool psphotExtendedSourceAnalysisReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe) { … … 110 125 111 126 // set this to 0 to run without threading 112 # if ( 1)127 # if (0) 113 128 if (!psThreadJobAddPending(job)) { 114 129 psError(PS_ERR_UNKNOWN, false, "Unable to guess model."); … … 164 179 psLogMsg ("psphot", PS_LOG_INFO, " %d annuli\n", Nannuli); 165 180 181 # if (PS_TRACE_ON) 182 fprintf (stderr, "ext analysis skipped @ 1 : %d\n", Nskip1); 183 fprintf (stderr, "ext analysis skipped @ 2 : %d\n", Nskip2); 184 fprintf (stderr, "ext analysis skipped @ 3 : %d\n", Nskip3); 185 fprintf (stderr, "ext analysis skipped @ 4 : %d\n", Nskip4); 186 fprintf (stderr, "ext analysis skipped @ 5 : %d\n", Nskip5); 187 fprintf (stderr, "ext analysis skipped @ 6 : %d\n", Nskip6); 188 #endif 189 190 psphotRadialProfileShowSkips (); 191 166 192 psphotVisualShowResidualImage (readout, false); 167 193 168 bool doPetrosian = psMetadataLookupBool (&status, recipe, "EXTENDED_SOURCE_PETROSIAN"); 169 if (doPetrosian) { 170 psphotVisualShowPetrosians (sources); 171 } 194 psphotVisualShowPetrosians (sources); 172 195 173 196 return true; … … 190 213 float skynoise = PS_SCALAR_VALUE(job->args->data[4],F32); 191 214 192 // S/N limit to perform full non-linear fits193 float SN_LIM = psMetadataLookupF32 (&status, recipe, "EXTENDED_SOURCE_SN_LIM");194 195 // which extended source analyses should we perform?196 215 bool doPetrosian = psMetadataLookupBool (&status, recipe, "EXTENDED_SOURCE_PETROSIAN"); 197 bool doAnnuli = psMetadataLookupBool (&status, recipe, "EXTENDED_SOURCE_ANNULI");198 bool doPetroStars = psMetadataLookupBool (&status, recipe, "PETROSIAN_FOR_STARS");199 216 200 217 // user-defined masks to test for good/bad pixels (build from recipe list if not yet set) … … 207 224 pmSource *source = sources->data[i]; 208 225 209 // if we have checked the source validity on the basis of the object set, then 210 // we either skip these tests below or we skip the source completely 211 if (source->tmpFlags & PM_SOURCE_TMPF_PETRO_SKIP) continue; 212 if (source->tmpFlags & PM_SOURCE_TMPF_PETRO_KEEP) goto keepSource; 213 214 // skip PSF-like and non-astronomical objects 215 if (source->type == PM_SOURCE_TYPE_DEFECT) continue; 216 if (source->type == PM_SOURCE_TYPE_SATURATED) continue; 217 if (source->mode & PM_SOURCE_MODE_DEFECT) continue; 218 if (source->mode & PM_SOURCE_MODE_SATSTAR) continue; 219 220 // skip saturated stars modeled with a radial profile 221 if (source->mode2 & PM_SOURCE_MODE2_SATSTAR_PROFILE) continue; 222 223 // optionally allow non-extended objects to get petrosians as well 224 if (!doPetroStars) { 225 if (!(source->mode & PM_SOURCE_MODE_EXT_LIMIT)) continue; 226 if (source->type == PM_SOURCE_TYPE_STAR) continue; 227 } 228 229 // limit selection to some SN limit 230 // assert (source->peak); // how can a source not have a peak? 231 // limit selection to some SN limit 232 bool skipSource = false; 233 if (source->mode & PM_SOURCE_MODE_EXT_LIMIT) { 234 skipSource = (source->moments->KronFlux < SN_LIM * source->moments->KronFluxErr); 235 } else { 236 skipSource = (sqrt(source->peak->detValue) < SN_LIM); 237 } 238 if (skipSource) continue; 239 240 // limit selection by analysis region (this automatically apply 241 if (source->peak->x < region->x0) continue; 242 if (source->peak->y < region->y0) continue; 243 if (source->peak->x > region->x1) continue; 244 if (source->peak->y > region->y1) continue; 245 246 keepSource: 226 Nall ++; 227 228 // rules for measuring petrosian parameters for specific objects are set in 229 // psphotChooseAnalysisOptions.c 230 if (!(source->tmpFlags & PM_SOURCE_TMPF_PETRO)) SKIP (Nskip1); 231 232 // limit selection by analysis region (XXX move this into psphotChooseAnalysisOption?) 233 if (source->peak->x < region->x0) SKIP (Nskip2); 234 if (source->peak->y < region->y0) SKIP (Nskip3); 235 if (source->peak->x > region->x1) SKIP (Nskip4); 236 if (source->peak->y > region->y1) SKIP (Nskip5); 247 237 248 238 // replace object in image … … 259 249 pmSourceRedefinePixels (source, readout, source->peak->xf, source->peak->yf, 1.5*radius); 260 250 261 // if we request any of these measurements, we require the radial profile 262 if (doPetrosian || doAnnuli) { 263 if (!psphotRadialProfile (source, recipe, skynoise, maskVal)) { 264 // all measurements below require the radial profile; skip them all 265 // re-subtract the object, leave local sky 266 psTrace ("psphot", 5, "failed to extract radial profile for source at %7.1f, %7.1f", source->moments->Mx, source->moments->My); 267 pmSourceSub (source, PM_MODEL_OP_FULL, maskVal); 268 continue; 269 } 270 Nannuli ++; 271 source->mode |= PM_SOURCE_MODE_RADIAL_FLUX; 272 } 251 // measure the radial profile 252 if (!psphotRadialProfile (source, recipe, skynoise, maskVal)) { 253 // re-subtract the object, leave local sky 254 psTrace ("psphot", 5, "failed to extract radial profile for source at %7.1f, %7.1f", source->moments->Mx, source->moments->My); 255 pmSourceSub (source, PM_MODEL_OP_FULL, maskVal); 256 SKIP (Nskip6); 257 } 258 259 Nannuli ++; 260 source->mode |= PM_SOURCE_MODE_RADIAL_FLUX; 273 261 274 262 // Petrosian Mags 275 263 if (doPetrosian) { 276 if (!psphotPetrosian (source, recipe, skynoise, maskVal)) {277 psTrace ("psphot", 5, "FAILED petrosian flux & radius for source at %7.1f, %7.1f", source->moments->Mx, source->moments->My);278 } else {279 psTrace ("psphot", 5, "measured petrosian flux & radius for source at %7.1f, %7.1f", source->moments->Mx, source->moments->My);280 Npetro ++;281 source->mode |= PM_SOURCE_MODE_EXTENDED_STATS;282 }264 if (!psphotPetrosian (source, recipe, skynoise, maskVal)) { 265 psTrace ("psphot", 5, "FAILED petrosian flux & radius for source at %7.1f, %7.1f", source->moments->Mx, source->moments->My); 266 } else { 267 psTrace ("psphot", 5, "measured petrosian flux & radius for source at %7.1f, %7.1f", source->moments->Mx, source->moments->My); 268 Npetro ++; 269 source->mode |= PM_SOURCE_MODE_EXTENDED_STATS; 270 } 283 271 } 284 272
Note:
See TracChangeset
for help on using the changeset viewer.
