How to export coefficient values for wave generated from curve fitting?
schollz
If use "Browse Waves" I can see that the "Wave Notes" includes the fitting parameters and coefficients, but I don't see a way to save these except to save a binary Igor file with "Save A Copy" which won't work, since I want just the Wave Note text.
Thanks!
Note also that the history report has only six digits of precision. Especially for polynomial fits that may not be enough. Saving the coefficient wave preserves full double-precision accuracy.
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
April 27, 2017 at 11:35 am - Permalink
Thanks John, you are helping me out a lot this week!
I'm not concerned about precision - I only need three digits actually. I thought about setting new W_coef's, and will probably implement that in the future, but currently I need something that will work on previously analyzed data.
Is there not a way to just export the "Wave Note" of each wave to a text file? That would suffice perfectly for what I need (which is just the parameters of each fit). This would be better than my parsing of the history file because then I don't have to keep track of removing old waves and replacing them as I parse the history.
Right now, my colleagues type in the coefficients directly into excel, but this doesn't scale well with thousands of fits.
April 27, 2017 at 11:51 am - Permalink
I might iterate over the waves using this idea, then post process the note book file as needed.
--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAH
April 27, 2017 at 03:38 pm - Permalink
Thanks, this is exactly what I was looking for.
Specifically I've found a function
note(waveName)
which prints out the wave note. I will just make a loop and output this to a file as suggested.Here is my code, if anyone down the line is interested:
String curvesInExperiment = WaveList("*",";","")
Variable curveNum = ItemsInList(curvesInExperiment)
variable i
for(i=0; i<=curveNum; i+=1)
String curveN = StringFromList(i,curvesInExperiment)
Print curveN
String waveText = note($curveN)
Print waveText
endfor
End
April 27, 2017 at 03:56 pm - Permalink