hyperspy / exspy

EDS and EELS data analysis with HyperSpy
https://hyperspy.org/exspy
GNU General Public License v3.0
10 stars 10 forks source link

ROI to select fitting range #21

Open HanHsuanWu opened 8 months ago

HanHsuanWu commented 8 months ago

Describe the functionality you would like to see.

As title, it will be nice to be able to use ROI to select the fitting range of a EELS model. Something like what GMS can do for background subtraction. Would it possible to do it with SpanROI that we have currently? image

Additional information

This is on the '2.0.dev0' version. It seems like ROI doesn't work with model1D object right now.

s = hs.datasets.two_gaussians()
m = s.create_model()
roi = hs.roi.SpanROI()
m.plot()
sliced_signal = roi.interactive(m, axes=m.axes_manager.signal_axes)

image

image

francisco-dlp commented 8 months ago

@HanHsuanWu, thank you for the suggestion.

You can set the fitting range interactively using set_signal_range. If you don't pass the signal range as an argument, it automatically displays a ROI to select the signal range for fitting. Does it meet you needs?

That said, this feature predates HyperSpy ROIs, and, therefore, it is not implemented using ROIs. I think that it would be good to reimplement the feature using ROIs instead. The same goes for all other functionality using interactive_range_selector. However, this is a discussion to have in the hyperspy repository.

Also, the fact that using ROIs on a Model raises an obscure exception is a bug: it should either work (not currently implemented) or raise an informative NotImplemented exception. Again, this is HyperSpy issue.

@HanHsuanWu, would you like to open those issues in the HyperSpy repository?