IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 34321


Ignore:
Timestamp:
Aug 19, 2012, 9:41:42 AM (14 years ago)
Author:
bills
Message:

requireing PSF.SIGMA.VALUES to be present in the recipe breaks
warp updates since it didn't exist. If it is missing fall back
to the old list.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psphot/src/psphotSourceStats.c

    r34307 r34321  
    524524    # define NSIGMA 8
    525525    // moved to config file
    526     // float sigma[NSIGMA]  = {1.0, 2.0, 3.0, 4.5, 6.0, 9.0, 12.0, 18.0};
    527     psVector  *sigmavec = psMetadataLookupPtr (&status, recipe, "PSF.SIGMA.VALUES"); psAssert(status, "missing PSF.SIGMA.VALUES");
    528     psAssert(sigmavec->n <= NSIGMA, "too many sigma values in recipe %ld maximum is %d", sigmavec->n, NSIGMA);
     526    psVector  *sigmavec = psMetadataLookupPtr (&status, recipe, "PSF.SIGMA.VALUES");
    529527
    530528    float sigma[NSIGMA];
     
    533531    int   Nout[NSIGMA]; // number of stars found in clump : use this to control the number of regions measured by psphotRoughClass
    534532
    535     // copy the data from vector to local array to keep the code below easier to read
    536     for (int i = 0 ; i < sigmavec->n; i++) {
    537         sigma[i] = sigmavec->data.F32[i];
     533    int nsigma;
     534    if (sigmavec) {
     535        psAssert(sigmavec->n <= NSIGMA, "too many sigma values in recipe %ld maximum is %d", sigmavec->n, NSIGMA);
     536        // copy the data from vector to local array to keep the code below easier to read
     537        for (int i = 0 ; i < sigmavec->n; i++) {
     538            sigma[i] = sigmavec->data.F32[i];
     539        }
     540        nsigma = sigmavec->n;
     541    } else {
     542        // requiring this causes updates to pop an assertion
     543        //  psAssert(status, "missing PSF.SIGMA.VALUES");
     544        float defaultsigma[NSIGMA]  = {1.0, 2.0, 3.0, 4.5, 6.0, 9.0, 12.0, 18.0};
     545        for (int i = 0 ; i < NSIGMA; i++) {
     546            sigma[i] = defaultsigma[i];
     547        }
     548        nsigma = NSIGMA;
    538549    }
    539550
     
    542553
    543554    // loop over radii:
    544     for (int i = 0; i < sigmavec->n; i++) {
     555    for (int i = 0; i < nsigma; i++) {
    545556
    546557        // XXX move max source number to config
     
    599610    float minS = Sout[0];
    600611    float maxS = Sout[0];
    601     for (int i = 0; i < sigmavec->n; i++) {
     612    for (int i = 0; i < nsigma; i++) {
    602613        minS = PS_MIN(Sout[i], minS);
    603614        maxS = PS_MAX(Sout[i], maxS);
    604615    }
    605     if (minS > 0.65) Sigma = sigma[sigmavec->n-1];
     616    if (minS > 0.65) Sigma = sigma[nsigma-1];
    606617    if (maxS < 0.65) Sigma = sigma[0];
    607618
    608     for (int i = 0; i < sigmavec->n - 1 && isnan(Sigma); i++) {
     619    for (int i = 0; i < nsigma - 1 && isnan(Sigma); i++) {
    609620        if (!isfinite(Sout[i]) || !isfinite(Sout[i+1])) continue;
    610621        if ((Sout[i] > 0.65) && (Sout[i+1] > 0.65)) continue;
Note: See TracChangeset for help on using the changeset viewer.