Wave modification
rhjpires
I have been reading several examples from Payam’s place and also the introduction notes on Programming from the manual but I think I have not got the grip of the basics of Igor yet. Essentially, I would like to process several curves, typically named in a systematic fashion, do something to them, get the result and store it in a wave. While I am aware of several of the functions, to incorporate it in something like a script likely requires a type of thinking I am not accustomed to.
I wonder if anyone could help me with a simple practical problem which I think can help me to understand the workings of Igor:
I have a set of waves each containing a single peak. The name of the waves have the following format:”string1””string2”, where is the number of the waves within the series. For each wave, = 0, 1, 2 ... I would like to normalize it using the peak average which I have stored in another wave (AveragePeakAmp) and subsequently subtract the background using wavemin. Having done that, I would like to save the new waves with a different name.
Can anyone help me?
Many thanks to all!!
R.
Variable i
String wList =WaveList("string*",";","")
Variable nwaves = ItemsInList(wList)
String wname,newname
Variable tempvar
Wave AveragePeakAmp
For(i=0; i<nwaves; i+=1)
wname = StringFromList(i, wlist)
// wname ="string" + num2str(i) //alternative version depending on your requirements
Wave w1=$wname
newname = wname + "_n"
Duplicate /O w1 $newname
Wave w2=$newname
w2 /=AveragePeakAmp[i]
tempvar =wavemin(w2)
w2 -=tempvar
EndFor
End
For this to work your AveragePeakAmp wave has to match the wavelist order. The way this is written, it will not check this. Without knowing a bit more detail it's difficult to prevent an error.
Also, just to say that I would subtract the minimum value, find the peak and then normalise to that value, giving a scale of 0 to 1. You didn't request this and wanted to subtract afterwards.
April 15, 2015 at 09:17 am - Permalink
Cheers,
R.
April 16, 2015 at 10:06 pm - Permalink