Changeset 32348 for trunk/psphot/src/psphotStackObjects.c
- Timestamp:
- Sep 6, 2011, 1:32:31 PM (15 years ago)
- Location:
- trunk/psphot
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot
-
trunk/psphot/src
- Property svn:ignore
-
old new 22 22 psphotMakePSF 23 23 psphotStack 24 psphotModelTest
-
- Property svn:ignore
-
trunk/psphot/src/psphotStackObjects.c
r28013 r32348 47 47 return true; 48 48 } 49 50 // mark good vs bad objects 51 bool psphotStackObjectsSelectForAnalysis (pmConfig *config, const pmFPAview *view, const char *filerule, psArray *objects) { 52 53 bool status = false; 54 55 // find the currently selected readout 56 pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, 0); // use the 0-index image to represent the image area 57 psAssert (file, "missing file?"); 58 59 pmReadout *readout = pmFPAviewThisReadout(view, file->fpa); 60 psAssert (readout, "missing readout?"); 61 62 // select the appropriate recipe information 63 psMetadata *recipe = psMetadataLookupPtr (&status, config->recipes, PSPHOT_RECIPE); 64 psAssert (recipe, "missing recipe?"); 65 66 // option to limit analysis to a specific region 67 char *region = psMetadataLookupStr (&status, recipe, "ANALYSIS_REGION"); 68 psRegion AnalysisRegion = psRegionForImage (readout->image, psRegionFromString (region)); 69 if (psRegionIsNaN (AnalysisRegion)) psAbort("analysis region mis-defined"); 70 71 // S/N limit to perform full non-linear fits 72 float SN_LIM = psMetadataLookupF32 (&status, recipe, "EXTENDED_SOURCE_SN_LIM"); 73 74 bool doPetroStars = psMetadataLookupBool (&status, recipe, "PETROSIAN_FOR_STARS"); 75 76 for (int i = 0; i < objects->n; i++) { 77 pmPhotObj *object = objects->data[i]; 78 if (!object) continue; 79 if (!object->sources) continue; 80 81 // we check each source for an object and keep the object if any source is valid 82 83 bool keepObject = false; 84 for (int j = 0; j < object->sources->n; j++) { 85 86 pmSource *source = object->sources->data[j]; 87 if (!source) continue; 88 if (!source->peak) continue; 89 90 // skip PSF-like and non-astronomical objects 91 if (source->type == PM_SOURCE_TYPE_DEFECT) continue; 92 if (source->type == PM_SOURCE_TYPE_SATURATED) continue; 93 if (source->mode & PM_SOURCE_MODE_DEFECT) continue; 94 if (source->mode & PM_SOURCE_MODE_SATSTAR) continue; 95 96 // optionally allow non-extended objects to get petrosians as well 97 if (!doPetroStars) { 98 if (!(source->mode & PM_SOURCE_MODE_EXT_LIMIT)) continue; 99 if (source->type == PM_SOURCE_TYPE_STAR) continue; 100 } 101 102 // limit selection to some SN limit 103 // assert (source->peak); // how can a source not have a peak? 104 // limit selection to some SN limit 105 bool skipSource = false; 106 if (source->mode & PM_SOURCE_MODE_EXT_LIMIT) { 107 skipSource = (source->moments->KronFlux < SN_LIM * source->moments->KronFluxErr); 108 } else { 109 skipSource = (sqrt(source->peak->detValue) < SN_LIM); 110 } 111 if (skipSource) continue; 112 113 // limit selection by analysis region (this automatically apply 114 if (source->peak->x < AnalysisRegion.x0) continue; 115 if (source->peak->y < AnalysisRegion.y0) continue; 116 if (source->peak->x > AnalysisRegion.x1) continue; 117 if (source->peak->y > AnalysisRegion.y1) continue; 118 119 keepObject = true; 120 } 121 122 for (int j = 0; j < object->sources->n; j++) { 123 pmSource *source = object->sources->data[j]; 124 if (!source) continue; 125 if (!source->peak) continue; 126 127 // we have to set a bit in either case to tell psphotExtendedSourceAnalysis to 128 // avoid the single-detection tests 129 130 if (keepObject) { 131 source->tmpFlags |= PM_SOURCE_TMPF_STACK_KEEP; 132 source->tmpFlags &= ~PM_SOURCE_TMPF_STACK_SKIP; 133 } else { 134 source->tmpFlags |= PM_SOURCE_TMPF_STACK_SKIP; 135 source->tmpFlags &= ~PM_SOURCE_TMPF_STACK_KEEP; 136 } 137 } 138 } 139 140 psLogMsg ("psphot", PS_LOG_INFO, "marked good vs bad objects\n"); 141 return true; 142 }
Note:
See TracChangeset
for help on using the changeset viewer.
