
Automation of Baseline Subtraction and Smoothing for Multiple Waves
vmmr5596
I'm working on a procedure that will allow me to do a baseline subtraction followed by a smoothing of the baseline corrected waves. I have completed the first part by using a "wrapper function" but am unsure how to appropriately add the Smooth portion to it.
Here is the procedure I have so far:
#pragma rtGlobals=3 // Use modern global access method and strict wave access. Function BaselineSubtraction(w1,leftmark, rightmark,rangetype) WAVE w1 VARIABLE leftmark, rightmark, rangetype String outputName= NameOfWave(w1) +"_baselined" if (rangetype<1470 || rangetype>1472) return -1 endif Duplicate/o w1 $outputName Wave output = $outputName if (rangetype==0) WaveStats/Q output endif if (rangetype==1470) WaveStats/Q/R=[leftmark,rightmark] output endif if (rangetype==1472) WaveStats/Q/R=(leftmark,rightmark) output endif output= output - V_min print V_min End FUNCTION SubtractAll(wname, fnum, leftmark, rightmark, rangetype) STRING wname VARIABLE fnum, leftmark, rightmark, rangetype VARIABLE i STRING w1 for(i=1; i<=fnum; i=i+1) w1 = wname+num2str(i) BaselineSubtraction($(w1),leftmark, rightmark,rangetype) endfor End
Let me know if you have any ideas/suggestions.
Thanks!
If you want to keep the "bg subtracted but not smoothed" wave you need to duplicate output and then smooth that wave, otherwise this will work.
July 21, 2016 at 12:00 pm - Permalink
July 22, 2016 at 05:31 am - Permalink
--Jim Prouty
Software Engineer, WaveMetrics, Inc.
July 22, 2016 at 11:41 am - Permalink