Normalization Hi

How do you normalize a spectre with Igor pro

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.

"Normalize By Wave Max", /Q, NormaliseTraceByMax("")
end

"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)
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

If you would like to all spectre by the maximum intensity you use these scipt

"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

modou wrote:

If you would like to all spectre by the maximum intensity you use these scipt

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

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