def fix_gaps(y):
    """Linearly interpolates over NaNs in 1D input array x

    Args
    ----
    x: ndarray
        array containing NaNs to interpolate over

    Returns
    -------
    y_interp: ndarray
        array with NaN values replaced by interpolated values
    """
    import numpy
    not_nan = ~numpy.isnan(y)
    xp = numpy.where(not_nan)
    yp = y[not_nan]
    x_interp = numpy.arange(len(xp))
    y_interp = numpy.interp(x_interp, xp, yp)
    return y_interp
