def _get_flim(flim, fscale, freq, sfreq=None):
 if (flim is None):
  if (freq is None):
   flim = [(0.1 if (fscale == 'log') else 0.0), (sfreq / 2.0)]
  else:
   if (fscale == 'linear'):
    flim = [freq[0]]
   else:
    flim = [(freq[0] if (freq[0] > 0) else (0.1 * freq[1]))]
   flim += [freq[(-1)]]
 if (fscale == 'log'):
  if (flim[0] <= 0):
   raise ValueError(('flim[0] must be positive, got %s' % flim[0]))
 elif (flim[0] < 0):
  raise ValueError(('flim[0] must be non-negative, got %s' % flim[0]))
 return flim

def _get_flim ( flim , fscale , freq , sfreq = None ) : if ( flim is None ) : if ( freq is None ) : flim = [ ( 0.1 if ( fscale == 'log' ) else 0.0 ) , ( sfreq / 2.0 ) ] else : if ( fscale == 'linear' ) : flim = [ freq [ 0 ] ] else : flim = [ ( freq [ 0 ] if ( freq [ 0 ] > 0 ) else ( 0.1 * freq [ 1 ] ) ) ] flim += [ freq [ ( - 1 ) ] ] if ( fscale == 'log' ) : if ( flim [ 0 ] <= 0 ) : raise ValueError ( ( 'flim[0] must be positive, got %s' % flim [ 0 ] ) ) elif ( flim [ 0 ] < 0 ) : raise ValueError ( ( 'flim[0] must be non-negative, got %s' % flim [ 0 ] ) ) return flim
get reasonable frequency limits .