parameters: (x, y, new_x)
return_statement: return new_y
docstring: Essentially a step function.
  
      For each `new_x`, finds largest j such that``x[j] < new_x[j]`` and
      returns ``y[j]``.
  
      Parameters
      ----------
      x : array_like
          Independent values.
      y : array_like
          Dependent values.
      new_x : array_like
          The x values used to calculate the interpolated y.
  
      Returns
      -------
      block : ndarray
          Return array, of same length as `x_new`.
docstring_summary: Essentially a step function.
docstring_tokens: Essentially a step function .
function: def block(x, y, new_x):
      """
      Essentially a step function.
  
      For each `new_x`, finds largest j such that``x[j] < new_x[j]`` and
      returns ``y[j]``.
  
      Parameters
      ----------
      x : array_like
          Independent values.
      y : array_like
          Dependent values.
      new_x : array_like
          The x values used to calculate the interpolated y.
  
      Returns
      -------
      block : ndarray
          Return array, of same length as `x_new`.
  
      """
      # find index of values in x that precede values in x
      # This code is a little strange -- we really want a routine that
      # returns the index of values where x[j] < x[index]
      TINY = 1e-10
      indices = np.searchsorted(x, new_x+TINY)-1
  
      # If the value is at the front of the list, it'll have -1.
      # In this case, we will use the first (0), element in the array.
      # take requires the index array to be an Int
      indices = np.atleast_1d(np.clip(indices, 0, np.Inf).astype(int))
      new_y = np.take(y, indices, axis=-1)
      return new_y
function_tokens: def block ( x , y , new_x ) : # find index of values in x that precede values in x # This code is a little strange -- we really want a routine that # returns the index of values where x[j] < x[index] TINY = 1e-10 indices = np . searchsorted ( x , new_x + TINY ) - 1 # If the value is at the front of the list, it'll have -1. # In this case, we will use the first (0), element in the array. # take requires the index array to be an Int indices = np . atleast_1d ( np . clip ( indices , 0 , np . Inf ) . astype ( int ) ) new_y = np . take ( y , indices , axis = - 1 ) return new_y