IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 7, 2009, 4:08:25 PM (17 years ago)
Author:
Paul Price
Message:

Merging trunk (r25026) to get up-to-date on old branch.

Location:
branches/pap
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/pap

  • branches/pap/psModules

    • Property svn:mergeinfo deleted
  • branches/pap/psModules/src/objects/pmSourceMatch.c

    r23241 r25027  
    4545                         psVector **x, psVector **y, // Coordinate vectors to return
    4646                         psVector **mag, psVector **magErr, // Magnitude and error vectors to return
     47                         psVector **indices, // Indices for sources
    4748                         const psArray *sources // Input sources
    4849    )
     
    5859    *mag = psVectorRecycle(*mag, numSources, PS_TYPE_F32);
    5960    *magErr = psVectorRecycle(*magErr, numSources, PS_TYPE_F32);
     61    *indices = psVectorRecycle(*indices, numSources, PS_TYPE_S32);
    6062    float xMin = INFINITY, xMax = -INFINITY, yMin = INFINITY, yMax = -INFINITY; // Bounds of sources
    6163    long num = 0;                       // Number of valid sources
    6264    for (long i = 0; i < numSources; i++) {
    6365        pmSource *source = sources->data[i]; // Source of interest
    64         if (!source) continue;
    65         if (source->mode & SOURCE_MASK) continue;
    66         if (!isfinite(source->psfMag)) continue;
    67         if (!isfinite(source->errMag)) continue;
    68         if (source->psfMag > SOURCE_FAINTEST) continue;
     66        if (!source || (source->mode & SOURCE_MASK) || !isfinite(source->psfMag) ||
     67            !isfinite(source->errMag) || source->psfMag > SOURCE_FAINTEST) {
     68            continue;
     69        }
    6970
    7071        float xSrc, ySrc;               // Coordinates of source
     
    7879        (*y)->data.F32[num] = ySrc;
    7980        (*mag)->data.F32[num] = source->psfMag;
    80         (*magErr)->data.F32[num] = source->errMag ;
     81        (*magErr)->data.F32[num] = source->errMag;
     82        (*indices)->data.S32[num] = i;
    8183        num++;
    8284    }
     
    8587    (*mag)->n = num;
    8688    (*magErr)->n = num;
     89    (*indices)->n = num;
    8790
    8891    if (*bounds) {
     
    175178        psVector *xImage = NULL, *yImage = NULL; // Coordinates of sources
    176179        psVector *magImage = NULL, *magErrImage = NULL; // Magnitude and mag
    177 
    178         int numSources = sourcesParse(&boundsImage, &xImage, &yImage, &magImage, &magErrImage,
     180        psVector *indices = NULL;     // Indices for sources
     181
     182        int numSources = sourcesParse(&boundsImage, &xImage, &yImage, &magImage, &magErrImage, &indices,
    179183                                      sources); // Number of sources
    180184
     
    187191            for (int j = 0; j < numSources; j++) {
    188192                pmSourceMatch *match = pmSourceMatchAlloc(); // Match data
    189                 pmSourceMatchAdd(match, magImage->data.F32[j], magErrImage->data.F32[j], i, j);
     193                pmSourceMatchAdd(match, magImage->data.F32[j], magErrImage->data.F32[j],
     194                                 i, indices->data.S32[j]);
    190195                matches->data[j] = match;
    191196            }
     
    206211            for (int j = 0, k = numMaster; j < numSources; j++, k++) {
    207212                pmSourceMatch *match = pmSourceMatchAlloc(); // Match data
    208                 pmSourceMatchAdd(match, magImage->data.F32[j], magErrImage->data.F32[j], i, j);
     213                pmSourceMatchAdd(match, magImage->data.F32[j], magErrImage->data.F32[j],
     214                                 i, indices->data.S32[j]);
    209215                matches->data[k] = match;
    210216            }
     
    231237                    // Record the match
    232238                    pmSourceMatch *match = matches->data[index]; // Match data
    233                     pmSourceMatchAdd(match, magImage->data.F32[j], magErrImage->data.F32[j], i, j);
     239                    pmSourceMatchAdd(match, magImage->data.F32[j], magErrImage->data.F32[j],
     240                                     i, indices->data.S32[j]);
    234241                    numMatch++;
    235242                } else {
    236243                    // Add to the master list
    237244                    pmSourceMatch *match = pmSourceMatchAlloc(); // Match data
    238                     pmSourceMatchAdd(match, magImage->data.F32[j], magErrImage->data.F32[j], i, j);
     245                    pmSourceMatchAdd(match, magImage->data.F32[j], magErrImage->data.F32[j],
     246                                     i, indices->data.S32[j]);
    239247                    xMaster->data.F32[numMaster] = xImage->data.F32[j];
    240248                    yMaster->data.F32[numMaster] = yImage->data.F32[j];
     
    469477
    470478    if (!psVectorStats(stats, trans, NULL, badImage, 0xFF)) {
     479        psError(PS_ERR_UNKNOWN, false, "Unable to perform statistics on transparencies.");
     480        psFree(stats);
     481        return -1;
     482    }
     483    // XXX handle this case better:
     484    if (isnan(stats->clippedMean))  {
    471485        psError(PS_ERR_UNKNOWN, false, "Unable to perform statistics on transparencies.");
    472486        psFree(stats);
Note: See TracChangeset for help on using the changeset viewer.