main.py 文件源码

python
阅读 31 收藏 0 点赞 0 评论 0

项目:lombscargle 作者: jakevdp 项目源码 文件源码
def _validate_method(method, dy, fit_bias, nterms,
                     frequency, assume_regular_frequency):
    fast_method_ok = hasattr(np.ufunc, 'at')
    if not fast_method_ok:
        warnings.warn("Fast Lomb-Scargle methods require numpy version 1.8 "
                      "or newer. Using slower methods instead.")

    # automatically choose the appropiate method
    if method == 'auto':
        if nterms != 1:
            if (fast_method_ok and len(frequency) > 100
                    and _is_regular(frequency, assume_regular_frequency)):
                method = 'fastchi2'
            else:
                method = 'chi2'
        elif (fast_method_ok and len(frequency) > 100
              and _is_regular(frequency, assume_regular_frequency)):
            method = 'fast'
        elif dy is None and not fit_bias:
            method = 'scipy'
        else:
            method = 'slow'


    if method not in METHODS:
        raise ValueError("invalid method: {0}".format(method))

    return method
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号