I am trying to use the netstim.mod file (below) and wanted to know the syntax to use to implement a different seed, to get a different distribution from the 'exprand()' function. Thank you.
NEURON {
ARTIFICIAL_CELL NetStim
RANGE y
RANGE interval, number, start
RANGE noise
}
PARAMETER {
interval = 10 (ms) <1e-9,1e9>: time between spikes (msec)
number = 10 <0,1e9> : number of spikes
start = 50 (ms) : start of first spike
noise = 0 <0,1> : amount of randomeaness (0.0 - 1.0)
}
ASSIGNED {
y
event (ms)
on
end (ms)
}
PROCEDURE seed(x) {
set_seed(x)
}
INITIAL {
on = 0
y = 0
if (noise < 0) {
noise = 0
}
if (noise > 1) {
noise = 1
}
if (start >= 0 && number > 0) {
: randomize the first spike so on average it occurs at
: start + noise*interval
event = start + invl(interval) - interval*(1. - noise)
: but not earlier than 0
if (event < 0) {
event = 0
}
net_send(event, 3)
}
}
PROCEDURE init_sequence(t(ms)) {
if (number > 0) {
on = 1
event = t
end = t + 1e-6 + invl(interval)*(number-1)
}
}
FUNCTION invl(mean (ms)) (ms) {
if (mean <= 0.) {
mean = .01 (ms) : I would worry if it were 0.
}
if (noise == 0) {
invl = mean
}else{
<B>invl = (1. - noise)*mean + noise*mean*exprand(100)</B>
}
}
PROCEDURE event_time() {
if (number > 0) {
event = event + invl(interval)
}
if (event > end) {
on = 0
}
}
NET_RECEIVE (w) {
if (flag == 0) { : external event
if (w > 0 && on == 0) { : turn on spike sequence
init_sequence(t)
net_send(0, 1)
}else if (w < 0 && on == 1) { : turn off spiking
on = 0
}
}
if (flag == 3) { : from INITIAL
if (on == 0) {
init_sequence(t)
net_send(0, 1)
}
}
if (flag == 1 && on == 1) {
y = 2
net_event(t)
event_time()
if (on == 1) {
net_send(event - t, 1)
}
net_send(.1, 2)
}
if (flag == 2) {
y = 0
}
}
how to implement seed in mod file
NMODL and the Channel Builder.
Return to “Adding new mechanisms and functions to NEURON”
Jump to
- The NEURON Forum
- ↳ Goals and Policies
- ↳ Suggestions and Feedback
- ↳ NEURON Announcements
- NEURON installation and configuration
- ↳ OS X
- ↳ MSWin
- ↳ UNIX/Linux
- NEURON design
- ↳ NEURON + Python
- ↳ Reaction-diffusion in NEURON
- Making and using models with NEURON
- ↳ NEURON hacks
- ↳ Hot tips
- ↳ Getting started
- ↳ The GUI
- ↳ Anatomically detailed models
- ↳ Adding new mechanisms and functions to NEURON
- ↳ Modeling networks
- ↳ Optimization
- ↳ Parallel NEURON
- ↳ Other questions
- Tools of interest to NEURON users
- ↳ HNN: Human Neocortical Neurosolver
- ↳ LFPsim
- ↳ NetPyNE
- ↳ SimAgent
- ↳ SimTracker
- ↳ Other tools
- NEURON in neuroscience education
- ↳ From Computer to Brain
- ↳ Neurons in Action
- ↳ SWIMMY
- ↳ Other ways of using NEURON in neuroscience education
- Data sharing
- ↳ ModelDB and other online sources of models
- ↳ Specific models
- ↳ Policies and procedures
- Computational neuroscience in general
- ↳ General questions and discussions about computational neuroscience
- ↳ Employment and educational opportunities