10-27-2016 02:35 PM - edited 10-27-2016 02:40 PM
Hello,
I have data with peaks. From noise sometimes some peaks are inserted between two pulses.
Adjusting the width of peak detector no works since the peaks varying in time.
IF the vi would have any way to fix that the dectector only find peaks inside of certain window it would be easy.
I tried to use the interval times peak series to get 20 number mean value and check if the reading peak is 30% inside of mean value. The problem is if you get one false pulse, this method detects the first and like the next interval will be taking like bad too.
Sometimes you could get 2 false pulses or several between 2 real pulses.
I would like to know if there is any easy, efficient way to accomplish that, and maybe i am complicating the way to do.
Maybe get Array Subset from the first peak and check if there is any peak in the (Mean time window-30%).
I would be grateful to get some ideas to do it.
Best Regards, Fred.
10-27-2016 03:24 PM
Just from looking at your pictures, First thing I would say is that it seems likely that you are using the distance between each peak when really you need to be using distance since last accepted peak position. This should stop the false detection you have in the second case.
Your prediction is also off for the first one because you are just taking the first peak, not the one that is closest to where you expect the next peak to be.
10-27-2016 03:31 PM
"Adjusting the width of peak detector no works since the peaks varying in time."
You say your "peaks varying in time", you mean you have some noise related "peak looking" spikes?
Hmm, reading through again your description, and a second look at your signal: if I understand well, your "real peaks" are appearing with the same periodicity? You could create a kind of algorithm, which first counts all the peaks above the specified threshold, then identifies the centers of all peaks. After this step, you need a function which removes those peaks which "outlie" the most common periodicity...
Another try could be to use filtering. Did you check the Fourier spectrum of your signal yet? You might get good results with some filtering algorithm / deconvolution?
10-27-2016 03:58 PM - edited 10-27-2016 04:00 PM
See my attached VI. I've just pretty much what I described in my earlier post. Looked at the interval rather then the next one. Seems to look pretty good to me but you will know what data is want and what isn't.
[EDIT] Attached a copysaved for earlier version.
10-27-2016 04:41 PM - edited 10-27-2016 04:55 PM
ogk.nz escribió:See my attached VI. I've just pretty much what I described in my earlier post. Looked at the interval rather then the next one. Seems to look pretty good to me but you will know what data is want and what isn't.
[EDIT] Attached a copysaved for earlier version.
Yes, I cited that one solution could be to check the window waitting any peak and if you get 2 remove 1 or look in one window post peak if there is some artefact peak.
I am checking your vi and you get the mean of whole data. I could fix the value, but I think is better to use one mean of near values.
lower than 0.3s and higher than 1.5s should be artefact peaks. The signal is from ECG data. So each beat is normally similar value interval but sometimes you get any artifacts with extra beat or missing beat.
I tried you vi, but i dont get any value and like I told you, I would use Mean of near values 20 values with middle index to be tested.
The first 10 will be only use the i+10, from index =10 it will use from 0 to 20, getting the mean value and then try to check if any peak is real or artefact peak.
I supposed there is several ways to do it.
Fix Width of detector peak is no the way to do, because of some times it will loss some peaks which is good.
10-27-2016 04:51 PM
Blokk escribió:"Adjusting the width of peak detector no works since the peaks varying in time."
You say your "peaks varying in time", you mean you have some noise related "peak looking" spikes?
Hmm, reading through again your description, and a second look at your signal: if I understand well, your "real peaks" are appearing with the same periodicity? You could create a kind of algorithm, which first counts all the peaks above the specified threshold, then identifies the centers of all peaks. After this step, you need a function which removes those peaks which "outlie" the most common periodicity...
Another try could be to use filtering. Did you check the Fourier spectrum of your signal yet? You might get good results with some filtering algorithm / deconvolution?
The peaks are not the same periodicity. It is ECG data, and like you know, you could be 120 heart rate, next 121 ,... 118,...
The noise from device, if you are moving get false peaks, taking like artefact.
Yes, i tried several filter and it works well, but some artefacts are imposible to remove from data source.
10-27-2016 05:38 PM
See the attached version, using variable timing based on the 20 previous intervals, given that this is near to real time operation you wont be having future intervals.
Still only takes the nearest to the average interval, so if there are 2 peaks near together it takes the one that most closely fits the pattern.
10-28-2016 07:34 AM - edited 10-28-2016 07:35 AM
ogk.nz escribió:See the attached version, using variable timing based on the 20 previous intervals, given that this is near to real time operation you wont be having future intervals.
Still only takes the nearest to the average interval, so if there are 2 peaks near together it takes the one that most closely fits the pattern.
Hi,
Yes, it tested your system and works well. But It has problem when you have one missed peak. So the algorithm takes the near peak index and stop the while loop.
Like you said, when you have one artefacts near to the tested peak start, it takes like valid when maybe is not, and when you have the next peak very near to the good one, it takes the first one.
The round to nearest it is no perfect. It should be several if/else to define this value.
Look at this test and you can see it stop when it finds one missed peak.
10-30-2016 03:38 PM
Just looking for a little clarification on this one.
What is your end case for this VI application?
It feels like if you are looking for an EKG type application then we might be getting a little bit off track with all of the focusing on applying the processing to a set of data as opposed to a stream of incoming data. The use case is pretty different in terms of how the processing is applied.
10-31-2016 05:23 AM
ogk.nz escribió:Just looking for a little clarification on this one.
What is your end case for this VI application?
It feels like if you are looking for an EKG type application then we might be getting a little bit off track with all of the focusing on applying the processing to a set of data as opposed to a stream of incoming data. The use case is pretty different in terms of how the processing is applied.
First, thanks for your interest!.
In this case, I do the processing on offline Ekg signal, one time procesed. If I got 6h of data, I split them in 2h intervals, from memory problems and try to remove artefacts and mark peaks R to diferent measures later.
Btw, for the problem with missing peak, I added to check the decimals on interpolation value and if it is between 0.4-0.6 add index to round to +inf if not, it round to nearest. Later of this while loop, I can check the missing peaks and divide in 2 or any parts to fit the mean value of window selected.
Also if the mean value is lower than 150 (0.3s) it fit this limit.