Quote from: Ben Buse on October 02, 2024, 01:41:52 AM
In hyperspy documentation it says "Utils - API of classes, which are not part of the hyperspy.api namespace but used by HyperSpy signals." Does anyone know if this is available for python?
Everything in hyperspy is available in python - it is python library package.
I just quickly installed hyperspy through mamba (Holy smoke 570MB!), and just tried it from python REPL:
from hyperspy import utilsand it imports utils with no problem. So what is the exact problem... wait I know there is lots of problems with hyperspy (I was for some moment one of devs) and now I see exactly the confusion. "Utils - API of classes" is not under
hyperspy.utils, but
hyperspy.misc.utils. I know and agree it is stupid. hyperspy overcome so much java'ing that at some point I just gave up with contributing to it and rather just use their split rossetaIO library for file loading, but do everything outside hyperspy. Importing just hyperspy imports only
hyperspy.api hiding everything behind, and I exactly discussed that nonsense few years ago that people wont find many things because of that. hyperspy became heavy, slow, contains loadcrap of unnecessary scruff, massive dependency (570MB) a mess in the structure hiding everything (private/public separation of function nazies) and nothing can be changed as most of devs are from material sciences and it scratch their itch. In your place I would consider NIST NeXL* (written by Ritchy) for quantification, where is already built in XPP, X-PHI matrix correction methods. And NeXL can load hyperspy files. So python rossetaIO lib could be used to load files and save to hyperspy file format and then those files could be used in NeXL.
*Java'ing - making python library behave, smell and hide things like it is in java for name of tidiness, conventions and all kind of other unproductive BS. BTW, I had not checked the state of rossettaio (name is stupid – I always forget as not-native-speaker if there is two 's's or two 't's or both). Last time I got pissed off was similar api hiding nonsense ongoing.
Thank you that seems to explain my problem although I still can't find hyperspy.material as listed here https://hyperspy.org/hyperspy-doc/v1.5/user_guide/eds.html (https://hyperspy.org/hyperspy-doc/v1.5/user_guide/eds.html)
Meanwhile I replaced usage of hyperspy with python packages pyxray and xraydb
Run the code and gives me the following for Sb metal:
C [wt%]: [1]
A [Da]: [121.75978367]
Z: [51]
Q: 2.624e-02
M [Da?]: 4.189e-01
J [keV]: 5.165e-01
1/f(V): 8.940e+03
dE/drhos [?]: 7.250e+03
1/S: 2.547e-05
R: 7.796e-01
f:0.0010453571843908095
So R backscattering factor is correct. Not sure about rest. And haven't yet figured out where the rest of the code is to finish the XPP.
Regarding NIST NeXL* looks interesting, although was hopping for a python solution. I'm not interested in applying it to hyperspy just looking to see if could apply matrix correction to datasets in python