Exemple #1
0
    // Constructor to initialize Exponential functions for 1D deviate photon shooting
    ExponentialInfo::ExponentialInfo(const GSParamsPtr& gsparams)
    {
        dbg<<"Start ExponentialInfo with gsparams = "<<gsparams.get()<<std::endl;
#ifndef USE_NEWTON_RAPHSON
        // Next, set up the classes for photon shooting
        _radial.reset(new ExponentialRadialFunction());
        dbg<<"Made radial"<<std::endl;
        std::vector<double> range(2,0.);
        range[1] = -std::log(gsparams->shoot_accuracy);
        _sampler.reset(new OneDimensionalDeviate( *_radial, range, true, gsparams));
        dbg<<"Made sampler"<<std::endl;
#endif

        // Calculate maxk:
        _maxk = std::pow(gsparams->maxk_threshold, -1./3.);
        dbg<<"maxk = "<<_maxk<<std::endl;

        // Calculate stepk:
        // int( exp(-r) r, r=0..R) = (1 - exp(-R) - Rexp(-R))
        // Fraction excluded is thus (1+R) exp(-R)
        // A fast solution to (1+R)exp(-R) = x:
        // log(1+R) - R = log(x)
        // R = log(1+R) - log(x)
        double logx = std::log(gsparams->folding_threshold);
        double R = -logx;
        for (int i=0; i<3; i++) R = std::log(1.+R) - logx;
        // Make sure it is at least 5 hlr
        // half-light radius = 1.6783469900166605 * r0
        const double hlr = 1.6783469900166605;
        R = std::max(R,gsparams->stepk_minimum_hlr*hlr);
        _stepk = M_PI / R;
        dbg<<"stepk = "<<_stepk<<std::endl;
    }
Exemple #2
0
 SBAiry::SBAiryImpl::SBAiryImpl(double lam_over_D, double obscuration, double flux,
                                const GSParamsPtr& gsparams) :
     SBProfileImpl(gsparams),
     _lam_over_D(lam_over_D),
     _D(1. / lam_over_D),
     _obscuration(obscuration),
     _flux(flux),
     _Dsq(_D*_D), _obssq(_obscuration*_obscuration),
     _inv_D_pi(1. / (_D * M_PI)),
     _inv_Dsq_pisq(_inv_D_pi * _inv_D_pi),
     _xnorm(flux * _Dsq),
     _knorm(flux / (M_PI * (1.-_obssq))),
     _info(cache.get(std::make_pair(_obscuration, this->gsparams.duplicate())))
 {
     xdbg<<"SBAiryImpl constructor: gsparams = "<<gsparams.get()<<std::endl;
     xdbg<<"this->gsparams = "<<this->gsparams.get()<<std::endl;
     xdbg<<*this->gsparams<<std::endl;
 }