Changeset 32628
- Timestamp:
- Nov 8, 2011, 2:41:42 PM (15 years ago)
- Location:
- branches/eam_branches/ipp-20110906/psphot/src
- Files:
-
- 5 edited
-
psphotExtendedSourceAnalysis.c (modified) (1 diff)
-
psphotRadialApertures.c (modified) (3 diffs)
-
psphotSourceMatch.c (modified) (7 diffs)
-
psphotStackObjects.c (modified) (5 diffs)
-
psphotStackReadout.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20110906/psphot/src/psphotExtendedSourceAnalysis.c
r32348 r32628 209 209 // if we have checked the source validity on the basis of the object set, then 210 210 // we either skip these tests below or we skip the source completely 211 if (source->tmpFlags & PM_SOURCE_TMPF_ STACK_SKIP) continue;212 if (source->tmpFlags & PM_SOURCE_TMPF_ STACK_KEEP) goto keepSource;211 if (source->tmpFlags & PM_SOURCE_TMPF_PETRO_SKIP) continue; 212 if (source->tmpFlags & PM_SOURCE_TMPF_PETRO_KEEP) goto keepSource; 213 213 214 214 // skip PSF-like and non-astronomical objects -
branches/eam_branches/ipp-20110906/psphot/src/psphotRadialApertures.c
r32616 r32628 26 26 int num = psphotFileruleCount(config, filerule); 27 27 28 // skip the chisq image (optionally?) 29 int chisqNum = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.CHISQ.NUM"); 30 if (!status) chisqNum = -1; 31 28 32 // loop over the available readouts 29 33 for (int i = 0; i < num; i++) { 34 if (i == chisqNum) continue; // skip chisq image 35 30 36 if (!psphotRadialAperturesReadout (config, view, filerule, i, recipe, entry)) { 31 37 psError (PSPHOT_ERR_CONFIG, false, "failed on measure extended source aperture-like parameters for %s entry %d", filerule, i); … … 218 224 pmSource *source = sources->data[i]; 219 225 226 // if we have checked the source validity on the basis of the object set, then 227 // we either skip these tests below or we skip the source completely 228 if (source->tmpFlags & PM_SOURCE_TMPF_RADIAL_SKIP) continue; 229 if (source->tmpFlags & PM_SOURCE_TMPF_RADIAL_KEEP) goto keepSource; 230 220 231 // skip PSF-like and non-astronomical objects 221 232 if (source->type == PM_SOURCE_TYPE_DEFECT) continue; … … 235 246 if (source->peak->x > region->x1) continue; 236 247 if (source->peak->y > region->y1) continue; 248 249 keepSource: 237 250 238 251 // allocate pmSourceExtendedParameters, if not already defined -
branches/eam_branches/ipp-20110906/psphot/src/psphotSourceMatch.c
r32619 r32628 67 67 objects = psArraySort (objects, pmPhotObjSortByX); 68 68 69 psVector *found = psVectorAlloc(sources->n, PS_TYPE_U8); 70 psVectorInit (found, 0); 69 psVector *foundSrc = psVectorAlloc(sources->n, PS_TYPE_U8); 70 psVectorInit (foundSrc, 0); 71 72 psVector *foundObj = psVectorAlloc(sources->n, PS_TYPE_U8); 73 psVectorInit (foundObj, 0); 71 74 72 75 // match sources to existing objects … … 93 96 if (dx > +1.02*RADIUS) NEXT2; 94 97 98 /* this block will match a given detection to the closest object within range of that detection. 99 XXX note that this matches ALL detections within range of the single object to that same object 100 this is bad, but I cannot just go in linear order (ie, mark off each object as they are 101 used). I should make a list of all Nobj * Ndet pairs in range and choose the matches 102 based on their separations. UGH 103 */ 104 95 105 // we are within match range, look for matches: 96 106 int Jmin = -1; … … 98 108 for (int J = j; (dx > -1.02*RADIUS) && (J < objects->n); J++) { 99 109 110 // skip objects that are already assigned: 111 if (foundObj->data.U8[J]) continue; 100 112 obj = objects->data[J]; 101 113 … … 117 129 } 118 130 obj = objects->data[Jmin]; 131 foundObj->data.U8[Jmin] = 1; 119 132 120 133 // add to object 121 134 pmPhotObjAddSource (obj, src); 122 found ->data.U8[i] = 1;135 foundSrc->data.U8[i] = 1; 123 136 i++; 124 137 } … … 128 141 for (i = 0; i < sources->n; i++) { 129 142 130 if (found ->data.U8[i]) continue;143 if (foundSrc->data.U8[i]) continue; 131 144 132 145 pmSource *src = sources->data[i]; … … 139 152 psLogMsg ("psphot", PS_LOG_DETAIL, "matched sources (%ld vs %ld)", sources->n, objects->n); 140 153 141 psFree (found); 154 psFree (foundSrc); 155 psFree (foundObj); 142 156 return true; 143 157 } … … 270 284 pmPhotObj *obj = objects->data[i]; 271 285 nSources += obj->sources->n; 286 psAssert (obj->sources->n == nImages, "failed to match sources?"); 272 287 } 273 288 psLogMsg ("psphot", PS_LOG_DETAIL, "total of %d sources for %d images", nSources, nImages); -
branches/eam_branches/ipp-20110906/psphot/src/psphotStackObjects.c
r32348 r32628 70 70 71 71 // S/N limit to perform full non-linear fits 72 float SN_LIM = psMetadataLookupF32 (&status, recipe, "EXTENDED_SOURCE_SN_LIM"); 72 float SN_LIM_PETRO = psMetadataLookupF32 (&status, recipe, "EXTENDED_SOURCE_SN_LIM"); 73 float SN_LIM_RADIAL = psMetadataLookupF32 (&status, recipe, "RADIAL_APERTURES_SN_LIM"); 73 74 74 75 bool doPetroStars = psMetadataLookupBool (&status, recipe, "PETROSIAN_FOR_STARS"); … … 81 82 // we check each source for an object and keep the object if any source is valid 82 83 83 bool keepObject = false; 84 bool keepObjectRadial = false; 85 bool keepObjectPetro = false; 84 86 for (int j = 0; j < object->sources->n; j++) { 85 87 … … 94 96 if (source->mode & PM_SOURCE_MODE_SATSTAR) continue; 95 97 96 // optionally allow non-extended objects to get petrosians as well97 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 limit103 // assert (source->peak); // how can a source not have a peak?104 // limit selection to some SN limit105 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 98 // limit selection by analysis region (this automatically apply 114 99 if (source->peak->x < AnalysisRegion.x0) continue; … … 117 102 if (source->peak->y > AnalysisRegion.y1) continue; 118 103 119 keepObject = true; 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; 120 123 } 121 124 … … 128 131 // avoid the single-detection tests 129 132 130 if (keepObject ) {131 source->tmpFlags |= PM_SOURCE_TMPF_ STACK_KEEP;132 source->tmpFlags &= ~PM_SOURCE_TMPF_ STACK_SKIP;133 if (keepObjectPetro) { 134 source->tmpFlags |= PM_SOURCE_TMPF_PETRO_KEEP; 135 source->tmpFlags &= ~PM_SOURCE_TMPF_PETRO_SKIP; 133 136 } else { 134 source->tmpFlags |= PM_SOURCE_TMPF_STACK_SKIP; 135 source->tmpFlags &= ~PM_SOURCE_TMPF_STACK_KEEP; 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; 136 147 } 137 148 } -
branches/eam_branches/ipp-20110906/psphot/src/psphotStackReadout.c
r32616 r32628 43 43 44 44 bool psphotStackReadout (pmConfig *config, const pmFPAview *view) { 45 46 psArray *objects = NULL; // used below after 'pass1finish' label 45 47 46 48 // measure the total elapsed time in psphotReadout. dtime is the elapsed time used jointly … … 187 189 psphotReplaceAllSources (config, view, STACK_SRC); // pass 1 (detections->allSources) 188 190 191 // if we only do one pass, skip to extended source analysis 192 if (!strcasecmp (breakPt, "PASS1")) goto pass1finish; 193 189 194 // linear fit to include all sources (subtract again) 190 195 // NOTE : apply to ALL sources (extended + psf) 191 196 psphotFitSourcesLinear (config, view, STACK_SRC, true); // pass 2 (detections->allSources) 192 193 // if we only do one pass, skip to extended source analysis194 if (!strcasecmp (breakPt, "PASS1")) goto pass1finish;195 197 196 198 // NOTE: possibly re-measure background model here with objects subtracted / or masked … … 241 243 // XXX check on free of sources... 242 244 psphotMergeSources (config, view, STACK_SRC); // (detections->newSources + detections->allSources -> detections->allSources) 243 244 // NOTE: apply to ALL sources245 psphotFitSourcesLinear (config, view, STACK_SRC, true); // pass 3 (detections->allSources)246 245 } 247 246 248 247 pass1finish: 248 249 // generate the objects (objects unify the sources from the different images) NOTE: could 250 // this just match the detections for the chisq image, and not bother measuring the source 251 // stats in that case...? 252 objects = psphotMatchSources (config, view, STACK_SRC); 253 psMemDump("matchsources"); 254 255 psphotStackObjectsUnifyPosition (objects); 256 257 psphotStackObjectsSelectForAnalysis (config, view, STACK_SRC, objects); 258 259 // NOTE: apply to ALL sources 260 psphotFitSourcesLinear (config, view, STACK_SRC, true); // pass 3 (detections->allSources) 249 261 250 262 // measure the radial profiles to the sky (only measures new objects) … … 260 272 261 273 psMemDump("psfstats"); 262 263 // XXX *** NOTE : this should happen above before the last psphotFitSourcesLinear in order264 // to generate psf forced photometry for the undetected sources265 266 // generate the objects (objects unify the sources from the different images)267 // XXX this could just match the detections for the chisq image, and not bother measuring the268 // source stats in that case...269 psArray *objects = psphotMatchSources (config, view, STACK_SRC);270 psMemDump("matchsources");271 272 psphotStackObjectsUnifyPosition (objects);273 274 psphotStackObjectsSelectForAnalysis (config, view, STACK_SRC, objects);275 274 276 275 // measure elliptical apertures, petrosians (objects sorted by S/N) … … 330 329 psphotMagnitudes(config, view, STACK_SRC); 331 330 332 if (0 && !psphotEfficiency(config, view, STACK_DET)) { 331 // XXX NOTE: this function wants to have the PSF of the image, but we (so far) only measure the 332 // PSF of the SRC image. can we fake it by generating the PSF for DET as well (up above)? 333 if (false && !psphotEfficiency(config, view, STACK_DET)) { 333 334 psErrorStackPrint(stderr, "Unable to determine detection efficiencies from fake sources"); 334 335 psErrorClear();
Note:
See TracChangeset
for help on using the changeset viewer.
