Example #1
0
    def __init__(self):
        print("loading very simple cell")
        neuron_utils.createProject(name='Very Simple Cell')

        print('Loading Model...')
        self.soma = h.Section(name='soma')
        self.soma.insert('pas')
        self.asyn = h.AlphaSynapse(self.soma(0.5))
        self.asyn.onset = 20
        self.asyn.gmax = 1
        self.v_vec = h.Vector()  # Membrane potential vector
        self.t_vec = h.Vector()  # Time stamp vector
        self.v_vec.record(self.soma(0.5)._ref_v)
        neuron_utils.createStateVariable(id='v_vec',
                                         name='v_vec',
                                         units='ms',
                                         python_variable={
                                             "record_variable": self.v_vec,
                                             "segment": self.soma(0.5)
                                         })

        self.t_vec.record(h._ref_t)
        neuron_utils.createStateVariable(id='time',
                                         name='time',
                                         units='ms',
                                         python_variable={
                                             "record_variable": self.t_vec,
                                             "segment": None
                                         })

        h.tstop = 80.0

        neuron_geometries_utils.extractGeometries()
Example #2
0
    def __init__(self):
        logging.debug('Loading PTcell')

        neuron_utils.createProject(name='PTcell Neuron')

        resource_package = "neuron_ui"
        resource_path = '/'.join(('models', 'PTcell.hoc'))
        filepath = pkg_resources.resource_filename(resource_package,
                                                   resource_path)

        h.load_file(filepath)
        self.PTCell = h.PTcell()

        self.t_vec = h.Vector()
        self.t_vec.record(h._ref_t)
        neuron_utils.createStateVariable(id='time',
                                         name='time',
                                         units='ms',
                                         python_variable={
                                             "record_variable": self.t_vec,
                                             "segment": None
                                         })

        neuron_geometries_utils.extractGeometries()

        logging.debug('PTcell loaded')
Example #3
0
    def __init__(self):
        logging.debug('Loading HNN')
        neuron_utils.createProject(name='HNN')
        import run

        self.t_vec = h.Vector()
        self.t_vec.record(h._ref_t)
        neuron_utils.createStateVariable(id='time',
                                         name='time',
                                         units='ms',
                                         python_variable={
                                             "record_variable": self.t_vec,
                                             "segment": None
                                         })

        neuron_geometries_utils.extractGeometries()

        logging.debug('HNN loaded')

        self.RunSimButton = neuron_utils.add_button('Run',
                                                    extraData={'commands': []})
        self.StopSimButton = neuron_utils.add_button(
            'Stop', extraData={'commands': []})
        self.SetParams = neuron_utils.add_button('Set Parameters')
        self.BasePanel = neuron_utils.add_panel(
            'HNN Control',
            items=[self.RunSimButton, self.StopSimButton, self.SetParams],
            widget_id='hnnBasePanel')
        self.BasePanel.on_close(self.close)
        self.BasePanel.display()
Example #4
0
    def modify_segment(self, triggeredComponent, args):
        logging.debug('Modifying segment')
        self.geometry.python_variable["section"].diam = float(
            self.section_diam.sync_value)
        self.geometry.python_variable["section"].L = float(
            self.section_length.sync_value)
        self.segment = float(self.segment_diam.sync_value)

        # Recreating Scene
        neuron_geometries_utils.extractGeometries(reload=True)
Example #5
0
    def __init__(self):
        logging.debug('Loading CA3 Pyramidal')

        neuron_utils.createProject(name='CA3 Pyramidal Neuron')

        resource_package = "neuron_ui"
        resource_path = '/'.join(('models', 'geo-cell1zr.hoc'))
        filepath = pkg_resources.resource_filename(resource_package,
                                                   resource_path)

        h.load_file(filepath)

        neuron_geometries_utils.extractGeometries()

        logging.debug('CA3 Pyramidal loaded')
