From 11:00 PM CDT Friday, May 10 – 02:30 PM CDT Saturday, May 11 (04:00 AM UTC – 07:30 PM UTC), ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From 11:00 PM CDT Friday, May 10 – 02:30 PM CDT Saturday, May 11 (04:00 AM UTC – 07:30 PM UTC), ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
04-02-2014 08:10 AM
Dear All,
I am facing the following issue:
I have weird value as peaks, in one channel that are due to noise and have no physical meaning.
How can I suppress those peaks using a script?
I join the data with this post.
Thank you very much for your help,
Best regards,
Louval
04-04-2014 02:42 AM
Hi,
if you need to do this quickly, there is a possibility in VIEW, mark peaks, then press set flags, remove data points and interpolate no values.
if you need to do this repeatedly, use script and delete values which difference is higher then the natural difference of two samples in signal.
Simyfren
04-04-2014 02:45 AM
Or, try to use Smooth function for this signal.
Simyfren
04-04-2014 12:20 PM
Hi louval,
How about running a digital filter? This looks pretty good to me (30 Hz low pass):
Call ChnFiltCalc("[1]/Time","[1]/IDCCT_HF","/FilteredSignal_30","IIR","Bessel","Low pass",2,30,0,0,1.2,25,"Hamming",1,1)
Brad Turpin
DIAdem Product Support Engineer
National Instruments
04-04-2014 01:08 PM
Good envening,
That works well! Great,
But it is losing the information between 0 and 0.004 s...
Would it exist a awy to keep track of the curve at that time as well?
Thank you very much,
Louval
04-04-2014 03:10 PM
04-06-2014 09:47 PM
Hi Again,
If you want to take semyfren's approach, I recommend using red DIAdem commands instead of a VBScript loop and VBScript comparisons-- it will run much faster.
R1 = 0.01 ' maximum deviation allowed between points Set Group = Data.Root.ActiveChannelGroup Set TimeChannel = Group.Channels("Time") Set DataChannel = Group.Channels("IDCCT_HF") Set DeltaChannel = Group.Channels.Add("Delta", DataTypeFloat64) Call ChnDeltaCalc(DataChannel, DeltaChannel) ChnLength(DeltaChannel) = ChnLength(DataChannel) Channels = Array(DataChannel, DeltaChannel) Symbols = Array("Data", "Delta") Formula = "Data = IIF(abs(Delta)>R1, Null, Data)" Call Calculate(Formula, Symbols, Channels, "") Call ChnNovHandle(TimeChannel, DataChannel, "Interpolate", "XY", 1, 0)
Call Group.Channels.Remove(DeltaChannel.Name)
Brad Turpin
DIAdem Product Support Engineer
National Instruments
04-07-2014 12:33 AM
Hi Brad,
thank you for your code. I must say that your example will help me very much. Your way is more elegant and and faster of course. Ideal for this example.
Thanks for inspiration into my future projects!
Simyfren
01-30-2019 10:53 AM
Hello Brad, firstly i'm sure its nice to hear that your reply is still helping people 5 years on. I have used your piece of code and adapted it for a signal that i am using, bu ti would like to make 1 tweak that i cant figure out. I do not want to delete the original data.
Many thanks
02-19-2019 03:30 PM
Hi Simyfren,
There are two spots in the code that operate "in place". The first is in the Calculate() command and the second is in the ChnNoVHandle() command (because the 5th parameter is a 1=TRUE). I think the best thing for you would be to give the "Delta" channel the name of the new channel you want to create ("NewData"), change the Calculate() formula to assign values to the "Delta" channel instead of the "Data" channel, and choose not to delete the "Delta" channel at the end, because it now has your results:
R1 = 0.01 ' maximum deviation allowed between points Set Group = Data.Root.ActiveChannelGroup Set TimeChannel = Group.Channels("Time") Set DataChannel = Group.Channels("IDCCT_HF") Set DeltaChannel = Group.Channels.Add("NewData", DataTypeFloat64) Call ChnDeltaCalc(DataChannel, DeltaChannel) ChnLength(DeltaChannel) = ChnLength(DataChannel) Channels = Array(DataChannel, DeltaChannel) Symbols = Array("Data", "Delta") Formula = "Delta = IIF(abs(Delta)>R1, Null, Data)" Call Calculate(Formula, Symbols, Channels, "") Call ChnNovHandle(TimeChannel, DeltaChannel, "Interpolate", "XY", 1, 0)
Brad Turpin
DIAdem Product Support Engineer
National Instruments