finding time at instantaneous voltage level

Anything that doesn't fit elsewhere.
Post Reply
pa1kumar
Posts: 13
Joined: Tue Oct 17, 2006 3:51 pm

finding time at instantaneous voltage level

Post by pa1kumar »

Hii,

I am trying to record the times at a particular voltage level say -70mV and also at an another voltage level of say -30mV for a particular cell output. If i
am right the netcon class record records only the spike timings not the time at a paticular instant of voltage. Sorry if i got that wrong. Can you let me know of a way to do this.

Any help would be really great.
Thank you
Pavan
ted
Site Admin
Posts: 6299
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: finding time at instantaneous voltage level

Post by ted »

pa1kumar wrote:I am trying to record the times at a particular voltage level say -70mV and also at an another voltage level of say -30mV for a particular cell output.
If both are positive-going transitions, then use two NetCons, one with threshold -70 and the
other with threshold -30. Then use NetCon class's record() method to record the threshold
crossing times. If you are using adaptive integration, you might consider using the CVode
class's condition_order() method to specify linear interpolation of threshold crossing times.
See Programme's Reference for details.

If it is ever necessary to detect a negative-going v transition, create a distributed mechanism that sets a range variable to -v, then monitor the new range variable.
pa1kumar
Posts: 13
Joined: Tue Oct 17, 2006 3:51 pm

Post by pa1kumar »

If i am not wrong by using the 2 thresholds the output may change and i may not get any threshold crossing for the -30mV level

I tried it in the following code(a part from the main code) of mine where i am to measure the times in the newcell[1] at both the -30mV and -70mV levels. From those times i can get the difference which is the time it takes to cross the -30mV level from the -70mV level and spike.

Code: Select all

i=1
newcell[i].soma{
netcon = new NetCon(&v(0.5), nil)
netcon.threshold = -40
netcon.record(timevec,vec,i)
netcon1 = new NetCon(&v(0.5),nil)
netcon1.threshold = -70
netcon1.record(timevec1,vec1,i)
spikes.append(netcon)
spikes.append(netcon1)

}
I hope i am clear about the problem.
Thanks for the quick reply.
Pavan
ted
Site Admin
Posts: 6299
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Post by ted »

If i am not wrong by using the 2 thresholds the output may change and i may not get any threshold crossing for the -30mV level
Nothing of the sort will happen.

These statements
spikes.append(netcon)
spikes.append(netcon1)
are unnecessary.
The two record() statements are sufficient to ensure that the threshold crossings are
captured. Indeed, the append() statements are also syntax errors, unless spikes happens
to be a List.

Further suggestions:
1. Why don't you try this on an extremely simple model--a single compartment cell with hh,
driven by a single current pulse to fire a single spike. Then you can focus on the correct
usage of record() and verify that everything is working properly, without all of the
distractions associated with a more complex model.

2. If you want the threshold crossings to trigger a particular action, instead of recording to
a pair of Vectors you should use record("stmt"), where stmt is a statement (e.g. could
call a func or proc). For example,

Code: Select all

netcon1.record("t0 = t")
netcon.record("{delta_t = t - t0   printf("delta_t is %g\n", delta_t)}")
will print the time elapsed on every occasion that
the lower threshold is crossed AND THEN the upper threshold is crossed
pa1kumar
Posts: 13
Joined: Tue Oct 17, 2006 3:51 pm

Post by pa1kumar »

I used the 2 thresholds for the same source of the netcon events as in the code below as per the suggestions you made. This is making the 2nd threshold to override the first one. I can say this because when i saw the values in the t0, it is always zero.

Is it because i am using the same source in the netcon events or is there any other reason?

Code: Select all

netcon1 = new NetCon(&v(0.5),nil)
netcon1.threshold = -70
netcon1.record("hand1()")
proc hand1(){
t0 = t
}

netcon = new NetCon(&v(0.5), nil)
netcon.threshold = -40
netcon.record("hand()")
proc hand(){
delta_t = t - t0   
}

The entire thing is done for the cell body.

Thank you
Pavan
Raj
Posts: 220
Joined: Thu Jun 09, 2005 1:09 pm
Location: Groningen, The Netherlands
Contact:

Post by Raj »

That is correct only the last threshold specified will be used, every source has one single threshold. This is based on the reasonable assumption that cells have a single threshold not depending on the postsynaptic target.

From the NetCon documentation:
http://www.neuron.yale.edu/neuron/stati ... tml#NetCon
A source used by multiple NetCon instances is shared by those instances to allow faster threshold detection (ie on a per source basis instead of a per NetCon basis) Therefore, there is really only one threshold for all NetCon objects that share a source. However, delay and weight are distinct for each NetCon object.
I can think of several workarounds but can't directly tell whether they will work for you. The simplest workaround is to give the soma several segments and record the different times from different segments. Other tricks would be to make a new mechanism whose only role would be to give a copy of the membrane potential which you can hand to a NetCon.

From your description it is however not clear to me that it is NetCon's threshold mechanism that you need. Is it the (upward!) crossing time you are interested in or do you want to know how long the membrane potential is in a certain interval?
Last edited by Raj on Tue Apr 10, 2007 12:10 pm, edited 1 time in total.
ted
Site Admin
Posts: 6299
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Post by ted »

