parameters: (window, nperseg, input_length)
return_statement: return win, nperseg
docstring: Parses window and nperseg arguments for spectrogram and _spectral_helper.
      This is a helper function, not meant to be called externally.
  
      Parameters
      ----------
      window : string, tuple, or ndarray
          If window is specified by a string or tuple and nperseg is not
          specified, nperseg is set to the default of 256 and returns a window of
          that length.
          If instead the window is array_like and nperseg is not specified, then
          nperseg is set to the length of the window. A ValueError is raised if
          the user supplies both an array_like window and a value for nperseg but
          nperseg does not equal the length of the window.
  
      nperseg : int
          Length of each segment
  
      input_length: int
          Length of input signal, i.e. x.shape[-1]. Used to test for errors.
  
      Returns
      -------
      win : ndarray
          window. If function was called with string or tuple than this will hold
          the actual array used as a window.
  
      nperseg : int
          Length of each segment. If window is str or tuple, nperseg is set to
          256. If window is array_like, nperseg is set to the length of the
          6
          window.
docstring_summary: Parses window and nperseg arguments for spectrogram and _spectral_helper.
      This is a helper function, not meant to be called externally.
docstring_tokens: Parses window and nperseg arguments for spectrogram and _spectral_helper . This is a helper function not meant to be called externally .
function: def _triage_segments(window, nperseg, input_length):
      """
      Parses window and nperseg arguments for spectrogram and _spectral_helper.
      This is a helper function, not meant to be called externally.
  
      Parameters
      ----------
      window : string, tuple, or ndarray
          If window is specified by a string or tuple and nperseg is not
          specified, nperseg is set to the default of 256 and returns a window of
          that length.
          If instead the window is array_like and nperseg is not specified, then
          nperseg is set to the length of the window. A ValueError is raised if
          the user supplies both an array_like window and a value for nperseg but
          nperseg does not equal the length of the window.
  
      nperseg : int
          Length of each segment
  
      input_length: int
          Length of input signal, i.e. x.shape[-1]. Used to test for errors.
  
      Returns
      -------
      win : ndarray
          window. If function was called with string or tuple than this will hold
          the actual array used as a window.
  
      nperseg : int
          Length of each segment. If window is str or tuple, nperseg is set to
          256. If window is array_like, nperseg is set to the length of the
          6
          window.
      """
  
      # parse window; if array like, then set nperseg = win.shape
      if isinstance(window, string_types) or isinstance(window, tuple):
          # if nperseg not specified
          if nperseg is None:
              nperseg = 256  # then change to default
          if nperseg > input_length:
              warnings.warn('nperseg = {0:d} is greater than input length '
                            ' = {1:d}, using nperseg = {1:d}'
                            .format(nperseg, input_length))
              nperseg = input_length
          win = get_window(window, nperseg)
      else:
          win = np.asarray(window)
          if len(win.shape) != 1:
              raise ValueError('window must be 1-D')
          if input_length < win.shape[-1]:
              raise ValueError('window is longer than input signal')
          if nperseg is None:
              nperseg = win.shape[0]
          elif nperseg is not None:
              if nperseg != win.shape[0]:
                  raise ValueError("value specified for nperseg is different"
                                   " from length of window")
      return win, nperseg
function_tokens: def _triage_segments ( window , nperseg , input_length ) : # parse window; if array like, then set nperseg = win.shape if isinstance ( window , string_types ) or isinstance ( window , tuple ) : # if nperseg not specified if nperseg is None : nperseg = 256 # then change to default if nperseg > input_length : warnings . warn ( 'nperseg = {0:d} is greater than input length ' ' = {1:d}, using nperseg = {1:d}' . format ( nperseg , input_length ) ) nperseg = input_length win = get_window ( window , nperseg ) else : win = np . asarray ( window ) if len ( win . shape ) != 1 : raise ValueError ( 'window must be 1-D' ) if input_length < win . shape [ - 1 ] : raise ValueError ( 'window is longer than input signal' ) if nperseg is None : nperseg = win . shape [ 0 ] elif nperseg is not None : if nperseg != win . shape [ 0 ] : raise ValueError ( "value specified for nperseg is different" " from length of window" ) return win , nperseg