Example #6
0
    def __init__(self,
                 N=5,
                 stim_w=0.004,
                 stim_number=1,
                 syn_w=0.01,
                 syn_delay=5):
        """
        :param N: Number of cells.
        :param stim_w: Weight of the stimulus
        :param stim_number: Number of spikes in the stimulus
        :param syn_w: Synaptic weight
        :param syn_delay: Delay of the synapse
        """
        neuron_utils.createProject(name='Ring')

        self._N = N  # Total number of cells in the net
        self.cells = []  # Cells in the net
        self.nclist = []  # NetCon list
        self.stim = None  # Stimulator
        self.stim_w = stim_w  # Weight of stim
        self.stim_number = stim_number  # Number of stim spikes
        self.syn_w = syn_w  # Synaptic weight
        self.syn_delay = syn_delay  # Synaptic delay
        self.t_vec = h.Vector()  # Spike time of all cells
        self.id_vec = h.Vector()  # Ids of spike times
        self.set_numcells(N)  # Actually build the net.

        self.time_vec = h.Vector()  # Time stamp vector
        self.time_vec.record(h._ref_t)
        neuron_utils.createStateVariable(id='time',
                                         name='time',
                                         units='ms',
                                         python_variable={
                                             "record_variable": self.time_vec,
                                             "segment": None
                                         })

        for i in range(N):
            self.set_recording_vectors(i)

        h.tstop = 50
        neuron_geometries_utils.extractGeometries()
Example #7
0
    def __init__(self):
        neuron_utils.createProject(name='Simple Cell')

        self.soma = h.Section(name='soma')
        self.dend = h.Section(name='dend')
        self.dend.connect(self.soma(1))

        # Surface area of cylinder is 2*pi*r*h (sealed ends are implicit).
        # Makes a soma of 500 microns squared.
        self.soma.L = self.soma.diam = 12.6157
        self.dend.L = 200  # microns
        self.dend.diam = 1  # microns

        for sec in h.allsec():
            sec.Ra = 100  # Axial resistance in Ohm * cm
            sec.cm = 1  # Membrane capacitance in micro Farads / cm^2

        # Insert active Hodgkin-Huxley current in the soma
        self.soma.insert('hh')
        self.soma.gnabar_hh = 0.12  # Sodium conductance in S/cm2
        self.soma.gkbar_hh = 0.036  # Potassium conductance in S/cm2
        self.soma.gl_hh = 0.0003  # Leak conductance in S/cm2
        self.soma.el_hh = -54.3  # Reversal potential in mV

        # Insert passive current in the dendrite
        self.dend.insert('pas')
        self.dend.g_pas = 0.001  # Passive conductance in S/cm2
        self.dend.e_pas = -65  # Leak reversal potential mV
        self.dend.nseg = 10

        # add synapse (custom channel)
        self.syn = h.AlphaSynapse(self.dend(1.0))
        self.syn.e = 0  # equilibrium potential in mV
        self.syn.onset = 20  # turn on after this time in ms
        self.syn.gmax = 0.05  # set conductance in uS
        self.syn.tau = 0.1  # set time constant

        # self.stim = h.IClamp(self.dend(1.0))
        # self.stim.amp = 0.3  # input current in nA
        # self.stim.delay = 1  # turn on after this time in ms
        # self.stim.dur = 1  # duration of 1 ms

        # record soma voltage and time
        self.t_vec = h.Vector()
        self.t_vec.record(h._ref_t)
        neuron_utils.createStateVariable(id='time',
                                         name='time',
                                         units='ms',
                                         python_variable={
                                             "record_variable": self.t_vec,
                                             "segment": None
                                         })

        self.v_vec_soma = h.Vector()
        self.v_vec_soma.record(self.soma(1.0)._ref_v)  # change recoding pos

        # TODO How do we extract the units?
        neuron_utils.createStateVariable(id='v_vec_soma',
                                         name='v_vec_soma',
                                         units='mV',
                                         python_variable={
                                             "record_variable":
                                             self.v_vec_soma,
                                             "segment": self.soma(1.0)
                                         })

        self.v_vec_dend = h.Vector()
        self.v_vec_dend.record(self.dend(1.0)._ref_v)
        # TODO How do we extract the units?
        neuron_utils.createStateVariable(id='v_vec_dend',
                                         name='v_vec_dend',
                                         units='mV',
                                         python_variable={
                                             "record_variable":
                                             self.v_vec_dend,
                                             "segment": self.dend(1.0)
                                         })

        # run simulation
        h.tstop = 60  # ms
        # h.run()

        neuron_geometries_utils.extractGeometries()