
IR Spectrums integration

Hi all,
I'm learning how to program in Igor Pro because my major professor asked me for a macro. Which has to be capable of integrating some IR spectrums at a time, plus it has to be able to narrow the range in which I want to run such integration. The idea is, to identify the products of a catalytic reaction in function of the time, the problem is that 2 of the principal products absorb at almost the same wavelength what makes difficult the characterization. Well, I thought that a slight modification of the integrating macro would work, but it seems that something is missing. Somebody with more expertise, please!
Macro IntSpect(name1,name2,name3,name4,start_INT,stop_INT)
STRING name1,name2,name3,name4,name1_IntSpect,name2_IntSpect,name3_IntSpect,name4_IntSpect
VARIABLE start_INT=400,stop_INT=4000
PROMPT start_INT, "What is the integration to start at?"
PROMPT stop_INT, "What is the integration to stop at?"
Prompt name1,"What is name of wave to convert?", popup, WaveList("*",";","")
Prompt name2,"What is name of wave to convert?", popup, WaveList("*",";","")
Prompt name3,"What is name of wave to convert?", popup, WaveList("*",";","")
Prompt name4,"What is name of wave to convert?", popup, WaveList("*",";","")
name1_IntSpect = name1 + "_IntSpect"
name2_IntSpect = name2 + "_IntSpect"
name3_IntSpect = name3 + "_IntSpect"
name4_IntSpect = name4 + "_IntSpect"
wavestats/R=(stop_INT,start_INT)$name1
wavestats/R=(stop_INT,start_INT)$name2
wavestats/R=(stop_INT,start_INT)$name3
wavestats/R=(stop_INT,start_INT)$name4
Integrate $name1/D=$name1_IntSpect
Integrate $name2/D=$name2_IntSpect
Integrate $name3/D=$name3_IntSpect
Integrate $name4/D=$name4_IntSpect
//Display $N_name
//SetAxis/A/R bottom
//Label left "area under de curve";DelayUpdate
//Label bottom "Wavelength"
Endmacro
And what is the problem? You can eliminate the output into the history from the WaveStats operation by adding the /Q flag.
I did this:
And the result was lots of garbage in the history and four integrated waves.
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
September 8, 2016 at 09:39 am - Permalink
parameter not declared
Error in IntSpect:ipf:IntSpect
Macro IntSpect(name1,name2,name3,name4,start_INT,stop_INT)
September 8, 2016 at 11:07 am - Permalink
Really you should be writing functions. Here is a function implementation:
One advantage of doing it this way is the separation between the GUI (menu "Macros" and mIntSpect()) and the actual computations (fIntSpect). It is almost sure that you will some day want to use the computation part in a different way, and this way it is ready to go. The separation also aids in debugging and in readability. Writing Igor functions gives you access to our most recent enhancements to the language, and it runs much faster. Functions are easier to write correctly because the compiler gives you immediate feedback on the correctness of the syntax for every line, whereas with a macro you have to actually execute it to get the syntax checked.
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
September 9, 2016 at 02:46 pm - Permalink
September 21, 2016 at 02:32 pm - Permalink