def test_twocomp(sim): """Pass a simulation object as parameter""" spine_area_mult = 2.0 cell = moose.Cell('mycell', sim.model) soma = MyCompartment('soma', cell) soma.length = 20e-6 soma.diameter = 2 * 7.5e-6 soma.Em = -65e-3 soma.initVm = -65e-3 soma.setSpecificCm(9e-3) soma.setSpecificRm(5.0) soma.setSpecificRa(2.5) dend = MyCompartment('dend', cell) dend.length = 40e-6 dend.diameter = 2 * 1.06e-6 dend.Em = -65e-3 dend.initVm = -65e-3 dend.setSpecificCm(9e-3 * spine_area_mult) dend.setSpecificRm(5.0 / spine_area_mult) dend.setSpecificRa(2.5) soma.traubConnect(dend) vm_table = dend.insertRecorder("Vm1", "Vm", sim.data) dend.insertPulseGen("pulsegen1", sim.model, firstLevel=3e-10, firstDelay=20e-3, firstWidth=100e-3) # sim.schedule() # sim.run(100e-3) # sim.dump_data("data") return cell
channel = class_obj(channel_class, lib) channel.X = 0.0 channel_lib[channel_class] = channel channels_inited = True return channel_lib if __name__ == '__main__': sim = Simulation('test_ss_soma') soma = MyCompartment('soma', sim.model) soma.length = 20e-6 soma.diameter = 2e-6 * 7.5 soma.setSpecificCm(9e-3) soma.setSpecificRm(5.0) soma.setSpecificRa(1.0) soma.Em = -65e-3 soma.initVm = -65e-3 channel_lib = init_channels() gk = {} for channel, density in channel_density.items(): chan = channel_lib[channel] new_chan = moose.HHChannel(chan, chan.name, soma) chan = soma.insertChannel(new_chan, density) chan.X = 0.0 gk[channel] = moose.Table(channel, sim.data) gk[channel].stepMode = 3 gk[channel].connect('inputRequest', chan, 'Gk') print chan.name, chan.Gbar if channel.startswith('K'): chan.Ek = EK elif channel.startswith('Na'):
from subprocess import call call(['/home/subha/neuron/nrn/x86_64/bin/nrngui', 'test_suppyrRS_1comp.hoc'], cwd='../nrn') from datetime import datetime import moose import config from cell import * from capool import CaPool from compartment import MyCompartment from simulation import Simulation sim = Simulation() cell = moose.Cell('cell', sim.model) soma = MyCompartment('soma', cell) soma.diameter = 16e-6 soma.length = 15e-6 soma.Em = -70e-3 soma.initVm = -65e-3 soma.setSpecificRm(5.0) soma.setSpecificRa(2.5) soma.setSpecificCm(9e-3) soma.insertChannel('NaF', specificGbar=1875.0, Ek=50e-3, shift=-3.5e-3) soma.insertChannel('CaL', specificGbar=10.0, Ek=125e-3) soma.insertCaPool(2600000.0, 100e-3) vmTable = soma.insertRecorder('Vm', 'Vm', sim.data) caTable = moose.Table('ca', sim.data) caTable.stepMode = 3 soma.ca_pool.connect('Ca', caTable, 'inputRequest') sim.schedule() sim.run(200e-3) sim.dump_data('data')
else: channel = class_obj(channel_class, lib) channel.X = 0.0 channel_lib[channel_class] = channel channels_inited = True return channel_lib if __name__ == '__main__': sim = Simulation('test_ss_soma') soma = MyCompartment('soma', sim.model) soma.length = 20e-6 soma.diameter = 2e-6 * 7.5 soma.setSpecificCm(9e-3) soma.setSpecificRm(5.0) soma.setSpecificRa(1.0) soma.Em = -65e-3 soma.initVm = -65e-3 channel_lib = init_channels() gk = {} for channel, density in channel_density.items(): chan = channel_lib[channel] new_chan = moose.HHChannel(chan, chan.name, soma) chan = soma.insertChannel(new_chan, density) chan.X = 0.0 gk[channel] = moose.Table(channel, sim.data) gk[channel].stepMode = 3 gk[channel].connect('inputRequest', chan, 'Gk') print chan.name, chan.Gbar if channel.startswith('K'): chan.Ek = EK elif channel.startswith('Na'):