Example #1
0
def test_extract_limit():
    d = dict(k=1.,limit_k=1.,error_k=1.,fix_k=1.)
    ret = extract_limit(d)
    assert_false('k' in ret)
    assert_true('limit_k' in ret)
    assert_false('error_k' in ret)
    assert_false('fix_k' in ret)
Example #2
0
def test_extract_limit():
    d = dict(k=1., limit_k=1., error_k=1., fix_k=1.)
    ret = extract_limit(d)
    assert 'k' not in ret
    assert 'limit_k' in ret
    assert 'error_k' not in ret
    assert 'fix_k' not in ret
Example #3
0
def pedantic(self, parameters, kwds, errordef):
    def w(msg):
        warn(msg, InitialParamWarning, stacklevel=3)
    for vn in parameters:
        if vn not in kwds:
            w('Parameter %s does not have initial value. Assume 0.' % vn)
        if 'error_' + vn not in kwds and 'fix_' + mutil.param_name(vn) not in kwds:
            w('Parameter %s is floating but does not have initial step size. Assume 1.' % vn)
    for vlim in mutil.extract_limit(kwds):
        if mutil.param_name(vlim) not in parameters:
            w('%s is given. But there is no parameter %s. Ignore.' % (vlim, mutil.param_name(vlim)))
    for vfix in mutil.extract_fix(kwds):
        if mutil.param_name(vfix) not in parameters:
            w('%s is given. But there is no parameter %s. Ignore.' % (vfix, mutil.param_name(vfix)))
    for verr in mutil.extract_error(kwds):
        if mutil.param_name(verr) not in parameters:
            w('%s float. But there is no parameter %s. Ignore.' % (verr, mutil.param_name(verr)))
    if errordef is None:
        w('errordef is not given. Default to 1.')