Changeset 18382 for trunk/ppStack/src/ppStackLoop.c
- Timestamp:
- Jun 30, 2008, 12:09:14 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/ppStack/src/ppStackLoop.c (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppStack/src/ppStackLoop.c
r18346 r18382 213 213 // Preparation iteration: Load the sources, and get a target PSF model 214 214 psTrace("ppStack", 1, "Determining target PSF....\n"); 215 psArray *sources = NULL; // Sources to use for PSF matching 215 psArray *globalSources = NULL; // Global list of sources for matching (haveSources = TRUE) 216 psArray *indSources = psArrayAlloc(num); // Individual lists of sources for matching (haveSources = FALSE) 216 217 pmPSF *targetPSF = NULL; // Target PSF 217 218 bool haveSources = psMetadataLookupBool(NULL, config->arguments, "HAVE.SOURCES"); // Global sources? … … 240 241 psError(PS_ERR_UNKNOWN, false, "Unable to find PSF."); 241 242 psFree(view); 242 psFree(sources); 243 psFree(globalSources); 244 psFree(indSources); 243 245 psFree(sourceLists); 244 246 psFree(fileIter); … … 257 259 psError(PS_ERR_UNKNOWN, false, "Unable to determine size of image from PSF."); 258 260 psFree(view); 259 psFree(sources); 261 psFree(globalSources); 262 psFree(indSources); 260 263 psFree(sourceLists); 261 264 psFree(fileIter); … … 270 273 if (!haveSources) { 271 274 pmReadout *ro = pmFPAviewThisReadout(view, inputFile->fpa); // Readout with sources 272 sourceLists = ppStackSourceListAdd(sourceLists, ro, config); 275 psArray *sources = psMetadataLookupPtr(NULL, ro->analysis, "PSPHOT.SOURCES"); // Sources 276 if (!sources) { 277 psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to find sources in readout."); 278 return NULL; 279 } 280 sources->data[index] = psMemIncrRefCounter(sources); 281 sourceLists = ppStackSourceListAdd(sourceLists, sources, config); 273 282 if (!sourceLists) { 274 283 psError(PS_ERR_UNKNOWN, false, "Unable to add sources to list."); 275 284 psFree(view); 276 psFree(sources); 285 psFree(globalSources); 286 psFree(indSources); 277 287 psFree(fileIter); 278 288 psFree(psfs); … … 288 298 if (!targetPSF) { 289 299 psError(PS_ERR_UNKNOWN, false, "Unable to determine output PSF."); 290 psFree(sources); 300 psFree(globalSources); 301 psFree(indSources); 291 302 return false; 292 303 } … … 294 305 if (haveSources) { 295 306 // We want to hang on to the 'sources' even when its host FPA is blown away 296 sources = psMemIncrRefCounter(pmFPAfileThisReadout(config->files, view, "PPSTACK.INPUT.SOURCES")); 297 if (!sources) { 307 globalSources = psMemIncrRefCounter(pmFPAfileThisReadout(config->files, view, 308 "PPSTACK.INPUT.SOURCES")); 309 if (!globalSources) { 298 310 psError(PS_ERR_UNKNOWN, true, "Unable to find sources."); 299 311 psFree(view); … … 301 313 } 302 314 } else { 303 sources = ppStackSourceListCombine(sourceLists, config);315 globalSources = ppStackSourceListCombine(sourceLists, config); 304 316 psFree(sourceLists); 305 if (! sources) {317 if (!globalSources) { 306 318 psError(PS_ERR_UNKNOWN, false, "Unable to add sources to list."); 307 319 psFree(view); … … 343 355 pmFPAview *view = filesIterateDown(config); 344 356 if (!view) { 345 psFree(sources); 357 psFree(globalSources); 358 psFree(indSources); 346 359 psFree(targetPSF); 347 360 psFree(rng); … … 354 367 // Background subtraction, scaling and normalisation is performed automatically by the image matching 355 368 psArray *regions = NULL, *kernels = NULL; // Regions and kernels used in subtraction 369 psArray *sources = haveSources ? globalSources : indSources->data[i]; // Sources for matching 356 370 if (!ppStackMatch(readout, ®ions, &kernels, sources, targetPSF, rng, config)) { 357 371 psErrorStackPrint(stderr, "Unable to match image %d --- ignoring.", i); … … 374 388 numGood++; 375 389 } 376 psFree(sources); 390 psFree(globalSources); 391 psFree(indSources); 377 392 psFree(targetPSF); 378 393 psFree(rng);
Note:
See TracChangeset
for help on using the changeset viewer.
