Changeset 33591
- Timestamp:
- Mar 22, 2012, 10:05:00 AM (14 years ago)
- Location:
- tags/ipp-20120216
- Files:
-
- 8 edited
-
psModules/src/objects (modified) (1 prop)
-
psModules/src/objects/pmFootprintCullPeaks.c (modified) (1 diff)
-
psModules/src/objects/pmPSFtryFitEXT.c (modified) (2 diffs)
-
psModules/src/objects/pmSourceIO.c (modified) (1 prop)
-
psphot/src (modified) (1 prop)
-
psphot/src/psphotSourceMatch.c (modified) (8 diffs)
-
psphot/src/psphotStackImageLoop.c (modified) (1 prop)
-
psphot/src/psphotStackMatchPSFsPrepare.c (modified) (1 prop)
Legend:
- Unmodified
- Added
- Removed
-
tags/ipp-20120216/psModules/src/objects
- Property svn:mergeinfo changed
/trunk/psModules/src/objects merged: 33463,33578,33586
- Property svn:mergeinfo changed
-
tags/ipp-20120216/psModules/src/objects/pmFootprintCullPeaks.c
r32998 r33591 178 178 psArray *myFP = pmFootprintsFind(subImg, threshold, 5); 179 179 if (!myFP) { 180 psWarning ("missing footprint? ");180 psWarning ("missing footprint? threshold: %.f", threshold); 181 181 continue; 182 182 } 183 183 if (!myFP->n) { 184 psWarning ("empty footprint? ");184 psWarning ("empty footprint? threshold: %.f", threshold); 185 185 psFree (myFP); 186 186 continue; -
tags/ipp-20120216/psModules/src/objects/pmPSFtryFitEXT.c
r30621 r33591 73 73 continue; 74 74 } 75 // If mask object does not exist, mark the source as bad. 76 // We cannot proceed with it because psImageMaskPixels leaves an uncleared error code last which causes 77 // psphot to exit with a fault. 78 if (source->maskObj == NULL) { 79 psTrace ("psModules.objects", 4, "source %d (%d,%d) : null maskObj\n", i, source->peak->x, source->peak->y); 80 psfTry->mask->data.PS_TYPE_VECTOR_MASK_DATA[i] = PSFTRY_MASK_EXT_FAIL; 81 continue; 82 } 75 83 76 84 source->modelEXT = pmSourceModelGuess (source, options->type); … … 89 97 90 98 // clear object mask to define valid pixels 91 psImageMaskPixels (source->maskObj, "AND", PS_NOT_IMAGE_MASK(markVal)); // clear the circular mask99 psImageMaskPixels (source->maskObj, "AND", PS_NOT_IMAGE_MASK(markVal)); // clear the circular mask 92 100 93 101 // exclude the poor fits -
tags/ipp-20120216/psModules/src/objects/pmSourceIO.c
- Property svn:mergeinfo changed (with no actual effect on merging)
-
tags/ipp-20120216/psphot/src
- Property svn:mergeinfo changed
/trunk/psphot/src merged: 33462,33587
- Property svn:mergeinfo changed
-
tags/ipp-20120216/psphot/src/psphotSourceMatch.c
r32996 r33591 3 3 bool psphotMatchSourcesAddMissing (pmConfig *config, const pmFPAview *view, const char *filerule, psArray *objects); 4 4 bool psphotMatchSourcesSetIDs (psArray *objects); 5 6 static psArray *psphotMatchFootprintCacheAlloc (int nImages); 7 static pmFootprint *psphotMatchLookupFootprint (psArray *cache, int footprintID, int imageID); 8 static pmFootprint *psphotMatchCopyFootprint (psArray *cache, pmFootprint *footprint, int imageID, psImage *image, psArray *footprints); 5 9 6 10 psArray *psphotMatchSources (pmConfig *config, const pmFPAview *view, const char *filerule) … … 193 197 // vector to track if source for an image is found 194 198 psVector *found = psVectorAlloc(nImages, PS_TYPE_U8); 199 psArray *footprintCache = psphotMatchFootprintCacheAlloc(nImages); 195 200 196 201 for (int i = 0; i < objects->n; i++) { … … 219 224 220 225 // we make a copy of the largest footprint; this will be used for all new sources associated with this object 221 pmFootprint * footprint = NULL;226 pmFootprint *largestFootprint = NULL; 222 227 if (iSpansMax != -1) { // copy the footprint info 223 228 pmSource *src = obj->sources->data[iSpansMax]; … … 226 231 psAssert(src->peak->footprint->nspans == nSpansMax, "wrong footprint?"); 227 232 228 // we only care about the spans, do not worry about the image of this footprint 229 footprint = pmFootprintCopyData(src->peak->footprint, NULL); 233 largestFootprint = src->peak->footprint; 230 234 } 231 235 … … 248 252 249 253 // assign to a footprint on this readout->image 250 if (footprint) { 251 peak->footprint = pmFootprintCopyData(footprint, readout->image); 252 253 // the peak does not claim ownership of the footprint (it does not free it). save a copy of this 254 // footprint on detections->footprints so we can free it later 255 psArrayAdd(detections->footprints, 100, peak->footprint); 256 psFree (peak->footprint); 254 if (largestFootprint) { 255 // we save the copies that we make of the of the footprints in a hash so that we can reuse them 256 // for all sources that share the fooprint. Without this we had serious memory explosion in 257 // dense fields with lots of footprints (spans are small but when you have enough of them ...) 258 peak->footprint = psphotMatchLookupFootprint(footprintCache, largestFootprint->id, index); 259 if (!peak->footprint) { 260 // the peak does not claim ownership of the footprint (it does not free it). 261 // psphotMatchCopyFootprint saves a copy of this 262 // footprint on detections->footprints so we can free it later 263 peak->footprint = psphotMatchCopyFootprint(footprintCache, largestFootprint, 264 index, readout->image, detections->footprints); 265 } 257 266 } 258 267 … … 272 281 pmSourceDefinePixels (source, readout, source->peak->x, source->peak->y, OUTER); 273 282 283 #if (0) 284 fprintf(stderr, "Add mising source for obj: %5d %5d image: %d flux: %f size: %4d %4d\n", 285 i, obj->id, index, peakFlux, source->pixels->numRows, source->pixels->numCols); 286 #endif 287 274 288 peak->assigned = true; 275 289 pmPhotObjAddSource(obj, source); … … 277 291 psFree (source); 278 292 } 279 psFree (footprint); 280 }293 } 294 psFree(footprintCache); 281 295 282 296 // how many sources do we have now? … … 309 323 return true; 310 324 } 325 326 // Cache of footprints created for unmatched sources. 327 static psArray * psphotMatchFootprintCacheAlloc (int nImages) { 328 psArray *cache = psArrayAlloc(nImages); 329 for (int i = 0; i < nImages; i++) { 330 psHash *hash = psHashAlloc(5000); 331 cache->data[i] = hash; 332 } 333 return cache; 334 } 335 336 // Find copy of footprint with given ID made for a given image 337 static pmFootprint *psphotMatchLookupFootprint (psArray *cache, int footprintID, int imageID) { 338 psHash *hash = (psHash *) cache->data[imageID]; 339 340 psAssert(hash != NULL, "missing hash for image %d", imageID); 341 342 // footprintID is the id of the original footprint. 343 char key[32]; 344 sprintf(key, "%d", footprintID); 345 346 // The footprints in our hashes are the copies of that footprint for the respective images 347 pmFootprint *copy = psHashLookup(hash, key); 348 349 return copy; 350 } 351 352 // Create a copy of a given footprint for a given image 353 static pmFootprint *psphotMatchCopyFootprint (psArray *cache, pmFootprint *footprint, int imageID, psImage *image, psArray *footprints) { 354 355 psAssert((imageID >= 0 && imageID < cache->n), "invalid imageID %d", imageID); 356 357 psHash *hash = (psHash *) cache->data[imageID]; 358 359 psAssert(hash != NULL, "missing hash for image %d", imageID); 360 361 char key[32]; 362 sprintf(key, "%d", footprint->id); 363 364 pmFootprint *copy = pmFootprintCopyData (footprint, image); 365 366 // save a copy in this image's hash 367 psHashAdd(hash, key, copy); 368 369 // save a copy of this footprint on the passed in footprints Array so we can free it later 370 psArrayAdd(footprints, 100, copy); 371 372 // drop our ref 373 psFree(copy); 374 375 return copy; 376 } -
tags/ipp-20120216/psphot/src/psphotStackImageLoop.c
- Property svn:mergeinfo changed (with no actual effect on merging)
-
tags/ipp-20120216/psphot/src/psphotStackMatchPSFsPrepare.c
- Property svn:mergeinfo changed (with no actual effect on merging)
Note:
See TracChangeset
for help on using the changeset viewer.
