'Initialize a 1D linear interpolation class.'

def __init__(self, x, y, kind='linear', axis=(-1), copy=True, bounds_error=None, fill_value=np.nan, assume_sorted=False):

    _Interpolator1D.__init__(self, x, y, axis=axis)
    self.bounds_error = bounds_error
    self.copy = copy
    if (kind in ['zero', 'slinear', 'quadratic', 'cubic']):
        order = {'zero': 0, 'slinear': 1, 'quadratic': 2, 'cubic': 3}[kind]
        kind = 'spline'
    elif isinstance(kind, int):
        order = kind
        kind = 'spline'
    elif (kind not in ('linear', 'nearest')):
        raise NotImplementedError(('%s    is    unsupported:    Use    fitpack    routines    for    other    types.' % kind))
    x = array(x, copy=self.copy)
    y = array(y, copy=self.copy)
    if (not assume_sorted):
        ind = np.argsort(x)
        x = x[ind]
        y = np.take(y, ind, axis=axis)
    if (x.ndim != 1):
        raise ValueError('the    x    array    must    have    exactly    one    dimension.')
    if (y.ndim == 0):
        raise ValueError('the    y    array    must    have    at    least    one    dimension.')
    if (not issubclass(y.dtype.type, np.inexact)):
        y = y.astype(np.float_)
    self.axis = (axis % y.ndim)
    self.y = y
    self._y = self._reshape_yi(self.y)
    self.x = x
    del y, x
    self._kind = kind
    self.fill_value = fill_value
    if (kind in ('linear', 'nearest')):
        minval = 2
        if (kind == 'nearest'):
            self.x_bds = (self.x / 2.0)
            self.x_bds = (self.x_bds[1:] + self.x_bds[:(-1)])
            self._call = self.__class__._call_nearest
        else:
            cond = ((self.x.dtype == np.float_) and (self.y.dtype == np.float_))
            cond = (cond and (self.y.ndim == 1))
            cond = (cond and (not _do_extrapolate(fill_value)))
            if cond:
                self._call = self.__class__._call_linear_np
            else:
                self._call = self.__class__._call_linear
    else:
        minval = (order + 1)
        rewrite_nan = False
        (xx, yy) = (self.x, self._y)
        if (order > 1):
            if np.isnan(self.x).any():
                xx = np.linspace(min(self.x), max(self.x), len(self.x))
                rewrite_nan = True
            if np.isnan(self._y).any():
                yy = np.ones_like(self._y)
                rewrite_nan = True
        self._spline = make_interp_spline(xx, yy, k=order, check_finite=False)
        if rewrite_nan:
            self._call = self.__class__._call_nan_spline
        else:
            self._call = self.__class__._call_spline
    if (len(self.x) < minval):
        raise ValueError(('x    and    y    arrays    must    have    at    least    %d    entries' % minval))
