code: def _fit_edge(
      x,
      window_start,
      window_stop,
      interp_start,
      interp_stop,
      axis,
      polyorder,
      deriv,
      delta,
      y,
  ):
      """
      Given an n-d array `x` and the specification of a slice of `x` from
      `window_start` to `window_stop` along `axis`, create an interpolating
      polynomial of each 1-d slice, and evaluate that polynomial in the slice
      from `interp_start` to `interp_stop`.  Put the result into the
      corresponding slice of `y`.
      """
  
      # Get the edge into a (window_length, -1) array.
      x_edge = axis_slice(
          x, start=window_start, stop=window_stop, axis=axis
      )
      if axis == 0 or axis == -x.ndim:
          xx_edge = x_edge
          swapped = False
      else:
          xx_edge = x_edge.swapaxes(axis, 0)
          swapped = True
      xx_edge = xx_edge.reshape(xx_edge.shape[0], -1)
  
      # Fit the edges.  poly_coeffs has shape (polyorder + 1, -1),
      # where '-1' is the same as in xx_edge.
      poly_coeffs = np.polyfit(
          np.arange(0, window_stop - window_start), xx_edge, polyorder
      )
  
      if deriv > 0:
          poly_coeffs = _polyder(poly_coeffs, deriv)
  
      # Compute the interpolated values for the edge.
      i = np.arange(
          interp_start - window_start, interp_stop - window_start
      )
      values = np.polyval(poly_coeffs, i.reshape(-1, 1)) / (
          delta**deriv
      )
  
      # Now put the values into the appropriate slice of y.
      # First reshape values to match y.
      shp = list(y.shape)
      shp[0], shp[axis] = shp[axis], shp[0]
      values = values.reshape(interp_stop - interp_start, *shp[1:])
      if swapped:
          values = values.swapaxes(0, axis)
      # Get a view of the data to be replaced by values.
      y_edge = axis_slice(
          y, start=interp_start, stop=interp_stop, axis=axis
      )
      y_edge[...] = values
  
file_path: catboost/contrib/python/scipy/py2/scipy/signal/_savitzky_golay.py
imports: from __future__ import division, print_function, absolute_import
  import numpy
  from scipy.linalg import lstsq
  from math import factorial
  from scipy.ndimage import convolve1d
  from ._arraytools import axis_slice
label_desc: Use image node_id 3 for calling a global function with example usage: _fit_edge(x, window_start, window_stop, interp_start, interp_stop, axis, polyorder, deriv, delta, y) without return types