def test_f(HH, Istim, freq, stim_t0, duration=1, tmax=1000):
    baseline_Iapp = HH.pars['Iapp']
    stim_period = 1000./freq
    HH.set(tdata=[0, tmax])
    n = int(floor(tmax/stim_period))
    print "Testing with stimulus frequency %.3f Hz" % freq
    print "  (stimulus period is %.4f ms)" % stim_period
    print "Stimulus amplitude is %.3f" % Istim
    stim_ts = array([stim_t0+i*stim_period for i in range(0,n+1)])
    Istim_vardict = make_spike_signal(stim_ts, 1, tmax*1.1, loval=0, hival=Istim, dt=0.1)
    HH.inputs = Istim_vardict
    HH._extInputsChanged = True
    traj = HH.compute('stim_test')
    pts = traj.sample()
    plt.figure(1)
    plt.clf()
    plt.plot(pts['t'], pts['v'], 'b', lw=2)
    plt.plot(pts['t'], 3*pts['I']-75, 'k', lw=2)
    #plt.ylim([-100, 50])
    plt.xlabel('t')
    plt.ylabel('v')
    plt.title('Voltage trace and I(t) pulse stimulus')
    try:
        show_maps(traj, stim_ts, 0.3*tmax)
    except IndexError:
        print "Not enough spikes to show a map"
    return traj, pts, stim_ts
Equivalent of Django's ``{% crsf_token %}``.
dataset/ETHPy150Open robclewley/compneuro/Entrain_teacher_copy.py/test_f--crossover with--dataset/ETHPy150Open jbalogh/jingo/jingo/helpers.py/csrf