Quasars / orange-spectroscopy

Other
52 stars 58 forks source link

Improvements on Peak Labeling #610

Open borondics opened 2 years ago

borondics commented 2 years ago

The new peak labeling functionality is great and I was thinking we could add an auto option to find some peaks with no user suffering.

A simple script

import numpy as np
from scipy.signal import find_peaks

dd = np.loadtxt('collagen.dat')
y = dd[:, 3]
p = find_peaks(y)

produces a pretty good result:

image

Not bad for a zero effort thing, right? Of course we would need to test it on billions of different spectra, but we shouldn't aim to be perfect I think.

@markotoplak, @stuart-cls, what do you think?

borondics commented 2 years ago

And of course, the user would fine-tune it and add the missing ones with the existing tool.

markotoplak commented 2 years ago

There already was a flexible (but in the end a bit too complex) option that @noahcabanas implemented. How does that function compare with his suggestion?

And more importantly, what does it do for multiple spectra? Or should we limit the user to select a spectrum and then use it?

borondics commented 2 years ago

Yeah, I think we shouldn't make it flexible. The purpose would be to put a bunch of vertical lines onto the spectrum in not random or equidistant positions. If it is a bit better than those, meaning that the lines are indeed close to peaks, we are winning.

For multiple spectra I would use the average. Again, this function would be to help the user in some way but not to have it perfect.