Maximum intensity from graph
Dear Users,
I am trying to extract the maximum intensity between the two points [p] (xmin, xmax) from the graph that has an entire series of data. I have multiple peaks and each peaks has different intensity depending on the experimental variable. I want to plot the the max intensity vs the experimental parameter I am varying. For this I wrote a script (that will print the maximum intensity and the tracename), however I am getting wrong value (the first value of each spectra).
Here is the code:
String graphNamestr
Variable xmin, xmax
String list=Tracenamelist(graphnamestr,";",1)
Variable i, numtraces=itemsinlist(list)
make/o/n=(numtraces) int_max
make/o/T/n=(numtraces) tracenames
for(i=0;i<numtraces;i+=1)
String trace=stringfromlist(i,list)
Wave wav=TraceNameToWaveRef(graphnamestr,trace)
int_max[i] = wavemax(wav,xmin,xmax)
tracenames[i]=trace
endfor
Edit int_max tracenames
end
I am also attaching the data set that I am using where xwave1 is the xaxis and rest all is the data.
Any help is much appreciated.
Thank you,
regards,
Rubin.
Forum
Support
Gallery
Igor Pro 9
Learn More
Igor XOP Toolkit
Learn More
Igor NIDAQ Tools MX
Learn More
My guess is that xmin and xmax are not specified correctly. From your description, the experimental values are plotted against xwave1 but your code is operating on the experimental values without any information from xwave1, i.e. the experimental values have no scaling. So when you input xmin and xmax, if you use x values from xwave1 rather than point numbers they're out of range (or something) which is returning an unexpected value.
The code looks OK. Have you tried specifying some point numbers and see if you get the expected result?
December 3, 2019 at 09:22 am - Permalink
In reply to My guess is that xmin and… by sjr51
I wrote the code so that I use the point number rather than the xwave value. I am getting the point number from graph info and it gives the unexpected values.
Is there a way to also include the xwave information in the code I could not figure that out, maybe that might solve the issue.
thank you for your help.
December 3, 2019 at 01:12 pm - Permalink
Hi,
I just tried your code with your sample set.
Created graph with all traces against last wave which appeared to be x values.
Ran your function and then compared with command line of wavemax(wavename, 30,40).
Your function appears to work as intended.
Andy
December 3, 2019 at 01:47 pm - Permalink
In reply to Hi, I just tried your code… by hegedus
Hey Andy,
It is working in your file but not mine (it is showing the data point only). I do not know the reason but it works now from your file. Thank you very much.
December 3, 2019 at 02:10 pm - Permalink