Measuring curvature
ncramer
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
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.
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
March 31, 2010 at 09:18 am - Permalink
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
April 1, 2010 at 06:00 am - Permalink
April 1, 2010 at 07:44 am - Permalink
April 1, 2010 at 12:12 pm - Permalink
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
April 1, 2010 at 12:46 pm - Permalink
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.
April 1, 2010 at 05:10 pm - Permalink
With your experiment, try this:
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
April 2, 2010 at 07:20 am - Permalink
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.
April 2, 2010 at 08:39 am - Permalink
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.)
April 2, 2010 at 11:46 am - Permalink
I noticed that the peak of the (smoothed) 3rd derivative looked to be pretty close to where your drawn arrows are.
April 2, 2010 at 02:21 pm - Permalink
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
April 3, 2010 at 05:50 pm - Permalink