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
评论列表
文章目录