def _compute_csd_params(n_times, sfreq, mode, mt_bandwidth, mt_low_bias, mt_adaptive):
 ret_mt_adaptive = mt_adaptive
 if (mode == 'multitaper'):
  if (mt_bandwidth is not None):
   half_nbw = ((float(mt_bandwidth) * n_times) / (2.0 * sfreq))
  else:
   half_nbw = 2.0
  n_tapers_max = int((2 * half_nbw))
  (window_fun, eigvals) = dpss_windows(n_times, half_nbw, n_tapers_max, low_bias=mt_low_bias)
  n_tapers = len(eigvals)
  logger.info(('    using multitaper spectrum estimation with %d DPSS windows' % n_tapers))
  if (mt_adaptive and (len(eigvals) < 3)):
   warn('Not adaptively combining the spectral estimators due to a low number of tapers.')
   ret_mt_adaptive = False
 elif (mode == 'fourier'):
  logger.info('    using FFT with a Hanning window to estimate spectra')
  window_fun = np.hanning(n_times)
  ret_mt_adaptive = False
  eigvals = 1.0
  n_tapers = None
 else:
  raise ValueError('Mode has an invalid value.')
 return (window_fun, eigvals, n_tapers, ret_mt_adaptive)

def _compute_csd_params ( n_times , sfreq , mode , mt_bandwidth , mt_low_bias , mt_adaptive ) : ret_mt_adaptive = mt_adaptive if ( mode == 'multitaper' ) : if ( mt_bandwidth is not None ) : half_nbw = ( ( float ( mt_bandwidth ) * n_times ) / ( 2.0 * sfreq ) ) else : half_nbw = 2.0 n_tapers_max = int ( ( 2 * half_nbw ) ) ( window_fun , eigvals ) = dpss_windows ( n_times , half_nbw , n_tapers_max , low_bias = mt_low_bias ) n_tapers = len ( eigvals ) logger . info ( ( '    using multitaper spectrum estimation with %d DPSS windows' % n_tapers ) ) if ( mt_adaptive and ( len ( eigvals ) < 3 ) ) : warn ( 'Not adaptively combining the spectral estimators due to a low number of tapers.' ) ret_mt_adaptive = False elif ( mode == 'fourier' ) : logger . info ( '    using FFT with a Hanning window to estimate spectra' ) window_fun = np . hanning ( n_times ) ret_mt_adaptive = False eigvals = 1.0 n_tapers = None else : raise ValueError ( 'Mode has an invalid value.' ) return ( window_fun , eigvals , n_tapers , ret_mt_adaptive )
compute windowing and multitaper parameters .