> Subject: VRF RE: PEAK Detection
> I need to obtain the time interval between peaks in a large array of
> data.
Ron,
I did just some litle thinking about your problem:
First you need to decide your threshold: what is a peak, what not.
For this playing with SIGNOF(SORT(ARRAY,0)-THRESHOLD) could help,
this will set the highest values first, and gives an array starting
with 1's for the peaks, -1's for the notpeaks. I realize that your
peaks might not be sigle values, but a range of values.
But still: choosing your threshold seems important.
Data filtering could help here.
Second I would map my array (I generated a coord array by filling
the Y-value with a ramp when I tried something). Then, when you
applied your threshold, after sorting the array it is fairly easy by
looking to the Y-values what is the time distance.
An FFT might be another way to find the repetition frequency (that is
in fact what you want to know)
At last: finding a good algoritm is important. Once found it,
programming is easy. Note that VEE is strong in manipulating arrays.
So not try to split up arrays too quickly.
With kind regards,
Johannes Mulder
Philips Electron Optics tel +31 40 2766867
Building AAE-room 21 fax +31 40 2766820
P.O.B. 218
5600 MD ACHT, the Netherlands
> I need to obtain the time interval between peaks in a large array of
> data.
Ron,
I did just some litle thinking about your problem:
First you need to decide your threshold: what is a peak, what not.
For this playing with SIGNOF(SORT(ARRAY,0)-THRESHOLD) could help,
this will set the highest values first, and gives an array starting
with 1's for the peaks, -1's for the notpeaks. I realize that your
peaks might not be sigle values, but a range of values.
But still: choosing your threshold seems important.
Data filtering could help here.
Second I would map my array (I generated a coord array by filling
the Y-value with a ramp when I tried something). Then, when you
applied your threshold, after sorting the array it is fairly easy by
looking to the Y-values what is the time distance.
An FFT might be another way to find the repetition frequency (that is
in fact what you want to know)
At last: finding a good algoritm is important. Once found it,
programming is easy. Note that VEE is strong in manipulating arrays.
So not try to split up arrays too quickly.
With kind regards,
Johannes Mulder
Philips Electron Optics tel +31 40 2766867
Building AAE-room 21 fax +31 40 2766820
P.O.B. 218
5600 MD ACHT, the Netherlands
feeble attempt to utilize VEE's array operators.
I need to obtain the time interval between peaks in a large array
of data. One way would be to use the maxIndex(x) function to locate
the largest peak and then search on either side of that point for the
next peak. Works but too slow.
A faster way is to operate on the entire array ( just like HP says
you should
The maxIndex(x) function gives you the index value of the largest
element in the array. If you set all your peaks to the same level
the maxIndex(x) function will then give you the index of the FIRST
largest element in the array. If you then create a subArray which
skips over the first peak and do the maxIndex(x) function on the
subArray you will get the index of the "next" peak ( first in the
SubArray)
Here's the formula for the first bit - clip everything greater than
say, 90% of the highest peak.
Array In -->----- X --- ClipUpper(x,(max(x)*.9)) ---- Result
Now get the subArray by finding the maxIndex(A) and adding the
expected width of the peak .
Result ---->----- A ----A[(maxIndex(A)+peakWidth):*] ------- Result2
Find the index of the first peak in the subArray, add the peakWidth
and you have the period.
Result2 --->----- A -----maxIndex(A)+peakWidth ------- Result3
This runs a lot quicker! The downside is you must know the expected
peak width and the peaks must all be within a certain percentage of the
largest peak. Does anyone have any other solutions ?
Second vote for a WEB FAQ or Mailing list.
Come on HP, show that your that your beuracracy isn't as intractable as your
software !
Cheers,
------------------------------
Ron Burgess <rburgess@physiology.uwo.ca>
Department of Physiology,
University of Western Ontario,
London, Ontario, Canada
------------------------------