Ejemplo n.º 1
0
def create_model():
    """Create two single compartmental neurons, neuron_A is the
    presynaptic neuron and neuron_B is the postsynaptic neuron.

        1. The presynaptic cell's Vm is monitored by a SpikeGen
        object. Whenever the Vm crosses the threshold of the spikegen, it
        sends out a spike event message.
    
        2. This is event message is received by a SynHandler, which
        passes the event as activation parameter to a SynChan object.

        3. The SynChan, which is connected to the postsynaptic neuron
        as a channel, updates its conductance based on the activation
        parameter.

        4. The change in conductance due to a spike may evoke an
        action potential in the post synaptic neuron.

    """
    model = moose.Neutral('/model')
    nrn_a = create_1comp_neuron('/model/neuron_A')[0]
    nrn_b = create_1comp_neuron('/model/neuron_B')[0]
    #: SynChan for post synaptic neuron
    synchan = moose.SynChan('/model/neuron_B/synchan')
    synchan.Gbar = 1e-8
    synchan.tau1 = 2e-3
    synchan.tau2 = 2e-3
    msg = moose.connect(nrn_b, 'channel', synchan, 'channel')
    #: Create SynHandler to handle spike event input and set the
    #: activation input of synchan
    synhandler = moose.SimpleSynHandler('/model/neuron_B/synhandler')
    synhandler.synapse.num = 1
    synhandler.synapse[0].delay = 5e-3
    moose.connect(synhandler, 'activationOut', synchan, 'activation')
    #: SpikeGen detects when presynaptic Vm crosses threshold and
    #: sends out a spike event
    spikegen = moose.SpikeGen('/model/neuron_A/spikegen')
    spikegen.threshold = 0.0
    msg = moose.connect(nrn_a, 'VmOut', spikegen, 'Vm')
    msg = moose.connect(spikegen, 'spikeOut', synhandler.synapse[0],
                        'addSpike')
    return {
        'presynaptic': nrn_a,
        'postsynaptic': nrn_b,
        'spikegen': spikegen,
        'synchan': synchan,
        'synhandler': synhandler
    }
Ejemplo n.º 2
0
def create_population(container, size):
    """Create a population of `size` single compartmental neurons with Na+
    and K+ channels. Also create SpikeGen objects and SynChan objects
    connected to these which can act as plug points for setting up
    synapses later.

    This uses **ionchannel.create_1comp_neuron**.

    """
    path = container.path
    print((path, size, type(path)))
    comps = create_1comp_neuron('{}/neuron'.format(path), number=size)
    synpath = path + '/synchan'
    print((synpath, size, type(size)))
    synchan = moose.vec(synpath, n=size, dtype='SynChan')
    synchan.Gbar = 1e-8
    synchan.tau1 = 2e-3
    synchan.tau2 = 2e-3
    m = moose.connect(comps, 'channel', synchan, 'channel', 'OneToOne')
    synhandler = moose.vec('{}/synhandler'.format(path),
                           n=size,
                           dtype='SimpleSynHandler')
    moose.connect(synhandler, 'activationOut', synchan, 'activation',
                  'OneToOne')
    spikegen = moose.vec('{}/spikegen'.format(path), n=size, dtype='SpikeGen')
    spikegen.threshold = 0.0
    m = moose.connect(comps, 'VmOut', spikegen, 'Vm', 'OneToOne')
    return {
        'compartment': comps,
        'spikegen': spikegen,
        'synchan': synchan,
        'synhandler': synhandler
    }
Ejemplo n.º 3
0
def create_cell():
    """Create a single-compartment Hodgking-Huxley neuron with a
    synaptic channel. 

    This uses the :func:`ionchannel.create_1comp_neuron` function for
    model creation.

    Returns a dict containing the neuron, the synchan and the
    synhandler for accessing the synapse,
    """
    neuron = create_1comp_neuron('/neuron')
    #: SynChan for post synaptic neuron
    synchan = moose.SynChan('/neuron/synchan')
    synchan.Gbar = 1e-8
    synchan.tau1 = 2e-3
    synchan.tau2 = 2e-3
    msg = moose.connect(neuron, 'channel', synchan, 'channel')
    #: Create SynHandler to handle spike event input and set the
    #: activation input of synchan
    synhandler = moose.SimpleSynHandler('/neuron/synhandler')
    synhandler.synapse.num = 1
    synhandler.synapse[0].delay = 5e-3
    moose.connect(synhandler, 'activationOut', synchan, 'activation')
    return {'neuron': neuron,
            'synchan': synchan,
            'synhandler': synhandler}
