Magnus
--
You received this message because you are subscribed to the Google Groups "hyperspy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hyperspy-user...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
I've been trying to do quantitative analysis of the fine structure of Ti by fitting 4 Voigt-functions (or Gaussian) to the Ti fine structure peaks.
I am using a powerlaw component to remove the background, and H-S GOS to fit the Ti-L3 and Ti-L2 edges. Then I extract the fine structure. I've been using two ways of doing this: Ti_L3.get_fine_structure_as_spectrum or by subtracting the model from the spectrum:
m() - m.spectrum()
Those should give approximately the same result (except for the fine structure smoothing)?
Doing the following:
fine_structure = np.append(Ti_L3.get_fine_structure_as_spectrum(), Ti_L2.get_fine_structure_as_spectrum())
Gives a fine structure spectrum with a discontinuity (attached image). Any ideas on how to solve this?
I've been thinking about convolving the H-S GOS model with the experimental energy resolution to make the edges less "sharp".
I guess that this should return the residuals unless you have previously disabled the fine structure. If that is the case still you won't get get the same result because in Hyperspy the fine structure replaces the H-S calculations in the fine structure energy window and when you disable it the H-S values are returned in that window instead of the fitted fine structure.
In principle it should be enough to play with the fine_structure_smoothing attribute, but if you need to fine tune it then convolving it with e.g. a gaussian it's certainly the way to go. You can do it changing from Spectrum to SpectrumSimulation and using the apply_spectral_gaussian_filter method. By the way, maybe we should move this method to Spectrum so that we don't need to change to SpectrumSimulation to use it.
[...]And I'm a curious, how exactly does the fine structure fitting work?
apply_spectral_gaussian_filter seems to work, but it seems to convolve the spectrum by using the array indexes rather then the signal axes. Meaning:
s = load("some_spectrum").to_simulation()
b = signals.spectrum_simulation.SpectrumSimulation({'data':s()})
s.apply_spectral_gaussian_filter(10)
b.apply_spectral_gaussian_filter(10)
s() - b() #Gives a zero array
Is there some way to make apply_spectral_gaussian_filter work on the signal axis unit scaling instead of the array index number. Basically meaning s.apply_spectral_gaussian_filter(10) would convolve the spectrum by a gaussian with a FWHM of 10 eV (if that is the signal axis unit).
Moving the function to Spectrum seems like a good idea.
[...]And I'm a curious, how exactly does the fine structure fitting work?
Hyperspy fits a spline to the region marked as fine structure. More details about this procedure can be found in:
Manoubi, T., Tence, M., Walls, M. G. & Colliex, C. Curve fitting methods for quantitative analysis in electron energy loss spectroscopy. Microscopy Microanalysis Microstructures 1, 23 (1990).
apply_spectral_gaussian_filter seems to work, but it seems to convolve the spectrum by using the array indexes rather then the signal axes. Meaning:
s = load("some_spectrum").to_simulation()
b = signals.spectrum_simulation.SpectrumSimulation({'data':s()})
s.apply_spectral_gaussian_filter(10)
b.apply_spectral_gaussian_filter(10)
s() - b() #Gives a zero array
Is there some way to make apply_spectral_gaussian_filter work on the signal axis unit scaling instead of the array index number. Basically meaning s.apply_spectral_gaussian_filter(10) would convolve the spectrum by a gaussian with a FWHM of 10 eV (if that is the signal axis unit).
Moving the function to Spectrum seems like a good idea.
Yes, that was a bug, thank you for reporting it. I moved the function to the Spectrum class, renamed it to gaussian_filter and fixed this and another bug. Everything is up in the master branch...
On Tuesday, March 5, 2013 10:57:22 AM UTC+1, francisco wrote:[...]And I'm a curious, how exactly does the fine structure fitting work?
Hyperspy fits a spline to the region marked as fine structure. More details about this procedure can be found in:What kind of function is used for the spline? In that article they use Lorentz distributions ontop of the H-S to fit the fine structure
There was a small bug in this implementation, I fixed it with: https://github.com/hyperspy/hyperspy/commit/a1c4fb698269bd49eedc18b3a05b4dc58a5b50f3
Magnus,2013/3/6 Magnus Nord <magn...@gmail.com>
On Tuesday, March 5, 2013 10:57:22 AM UTC+1, francisco wrote:[...]And I'm a curious, how exactly does the fine structure fitting work?
Hyperspy fits a spline to the region marked as fine structure. More details about this procedure can be found in:What kind of function is used for the spline? In that article they use Lorentz distributions ontop of the H-S to fit the fine structure
Yes, in the article they use lorentzians to fit the whitelines and they point out that you can use any function that fits well the fine structure features. A spline fits well mostly anything that is well behaved and that is why it is the function that Hyperspy uses by default. Splines are good if you are only interested in elemental quantification but it is probably not optimal for quantifying the fine structure that I presume that it is what you're trying to do.
In your case I would do the following:1. activate the fine structure of the Ti_L3 and Ti_L2 edges but fix them.By default this will set the fine structure region of the Ti L3,2 edges to zero.
>>> Ti_L3.fine_structure_active =False
>>> Ti_L2.fine_structure_active =False
>>> Ti_L3.fine_structure_coeff.free = False
>>> Ti_L2.fine_structure_coeff.free = False
2. Add components to the model to fit your whitelines and set the
starting parameters and possible the boundings to reasonable values.
I guess this should give you what you want. However, I must admit that it is a little bit cumbersome. To make the task easier I was thinking to add the possibilty to set a model as the fine structure of a given component. I'll show you with an example what I mean:
>>> s.add_elements(("Sr", "Ti", "O"))
>>> Ti_L32_FS = create_model(s)
>>> g1, g2 = components.Gaussian(), components.Gaussian()
>>> Ti_L32_FS.extend((g1, g2))
>>> m = create_model(s)
>>> Ti_L3.fine_structure_mode = Ti_L32_FS
What do you think?
That works. In addition I need some way to apply a Gaussian convolution to some of the components (for example the H-S components), is there some way to convolve a component in a model? I'm guessing it should be fairly straight forward to implement: adding the gaussian_filter function from the spectrum class to the model class, and then add a check in the function which generates the model-array to see if the gaussian_filter function should be used to convolve the model-array.