Esempio n. 1
0
 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
Esempio n. 2
0
    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()
Esempio n. 5
0
 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()
Esempio n. 6
0
def get_comp(cell, index):
    """Return a wrapper over compartment specified by index. None if
    no such compartment exists."""
    if index <= 0: return None
    path = cell.path + '/comp_' + str(index)
    # print 'get_comp', path
    if config.context.exists(path):
        return MyCompartment(path)
    else:
        raise Exception('Cell: %s , index: %d - no such compartment.' %
                        (cell.path, index))
Esempio n. 7
0
    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)
Esempio n. 8
0
    def _create_axon(self):
        """Create the axonal structure.

        It is like:       
                          a_0_0 -- a_0_1
                         /
                        /
        soma -- a_0 -- a_1
                       \
                        \
                         a_1_0 --  a_1_1
        """
        self.axon.append(MyCompartment('a_0', self.soma))
        self.axon[-1].diameter = 0.7 * 2e-6
        self.axon.append(MyCompartment('a_1', self.axon[0]))
        self.axon[-1].diameter = 0.6 * 2e-6
        self.axon.append(MyCompartment('a_0_0', self.axon[1]))
        self.axon.append(MyCompartment('a_1_0', self.axon[1]))
        self.axon.append(MyCompartment('a_0_1', self.axon[2]))
        self.axon.append(MyCompartment('a_1_1', self.axon[3]))
        for comp in self.axon[2:]:
            comp.diameter = 0.5 * 2e-6
        for comp in self.axon:
            self.levels[0].add(comp)
            comp.length = 50e-6
        self.comp += self.axon
Esempio n. 9
0
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
Esempio n. 10
0
from simulation import Simulation

#import timeit
from datetime import datetime
import pylab
if __name__ == '__main__':
    sim = Simulation()
    t1 = datetime.now()
    s = SpinyStellate('ss', sim.model)
    t2 = datetime.now()
    delta_t = t2 - t1
    print '### TIME SPENT IN CELL CREATION: ', delta_t.seconds + delta_t.microseconds * 1e-6
    #    pymoose.printtree(s.soma)
    dump_cell(s, 'ss.p')
    path = s.soma.path + '/a_0/a_1/a_0_0/a_0_1'
    a2 = MyCompartment(path)
    vm_table = s.soma.insertRecorder('Vm_spinstell', 'Vm', sim.data)
    s.soma.insertPulseGen('pulsegen',
                          sim.model,
                          firstLevel=3e-10,
                          firstDelay=20e-3,
                          firstWidth=100e-3)
    sim.schedule()
    t1 = datetime.now()
    sim.run(100e-3)
    t2 = datetime.now()
    delta_t = t2 - t1
    print '#### TIME TO SIMULATE:', delta_t.seconds + delta_t.microseconds * 1e-6
    sim.dump_data('data')
    pylab.plot(vm_table)
    pylab.show()
Esempio n. 11
0
# 

# 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()
Esempio n. 12
0
            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)
Esempio n. 13
0
            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 = {}
    chandict = {}
    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
Esempio n. 14
0
        if config.context.exists('/library/' + channel_class):
            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)