Measuring curvature

Hello,

I would like to be able to find the point of maximum curvature in a simple 1D wave. I have tried using the following formula found online:

curvature = abs(y'')/(abs(1+(y')^2))^(3/2)

but get nonsensical results. Part of my problem (I think) is that my data is fairly noisy. It is collected at 50kHz and the curvature I am interested in is at a much slower time scale (on the order of a few ms). The sharp peaks in the data at the faster timescale wreak havoc on all the calculations. Smoothing or decimating the data helps somewhat but still does not yield decent results.

For the electrophysiologists out there... I am trying to see how action potential thresholds defined by the point of maximum curvature compare to other methods (like the peak of the second derivative).

Any suggestions would be greatly appreciated!

Thanks,
Nate
ncramer wrote:

I would like to be able to find the point of maximum curvature in a simple 1D wave. I have tried using the following formula found online:

curvature = abs(y'')/(abs(1+(y')^2))^(3/2)

but get nonsensical results.


You do not say how you are using this equation. Are you fitting it to derivatives of your y-versus-x data for example (you would need the first and second deriviatives), or are you fitting an integrated form of the above equation to your data (lacking an analytical form of the expression, you could use numerical forms of the derivatives for fitting). Each of these methods has its own advantages and pitfalls.

ncramer wrote:

Part of my problem (I think) is that my data is fairly noisy. It is collected at 50kHz and the curvature I am interested in is at a much slower time scale ...


Rather than "smoothing", did you consider applying a filter (via FFT operations for example) to remove high frequency components in the data?

--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAH
Thank you for your reply, J.J.

What I've tried is calculating the first and second derivatives of the wave I'm interested in and then plugging in their values on a point by point basis into the equation. My understanding is that should give me the curvature of the line at that point. The result, however, is a very noisy wave that bounces around zero with no features that would intuitively correspond to the original data wave. I've seen other people tackle this problem in matlab by essentially finding the radius of an arc that best fits short segments of the data but I'm not sure how to implement this in Igor. Using a "best fit" approach seems like it would also get around my high frequency jitter problem.

With respect to the jitter, I have not seriously tried filtering the data. An initial pass seemed like smoothing caused less distortion in the shape of the waveform but I will give it a more rigorous look.

Best,
Nate
If you have an example that you could post here, that might be helpful. The best way is to save the wave in Igor as an Igor binary wave (Data->Save Waves menu item) and then post it here.
I've uploaded a sample wave. The data shows the membrane potential of a neuron as a function of time. There is an initial step up from a baseline value which causes the neuron to fire action potentials or spikes during this step. What I would like to do is measure the curvature at the base of these spikes and find the point where it reaches a maximum.
ActionPotentials.ibw (140.15 KB)
ncramer wrote:
...What I would like to do is measure the curvature at the base of these spikes and find the point where it reaches a maximum.


Would you also please post a picture that shows somehow where it exactly is that you are attempting to determine curvature (immediately before, immediately after, or somewhat after the spike in particular).

--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville
jjweimer wrote:
ncramer wrote:
...What I would like to do is measure the curvature at the base of these spikes and find the point where it reaches a maximum.


Would you also please post a picture that shows somehow where it exactly is that you are attempting to determine curvature (immediately before, immediately after, or somewhat after the spike in particular).

--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville



I've uploaded a pxp file with the points of interest indicated with arrows. Ideally, I'd like to identify the curvature at the base, immediately before, each spike.
curvatureLocation.pxp (142.88 KB)
ncramer wrote:

I've uploaded a pxp file with the points of interest indicated with arrows. Ideally, I'd like to identify the curvature at the base, immediately before, each spike.


With your experiment, try this:

Duplicate/O w10324008_Ch0_grab test1
Differentiate test1
Differentiate test1
Smooth 100, test1
Display w10324008_Ch0_grab
Append/R test1
ModifyGraph rgb(test1)=(0,0,65535)
SetAxis bottom 0.073565152,0.081548708


Larry Hutchinson wrote:
ncramer wrote:

I've uploaded a pxp file with the points of interest indicated with arrows. Ideally, I'd like to identify the curvature at the base, immediately before, each spike.


With your experiment, try this:

Duplicate/O w10324008_Ch0_grab test1
Differentiate test1
Differentiate test1
Smooth 100, test1
Display w10324008_Ch0_grab
Append/R test1
ModifyGraph rgb(test1)=(0,0,65535)
SetAxis bottom 0.073565152,0.081548708


This is the method I tried to use before going the curvature route. The problem I run into is with the smoothing of the second (or first) derivative. If you don't smooth, the peak of the second derivative will correspond to a point much farther up the peak of the raw data (y value around -28.6 mV in this example). With the smoothing, the peak of the second derivative shifts leftward and corresponds to a different point on the raw data (y value around -39.2mV). The smoothed value appears to more closely capture where the signal begins to change rapidly (which is the value I would like to accurately report) but I don't know how to objectively justify the smoothing.
The shift looked pretty minor to me.

But if you want a more accurate location, you might try doing a fit to a gaussian for the top third or so of the 2nd derivative data (unsmoothed.)
I just tried the fit technique and got pretty much the same as the peak of the smoothed 2nd derivative.

I noticed that the peak of the (smoothed) 3rd derivative looked to be pretty close to where your drawn arrows are.
Thank you, Larry... The shift produced by smoothing is pretty minor but it occurs at a point where the wave is changing quickly and translates into an appreciable difference in the measurement. I do like the gaussian fit approach though. Even though it effectively does the same thing as smoothing it strikes me as a safer way to find the peak. I can implement this approach...

With respect to curvature, I found that using the above equation on a smooth/non-noisy curve gives intuitively correct results. It seems then that it is the high frequency fluctuations in my waves that is the wrench in the works. By analyzing polynomial fits to small segments of the wave, I've found I can get a pretty decent measurement of the curvature along the entire length of the wave. Unfortunately the fits are not as clean where the wave values are changing rapidly but I think I can work around this.

I greatly appreciate everyone's help...
Nate