Changeset 13900 for trunk/psphot/src/psphotBlendFit.c
- Timestamp:
- Jun 19, 2007, 4:40:44 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/psphot/src/psphotBlendFit.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src/psphotBlendFit.c
r13035 r13900 2 2 3 3 // XXX I don't like this name 4 bool psphotBlendFit (pmReadout *readout, psArray *sources, psMetadata *recipe, pmPSF *psf ) {4 bool psphotBlendFit (pmReadout *readout, psArray *sources, psMetadata *recipe, pmPSF *psf, psMaskType maskVal) { 5 5 6 6 int Nfit = 0; … … 14 14 // source analysis is done in S/N order (brightest first) 15 15 sources = psArraySort (sources, pmSourceSortBySN); 16 16 17 17 // S/N limit to perform full non-linear fits 18 18 float FIT_SN_LIM = psMetadataLookupF32 (&status, recipe, "FULL_FIT_SN_LIM"); … … 30 30 31 31 for (int i = 0; i < sources->n; i++) { 32 // if (i%100 == 0) psphotFitSummary ();32 // if (i%100 == 0) psphotFitSummary (); 33 33 34 pmSource *source = sources->data[i];34 pmSource *source = sources->data[i]; 35 35 36 // skip non-astronomical objects (very likely defects)37 if (source->mode & PM_SOURCE_MODE_BLEND) continue;38 if (source->type == PM_SOURCE_TYPE_DEFECT) continue; 39 if (source->type == PM_SOURCE_TYPE_SATURATED) continue;36 // skip non-astronomical objects (very likely defects) 37 if (source->mode & PM_SOURCE_MODE_BLEND) continue; 38 if (source->type == PM_SOURCE_TYPE_DEFECT) continue; 39 if (source->type == PM_SOURCE_TYPE_SATURATED) continue; 40 40 41 // skip DBL second sources (ie, added by psphotFitBlob)42 if (source->mode & PM_SOURCE_MODE_PAIR) continue;41 // skip DBL second sources (ie, added by psphotFitBlob) 42 if (source->mode & PM_SOURCE_MODE_PAIR) continue; 43 43 44 // limit selection to some SN limit45 // XXX this should use peak?46 if (source->moments == NULL) continue;47 if (source->moments->SN < FIT_SN_LIM) continue;44 // limit selection to some SN limit 45 // XXX this should use peak? 46 if (source->moments == NULL) continue; 47 if (source->moments->SN < FIT_SN_LIM) continue; 48 48 49 // XXX this should use peak?50 if (source->moments->x < AnalysisRegion.x0) continue;51 if (source->moments->y < AnalysisRegion.y0) continue;52 if (source->moments->x > AnalysisRegion.x1) continue;53 if (source->moments->y > AnalysisRegion.y1) continue;49 // XXX this should use peak? 50 if (source->moments->x < AnalysisRegion.x0) continue; 51 if (source->moments->y < AnalysisRegion.y0) continue; 52 if (source->moments->x > AnalysisRegion.x1) continue; 53 if (source->moments->y > AnalysisRegion.y1) continue; 54 54 55 // if model is NULL, we don't have a starting guess56 if (source->modelPSF == NULL) continue;55 // if model is NULL, we don't have a starting guess 56 if (source->modelPSF == NULL) continue; 57 57 58 // skip sources which are insignificant flux?59 if (source->modelPSF->params->data.F32[1] < 0.1) {60 psTrace ("psphot", 5, "skipping near-zero source: %f, %f : %f\n",61 source->modelPSF->params->data.F32[1],62 source->modelPSF->params->data.F32[2],63 source->modelPSF->params->data.F32[3]);64 continue;65 }58 // skip sources which are insignificant flux? 59 if (source->modelPSF->params->data.F32[1] < 0.1) { 60 psTrace ("psphot", 5, "skipping near-zero source: %f, %f : %f\n", 61 source->modelPSF->params->data.F32[1], 62 source->modelPSF->params->data.F32[2], 63 source->modelPSF->params->data.F32[3]); 64 continue; 65 } 66 66 67 // replace object in image68 if (source->mode & PM_SOURCE_MODE_SUBTRACTED) {69 pmSourceAdd (source, PM_MODEL_OP_FULL);70 }71 Nfit ++;67 // replace object in image 68 if (source->mode & PM_SOURCE_MODE_SUBTRACTED) { 69 pmSourceAdd (source, PM_MODEL_OP_FULL, maskVal); 70 } 71 Nfit ++; 72 72 73 // try fitting PSFs, then try extended sources74 // these functions subtract the resulting fitted source (XXX and update the modelFlux?)75 if (psphotFitBlend (readout, source, psf)) { 76 psTrace ("psphot", 5, "source at %7.1f, %7.1f is psf", source->moments->x, source->moments->y);77 Npsf ++;78 continue;79 }80 if (psphotFitBlob (readout, source, sources, psf)) {81 psTrace ("psphot", 5, "source at %7.1f, %7.1f is ext", source->moments->x, source->moments->y);82 Next ++;83 continue;84 }73 // try fitting PSFs, then try extended sources 74 // these functions subtract the resulting fitted source (XXX and update the modelFlux?) 75 if (psphotFitBlend (readout, source, psf, maskVal)) { 76 psTrace ("psphot", 5, "source at %7.1f, %7.1f is psf", source->moments->x, source->moments->y); 77 Npsf ++; 78 continue; 79 } 80 if (psphotFitBlob (readout, source, sources, psf, maskVal)) { 81 psTrace ("psphot", 5, "source at %7.1f, %7.1f is ext", source->moments->x, source->moments->y); 82 Next ++; 83 continue; 84 } 85 85 86 psTrace ("psphot", 5, "source at %7.1f, %7.1f failed", source->moments->x, source->moments->y);87 Nfail ++;86 psTrace ("psphot", 5, "source at %7.1f, %7.1f failed", source->moments->x, source->moments->y); 87 Nfail ++; 88 88 89 // re-subtract the object, leave local sky90 pmSourceCacheModel (source);91 pmSourceSub (source, PM_MODEL_OP_FULL);92 source->mode |= PM_SOURCE_MODE_SUBTRACTED;93 source->mode |= PM_SOURCE_MODE_TEMPSUB;89 // re-subtract the object, leave local sky 90 pmSourceCacheModel (source, maskVal); 91 pmSourceSub (source, PM_MODEL_OP_FULL, maskVal); 92 source->mode |= PM_SOURCE_MODE_SUBTRACTED; 93 source->mode |= PM_SOURCE_MODE_TEMPSUB; 94 94 } 95 95
Note:
See TracChangeset
for help on using the changeset viewer.