Oops. I should take my own advice
Why don't you try this
pa1kumar
Posts: 13
Joined: Tue Oct 17, 2006 3:51 pm

Post by pa1kumar »

Sorry if i am not clear.
I wanna record the time elapsed for the voltage level to reach from the -70mV level to -30mV level for a single duty cycle(My input is a sinusoidal signal of frquency 2hz for about 30sec).
It may cross the -30mV level to spike in that duty cycle or it may not. I wanna note the times (i.e.,time elapsed for the voltage level to reach from the -70mV level to -30mV level ) where it crosses the -30mv level and spikes(and also count the number of spikes).
So you can see i need the upward crossing at that levels and also the time elapsed in between that voltages.

I hope i am clear about the problem now.
Thank you
Pavan
pa1kumar
Posts: 13
Joined: Tue Oct 17, 2006 3:51 pm

Post by pa1kumar »

If its not a problem can you also tell me how we can get a mechanism to get the copy of the membrane potential( just curious and may be that can help me)

Thank you
Pavan
ted
Site Admin
Posts: 6299
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

POINT_PROCESS Dup

Post by ted »

I wanna record the time elapsed for the voltage level to reach from the -70mV level to -30mV level for a single duty cycle(My input is a sinusoidal signal of frquency 2hz for about 30sec).
That being the case, you could conceivably just record v to a Vector and analyze after
the end of the simulation. The model will need many cycles to converge toward a stable
cycle.

But if you wish to proceed as originally planned, try this:

Code: Select all

: replicate membrane potential
: useful if multiple NetCons with different v thresholds 
: are to be attached to a single node

NEURON {
	POINT_PROCESS Dup
	RANGE vv
}

ASSIGNED {
	v (millivolt)
	vv (millivolt)
}

INITIAL { vv = v }

BREAKPOINT { vv = v }
Attach at the location that is to be monitored, e.g.
objref foo
soma foo = new Dup(0.5)
Then foo.vv will be an exact copy of soma.v(0.5), and can be monitored by a NetCon
objref nc, nil
nc = new NetCon(&foo.vv, nil)
nc.threshold = whatever

Dup is a point process, so you should be able to attach multiple instances of it to a node,
and monitor all of their vv variables with NetCons, one per instance, each NetCon having
its own unique threshold. "Verifying that this is so is left as an exercise to the reader."
eugene

Post by eugene »

Hey Ted,

Could you elucidate for me what a distrubted mechanism for dectecting negative going spikes is?

Thanks,
Eugene
Raj
Posts: 220
Joined: Thu Jun 09, 2005 1:09 pm
Location: Groningen, The Netherlands
Contact:

Post by Raj »

Eugene here you have two mod-files (based on Ted's example) to solve the problem and an example to illustrate their use. The first is a distributed implementation, giving you a signed duplicate in every segment of of section, following the changes in the underlying membrane potential. The second mod-files is defined as a point process and only follows a variable at a single point.

SignedDup:

Code: Select all

: replicate membrane potential with freely chosen sign
: useful if multiple NetCons with different v thresholds
: are to be attached to a single node

NEURON {
   SUFFIX SignedDup
   RANGE signedv, sign
}


PARAMETER {
   sign = 1 (1)
}


ASSIGNED {
   v (millivolt)
   signedv (millivolt)
}

INITIAL { signedv = sign*v }

BREAKPOINT { signedv = sign*v }
SignedDup2:

Code: Select all

: replicate a parameter with freely chosen sign
: useful if multiple NetCons with different  thresholds
: arewatching the same variable

UNITSOFF
NEURON {
   POINT_PROCESS SignedDup2
   RANGE signeddup, sign
   POINTER org 
}


PARAMETER {
    
   sign = 1 (1)
}


ASSIGNED {
   org 
   signeddup 
}

INITIAL { signeddup = sign*org }

BREAKPOINT { signeddup = sign*org }

UNITSON

Dupdemo.hoc:

Code: Select all

// Dupdemo
load_file("nrngui.hoc")
tstop=600

create soma

access soma {
insert hh
insert pas
L=20
diam=20
}

objref ic 
soma ic=new IClamp(0.5)
ic.amp=1
ic.dur=200
ic.del=50

objref dup1,dup2

soma {
  insert SignedDup
  sign_SignedDup=-1
}
soma dup2=new SignedDup2(0.2)
dup2.sign=-1
soma setpointer dup2.org, v(0.5)

// Session file starts here
objectvar save_window_, rvp_
objectvar scene_vector_[3]
objectvar ocbox_, ocbox_list_, scene_, scene_list_
{ocbox_list_ = new List()  scene_list_ = new List()}
{
save_window_ = new Graph(0)
save_window_.size(0,500,-70,70)
scene_vector_[2] = save_window_
{save_window_.view(0, -70, 500, 140, 558, 236, 647.1, 397.9)}
graphList[0].append(save_window_)
save_window_.save_name("graphList[0].")
save_window_.addexpr("soma.signedv_SignedDup(0.5)", 2, 3, 0.8, 0.9, 2)
save_window_.addexpr("dup2.signeddup", 3, 1, 0.8, 0.9, 2)
save_window_.addvar("soma.v( 0.5 )", 4, 1, 0.8, 0.9, 2)
}
objectvar scene_vector_[1]
{doNotify()}
// Session file ends here
run()
Have fun!
Post Reply