Changeset 33640
- Timestamp:
- Mar 30, 2012, 2:54:17 PM (14 years ago)
- Location:
- branches/eam_branches/ipp-20111122/psphot
- Files:
-
- 23 edited
-
. (modified) (1 prop)
-
src (modified) (1 prop)
-
src/psphotApResid.c (modified) (1 diff)
-
src/psphotBlendFit.c (modified) (1 diff)
-
src/psphotExtendedSourceAnalysis.c (modified) (1 diff)
-
src/psphotExtendedSourceFits.c (modified) (1 diff)
-
src/psphotFindFootprints.c (modified) (1 diff)
-
src/psphotFitSourcesLinear.c (modified) (1 diff)
-
src/psphotForcedReadout.c (modified) (1 diff)
-
src/psphotGuessModels.c (modified) (1 diff)
-
src/psphotKronIterate.c (modified) (1 diff)
-
src/psphotMagnitudes.c (modified) (2 diffs)
-
src/psphotMergeSources.c (modified) (2 diffs)
-
src/psphotRadialApertures.c (modified) (1 diff)
-
src/psphotRadialProfileWings.c (modified) (2 diffs)
-
src/psphotReadout.c (modified) (2 diffs)
-
src/psphotSersicModelClass.c (modified) (1 diff)
-
src/psphotSourceMatch.c (modified) (8 diffs)
-
src/psphotSourceStats.c (modified) (2 diffs)
-
src/psphotStackImageLoop.c (modified) (1 prop)
-
src/psphotStackMatchPSFs.c (modified) (1 diff)
-
src/psphotStackMatchPSFsPrepare.c (modified) (1 diff)
-
src/psphotTest.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20111122/psphot
- Property svn:mergeinfo changed
/trunk/psphot merged: 32868,32996,33030,33089,33140,33410-33411,33444,33462,33587
- Property svn:mergeinfo changed
-
branches/eam_branches/ipp-20111122/psphot/src
- Property svn:mergeinfo changed
/trunk/psphot/src merged: 32868,32996,33030,33089,33140,33410-33411,33444,33462,33587
- Property svn:mergeinfo changed
-
branches/eam_branches/ipp-20111122/psphot/src/psphotApResid.c
r32348 r33640 154 154 155 155 // wait for the threads to finish and manage results 156 if (!psThreadPoolWait (false )) {156 if (!psThreadPoolWait (false, true)) { 157 157 psError(PS_ERR_UNKNOWN, false, "Unable to guess model."); 158 psFree(cellGroups); 158 159 return false; 159 160 } -
branches/eam_branches/ipp-20111122/psphot/src/psphotBlendFit.c
r32695 r33640 151 151 152 152 // wait for the threads to finish and manage results 153 if (!psThreadPoolWait (false )) {153 if (!psThreadPoolWait (false, true)) { 154 154 psError(PS_ERR_UNKNOWN, false, "Unable to guess model."); 155 155 psFree (fitOptions); -
branches/eam_branches/ipp-20111122/psphot/src/psphotExtendedSourceAnalysis.c
r32633 r33640 134 134 135 135 // wait for the threads to finish and manage results 136 if (!psThreadPoolWait (false )) {136 if (!psThreadPoolWait (false, true)) { 137 137 psError(PS_ERR_UNKNOWN, false, "Unable to guess model."); 138 138 psFree(AnalysisRegion); -
branches/eam_branches/ipp-20111122/psphot/src/psphotExtendedSourceFits.c
r32744 r33640 218 218 219 219 // wait for the threads to finish and manage results 220 if (!psThreadPoolWait (false )) {220 if (!psThreadPoolWait (false, true)) { 221 221 psError(PS_ERR_UNKNOWN, false, "Unable to guess model."); 222 222 psFree(AnalysisRegion); -
branches/eam_branches/ipp-20111122/psphot/src/psphotFindFootprints.c
r32348 r33640 35 35 psArray *tmp = pmFootprintArrayGrow(footprints, growRadius); 36 36 psImageConvolveSetThreads(oldThreads); 37 psLogMsg ("psphot", PS_LOG_MINUTIA, "grow footprint coverage by %d pixels, %ld footprints become %ld footprints: %f sec\n", growRadius, footprints->n, tmp->n, psTimerMark ("psphot.footprints")); 38 psFree(footprints); 39 footprints = tmp; 37 psLogMsg ("psphot", PS_LOG_MINUTIA, "grow footprint coverage by %d pixels, %ld footprints become %ld footprints: %f sec\n", growRadius, footprints->n, tmp ? tmp->n : 0, psTimerMark ("psphot.footprints")); 38 if (tmp) { 39 psFree(footprints); 40 footprints = tmp; 41 } else { 42 psLogMsg ("psphot", PS_LOG_WARN, "pmFootprintArray grow returned NULL\n"); 43 } 44 40 45 } 41 46 -
branches/eam_branches/ipp-20111122/psphot/src/psphotFitSourcesLinear.c
r33094 r33640 280 280 psLogMsg ("psphot.ensemble", PS_LOG_MINUTIA, "built fitSources: %f sec (%ld objects)\n", psTimerMark ("psphot.linear"), sources->n); 281 281 282 // fprintf (stderr, "****** Nsat : %d ********\n", Nsat);283 284 282 if (fitSources->n == 0) { 285 283 psFree(fitSources); -
branches/eam_branches/ipp-20111122/psphot/src/psphotForcedReadout.c
r32924 r33640 55 55 psphotLoadExtSources (config, view, filerule); 56 56 57 // merge the newly selected sources into the existing list 58 // NOTE: merge OLD and NEW 59 psphotMergeSources (config, view, filerule); 60 57 61 // Construct an initial model for each object, set the radius to fitRadius, set circular 58 62 // fit mask. NOTE: only applied to sources without guess models 59 63 psphotGuessModels (config, view, filerule); 60 61 // merge the newly selected sources into the existing list62 // NOTE: merge OLD and NEW63 psphotMergeSources (config, view, filerule);64 64 65 65 // linear PSF fit to source peaks, subtract the models from the image (in PSF mask) -
branches/eam_branches/ipp-20111122/psphot/src/psphotGuessModels.c
r32924 r33640 112 112 // wait here for the threaded jobs to finish 113 113 // fprintf (stderr, "wait for threads (%d, %d)\n", jx, jy); 114 if (!psThreadPoolWait (false)) { 114 if (!psThreadPoolWait (false, true)) { 115 // harvest our jobs 116 psFree(cellGroups); 115 117 psError(PS_ERR_UNKNOWN, false, "Unable to guess model."); 116 118 return false; -
branches/eam_branches/ipp-20111122/psphot/src/psphotKronIterate.c
r33612 r33640 163 163 164 164 // wait for the threads to finish and manage results 165 if (!psThreadPoolWait (false )) {165 if (!psThreadPoolWait (false, true)) { 166 166 psError(PS_ERR_UNKNOWN, false, "Unable to guess model."); 167 167 return false; -
branches/eam_branches/ipp-20111122/psphot/src/psphotMagnitudes.c
r32348 r33640 129 129 130 130 // wait for the threads to finish and manage results 131 if (!psThreadPoolWait (false )) {131 if (!psThreadPoolWait (false, true)) { 132 132 psError(PS_ERR_UNKNOWN, false, "Unable to guess model."); 133 133 return false; … … 309 309 310 310 // wait for the threads to finish and manage results 311 if (!psThreadPoolWait (false )) {311 if (!psThreadPoolWait (false, true)) { 312 312 psError(PS_ERR_UNKNOWN, false, "Unable to guess model."); 313 313 return false; -
branches/eam_branches/ipp-20111122/psphot/src/psphotMergeSources.c
r32695 r33640 677 677 if (sourceOut->modelPSF) { 678 678 pmSourceRedefinePixels (sourceOut, readoutOut, sourceOut->peak->x, sourceOut->peak->y, sourceOut->modelPSF->fitRadius); 679 } 679 } else { 680 // if we have no pixels we can't use it to determine the psf so make sure this bit is off 681 sourceOut->tmpFlags &= ~PM_SOURCE_TMPF_CANDIDATE_PSFSTAR; 682 } 680 683 681 684 // child sources have not been subtracted in this image, but this flag may be raised if … … 900 903 // allocate image, weight, mask for the new image for each peak 901 904 if (sourceOut->modelPSF) { 902 pmSourceRedefinePixels (sourceOut, readout, sourceOut->peak->x, sourceOut->peak->y, sourceOut->modelPSF->fitRadius); 903 } 905 pmSourceRedefinePixels (sourceOut, readout, sourceOut->peak->x, sourceOut->peak->y, 906 sourceOut->modelPSF->fitRadius); 907 } else { 908 // if we have no pixels we can't use it to determine the psf so make sure this bit is off 909 sourceOut->tmpFlags &= ~PM_SOURCE_TMPF_CANDIDATE_PSFSTAR; 910 } 904 911 905 912 // child sources have not been subtracted in this image, but this flag may be raised if -
branches/eam_branches/ipp-20111122/psphot/src/psphotRadialApertures.c
r32633 r33640 176 176 177 177 // wait for the threads to finish and manage results 178 if (!psThreadPoolWait (false )) {178 if (!psThreadPoolWait (false, true)) { 179 179 psError(PS_ERR_UNKNOWN, false, "Unable to guess model."); 180 180 psFree(AnalysisRegion); -
branches/eam_branches/ipp-20111122/psphot/src/psphotRadialProfileWings.c
r32850 r33640 147 147 148 148 // wait for the threads to finish and manage results 149 if (!psThreadPoolWait (false )) {149 if (!psThreadPoolWait (false, true)) { 150 150 psError(PS_ERR_UNKNOWN, false, "Unable to guess model."); 151 151 return false; … … 307 307 // linearly interpolate to the radius at which we hit the sky, using the last flux and the limiting slope 308 308 if (isfinite(lastFlux)) { 309 limitRadius = lastRadius + lastFlux / 3.0; 309 float interpolatedRadius = lastRadius + lastFlux / 3.0; 310 if (interpolatedRadius < MAX_RADIUS) { 311 limitRadius = interpolatedRadius; 312 } else { 313 // XXX should we keep going in this case? 314 limitRadius = meanRadius; 315 } 310 316 } else { 311 317 limitRadius = meanRadius; -
branches/eam_branches/ipp-20111122/psphot/src/psphotReadout.c
r32924 r33640 133 133 // Construct an initial model for each object, set the radius to fitRadius, set circular 134 134 // fit mask. NOTE: only applied to sources without guess models 135 psphotGuessModels (config, view, filerule); // pass 1 135 // pass 1 136 if (!psphotGuessModels (config, view, filerule)) { 137 psLogMsg ("psphot", 3, "failure to Guess Model - pass 1"); 138 return psphotReadoutCleanup (config, view, filerule); 139 } 136 140 137 141 // linear PSF fit to source peaks, subtract the models from the image (in PSF mask) … … 155 159 // non-linear PSF and EXT fit to brighter sources 156 160 // replace model flux, adjust mask as needed, fit, subtract the models (full stamp) 161 // XXX: can leave faulted job in done queue 157 162 psphotBlendFit (config, view, filerule); // pass 1 (detections->allSources) 158 163 -
branches/eam_branches/ipp-20111122/psphot/src/psphotSersicModelClass.c
r32348 r33640 546 546 // set the normalization by linear fit between model and data 547 547 psphotSersicModelNorm (pcm, source); 548 if (!isfinite(PAR[PM_PAR_I0])) { 549 fprintf(stderr, "psphotSersicModelClassGuessPCM: psphotSerisicModelNorm set PM_PAR_I0 to NAN\n"); 550 return false; 551 } 548 552 549 553 if (TIMING) { t5 = psTimerMark ("SersicGuess"); } -
branches/eam_branches/ipp-20111122/psphot/src/psphotSourceMatch.c
r32924 r33640 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 } -
branches/eam_branches/ipp-20111122/psphot/src/psphotSourceStats.c
r32699 r33640 216 216 217 217 // wait for the threads to finish and manage results 218 if (!psThreadPoolWait (false )) {218 if (!psThreadPoolWait (false, true)) { 219 219 psError(PS_ERR_UNKNOWN, false, "Failure in thread job PSPHOT_SOURCE_STATS"); 220 220 psFree(detections->newSources); … … 347 347 348 348 // wait for the threads to finish and manage results 349 if (!psThreadPoolWait (false )) {349 if (!psThreadPoolWait (false, true)) { 350 350 psError(PS_ERR_UNKNOWN, false, "Failure in thread job PSPHOT_SOURCE_STATS"); 351 351 return NULL; -
branches/eam_branches/ipp-20111122/psphot/src/psphotStackImageLoop.c
- Property svn:mergeinfo changed
/trunk/psphot/src/psphotStackImageLoop.c merged: 32996,33030
- Property svn:mergeinfo changed
-
branches/eam_branches/ipp-20111122/psphot/src/psphotStackMatchPSFs.c
r32348 r33640 101 101 // Image Matching (PSFs or just flux) 102 102 if (options->convolve) { 103 matchKernel(config, readoutOut, readoutSrc, options, index); 103 if (!matchKernel(config, readoutOut, readoutSrc, options, index)){ 104 psError(psErrorCodeLast(), false, "Unable to match image PSF in readout."); 105 return false; 106 } 104 107 saveMatchData(readoutOut, options, index); 105 108 } -
branches/eam_branches/ipp-20111122/psphot/src/psphotStackMatchPSFsPrepare.c
r32348 r33640 32 32 pmDetections *detections = psMetadataLookupPtr(NULL, readout->analysis, "PSPHOT.DETECTIONS"); // Sources 33 33 if (!detections || !detections->allSources) { 34 psWarning("No detections found for image %d --- rejecting.", index); 35 options->inputMask->data.PS_TYPE_VECTOR_MASK_DATA[index] = 0x01;36 return true; // XXX not an error: we continue processing other images 34 // An input must have sources. If we got here without any the input file was likely corrupt 35 psError(PSPHOT_ERR_IO, true, "Input %d has no sources.\n\tCheck all instances of: %s", index, inputSrc->origname); 36 return false; 37 37 } 38 38 psAssert (detections->allSources, "missing sources?"); -
branches/eam_branches/ipp-20111122/psphot/src/psphotTest.c
r33086 r33640 85 85 86 86 // wait for the threads to finish and manage results 87 if (!psThreadPoolWait (true )) {87 if (!psThreadPoolWait (true, true)) { 88 88 fprintf (stderr, "failure to run FillImage (2)"); 89 89 exit (1);
Note:
See TracChangeset
for help on using the changeset viewer.
