determining length of AHP for recorded membrane pot vector

Anything that doesn't fit elsewhere.
Post Reply
lb5999
Posts: 56
Joined: Mon Oct 11, 2010 9:12 am

determining length of AHP for recorded membrane pot vector

Post by lb5999 »

Hi NEURON forum,

I have a dataset of 3 recorded vectors - vrec[0], vrec[1] and vrec[2] and a timestep vector vdt. The recorded vectors show the response of my cell to a brief depolarising pulse, causing a single action potential, and have been truncated using vrec.remove() to leave only the trough and following afterhyperpolarisation (AHP).

I want to create a new vector 'AHP', of length 3, where the ith entry is the time it takes for vrec to increase to 66% of its depth, i.e. AHP.x will be some measure of how long the AHP is in vector vrec.

I have tried to cook up some HOC code which does this (pasted below) but it keeps giving AHP.x=2000 for i=0,1,2. Can anyone point me in the right direction please? I feel like I am barking up the wrong tree by using all these if commands.

Code: Select all


for i=0,2 {vrec[i].remove(0,41119)}

vdt.remove(0,41119)

// objectvar H
// H=new Matrix(vrec[0].size(),4)
// for i=0,2 {H.setcol(i+1,vrec[i])}
// H.setcol(0,vdt)

// objectvar DataH
// DataH=new File()
// DataH.wopen("test.dat")
// H.fprint(DataH, " %g")

objectvar zetak
zetak=new Vector(41)

zetak.indgen(-6,-4,0.05)			// Fill vector with elements in increments of 0.05 between and including -6 and -4.

objectvar AHP
AHP=new Vector(3)

for i=0, 2                // Cycles through each recorded vector
{for j=0, vrec[0].size()               // each recorded vector is the same length - cycles through each element of the vector.
{
if (vrec[i].x[j]=vrec[i].min()-(2/3)*(vrec[i].min()-RMP.x[i])           // I believe this statment says: if the jth element of vrec[i] is such that it equals 66% of the height of the AHP, then...
{AHP.x[i]=vdt.x[j]-vdt.x[???]} else {AHP.x[i]=0}                 // ... set the ith element of AHP to the time at which this happens MINUS the time at which the trough of the AHP starts. Else set the ith element of AHP to 0 (this should never happen).
}
}
Thanks :) lb5999
ted
Site Admin
Posts: 5793
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: determining length of AHP for recorded membrane pot vector

Post by ted »

Conceptualize the problem of making a single measurement on a single waveform.
Express the solution to the problem as an algorithm, or sequence of tasks, expressed in pseudocode, which can be implemented and tested one by one.
Instantiate it in whatever programming language, and verify that it works.
Then apply it to as many waveforms as you need to.
I want . . . some measure of how long the AHP is
Wouldn't half width be a better measure? A single measurement on the "rising" phase of a waveform tells nothing about the "falling" phase.

A naive algorithm for determining half width would be

Code: Select all

Determine v0 (the baseline from which all measurements are made) 
Determine j0 (the sample number at which the AHP begins)
Starting at sample j0, determine vmin (the minimum of the waveform) and the corresponding jmin (the sample number at which vmin is reached)
Calculate vhalf = v0+vmin/2
Starting at sample j0, determine j1 (the sample number at which v first falls below vhalf)
Starting at sample jmin, determine j2 (the sample number at which v first rises above vhalf)
Half width is th = (j2-j1)*DT where DT is the intersample interval
Of course this assumes noiseless data so that samples fall monotonically to a minimum, then rise monotonically back to the baseline. Noise requires smarter operational definitions of v0, vmin, jmin, j1, and j2. v0 is easy: average a series of samples "at rest". The others are more difficult. You might try fitting a single polynomial to the data over a range of samples, e..g. try a cubic over the range of samples that lie below v0 - k*(v0-vmin) where k is 0.1 or 0.2. Or you might determine jmin and vmin by fitting a parabola to the samples that lie within ~ 20% of the minimum sample, then get j1 and j2 from straight lines fitted to the waveform's falling and rising phases over a range of values (e.g. the 20-80% or 30-70% zones).
Post Reply