Entering edit mode
Duke
▴
210
@duke-4050
Last seen 10.2 years ago
Hi folks,
I have to deal with finding peaks and their widths (for example FWHM -
Full width at half maximum) of a dataset (basically x coordinates and
y
non-negative values). So far, after searching through forum and
google,
I found turnpoints() function in Pastecs package which can help me to
find the turning points. My algorithm is as followed:
1. get the list of local peaks with certain threshold (max turnpoints
by
turnpoints function)
2. for each of the found peaks, do two scans using peak's index to
find
furthest upper/lower points that have values not smaller than half of
that peak. These points will determine the peak's FWHM.
Well, the algorithm is fine, and so far for a small dataset, it runs
fine and give me quite a satisfied result. But the problem is the time
of the scan. Usually the peak finding takes about few minutes for a
data
of about few million points, but the scan to get FWHM takes like the
whole day, because of its double looping (1st for peak loop, 2nd for
each peak).
I thougth using array / matrix will help improve the speed much
faster,
so anybody has any other idea/suggestions? Or any one know packages
that
can help my task?
Thanks a lot,
D.