Problem with event-based simulation

Moderator: wwlytton

Post Reply
duboismathieu

Problem with event-based simulation

Post by duboismathieu »

Hello everybody,

I'm a new user of NEURON (and French so excuse my English).

For my master project I need to understand event-based simulation so I have begun with the IntFire2 model (because it is very close to what I have to do). Here is the code of the NET_RECEIVE block (the cell is called IntFire2Mathieu :):

Code: Select all

NET_RECEIVE (w) {LOCAL ts_
	://Update the value of i just before the spike i(t0-)
	update_i(t)

	://Update the value of m just before the spike m(t0-)
	m = comp_m(t)

	IF (INFO) {printf("Net_Receive: t=%g, w=%g, m=%g, i=%g, ts=%g\n", t, w, m, i, ts)}

	if (flag == 1) { : time to fire
		IF (INFO) {printf("\tSpike at t=%g\n", t)}
		net_event(t)
		m = 0
		m0 = 0
		synaptic_event(t)
		ts_ = firetime()
		net_send(ts_, 1)
	}else{
		IF (INFO) {printf("\tReceive a spike at t=%g. Last synaptic event at t0=%g\n", t, t0)}

		://The spike change the value of i by w: i(t0+) = i(t0-) + w
		i = i + w
		IF (DEBUG) {printf("\ti updated by w: i=%g\n", i)}

		://Save the values needed to compute m: t0, m0, i0
		synaptic_event(t)
		IF (DEBUG) {printf("\tSaving the values needed to compute m(t): t0=%g, m0=%g, i0=%g\n", t0, m0, i0)}

		://We can compute the new constants
		a = ib
		b = (i - ib)*taus/(taus-taum)
		c = m0

		if (m >= 1) {
			net_move(t) : the time to fire is now
		}else{
			ts_ = firetime()
			printf("\t\tts=%g, ts_=%g\n", ts, ts_)
				ts = ts_
				net_move(ts)
		}

	}
	IF (INFO) {printf("End of Net_Receive\n")}
}
The structure is the same than in IntFire2.mod and chapter 10 of “The NEURON bookâ€
duboismathieu

Post by duboismathieu »

Hum, the code is a little bit long so here is a light version without the debugging messages:

Code: Select all

NET_RECEIVE (w) {LOCAL ts_
	://Update the value of i just before the spike i(t0-)
	update_i(t)

	://Update the value of m just before the spike m(t0-)
	m = comp_m(t)

	if (flag == 1) { : time to fire
		net_event(t)
		m = 0
		m0 = 0
		synaptic_event(t)
		ts_ = firetime()
		net_send(ts_, 1)
	}else{
		://The spike change the value of i by w: i(t0+) = i(t0-) + w
		i = i + w

		://Save the values needed to compute m: t0, m0, i0
		synaptic_event(t)

		://We can compute the new constants
		a = ib
		b = (i - ib)*taus/(taus-taum)
		c = m0

		if (m >= 1) {
			net_move(t) : the time to fire is now
		}else{
			ts_ = firetime()
			ts = ts_
			net_move(ts)
		}

	}
}
Few comments:
-update_i computes i just before the synaptic event according to eq 10.6 in "The NEURON Book"
-comp_m computes m just before the synaptic event according to eq 10.7 in "The NEURON Book"
-a,b,c are the same than in IntFire2 except that I compute them only once
-the code for self-events (flag==1) is maybe not correct (but presently it is never run because NEURON crashes before :)

We can do better but the goal is not to be efficient at the moment :).

Thanks again.
Mathieu.
ted
Site Admin
Posts: 6299
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Post by ted »

Don't worry about your English; it's fine.

To diagnose the problem, it will be necessary to be able to reproduce it. Can you define
a minimal model implementation that reproduces the error message? Zip up just those
hoc, mod, and ses files that are necessary, and email them to me
ted .dot. carnevale .at. yale .dot. edu

Two questions: what version of NEURON are you using, and under what OS?
duboismathieu

Post by duboismathieu »

I have found the problem.

It doesn't come from net_move or any "important" function. It comes from the printf statement at the beginning of the NET_RECEIVE block: in case of a self-event (at least in my case), w is not defined and this make NEURON crash. So the solution is simply to remove this printf.

I don't know if it is the intended behavior: it seems stupid to have a weight for a self-event (when you think about it :) but maybe NEURON should not crash...

Thanks Mr Carnevale for your response.

Best regards,
Mathieu.
hines
Site Admin
Posts: 1687
Joined: Wed May 18, 2005 3:32 pm

Re: Problem with event-based simulation

Post by hines »

The only case when the weight vector is NULL is when the self event is sent from the
INITIAL block (or descends from that primordial net_send). If the self event descends
from an external event (flag == 0) then the weight vector is exactly the weight vector
from the delivered NetCon.
Post Reply