def validate_method(method, dy, fit_mean, nterms, frequency, assume_regular_frequency):
 methods = available_methods()
 fast_method_ok = ('fast' in methods)
 prefer_fast = (fast_method_ok and (len(frequency) > 200) and (assume_regular_frequency or _is_regular(frequency)))
 prefer_scipy = (('scipy' in methods) and (dy is None) and (not fit_mean))
 if (method == 'auto'):
  if (not fast_method_ok):
   warnings.warn('Fast Lomb-Scargle methods require numpy version 1.8 or newer. Using slower methods instead.')
  if (nterms != 1):
   if prefer_fast:
    method = 'fastchi2'
   else:
    method = 'chi2'
  elif prefer_fast:
   method = 'fast'
  elif prefer_scipy:
   method = 'scipy'
  else:
   method = 'cython'
 if (method not in METHODS):
  raise ValueError('invalid method: {0}'.format(method))
 return method

def validate_method ( method , dy , fit_mean , nterms , frequency , assume_regular_frequency ) : methods = available_methods ( ) fast_method_ok = ( 'fast' in methods ) prefer_fast = ( fast_method_ok and ( len ( frequency ) > 200 ) and ( assume_regular_frequency or _is_regular ( frequency ) ) ) prefer_scipy = ( ( 'scipy' in methods ) and ( dy is None ) and ( not fit_mean ) ) if ( method == 'auto' ) : if ( not fast_method_ok ) : warnings . warn ( 'Fast Lomb-Scargle methods require numpy version 1.8 or newer. Using slower methods instead.' ) if ( nterms != 1 ) : if prefer_fast : method = 'fastchi2' else : method = 'chi2' elif prefer_fast : method = 'fast' elif prefer_scipy : method = 'scipy' else : method = 'cython' if ( method not in METHODS ) : raise ValueError ( 'invalid method: {0}' . format ( method ) ) return method
validate the method argument .