You might want to look into the Wave Arithmetic package. To learn more about it, look at the example experiment- File->Example Experiments->Analysis->Wave Arithmetic Panel Demo.
Depending on what you mean by normalize, this may either do what you need or give you a starting point for a GUI.
While this may seem like a lot of GUI for a trivial operation (wave/=number), I find it very useful when entering data from a lab book to be able to see and check the entries, and to be able to operate on a lot of spectra in one go.
"Normalize a spectrum" means different things to different people.
What kind of spectrum, and how do you want to normalize it?
For example, in vibrational spectroscopy absorbance spectra collected in transmission geometry may be normalized to unit path length, or Raman spectra may be normalized to equal area, or other kinds of spectra may be normalized to a reference value at some position, there are many possibilities and we have no way to know what it is that you want to do.
I want to normalize with the majeur element in the spectre
I guess you mean that you want to divide the spectrum by the largest value in the spectrum. You can do that with the Wave Arithmetic panel I mentioned earlier.
I use the technique LIBS atomic spectroscopy. I would like to normalize to a reference value like this divide Intensity/Intensity(element reference),Intensity(element reference) mean high intensity in the spectre
If you would like to all spectre by the maximum intensity you use these scipt
Menu "AllTracesPopup"
Yes, to see the all traces popup menu you must shift-right-click on a trace in the graph window. Alternatively you can execute NormaliseAllTracesByMax() when the waves are plotted in the top graph. Or you could add another menu like this:
Menu"Macros" "Normalize all waves in top graph", NormaliseAllTracesByMax() end
You might want to look into the Wave Arithmetic package. To learn more about it, look at the example experiment- File->Example Experiments->Analysis->Wave Arithmetic Panel Demo.
April 2, 2019 at 09:36 am - Permalink
Check out the documentation for MatrixOP which includes a number of normalization options.
April 2, 2019 at 10:38 am - Permalink
Depending on what you mean by normalize, this may either do what you need or give you a starting point for a GUI.
While this may seem like a lot of GUI for a trivial operation (wave/=number), I find it very useful when entering data from a lab book to be able to see and check the entries, and to be able to operate on a lot of spectra in one go.
April 3, 2019 at 01:28 am - Permalink
In reply to Depending on what you mean… by tony
I don't understand. I would like to normalize my spectre. I want to normalize with the majeur element in the spectre
April 8, 2019 at 06:52 am - Permalink
In reply to I don't understand. I would… by modou
"Normalize a spectrum" means different things to different people.
What kind of spectrum, and how do you want to normalize it?
For example, in vibrational spectroscopy absorbance spectra collected in transmission geometry may be normalized to unit path length, or Raman spectra may be normalized to equal area, or other kinds of spectra may be normalized to a reference value at some position, there are many possibilities and we have no way to know what it is that you want to do.
April 8, 2019 at 07:48 am - Permalink
In reply to I don't understand. I would… by modou
I guess you mean that you want to divide the spectrum by the largest value in the spectrum. You can do that with the Wave Arithmetic panel I mentioned earlier.
April 8, 2019 at 01:42 pm - Permalink
In reply to "Normalize a spectrum" means… by tony
I use the technique LIBS atomic spectroscopy. I would like to normalize to a reference value like this divide Intensity/Intensity(element reference),Intensity(element reference) mean high intensity in the spectre
April 8, 2019 at 02:19 pm - Permalink
In reply to I use the technique LIBS… by modou
using trace menus:
"Normalize By Wave Max", /Q, NormaliseTraceByMax("")
end
Menu "AllTracesPopup"
"Normalize All By Maxima", /Q, NormaliseAllTracesByMax()
end
function NormaliseAllTracesByMax()
string tracelist=TraceNameList("",";",1+4)
string s_trace
variable i=0, numTraces=ItemsInList(tracelist)
for(i=0;i<numTraces;i+=1)
s_trace=StringFromList(i,tracelist)
NormaliseTraceByMax(s_trace)
endfor
end
function NormaliseTraceByMax(s_trace, [x1, x2])
string s_trace
variable x1, x2
if (strlen(s_trace)==0)
GetLastUserMenuInfo
string tracesList=S_traceName
endif
wave w=traceNameToWaveRef("",s_trace)
if (waveexists(w)==0)
return 0
endif
variable maxVal=nan
if(ParamIsDefault(x1)||ParamIsDefault(x2))
maxVal=wavemax(w)
else
maxVal=wavemax(w, x1, x2)
endif
duplicate /o w $nameofwave(w)+"_n" /wave=w_norm
w_norm=w/maxVal
printf "duplicate /o %s %s_n\r" nameofwave(w), nameofwave(w)
printf "%s_n = %s/%g\r" nameofwave(w), nameofwave(w), maxVal
ReplaceWave trace=$s_trace, $nameofwave(w)+"_n"
end
April 9, 2019 at 04:58 am - Permalink
If you would like to all spectre by the maximum intensity you use these scipt
Menu "AllTracesPopup"
"Normalize All By Maxima", /Q, NormaliseAllTracesByMax()
end
function NormaliseAllTracesByMax()
string tracelist=TraceNameList("",";",1+4)
string s_trace
variable i=0, numTraces=ItemsInList(tracelist)
for(i=0;i<numTraces;i+=1)
s_trace=StringFromList(i,tracelist)
NormaliseTraceByMax(s_trace)
endfor
end
April 9, 2019 at 10:03 am - Permalink
In reply to If you would like to all… by modou
Yes, to see the all traces popup menu you must shift-right-click on a trace in the graph window. Alternatively you can execute NormaliseAllTracesByMax() when the waves are plotted in the top graph. Or you could add another menu like this:
"Normalize all waves in top graph", NormaliseAllTracesByMax()
end
April 9, 2019 at 11:56 pm - Permalink
In reply to modou wrote: If you… by tony
I try and I comeback.THANKS for your help
April 10, 2019 at 06:37 am - Permalink
In reply to I try and I comeback.THANKS… by modou
Now I use this script he works
Macro GetCursor(ctrlName) : ButtonControl
String ctrlName
variable ,i_B
variable/G nn
Make/O/N=(nn) Average_Norm
i_A = pcsr(A)
Average_Norm = Average/Average[i_A]
End
Tony thank you for your help
April 13, 2019 at 05:32 am - Permalink