EELS fine structure fitting using two gaussians #63
-
Describe the bugI am trying to analyse a core-loss EELS line-spectrum. I have attempted to fit the data with a series of Gaussian and 1st-order polynomial functions. I have attempted to fit each peak by constraining the fitting of each Gaussian by defining bmin, bmax bounds as well as providing an initial estimate of the Gaussian centre value (corresponding approximately to the specific peak of interest). I have included code below that attempts to fit a single Gaussian (both Gaussian and GaussianHF have been attempted) to the data but it results in a double-peaked Gaussian in the resulting fitted curve, as illustrated at the end of this bug report. Moreover, the model component parameters do not adjust once the multi-fit is run and the Gaussian curves extend beyond the defined bmin and bmax bounds. No errors have been produced. I am unsure whether these errors have arisen due to human error or a bug with Hyperspy. However, I have been prompted to submit a bug report by my supervisor. To ReproduceSteps to reproduce the behavior:
Python environment:
Additional contextAttached below are illustrations of the code and a figure showing the double-peak Gaussian fit. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I moved this to a discussion because it seems to be a matter of how it should be use rather than a bug itself. The approach on estimating sensible starting parameters, setting bounds generally works in these case, even if this is not the most robust and sometimes it is a matter of finding the right way to get the fit to converge to right minima: in this case, it seems to converge in a local minima which is not correct. To model the continuum, usually arctan or core edge components are used instead of polynomial. See for example discussion in #58 Since there is no error and the data are missing to reproduce what you are seeing, it is difficult to be sure, but I would do the following:
It would be useful if your supervisor could give this kind of generic advice! 😉 |
Beta Was this translation helpful? Give feedback.
I moved this to a discussion because it seems to be a matter of how it should be use rather than a bug itself.
The approach on estimating sensible starting parameters, setting bounds generally works in these case, even if this is not the most robust and sometimes it is a matter of finding the right way to get the fit to converge to right minima: in this case, it seems to converge in a local minima which is not correct. To model the continuum, usually arctan or core edge components are used instead of polynomial. See for example discussion in #58
Since there is no error and the data are missing to reproduce what you are seeing, it is difficult to be sure, but I would do the following: