- Timestamp:
- Mar 29, 2010, 3:55:49 PM (16 years ago)
- Location:
- branches/eam_branches/20100225
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
psModules/src/objects/pmSourceMatch.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/20100225
- Property svn:mergeinfo changed
-
branches/eam_branches/20100225/psModules/src/objects/pmSourceMatch.c
r26076 r27517 8 8 9 9 #include "pmSource.h" 10 #include "pmErrorCodes.h" 10 11 11 12 #include "pmSourceMatch.h" … … 17 18 #define SOURCES_MAX_LEAF 2 // Maximum number of points on a tree leaf 18 19 #define ARRAY_BUFFER 16 // Buffer for array 19 20 20 21 21 ////////////////////////////////////////////////////////////////////////////////////////////////////////////// … … 113 113 psFree(match->mag); 114 114 psFree(match->magErr); 115 psFree(match->x); 116 psFree(match->y); 115 117 psFree(match->image); 116 118 psFree(match->index); 119 psFree(match->mask); 117 120 } 118 121 … … 180 183 for (int i = 0; i < numImages; i++) { 181 184 psArray *sources = sourceArrays->data[i]; // Sources in image 182 if (!sources ) {185 if (!sources || sources->n == 0) { 183 186 continue; 184 187 } … … 270 273 psFree(magImage); 271 274 psFree(magErrImage); 272 } 275 psFree(indices); 276 } 277 278 psFree(xMaster); 279 psFree(yMaster); 280 psFree(boundsMaster); 273 281 274 282 if (cullSingles) { … … 608 616 int numImages = zp->n; // Number of images 609 617 int numStars = matches->n; // Number of stars 618 psVector *badImage = psVectorAlloc(numImages, PS_TYPE_U8); // Bad image? 619 psVectorInit(badImage, 0); 620 621 // Check for data integrity 622 { 623 psVector *num = psVectorAlloc(numImages, PS_TYPE_S32); // Number of stars per image 624 psVectorInit(num, 0); 625 for (int i = 0; i < numStars; i++) { 626 pmSourceMatch *match = matches->data[i]; // Matched stars 627 for (int j = 0; j < match->num; j++) { 628 int index = match->image->data.U32[j]; // Image index 629 psAssert(index >= 0 && index < numImages, "Bad index: %d", index); 630 num->data.S32[index]++; 631 } 632 } 633 int numGood = 0; // Number of good images 634 for (int i = 0; i < numImages; i++) { 635 if (num->data.S32[i] == 0 || !isfinite(zp->data.F32[i])) { 636 badImage->data.U8[i] = 0xFF; 637 continue; 638 } 639 numGood++; 640 } 641 psFree(num); 642 if (numGood == 0) { 643 psError(PM_ERR_DATA, true, "No images with good stars."); 644 psFree(badImage); 645 return false; 646 } 647 } 648 610 649 psVector *trans = psVectorAlloc(numImages, PS_TYPE_F32); // Transparencies for each image, magnitudes 611 650 psVectorInit(trans, 0.0); 612 651 psVector *photo = psVectorAlloc(numImages, PS_TYPE_U8); // Photometric determination for each image 613 652 psVectorInit(photo, 0); 614 psVector *badImage = psVectorAlloc(numImages, PS_TYPE_U8); // Bad image?615 psVectorInit(badImage, 0);616 653 psVector *stars = psVectorAlloc(numStars, PS_TYPE_F32); // Magnitudes for each star 617 654
Note:
See TracChangeset
for help on using the changeset viewer.
