- Timestamp:
- Mar 5, 2012, 5:19:48 PM (14 years ago)
- Location:
- branches/meh_branches/ppstack_test
- Files:
-
- 4 edited
-
. (modified) (1 prop)
-
psphot (modified) (1 prop)
-
psphot/src (modified) (2 props)
-
psphot/src/psphotStackObjects.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/meh_branches/ppstack_test
- Property svn:mergeinfo changed
-
branches/meh_branches/ppstack_test/psphot
- Property svn:mergeinfo changed
-
branches/meh_branches/ppstack_test/psphot/src
- Property svn:ignore
-
old new 22 22 psphotMakePSF 23 23 psphotStack 24 psphotModelTest
-
- Property svn:mergeinfo set to
- Property svn:ignore
-
branches/meh_branches/ppstack_test/psphot/src/psphotStackObjects.c
r28013 r33415 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_PETRO = psMetadataLookupF32 (&status, recipe, "EXTENDED_SOURCE_SN_LIM"); 73 float SN_LIM_RADIAL = psMetadataLookupF32 (&status, recipe, "RADIAL_APERTURES_SN_LIM"); 74 75 bool doPetroStars = psMetadataLookupBool (&status, recipe, "PETROSIAN_FOR_STARS"); 76 77 for (int i = 0; i < objects->n; i++) { 78 pmPhotObj *object = objects->data[i]; 79 if (!object) continue; 80 if (!object->sources) continue; 81 82 // we check each source for an object and keep the object if any source is valid 83 84 bool keepObjectRadial = false; 85 bool keepObjectPetro = false; 86 for (int j = 0; j < object->sources->n; j++) { 87 88 pmSource *source = object->sources->data[j]; 89 if (!source) continue; 90 if (!source->peak) continue; 91 92 // skip PSF-like and non-astronomical objects 93 if (source->type == PM_SOURCE_TYPE_DEFECT) continue; 94 if (source->type == PM_SOURCE_TYPE_SATURATED) continue; 95 if (source->mode & PM_SOURCE_MODE_DEFECT) continue; 96 if (source->mode & PM_SOURCE_MODE_SATSTAR) continue; 97 98 // limit selection by analysis region (this automatically apply 99 if (source->peak->x < AnalysisRegion.x0) continue; 100 if (source->peak->y < AnalysisRegion.y0) continue; 101 if (source->peak->x > AnalysisRegion.x1) continue; 102 if (source->peak->y > AnalysisRegion.y1) continue; 103 104 // SN limit tests for RADIAL APERTURES: 105 bool skipSourceRadial = false; 106 if (source->mode & PM_SOURCE_MODE_EXT_LIMIT) { 107 skipSourceRadial = (source->moments->KronFlux < SN_LIM_RADIAL * source->moments->KronFluxErr); 108 } else { 109 skipSourceRadial = (sqrt(source->peak->detValue) < SN_LIM_RADIAL); 110 } 111 if (!skipSourceRadial) keepObjectRadial = true; 112 113 // SN limit tests for PETRO 114 bool skipSourcePetro = false; 115 if (source->mode & PM_SOURCE_MODE_EXT_LIMIT) { 116 skipSourcePetro = (source->moments->KronFlux < SN_LIM_PETRO * source->moments->KronFluxErr); 117 } else { 118 skipSourcePetro = doPetroStars ? (sqrt(source->peak->detValue) < SN_LIM_PETRO) : true; 119 } 120 if (!skipSourcePetro) keepObjectPetro = true; 121 122 keepObjectPetro = true; 123 } 124 125 for (int j = 0; j < object->sources->n; j++) { 126 pmSource *source = object->sources->data[j]; 127 if (!source) continue; 128 if (!source->peak) continue; 129 130 // we have to set a bit in either case to tell psphotExtendedSourceAnalysis to 131 // avoid the single-detection tests 132 133 if (keepObjectPetro) { 134 source->tmpFlags |= PM_SOURCE_TMPF_PETRO_KEEP; 135 source->tmpFlags &= ~PM_SOURCE_TMPF_PETRO_SKIP; 136 } else { 137 source->tmpFlags |= PM_SOURCE_TMPF_PETRO_SKIP; 138 source->tmpFlags &= ~PM_SOURCE_TMPF_PETRO_KEEP; 139 } 140 141 if (keepObjectRadial) { 142 source->tmpFlags |= PM_SOURCE_TMPF_RADIAL_KEEP; 143 source->tmpFlags &= ~PM_SOURCE_TMPF_RADIAL_SKIP; 144 } else { 145 source->tmpFlags |= PM_SOURCE_TMPF_RADIAL_SKIP; 146 source->tmpFlags &= ~PM_SOURCE_TMPF_RADIAL_KEEP; 147 } 148 } 149 } 150 151 psLogMsg ("psphot", PS_LOG_INFO, "marked good vs bad objects\n"); 152 return true; 153 }
Note:
See TracChangeset
for help on using the changeset viewer.
