Changeset 34215
- Timestamp:
- Jul 27, 2012, 11:28:57 AM (14 years ago)
- Location:
- trunk/psphot/src
- Files:
-
- 9 edited
-
psphot.h (modified) (1 diff)
-
psphotEfficiency.c (modified) (1 diff)
-
psphotFitSourcesLinear.c (modified) (6 diffs)
-
psphotForcedReadout.c (modified) (1 diff)
-
psphotReadout.c (modified) (4 diffs)
-
psphotReadoutForcedKnownSources.c (modified) (1 diff)
-
psphotReadoutKnownSources.c (modified) (1 diff)
-
psphotReadoutMinimal.c (modified) (1 diff)
-
psphotStackReadout.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src/psphot.h
r34136 r34215 101 101 bool psphotMergeSourcesReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index); 102 102 103 bool psphotFitSourcesLinear (pmConfig *config, const pmFPAview *view, const char *filerule, bool final );104 bool psphotFitSourcesLinearReadout (psMetadata *recipe, pmReadout *readout, psArray *sources, pmPSF *psf, bool final, pmSourceFitVarMode fitVarMode );103 bool psphotFitSourcesLinear (pmConfig *config, const pmFPAview *view, const char *filerule, bool final, bool skipNegativeFluxSources); 104 bool psphotFitSourcesLinearReadout (psMetadata *recipe, pmReadout *readout, psArray *sources, pmPSF *psf, bool final, pmSourceFitVarMode fitVarMode, bool skipNegativeFluxSources); 105 105 106 106 bool psphotSourceSize (pmConfig *config, const pmFPAview *view, const char *filerule, bool getPSFsize); -
trunk/psphot/src/psphotEfficiency.c
r34086 r34215 420 420 421 421 // psphotFitSourcesLinearReadout subtracts the model fits 422 if (!psphotFitSourcesLinearReadout(recipe, readout, fakeSourcesAll, psf, true, PM_SOURCE_PHOTFIT_CONST )) {422 if (!psphotFitSourcesLinearReadout(recipe, readout, fakeSourcesAll, psf, true, PM_SOURCE_PHOTFIT_CONST, false)) { 423 423 psError(PS_ERR_UNKNOWN, false, "Unable to perform linear fit on fake sources."); 424 424 psFree(fakeSources); -
trunk/psphot/src/psphotFitSourcesLinear.c
r34136 r34215 13 13 14 14 // for now, let's store the detections on the readout->analysis for each readout 15 bool psphotFitSourcesLinear (pmConfig *config, const pmFPAview *view, const char *filerule, bool final )15 bool psphotFitSourcesLinear (pmConfig *config, const pmFPAview *view, const char *filerule, bool final, bool skipNegativeFluxSources) 16 16 { 17 17 bool status = true; … … 66 66 psAssert (psf, "missing psf?"); 67 67 68 if (!psphotFitSourcesLinearReadout (recipe, readout, sources, psf, final, fitVarModePass1 )) {68 if (!psphotFitSourcesLinearReadout (recipe, readout, sources, psf, final, fitVarModePass1, skipNegativeFluxSources)) { 69 69 psError (PSPHOT_ERR_CONFIG, false, "failed to fit sources (linear) for %s entry %d", filerule, i); 70 70 return false; … … 85 85 86 86 // rerun fit with correct fitVarMode 87 if (!psphotFitSourcesLinearReadout (recipe, readout, sources, psf, final, fitVarMode)) { 87 // XXX: does skipNegativeFlux work here? 88 if (!psphotFitSourcesLinearReadout (recipe, readout, sources, psf, final, fitVarMode, skipNegativeFluxSources)) { 88 89 psError (PSPHOT_ERR_CONFIG, false, "failed to fit sources (linear) for %s entry %d", filerule, i); 89 90 return false; … … 136 137 } 137 138 138 bool psphotFitSourcesLinearReadout (psMetadata *recipe, pmReadout *readout, psArray *sources, pmPSF *psf, bool final, pmSourceFitVarMode fitVarMode ) {139 bool psphotFitSourcesLinearReadout (psMetadata *recipe, pmReadout *readout, psArray *sources, pmPSF *psf, bool final, pmSourceFitVarMode fitVarMode, bool skipNegativeFluxSources) { 139 140 bool status; 140 141 float x; … … 183 184 float MIN_VALID_FLUX = psMetadataLookupF32(&status, recipe, "PSF_FIT_MIN_VALID_FLUX"); 184 185 if (!status) { 186 MIN_VALID_FLUX = 0.0; 187 } 188 if (skipNegativeFluxSources && MIN_VALID_FLUX < 0) { 185 189 MIN_VALID_FLUX = 0.0; 186 190 } … … 258 262 if (modelSum < 0.5) continue; // skip sources with no model constraint (somewhat arbitrary limit) 259 263 if (modelSum < 0.8) { 260 fprintf (stderr, "low-sig model @ %f, %f (%f masked sum, %f sum, %f peak)\n",264 psLogMsg ("psphot.ensemble", PS_LOG_MINUTIA, "low-sig model @ %f, %f (%f masked sum, %f sum, %f peak)\n", 261 265 source->peak->xf, source->peak->yf, maskedSum, modelSum, source->peak->rawFlux); 262 266 } 263 267 if (maskedSum < 0.5) { 264 fprintf (stderr, "worrying model @ %f, %f (%f masked sum, %f sum, %f peak)\n",268 psLogMsg ("psphot.ensemble", PS_LOG_MINUTIA, "worrying model @ %f, %f (%f masked sum, %f sum, %f peak)\n", 265 269 source->peak->xf, source->peak->yf, maskedSum, modelSum, source->peak->rawFlux); 266 270 } -
trunk/psphot/src/psphotForcedReadout.c
r33140 r34215 64 64 65 65 // linear PSF fit to source peaks, subtract the models from the image (in PSF mask) 66 psphotFitSourcesLinear (config, view, filerule, false );66 psphotFitSourcesLinear (config, view, filerule, false, false); 67 67 68 68 // identify CRs and extended sources -
trunk/psphot/src/psphotReadout.c
r34086 r34215 185 185 186 186 // linear PSF fit to source peaks, subtract the models from the image (in PSF mask) 187 psphotFitSourcesLinear (config, view, filerule, false ); // pass 1 (detections->allSources)187 psphotFitSourcesLinear (config, view, filerule, false, false); // pass 1 (detections->allSources) 188 188 189 189 // measure the radial profiles to the sky … … 212 212 // linear fit to include all sources (subtract again) 213 213 // NOTE : apply to ALL sources (extended + psf) 214 psphotFitSourcesLinear (config, view, filerule, true ); // pass 2 (detections->allSources)214 psphotFitSourcesLinear (config, view, filerule, true, false); // pass 2 (detections->allSources) 215 215 216 216 // if we only do one pass, skip to extended source analysis … … 261 261 262 262 // NOTE: apply to ALL sources 263 psphotFitSourcesLinear (config, view, filerule, true ); // pass 3 (detections->allSources)263 psphotFitSourcesLinear (config, view, filerule, true, false); // pass 3 (detections->allSources) 264 264 } 265 265 … … 302 302 303 303 // NOTE: apply to ALL sources 304 psphotFitSourcesLinear (config, view, filerule, true ); // pass 3 (detections->allSources)304 psphotFitSourcesLinear (config, view, filerule, true, false); // pass 3 (detections->allSources) 305 305 } 306 306 -
trunk/psphot/src/psphotReadoutForcedKnownSources.c
r32996 r34215 45 45 46 46 // linear PSF fit to source peaks 47 psphotFitSourcesLinear (config, view, filerule, false );47 psphotFitSourcesLinear (config, view, filerule, false, false); 48 48 49 49 // calculate source magnitudes -
trunk/psphot/src/psphotReadoutKnownSources.c
r33692 r34215 57 57 58 58 // linear PSF fit to source peaks 59 psphotFitSourcesLinear (config, view, filerule, false );59 psphotFitSourcesLinear (config, view, filerule, false, false); 60 60 61 61 // measure aperture photometry corrections -
trunk/psphot/src/psphotReadoutMinimal.c
r33842 r34215 70 70 71 71 // linear PSF fit to source peaks 72 psphotFitSourcesLinear (config, view, filerule, false );72 psphotFitSourcesLinear (config, view, filerule, false, false); 73 73 74 74 // XXX eventually, add the extended source fits here -
trunk/psphot/src/psphotStackReadout.c
r34135 r34215 187 187 188 188 // linear PSF fit to source peaks, subtract the models from the image (in PSF mask) 189 psphotFitSourcesLinear (config, view, STACK_SRC, false );189 psphotFitSourcesLinear (config, view, STACK_SRC, false, false); 190 190 psphotStackVisualFilerule(config, view, STACK_SRC); 191 191 … … 215 215 // NOTE : apply to ALL sources (extended + psf) 216 216 // NOTE 2 : this function subtracts the models from the given filerule (SRC), not DET 217 psphotFitSourcesLinear (config, view, STACK_SRC, true ); // pass 2 (detections->allSources)217 psphotFitSourcesLinear (config, view, STACK_SRC, true, false); // pass 2 (detections->allSources) 218 218 219 219 // NOTE: possibly re-measure background model here with objects subtracted / or masked … … 288 288 pass1finish: 289 289 290 #ifdef notyet 291 // Split the fit of detected sources from matched sources. But not yet. 292 // NOTE: apply to ALL sources. Only include sources with postitive flux in the fit 293 psphotFitSourcesLinear (config, view, STACK_SRC, true, true); // pass 3 (detections->allSources) 294 #endif 295 290 296 // generate the objects (objects unify the sources from the different images) NOTE: could 291 297 // this just match the detections for the chisq image, and not bother measuring the source … … 302 308 psphotStackObjectsSelectForAnalysis (config, view, STACK_SRC, objects); 303 309 304 // NOTE: apply to ALL sources 305 psphotFitSourcesLinear (config, view, STACK_SRC, true); // pass 3 (detections->allSources) 310 #ifdef notyet 311 // NOTE: apply to Matched sources. Since the sources that we fit above are subtracted, they will 312 // not be included in this fit. 313 psphotFitSourcesLinear (config, view, STACK_SRC, true, false); // pass 4 (detections->allSources) 314 #else 315 psphotFitSourcesLinear (config, view, STACK_SRC, true, false); // pass 3 (detections->allSources) 316 #endif 306 317 307 318 // measure the radial profiles to the sky (only measures new objects) … … 369 380 370 381 // this is necessary to get the right normalization for the new models 371 psphotFitSourcesLinear (config, view, STACK_OUT, false );382 psphotFitSourcesLinear (config, view, STACK_OUT, false, false); 372 383 373 384 // measure circular, radial apertures (objects sorted by S/N)
Note:
See TracChangeset
for help on using the changeset viewer.
