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
def _add_comp(self, parent, level_no, dia=15e-6, length=40e-6): SpinyStellate.comp_cnt += 1 comp = MyCompartment('comp_' + str(SpinyStellate.comp_cnt), parent) self.level[level_no].add(comp) comp.diameter = dia comp.length = length return comp
def _create_dtree(self, name_prefix, parent, tree, level, default_length=40e-6, radius_dict=radius): """Create the dendritic tree structure with compartments. Returns the root.""" if not tree: return comp = MyCompartment(name_prefix + str(tree[0]), parent) self.comp.append(comp) comp.length = default_length comp.diameter = radius_dict[tree[0]] * 2e-6 self.levels[level].add(comp) self.dendrites.add(comp) for subtree in tree[1:]: self._create_dtree(name_prefix, comp, subtree, level+1, default_length, radius_dict)
def _create_cell(self): """Create the compartmental structure and set the geometry.""" if not hasattr(self, 'levels'): self.levels = defaultdict(set) comp = MyCompartment('soma', self) self.comp.append(comp) comp.length = 20e-6 comp.diameter = 7.5 * 2e-6 self.soma = comp self.levels[1].add(comp) t1 = datetime.now() for i in range(4): self. _create_dtree('d_' + str(i) + '_', comp, SpinyStellate.dendritic_tree, 2) t2 = datetime.now() delta = t2 - t1 print 'create_dtree took: ', delta.seconds + 1e-6 * delta.microseconds self._create_axon()
def _create_cell(self): """Create the compartmental structure and set the geometry.""" if not hasattr(self, 'levels'): self.levels = defaultdict(set) comp = MyCompartment('soma', self) self.comp.append(comp) comp.length = 20e-6 comp.diameter = 7.5 * 2e-6 self.soma = comp self.levels[1].add(comp) t1 = datetime.now() for i in range(4): self._create_dtree('d_' + str(i) + '_', comp, SpinyStellate.dendritic_tree, 2) t2 = datetime.now() delta = t2 - t1 print 'create_dtree took: ', delta.seconds + 1e-6 * delta.microseconds self._create_axon()
def _create_dtree(self, name_prefix, parent, tree, level, default_length=40e-6, radius_dict=radius): """Create the dendritic tree structure with compartments. Returns the root.""" if not tree: return comp = MyCompartment(name_prefix + str(tree[0]), parent) self.comp.append(comp) comp.length = default_length comp.diameter = radius_dict[tree[0]] * 2e-6 self.levels[level].add(comp) self.dendrites.add(comp) for subtree in tree[1:]: self._create_dtree(name_prefix, comp, subtree, level + 1, default_length, radius_dict)
# Code: 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: class_obj = eval(channel_class) if channel_class == 'NaF2': channel = class_obj(channel_class, lib, shift=-2.5e-3) 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
channel = moose.HHChannel(channel_class, lib) else: class_obj = eval(channel_class) if channel_class == 'NaF2': channel = class_obj(channel_class, lib, shift=-2.5e-3) 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