views:

28

answers:

1

Does anyone know of any peakfitting libraries for Java?

I want to give it an array of data, and it tell me the position of the peak.

eg for this data:

x, y
-5, 0.875333026
-4, 0.885868909
-3, 0.895851362
-2, 0.903971085
-1, 0.908274124
0, 0.907117054
1, 0.901894046
2, 0.894918547
3, 0.887651936
4, 0.880114302
5, 0.872150014

it will say that the peak is at (about) -0.75

I'll probably just want to fit a gaussian, or maybe a split gaussian...

.

I've tagged it as curve-fitting, not peak-fitting or peak-finding as I don't have enough reputation to make new tags...

edit: I would prefer Apache (or compatible) licensed code...

A: 

Do you want to determine the position of peak by least-squares fitting? I think the most popular method for this is Levenberg–Marquardt algorithm.

I don't know any Java libraries, but I'd search for terms like: nonlinear curve fitting, nonlinear least-squares, Levenberg–Marquardt or just Marquardt method. You may also consider coding it yourself. If you have a library for matrix manipulations it is like 20-30 lines of code (see Numerical Recipes).

Finally, there is my program for peak detection and peak fitting (peak means bell-shaped curve), on GPL. It includes a library (libfityk) and SWIG-based bindings to this library for Python and Lua. Someone reported generating also Java bindings and using libfityk from Java. But honestly, it may be an overkill for your needs.

marcin