Ejemplo n.º 4
0
def create_population(container, size):
    """Create a population of `size` single compartmental neurons with Na+
    and K+ channels. Also create SpikeGen objects and SynChan objects
    connected to these which can act as plug points for setting up
    synapses later.

    This uses ..ref::`ionchannel.create_1comp_neuron`.

    """
    path = container.path
    print path, size, type(path)
    comps = create_1comp_neuron("{}/neuron".format(path), number=size)
    synpath = path + "/synchan"
    print synpath, size, type(size)
    synchan = moose.vec(synpath, n=size, dtype="SynChan")
    synchan.Gbar = 1e-8
    synchan.tau1 = 2e-3
    synchan.tau2 = 2e-3
    m = moose.connect(comps, "channel", synchan, "channel", "OneToOne")
    synhandler = moose.vec("{}/synhandler".format(path), n=size, dtype="SimpleSynHandler")
    moose.connect(synhandler, "activationOut", synchan, "activation", "OneToOne")
    spikegen = moose.vec("{}/spikegen".format(path), n=size, dtype="SpikeGen")
    spikegen.threshold = 0.0
    m = moose.connect(comps, "VmOut", spikegen, "Vm", "OneToOne")
    return {"compartment": comps, "spikegen": spikegen, "synchan": synchan, "synhandler": synhandler}
Ejemplo n.º 5
0
def create_population(container, size):
    """Create a population of `size` single compartmental neurons with Na+
    and K+ channels. Also create SpikeGen objects and SynChan objects
    connected to these which can act as plug points for setting up
    synapses later.

    This uses ..ref::`ionchannel.create_1comp_neuron`.

    """
    path = container.path
    print((path, size, type(path)))
    comps = create_1comp_neuron('{}/neuron'.format(path), number=size)
    synpath = path+'/synchan'
    print((synpath, size, type(size)))
    synchan = moose.vec(synpath, n=size, dtype='SynChan')
    synchan.Gbar = 1e-8
    synchan.tau1 = 2e-3
    synchan.tau2 = 2e-3
    m = moose.connect(comps, 'channel', synchan, 'channel', 'OneToOne')
    synhandler = moose.vec('{}/synhandler'.format(path), n=size,
                           dtype='SimpleSynHandler')
    moose.connect(synhandler, 'activationOut', synchan, 'activation', 'OneToOne')
    spikegen = moose.vec('{}/spikegen'.format(path), n=size, dtype='SpikeGen')
    spikegen.threshold = 0.0
    m = moose.connect(comps, 'VmOut', spikegen, 'Vm', 'OneToOne')
    return {'compartment': comps, 'spikegen': spikegen, 'synchan':
            synchan, 'synhandler': synhandler}
Ejemplo n.º 6
0
def create_cell():
    """Create a single-compartment Hodgking-Huxley neuron with a
    synaptic channel.

    This uses the :func:`ionchannel.create_1comp_neuron` function for
    model creation.

    Returns a dict containing the neuron, the synchan and the
    synhandler for accessing the synapse,
    """
    neuron = create_1comp_neuron('/neuron')
    #: SynChan for post synaptic neuron
    synchan = moose.SynChan('/neuron/synchan')
    synchan.Gbar = 1e-8
    synchan.tau1 = 2e-3
    synchan.tau2 = 2e-3
    msg = moose.connect(neuron, 'channel', synchan, 'channel')
    #: Create SynHandler to handle spike event input and set the
    #: activation input of synchan
    synhandler = moose.SimpleSynHandler('/neuron/synhandler')
    synhandler.synapse.num = 1
    synhandler.synapse[0].delay = 5e-3
    moose.connect(synhandler, 'activationOut', synchan, 'activation')
    return {'neuron': neuron,
            'synchan': synchan,
            'synhandler': synhandler}
Ejemplo n.º 7
0
def create_model():
    """
Create two single compartmental neurons, neuron_A is the
presynaptic neuron and neuron_B is the postsynaptic neuron.

    1. The presynaptic cell's Vm is monitored by a SpikeGen
    object. Whenever the Vm crosses the threshold of the spikegen, it
    sends out a spike event message.

    2. This is event message is received by a SynHandler, which
    passes the event as activation parameter to a SynChan object.

    3. The SynChan, which is connected to the postsynaptic neuron
    as a channel, updates its conductance based on the activation
    parameter.

    4. The change in conductance due to a spike may evoke an
    action potential in the post synaptic neuron.

    """
    model = moose.Neutral('/model')
    nrn_a = create_1comp_neuron('/model/neuron_A')[0]
    nrn_b = create_1comp_neuron('/model/neuron_B')[0]
    #: SynChan for post synaptic neuron
    synchan = moose.SynChan('/model/neuron_B/synchan')
    synchan.Gbar = 1e-8
    synchan.tau1 = 2e-3
    synchan.tau2 = 2e-3
    msg = moose.connect(nrn_b, 'channel', synchan, 'channel')
    #: Create SynHandler to handle spike event input and set the
    #: activation input of synchan
    synhandler = moose.SimpleSynHandler('/model/neuron_B/synhandler')
    synhandler.synapse.num = 1
    synhandler.synapse[0].delay = 5e-3
    moose.connect(synhandler, 'activationOut', synchan, 'activation')
    #: SpikeGen detects when presynaptic Vm crosses threshold and
    #: sends out a spike event
    spikegen = moose.SpikeGen('/model/neuron_A/spikegen')
    spikegen.threshold = 0.0
    msg = moose.connect(nrn_a, 'VmOut', spikegen, 'Vm')
    msg = moose.connect(spikegen, 'spikeOut', synhandler.synapse[0],
                        'addSpike')
    return {'presynaptic': nrn_a, 'postsynaptic': nrn_b, 'spikegen':
            spikegen, 'synchan': synchan, 'synhandler': synhandler}