Exemple #1
0
def F(alpha):
    "lorentzian, with norm calcualted"
    alpha[-1] = 1. # always set norm = 1
    f = lorentzian.ForwardFactory(alpha)
    from scipy.integrate import romberg
    n = romberg(f, 0, 3) #NOTE: this step is _SLOW_
    def _(x):
        return f(x)/n
    return _
def F(alpha):
    "lorentzian, with norm calcualted"
    alpha[-1] = 1. # always set norm = 1
    f = lorentzian.ForwardFactory(alpha)
    from scipy.integrate import romberg
    with warnings.catch_warnings():
        # suppress: "AccuracyWarning: divmax (10) exceeded"
        warnings.simplefilter('ignore')
        n = romberg(f,0,3,divmax=5) #NOTE: this step is _SLOW_ (tweak divmax)
    def _(x):
        return f(x)/n
    return _