Page 1 of 1

vector.record()

Posted: Mon Jun 27, 2011 9:12 pm
by rllin
If I wished to know peak synaptic current on an IntFire4, this is presumably through IntFire4.E ?

How would I record the current to a vector so that I can then find the maximum value?

I tried vector.record(IF.E) and similar variations. Help? Thanks!

Re: vector.record()

Posted: Tue Jun 28, 2011 1:10 pm
by ted
E, I, and M are functions, not doubles. Attempting to use the Vector class's record(), e.g. by
vec.record(&foo.E)
will produce error messages like this:

Code: Select all

nrniv: Not a double pointer
 near line 10
 vec.record(&foo.E)
                   ^
You can instead record the actual state e itself
vec.record(&foo.e)
It won't be pretty because e is evaluated only when a new event arrives so e will look like a staircase, but it should work.

Re: vector.record()

Posted: Thu Sep 15, 2011 8:01 am
by Raj
This ModelDB http://senselab.med.yale.edu/modeldb/Sh ... del=115357 entry with accession number 115357 contains code for printing the function M over time, and also for a special combination of E and I.

That being said I like to point out that all "currents" in the IntFire4 (excitatory and inhibitory) are normalized such that the peak value of m (M) due to an isolated single synaptic activation equals the weight of the activated synapse (NetCon). The same holds for the intermediate currents e and i2.

Re: vector.record()

Posted: Thu Sep 15, 2011 9:02 am
by ted
Raj wrote:This ModelDB http://senselab.med.yale.edu/modeldb/Sh ... del=115357 entry with accession number 115357 contains code for printing the function M over time, and also for a special combination of E and I.
Good point, Raj. And anything that can be printed can also be appended to a Vector. So that's one way to capture the "time course" of E, I, etc..

A general strategy for doing any kind of calculation before or after each time step is to use a custom proc advance(). The advance() built into NEURON's standard run system is

Code: Select all

proc advance() {
  fadvance()
}
So in your program, after the standard run library has been loaded and model setup code has been executed, but before a simulation has been launched, insert the following code

Code: Select all

objref evec, ivec, mvec
evec = new Vector()
ivec = new Vector()
mvec = new Vector()
proc capture() {
  evec.append(cell.E())
  ivec.append(cell.I())
  mvec.append(cell.M())
}
proc advance() {
  fadvance()
  capture()
}
and you will find that evec, ivec, and mvec will contain the time course of these three "variables."

If you decide to run another simulation without exiting NEURON, you must first resize these three vectors to 0. That can be done with an FInitializeHandler.that calls a procedure to resize the Vectors (left as an exercise to the reader, who is referred to the Programmer's Reference for documentation of the FInitializeHandler and Vector classes).