How to use the neuron.h.IClamp function in NEURON

To help you get started, we’ve selected a few NEURON examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github JustasB / BlenderNEURON / tests / test_client.py View on Github external
def test():
            from blenderneuron.quick import bn

            with Blender(keep=False):

                from neuron import h
                h.load_file(test_hoc_file)
                tc1 = h.TestCell()
                tc2 = h.TestCell()

                ic = h.IClamp(0.5, sec=tc1.soma)
                ic.delay = 1
                ic.dur = 3
                ic.amp = 0.5

                bn.prepare_for_collection()
                bn.groups["all"]["3d_data"]["interaction_level"] = "Cell"
                bn.groups["all"]["3d_data"]["color_level"] = "Segment"

                h.run()

                bn.to_blender()

                self.assertTrue(bn.run_command("return_value = 'TestCell[0]' in bpy.data.objects"))
                self.assertTrue(bn.run_command("return_value = 'TestCell[1]' in bpy.data.objects"))

                self.assertTrue(bn.run_command("return_value = 'TestCell[0].soma[0]' in bpy.data.materials"))
github JustasB / BlenderNEURON / tests / test_client.py View on Github external
def test():
            from blenderneuron.quick import bn

            with Blender(keep=False):

                from neuron import h
                h.load_file(test_hoc_file)
                tc1 = h.TestCell()
                tc2 = h.TestCell()

                ic = h.IClamp(0.5, sec=tc1.soma)
                ic.delay = 1
                ic.dur = 3
                ic.amp = 0.5

                bn.prepare_for_collection()
                bn.groups["all"]["3d_data"]["interaction_level"] = "Cell"
                bn.groups["all"]["3d_data"]["color_level"] = "Section"

                h.run()

                bn.to_blender()

                self.assertTrue(bn.run_command("return_value = 'TestCell[0]' in bpy.data.objects"))
                self.assertTrue(bn.run_command("return_value = 'TestCell[1]' in bpy.data.objects"))

                self.assertTrue(bn.run_command("return_value = 'TestCell[0].soma' in bpy.data.materials"))
github BlueBrain / CoreNeuron / tests / jenkins / neuron_direct.py View on Github external
from neuron import h, gui
import sys

h('''create soma''')
h.soma.L=5.6419
h.soma.diam=5.6419
h.soma.insert("hh")
ic = h.IClamp(h.soma(.5))
ic.delay = .5
ic.dur = 0.1
ic.amp = 0.3

h.cvode.use_fast_imem(1)
h.cvode.cache_efficient(1)

v = h.Vector()
v.record(h.soma(.5)._ref_v, sec = h.soma)
i_mem = h.Vector()
i_mem.record(h.soma(.5)._ref_i_membrane_, sec = h.soma)
tv = h.Vector()
tv.record(h._ref_t, sec=h.soma)
h.run()
vstd = v.cl()
tvstd = tv.cl()
github BlueBrain / eFEL / examples / deap / deap_efel_eval1.py View on Github external
Evaluate a neuron model with parameters e_pas and g_pas, extracts
    features from resulting traces and returns a tuple with
    abs(voltage_base-target_voltage1) and 
    abs(steady_state_voltage-target_voltage2)
    """

    neuron.h.v_init = target_voltage1

    soma = neuron.h.Section()

    soma.insert('pas')

    soma.g_pas = individual[0]
    soma.e_pas = individual[1]

    clamp = neuron.h.IClamp(0.5, sec=soma)

    stim_start = 500
    stim_end = 1000

    clamp.amp = 1.0
    clamp.delay = stim_start
    clamp.dur = 100000

    voltage = neuron.h.Vector()
    voltage.record(soma(0.5)._ref_v)

    time = neuron.h.Vector()
    time.record(neuron.h._ref_t)

    neuron.h.tstop = stim_end
    neuron.h.run()
github NeuralEnsemble / PyNN / src / neuron / electrodes.py View on Github external
def inject_into(self, cell_list):
        """Inject this current source into some cells."""
        for id in cell_list:
            if id.local:
                if not id.celltype.injectable:
                    raise TypeError("Can't inject current into a spike source.")
                iclamp = h.IClamp(0.5, sec=id._cell.source_section)
                iclamp.delay = 0.0
                iclamp.dur = 1e12
                iclamp.amp = 0.0
                self._devices.append(iclamp)
                self.amplitudes.play(iclamp._ref_amp, self.times)
github openworm / pygeppetto / jupyter-frontend / simple_network.py View on Github external
def add_current_stim(self, delay):
        self.stim = h.IClamp(self.dend(1.0))
        self.stim.amp = 0.3  # input current in nA
        self.stim.delay = delay  # turn on after this time in ms
        self.stim.dur = 1  # duration of 1 ms
github AllenInstitute / bmtk / bmtk / simulator / bionet / iclamp.py View on Github external
def attach_current(self, cell):
        self._stim = h.IClamp(cell.hobj.soma[0](0.5))
        self._stim.delay = self._iclamp_del
        self._stim.dur = self._iclamp_dur
        self._stim.amp = self._iclamp_amp
        return self._stim
github mattions / neuronvisio / examples / pyramidal / main.py View on Github external
import nrnVisio
controls = nrnVisio.Controls()

# Importing hoc interpreter
from neuron import h

# loading the model
# importing the interview so the GUI does not freeze
# Uncomment this if you use the interview GUI
import neuron.gui

# Load the script
h.load_file("demo.hoc")

## Insert an IClamp
st = h.IClamp(0.5, sec=h.soma)
st.amp = 0.25
st.delay = 3
st.dur = 40


controls.join() # Join the thread to have a clean exit.
github mattions / neuronvisio / examples / pyramidal / main.py View on Github external
controls = Controls()

# Importing hoc interpreter
from neuron import h

# loading the model
# importing the interview so the GUI does not freeze
# Uncomment this if you want to use also the interview GUI
#import neuron.gui

# Load the script
h.load_file("demo.hoc")


## Insert an IClamp
st = h.IClamp(0.5, sec=h.soma)
st.amp = 0.25
st.delay = 3
st.dur = 40