def Vi_func(t, time, spike):
    """return value of Vi at time t (s) using simple linear interpolation"""
    dt = time[1]-time[0]
    t0 = time[0]
    if t < t0:
        return spike[0]
    t -= t0
    ind_t = int(t/dt)
    shift = t - dt*ind_t
    if ind_t+1 >= len(spike):
        ind_t = len(spike)-2
    out = (spike[ind_t]*(dt-shift) + spike[ind_t+1]*shift)/dt
    return out