Extract contour waves using a function?
s.r.chinn
#include<Extract Contours As Waves>
adds the wave-from-contour extraction operation to the Graph menu, but this must be performed manually. I did try inspecting the code in the included ipf, but it is pretty opaque (to me).As an alternative the Manual suggests
Another way to copy the traces into a normal wave is to use the Data Browser to browse the saved experiment; the contour traces are saved as waves in a temporary data folder whose name begins with “WM_CTraces_” and ends with the contour’s “contour instance name”.Since I created the custom contour level , I think I can construct the necessary instance name to use in a function. However, after I created a test image with contours, this folder was nowhere to be found. If it is temporary, how can it be accessed?
I would appreciate any suggestions.
(IP 6.22A, WinVista)
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
April 4, 2012 at 10:02 am - Permalink
Thanks for your help. I initially thought I had solved the problem with the following example:
#include<Extract Contours As Waves>
function SetupGraphWithContours()
make/O/N=(100,100) wave0
setscale x, -2, 2,"" wave0
setscale y, -2,2, "" wave0
wave0=exp(-(x^2+y^2)/0.5)
NewImage wave0
ModifyGraph width=0,height={Plan,1,left,top}
ModifyGraph width = 400
DoWindow/F Graph0
AppendMatrixContour/W=Graph0/L/T/F="%s=%1.4f" wave0
ModifyContour/W=Graph0 wave0 autoLevels={*,*,5}
end
function/S TestContourExtract(MyNewLevel)
variable MyNewLevel
WAVE wave0
string MyNewLevelString
sprintf MyNewLevelString, "%s=%1.4f", NameOfWave(wave0), MyNewLevel
ModifyContour/W=Graph0 wave0 , morelevels=0, morelevels={(MyNewLevel)}; DelayUpdate
return WMDuplicateTraceWave("Graph0", MyNewLevelString)
// string with extracted .x .y contour waves
end
•print TestContourExtract(0.05)
wave0=0.0500.x,wave0=0.0500.y
The new contour level was added to the Graph0 image plot, and the new extracted contour waves appeared in the Data Browser. However, these new waves each had 0 points. What did I do incorrectly?
April 5, 2012 at 04:27 am - Permalink
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
April 5, 2012 at 09:18 am - Permalink
I was confused in the application of the AppendMatrixContour help file contents:
This test example was somewhat artificial. However, fitting a contour shape of real data can be useful.
April 5, 2012 at 10:12 am - Permalink
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
April 6, 2012 at 10:08 am - Permalink