Recent

Author Topic: Peak detection in TAChart ?  (Read 1525 times)

AL

  • Sr. Member
  • ****
  • Posts: 261
Peak detection in TAChart ?
« on: November 14, 2019, 07:23:21 pm »
Is there a way to detect peaks with TAChart in a TlineSeries?

Thanks,

Al
« Last Edit: November 14, 2019, 07:30:07 pm by AL »
Laz 3.1, fpc 3.2.2, Win10
Laz 3.1  fpc 3.2.2, MacOS Monterey running on VMWare/Win 10
Laz 3.1  fpc 3.2.2 Ubuntu 20.04

Thaddy

  • Hero Member
  • *****
  • Posts: 14197
  • Probably until I exterminate Putin.
Re: Peak detection in TAChart
« Reply #1 on: November 14, 2019, 07:31:21 pm »
You should not misuse the TaChart for that:TaChart is the presentation layer, not the compute layer.
 You should detect peaks in the data before you display it. And that is a simple max run.
« Last Edit: November 14, 2019, 07:37:22 pm by Thaddy »
Specialize a type, not a var.

wp

  • Hero Member
  • *****
  • Posts: 11853
Re: Peak detection in TAChart ?
« Reply #2 on: November 14, 2019, 07:56:31 pm »
No automatic peak detection, I agree with Thaddy.

There is a manual interactive peak detection with some limitations, though. Look at example "distancedemo" in folder "demo/distance" of your Lazarus installation, page "Fit": Select "Find peak" in the "Measure" box, then, holding the RIGHT mouse button down, drag from the somewhere below the peak to somewhere after the peak. The routine will fit a parabola to the data in the range spanned by the mouse range and display y and y value of the parabola's extremum.

Note, however, that this does not separate overlapping peaks or subtract a varying background. Therefore, the peak producing the shoulder near x=6 is reported at an incorrect value (7.75, but from the construction of the curve it should be at 2*pi = 6.28; finding the correct value requires more effort).

AL

  • Sr. Member
  • ****
  • Posts: 261
Re: Peak detection in TAChart
« Reply #3 on: November 14, 2019, 08:51:32 pm »
WP:  Thanks for pointing that demo.  This is interesting, I will study that.

You should not misuse the TaChart for that:TaChart is the presentation layer, not the compute layer.
 You should detect peaks in the data before you display it. And that is a simple max run.
This is what I tought, but I wanted to ask, just in case.  This package is so good, you never know.
At the moment, this is what I do, looking for max ( up to 3 peaks), but I need something a little fancier.

Thank you both for your quick answers
Laz 3.1, fpc 3.2.2, Win10
Laz 3.1  fpc 3.2.2, MacOS Monterey running on VMWare/Win 10
Laz 3.1  fpc 3.2.2 Ubuntu 20.04

 

TinyPortal © 2005-2018