IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 3, 2010, 2:33:56 PM (16 years ago)
Author:
Paul Price
Message:

Catch images with no sources.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/objects/pmSourceMatch.c

    r26076 r27162  
    88
    99#include "pmSource.h"
     10#include "pmErrorCodes.h"
    1011
    1112#include "pmSourceMatch.h"
     
    608609    int numImages = zp->n;              // Number of images
    609610    int numStars = matches->n;          // Number of stars
     611    psVector *badImage = psVectorAlloc(numImages, PS_TYPE_U8); // Bad image?
     612    psVectorInit(badImage, 0);
     613
     614    // Check for data integrity
     615    {
     616        psVector *num = psVectorAlloc(numImages, PS_TYPE_S32); // Number of stars per image
     617        for (int i = 0; i < numStars; i++) {
     618            pmSourceMatch *match = matches->data[i]; // Matched stars
     619            for (int j = 0; j < match->num; j++) {
     620                if (match->mask->data.PS_TYPE_VECTOR_MASK_DATA[j] & PM_SOURCE_MATCH_MASK_PHOT) {
     621                    continue;
     622                }
     623                int index = match->image->data.U32[j]; // Image index
     624                num->data.S32[index]++;
     625            }
     626        }
     627        int numGood = 0;                // Number of good images
     628        for (int i = 0; i < numImages; i++) {
     629            if (num->data.S32[i] == 0 || !isfinite(zp->data.F32[i])) {
     630                badImage->data.U8[i] = 0xFF;
     631                continue;
     632            }
     633            numGood++;
     634        }
     635        psFree(num);
     636        if (numGood == 0) {
     637            psError(PM_ERR_DATA, true, "No images with good stars.");
     638            psFree(badImage);
     639            return false;
     640        }
     641    }
     642
    610643    psVector *trans = psVectorAlloc(numImages, PS_TYPE_F32); // Transparencies for each image, magnitudes
    611644    psVectorInit(trans, 0.0);
    612645    psVector *photo = psVectorAlloc(numImages, PS_TYPE_U8); // Photometric determination for each image
    613646    psVectorInit(photo, 0);
    614     psVector *badImage = psVectorAlloc(numImages, PS_TYPE_U8); // Bad image?
    615     psVectorInit(badImage, 0);
    616647    psVector *stars = psVectorAlloc(numStars, PS_TYPE_F32); // Magnitudes for each star
    617648
Note: See TracChangeset for help on using the changeset viewer.