Changeset 43019
- Timestamp:
- May 11, 2026, 3:21:33 PM (2 months ago)
- Location:
- branches/eam_branches/ipp-pstamp-20260421/ppStack/src
- Files:
-
- 5 edited
-
ppStackCleanup.c (modified) (1 diff)
-
ppStackFiles.c (modified) (1 diff)
-
ppStackOptions.c (modified) (1 diff)
-
ppStackSources.c (modified) (5 diffs)
-
ppStackTarget.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-pstamp-20260421/ppStack/src/ppStackCleanup.c
r34800 r43019 141 141 pmVisualCleanup (); 142 142 143 psLogMsg("ppStack", PS_LOG_INFO, "Memory leaks: %d\n", psMemCheckLeaks(0, NULL, stdout, false)); 144 143 145 exitValue = ppStackExitCode(exitValue); 144 146 exit(exitValue); -
branches/eam_branches/ipp-pstamp-20260421/ppStack/src/ppStackFiles.c
r42094 r43019 253 253 return false; 254 254 } 255 psFree(tmphead); 255 256 } 256 257 if (!psFitsClose(fits)) { -
branches/eam_branches/ipp-pstamp-20260421/ppStack/src/ppStackOptions.c
r42094 r43019 32 32 psFree(options->inspect); 33 33 psFree(options->rejected); 34 psFree(options->zpInput); 35 psFree(options->expTimeInput); 36 psFree(options->airmassInput); 37 psFree(options->bkgImages); 34 38 35 39 return; -
branches/eam_branches/ipp-pstamp-20260421/ppStack/src/ppStackSources.c
r42893 r43019 295 295 if (options->matchZPs) { 296 296 297 psVector *trans = pmSourceMatchRelphot(matches, matchedSources, zp, tol, iter1, starRej1, starSys1,297 psVector *trans = pmSourceMatchRelphot(matches, matchedSources, zp, tol, iter1, starRej1, starSys1, 298 298 iter2, starRej2, starSys2, starLimit, 299 299 transIter, transRej, transThresh); // Transparencies per image … … 345 345 dumpMatches("source_match2.dat", num, matches, zp, trans); 346 346 #endif 347 // XXX this second block is always true (since options->matchZPs is true above) 347 348 if (options->matchZPs) { 348 349 options->norm = psVectorAlloc(num, PS_TYPE_F32); … … 383 384 } 384 385 } 385 matches = pmSourceMatchSources(sourceLists, radius, true); // List of matches 386 387 // XXX this duplicates the pmSourceMatch above 388 // matches = pmSourceMatchSources(sourceLists, radius, true); // List of matches 386 389 387 390 if (zpExpNum == numGoodImages) { … … 393 396 options->zp = NAN; 394 397 } 395 396 398 397 399 psFree(trans); … … 487 489 488 490 489 if (options->photometry) { 490 // Save best matches for future photometry 491 psArray *sourcesBest = options->sources = psArrayAllocEmpty(matches->n); 492 // XXX something of a hack: require at least 2 detections or the nominated fraction of the max possible 493 //int minMatches = PS_MAX(2, fracMatch * num);// Minimum number of matches required 494 //MEH - if many poor images, will hit oddity with num fraction. use numGoodImages instead 495 int minMatches = PS_MAX(2, fracMatch * numGoodImages);// Minimum number of matches required 491 if (options->photometry) { 492 // Save best matches for future photometry 493 psArray *sourcesBest = psArrayAllocEmpty(matches->n); 494 495 // XXX something of a hack: require at least 2 detections or the nominated fraction of the max possible 496 //int minMatches = PS_MAX(2, fracMatch * num);// Minimum number of matches required 497 //MEH - if many poor images, will hit oddity with num fraction. use numGoodImages instead 498 int minMatches = PS_MAX(2, fracMatch * numGoodImages);// Minimum number of matches required 496 499 497 int good0 = 0; 498 for (int i = 0; i < num; i++) { 499 if (inputMask->data.U8[i]) { 500 continue; 500 int good0 = 0; 501 for (int i = 0; i < num; i++) { 502 if (inputMask->data.U8[i]) { 503 continue; 504 } 505 good0 = i; 506 break; 507 } 508 509 for (int i = 0; i < matches->n; i++) { 510 pmSourceMatch *match = matches->data[i]; // Match of interest 511 if (match->num < minMatches) { 512 continue; 513 } 514 515 // We need to grab a single instance of this source: just take the first available 516 // MEH - if first available is a rejected image, then problem. so take first non-rejected instance above 517 // int image = match->image->data.S32[0]; // Index of image 518 // int index = match->index->data.S32[0]; // Index of source within image 519 int image = match->image->data.S32[good0]; // Index of image 520 int index = match->index->data.S32[good0]; // Index of source within image 521 psArray *sources = sourceLists->data[image]; // Sources for image 522 pmSource *source = sources->data[index]; // Source of interest 523 524 // CZW: Accept the first source for all properties, except for the magnitudes. 525 // We have average magnitudes from relphot, so we should use those 526 pmSource *photsource = matchedSources->data[i]; 527 if ((photsource)&&(isfinite(photsource->psfMag))) { 528 // CZW: photsource is the average relphot mag, which is equal to <m_i + zpIN_j> 529 // (primed are averaged values for this discussion) 530 // Therefore, the correct magnitude for psfMag' is: 531 // psfMag' = (photsource - zpIN_j + magCorr) 532 // apMag - psfMag should be retained, so: 533 // apMag - psfMag = apMag' - psfMag' 534 // apMag' = apMag + psfMag' - psfMag 535 source->apMag = source->apMag + (photsource->psfMag + options->norm->data.F32[image] - zp->data.F32[image] - source->psfMag); 536 source->psfMag = photsource->psfMag + options->norm->data.F32[image] - zp->data.F32[image]; 537 538 psTrace("ppStack", 5, "Best Source %d/%ld @ %f %f %f %f %f %d",i,sourcesBest->n,source->peak->xf,source->peak->yf, 539 source->psfMag, 540 photsource->psfMag + options->norm->data.F32[image] - zp->data.F32[image] , 541 source->psfMagErr,-1); 542 psArrayAdd(sourcesBest, sourcesBest->n, source); 543 } 544 } 545 psLogMsg("ppStack", PS_LOG_INFO, "Selected %ld sources for photometry analysis", sourcesBest->n); 546 547 // at this point, options->sources contains the full matched list 548 // here we only keep the best sources: 549 psFree (options->sources); 550 options->sources = sourcesBest; 501 551 } 502 good0 = i; 503 break; 504 } 505 506 for (int i = 0; i < matches->n; i++) { 507 pmSourceMatch *match = matches->data[i]; // Match of interest 508 if (match->num < minMatches) { 509 continue; 510 } 511 512 // We need to grab a single instance of this source: just take the first available 513 // MEH - if first available is a rejected image, then problem. so take first non-rejected instance above 514 // int image = match->image->data.S32[0]; // Index of image 515 // int index = match->index->data.S32[0]; // Index of source within image 516 int image = match->image->data.S32[good0]; // Index of image 517 int index = match->index->data.S32[good0]; // Index of source within image 518 psArray *sources = sourceLists->data[image]; // Sources for image 519 pmSource *source = sources->data[index]; // Source of interest 520 521 // CZW: Accept the first source for all properties, except for the magnitudes. 522 // We have average magnitudes from relphot, so we should use those 523 pmSource *photsource = matchedSources->data[i]; 524 if ((photsource)&&(isfinite(photsource->psfMag))) { 525 // CZW: photsource is the average relphot mag, which is equal to <m_i + zpIN_j> 526 // (primed are averaged values for this discussion) 527 // Therefore, the correct magnitude for psfMag' is: 528 // psfMag' = (photsource - zpIN_j + magCorr) 529 // apMag - psfMag should be retained, so: 530 // apMag - psfMag = apMag' - psfMag' 531 // apMag' = apMag + psfMag' - psfMag 532 source->apMag = source->apMag + (photsource->psfMag + options->norm->data.F32[image] - zp->data.F32[image] - source->psfMag); 533 source->psfMag = photsource->psfMag + options->norm->data.F32[image] - zp->data.F32[image]; 534 535 psTrace("ppStack", 5, "Best Source %d/%ld @ %f %f %f %f %f %d",i,sourcesBest->n,source->peak->xf,source->peak->yf, 536 source->psfMag, 537 photsource->psfMag + options->norm->data.F32[image] - zp->data.F32[image] , 538 source->psfMagErr,-1); 539 psArrayAdd(sourcesBest, sourcesBest->n, source); 540 } 541 } 542 psLogMsg("ppStack", PS_LOG_INFO, "Selected %ld sources for photometry analysis", sourcesBest->n); 543 544 } 545 psFree(zp); 546 psFree(matches); 547 548 return true; 552 psFree(zp); 553 psFree(matches); 554 psFree(matchedSources); 555 556 return true; 549 557 } -
branches/eam_branches/ipp-pstamp-20260421/ppStack/src/ppStackTarget.c
r35383 r43019 89 89 } 90 90 } 91 psFree (indices); 91 92 } 92 93 psFree(coords);
Note:
See TracChangeset
for help on using the changeset viewer.
