IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 5, 2012, 4:04:34 PM (14 years ago)
Author:
eugene
Message:

merge changes from trunk

Location:
branches/eam_branches/ipp-20120805/psphot
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20120805/psphot

  • branches/eam_branches/ipp-20120805/psphot/src

  • branches/eam_branches/ipp-20120805/psphot/src/psphotSourceStats.c

    r34378 r34399  
    524524    float PSF_SN_LIM = 2.0*psMetadataLookupF32(&status, recipe, "PSF_SN_LIM"); psAssert (status, "missing PSF_SN_LIM");
    525525
    526     // XXX move this to a config file?
     526    // XXX this will cause an error in the vector length is > 8
    527527    # define NSIGMA 8
    528     float sigma[NSIGMA] = {1.0, 2.0, 3.0, 4.5, 6.0, 9.0, 12.0, 18.0};
     528    // moved to config file
     529    psVector  *sigmavec = psMetadataLookupPtr (&status, recipe, "PSF.SIGMA.VALUES");
     530
     531    float sigma[NSIGMA];
    529532    float Sout[NSIGMA];
    530533    float Rmin[NSIGMA];
    531534    int   Nout[NSIGMA]; // number of stars found in clump : use this to control the number of regions measured by psphotRoughClass
    532535
     536    int nsigma;
     537    if (sigmavec) {
     538        psAssert(sigmavec->n <= NSIGMA, "too many sigma values in recipe %ld maximum is %d", sigmavec->n, NSIGMA);
     539        // copy the data from vector to local array to keep the code below easier to read
     540        for (int i = 0 ; i < sigmavec->n; i++) {
     541            sigma[i] = sigmavec->data.F32[i];
     542        }
     543        assert (sigmavec->n <= 8);
     544        nsigma = sigmavec->n;
     545    } else {
     546        // requiring this causes updates to pop an assertion
     547        //  psAssert(status, "missing PSF.SIGMA.VALUES");
     548        float defaultsigma[NSIGMA]  = {1.0, 2.0, 3.0, 4.5, 6.0, 9.0, 12.0, 18.0};
     549        for (int i = 0 ; i < NSIGMA; i++) {
     550            sigma[i] = defaultsigma[i];
     551        }
     552        nsigma = NSIGMA;
     553    }
     554
    533555    // this sorts by peak->rawFlux
    534556    sources = psArraySort (sources, pmSourceSortByFlux);
    535557
    536558    // loop over radii:
    537     for (int i = 0; i < NSIGMA; i++) {
     559    for (int i = 0; i < nsigma; i++) {
    538560
    539561        // XXX move max source number to config
     
    592614    float minS = Sout[0];
    593615    float maxS = Sout[0];
    594     for (int i = 0; i < NSIGMA; i++) {
     616    for (int i = 0; i < nsigma; i++) {
    595617        minS = PS_MIN(Sout[i], minS);
    596618        maxS = PS_MAX(Sout[i], maxS);
    597619    }
    598     if (minS > 0.65) Sigma = sigma[NSIGMA-1];
     620    if (minS > 0.65) Sigma = sigma[nsigma-1];
    599621    if (maxS < 0.65) Sigma = sigma[0];
    600622
    601     for (int i = 0; i < NSIGMA - 1 && isnan(Sigma); i++) {
     623    for (int i = 0; i < nsigma - 1 && isnan(Sigma); i++) {
    602624        if (!isfinite(Sout[i]) || !isfinite(Sout[i+1])) continue;
    603625        if ((Sout[i] > 0.65) && (Sout[i+1] > 0.65)) continue;
Note: See TracChangeset for help on using the changeset viewer.