Is there a way to use hyperspy as a "normal" python library?
Is it possible to do smart_fit() on a stack of EELSspectrums?
I ran fitting on a single spectrum from a .msa file, which gives me a nice fitting and it plots fine. However when I use export_results on the model I get:
"NavigationDimensionError: 'navigation dimension = 0, >0 expected'"
Is there some other way of getting the fitting data?
I'm having some problems using the multifit(kind="smart"), the following does not work:
s = load(imagefile).to_EELS() #stack
ll = load(lowlossfile).to_EELS()
s.add_elements((...))
s.set_microscope_parameters(...)
m = create_model(s, ll=ll)
m.enable_fine_structure()
m.multifit(kind="smart")
When running the multifit, I get the error: http://pastebin.com/PctYUD2K
If I do not include the lowloss spectrum in the model, everything works fine. Currently using the latest github-version.
Is there a way to "extract" a single spectrum from a stack of spectrums, while retaining all the metadata (energy-range, elements, instrument parameters, ...)?
Is there an easy way get the fine structure from a model as a spectrum, so that I can do further curve fitting on the fine structure (for example using voigt-profiles to further analyze the fine structure)?
I'm thinking of writing some examples of using hyperspy, would a good way of doing this be to write it and send a pull request to the hyperspy github project?
I think that the problem may be that the low-loss navigation (i.e. spatial) dimensions are not the same as the core-loss navigation dimensions that you are trying to fit. Is it the case?
I have just added a new method to the Signal class to get the feature that you suggest. After pulling from github the following should work: s0 = s.get_current_signal()
I guess that the easiest way to do it is by generating the full model using
generate_data_from_model. e.g.:
>>> s = load('yourfile')
>>> m = create_model(s)
---- fit your data ---
>>> m.generate_data_from_model()
>>> sm = s.deepcopy()
>>> sm.data = m.model_cube
Now you can create a new model to fit sm.
Great, the project desperately needs better documentation and many more examples! Would you like to add the examples to the main documentation or to the examples section of the website? To add them to the examples section of the website you just need to add the scripts to an appropriate folder in the examples folder of the project root folder. To add them to the documentation, as you know, you must edit the rst files in doc/user_guide. In any case, yes, sending a pull request is the way to put it in. Let me know if you need any help in the process and thank you very much for helping improve Hyperspy.
This gives me the full model (with both powerlaw background and the edges), is it possible to get just the fine structure?
I think I'll add some examples of the stuff I've been doing. And maybe add some "workflow" documentation, which I find very helpful (such as http://hyperspy.org/hyperspy-doc/current/user_guide/model.html#eels-curve-fitting).
- Magnus
At the moment it is not possible in an easy way, but it would be nice to have this feature so I will work on it and I will let you know when it is ready, probably next week. In the meantime you could get what you want by disabling what you don't want in your model before calling m.generate_data_from_model , e.g.# To disable the power law background>>> background.active = False# To disable the edges of the elements that you are not interested it>>> m.disable_edges((Sr,Ti))# To get the single scattering distribution>>> m.convolved = False
I think I'll add some examples of the stuff I've been doing. And maybe add some "workflow" documentation, which I find very helpful (such as http://hyperspy.org/hyperspy-doc/current/user_guide/model.html#eels-curve-fitting).Great, thanks!
Francisco