NetStim and NetCon

When Python is the interpreter, what is a good
design for the interface to the basic NEURON
concepts.

Moderator: hines

Post Reply
anandhupresannan
Posts: 11
Joined: Tue Feb 26, 2019 10:13 am

NetStim and NetCon

Post by anandhupresannan »

Hi,

In my model I am using NetCon for connecting neurons. I have some doubts related to it. Could you please clarify it.

1) In NetCon can we pass array elements (time of spike) as a source variable

2) What kind of output is generated by NetStim? Is the NetStim output is stored in any global variable so we can look into the generated output.

Thank You.
ted
Site Admin
Posts: 5795
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: NetStim and NetCon

Post by ted »

In NetCon can we pass array elements (time of spike) as a source variable
No, but you would have discovered this fact by reading the Programmer's Reference documentation of the NetCon class. Presumably you have some precalculated spike times that you would like to use. Download and expand the gzipped tar file of NEURON's source code, then look at the files nrn/share/nrn/examples/nrniv/netcon/vecevent*
What kind of output is generated by NetStim?
Events.
Is the NetStim output is stored in any global variable so we can look into the generated output.
Read the documentation of the NetCon class's record() method.
anandhupresannan
Posts: 11
Joined: Tue Feb 26, 2019 10:13 am

Re: NetStim and NetCon

Post by anandhupresannan »

Thanks Ted.
Is there any way to give a set of spike times as input to the model?
ramcdougal
Posts: 214
Joined: Fri Nov 28, 2008 3:38 pm
Location: Yale School of Public Health

Re: NetStim and NetCon

Post by ramcdougal »

Yes.

If you're specifying each cell's inputs separately, as Ted pointed out, you can use VecStim (defined in vecevent.mod, which you'd have to include in your model and compile like any other mod file).

Here's an example, showing three inputs, two of which are able to cause a spike, one of which occurs during the refractory period:

Code: Select all

# libraries
import matplotlib.pyplot as plt
from neuron import h
from neuron.units import ms, mV
h.load_file('stdrun.hoc')

# specify the model
soma = h.Section(name='soma')
soma.L = soma.diam = 10 
soma.insert('hh')
syn = h.ExpSyn(soma(0.5))

# specify the input times
spt = h.Vector([3 * ms, 10 * ms, 25 * ms])
try:
    vs = h.VecStim()
except AttributeError:
    # note: the current version of vecevent.mod is always available from:
    # https://raw.githubusercontent.com/neuronsimulator/nrn/master/share/examples/nrniv/netcon/vecevent.mod
    raise Exception(
        "h.VecStim is not defined; did you forget to include and compile vecevent.mod?"
    )
vs.play(spt)

# attach the VecStim to the synapse
nc = h.NetCon(vs, syn)
nc.weight[0] = 0.004

# setup reccordiing of the soma
v = h.Vector().record(soma(0.5)._ref_v)
t = h.Vector().record(h._ref_t)

# run the simulation
h.finitialize(-65 * mV)
h.continuerun(50 * ms)

# plot it
plt.plot(t, v)
plt.show()

Image

The built-in way is to use PatternStim (there's an example at the link). It's a little more complicated to use for simple models, but it can specify inputs to all cells in one line.
Post Reply