IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 27, 2015, 10:41:36 AM (11 years ago)
Author:
eugene
Message:

handle nan values in parameters

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20150326/psastro/src/psastroGalaxyShapeErrors.c

    r38019 r38025  
    6969            float *dPAR = model->dparams->data.F32;
    7070
     71            if (!(isfinite(PAR[PM_PAR_SXX]) && isfinite(PAR[PM_PAR_SXY]) && isfinite(PAR[PM_PAR_SYY]))) {
     72              // set a mask bit
     73              continue;
     74            }
     75            if (!(isfinite(dPAR[PM_PAR_SXX]) && isfinite(dPAR[PM_PAR_SXY]) && isfinite(dPAR[PM_PAR_SYY]))) {
     76              // set a (different) mask bit
     77              continue;
     78            }
     79
    7180            // psphot writes out dPAR, but PAR is writen as MAJOR,MINOR,THETA but transformed
    7281            // to PAR[SXX,SXY,SYY] when the cmf is read.  here we use a monte carlo to generate
     
    8594                float Sxy = PAR[PM_PAR_SXY] + dPAR[PM_PAR_SXY]*psRandomGaussian(rng);
    8695                float Syy = PAR[PM_PAR_SYY] + dPAR[PM_PAR_SYY]*psRandomGaussian(rng);
     96                if (!(isfinite(Sxx) && isfinite(Sxy) && isfinite(Syy))) {
     97                  continue;
     98                }
     99
    87100                pmModelParamsToAxes (&axes, Sxx, Sxy, Syy, useReff);
    88101                if (!(isfinite(axes.major) && isfinite(axes.minor) && isfinite(axes.theta))) continue;
     
    111124    }
    112125    psFree (rng);
     126    psFree (stats);
     127    psFree (majorValues);
     128    psFree (minorValues);
     129    psFree (thetaValues);
    113130
    114     psLogMsg ("psastro.galaxy", PS_LOG_INFO, "monte carlo shape errors for %d of %d objects: %f sec\n", nObjects, (int) sources->n, psTimerMark ("psphot.choose.psf"));
     131    psLogMsg ("psastro.galaxy", PS_LOG_INFO, "monte carlo shape errors for %d of %d objects: %f sec\n", nObjects, (int) sources->n, psTimerMark ("psastro.galaxy.shape.errors"));
    115132    return true;
    116133}
Note: See TracChangeset for help on using the changeset viewer.