soma.insertPulseGen('pulsegen',
                        sim.model,
                        firstLevel=3e-10,
                        firstDelay=20.0e-3,
                        firstWidth=1e3)
    print 'Rm:', soma.Rm
    print 'Cm:', soma.Cm,
    print 'Em:', soma.Em
    gk_naf2_table = moose.Table('Gk_NaF2', sim.data)
    gk_naf2_table.stepMode = 3
    chan = moose.HHChannel(soma.path + '/NaF2')
    print chan.Gbar, chan.Ek
    chan.connect('Gk', gk_naf2_table, 'inputRequest')
    sim.schedule()
    config.context.useClock(0, sim.model.path + '/##')
    soma.useClock(1, 'init')
    for channel in soma.channels:
        channel.useClock(0)
    sim.run(50e-3)
    for i in range(len(gk_naf2_table)):
        gk_naf2_table[i] = gk_naf2_table[i] / soma.sarea()
    sim.dump_data('data')
    pylab.subplot(211)
    pylab.plot(vm_table)
    pylab.subplot(212)
    for key, value in gk.items():
        pylab.plot(value, label=key)
    pylab.legend()
    pylab.show()

#
	    print 'Error: unknown channel', channel
	    
    soma.insertCaPool(5.2e-6 / 2e-10, 50e-3)
    vm_table = soma.insertRecorder('Vm', 'Vm', sim.data)
    soma.insertPulseGen('pulsegen', sim.model, firstLevel=3e-10, firstDelay=20.0e-3, firstWidth=1e3)
    print 'Rm:', soma.Rm
    print 'Cm:', soma.Cm,
    print 'Em:', soma.Em
    gk_naf2_table = moose.Table('Gk_NaF2', sim.data)
    gk_naf2_table.stepMode = 3
    chan = moose.HHChannel(soma.path + '/NaF2')
    print chan.Gbar, chan.Ek
    chan.connect('Gk', gk_naf2_table, 'inputRequest')
    sim.schedule()
    config.context.useClock(0, sim.model.path + '/##')
    soma.useClock(1, 'init')
    for channel in soma.channels:
        channel.useClock(0)
    sim.run(50e-3)
    for i in range(len(gk_naf2_table)):
        gk_naf2_table[i] = gk_naf2_table[i] / soma.sarea()
    sim.dump_data('data')
    pylab.subplot(211)
    pylab.plot(vm_table)
    pylab.subplot(212)
    for key, value in gk.items():
        pylab.plot(value, label=key)
    pylab.legend()
    pylab.show()