Closed HamishGBrown closed 3 months ago
@HamishGBrown it looks like the data is 28,30|2048 channels? Is that correct. Tiffs only support 3 dimension stacks with 2 of the dimensions for each "image" so likely the data is saved transposed which is why it is loaded in as a signal 2D or 2048|30,28.
Try this:
gfp = hs.load("/home/hbrown/Mount/F30data/Hamish/20240603_GFP_BSA_comparison/{0}/{1}_EELS Spectrum Image.tif".format('1_5mgmlGFP','AF'))
gfp.T #the signal is now a Signal1D
gfp.set_signal_type("EELSSpectrum")
You might need to manually adjust the axes manager based on the header and set things like gfp.axes_manager.signal_axes[0].scale
Let me know if you need more help and if you share the data I can look at it further. If there is enough metadata in the header this might be some thing we could support
@CSSFrancis, this seems to have fixed the problem so thank you for your help. I had to make one edit:
gfp = gfp.T #the signal is now a Signal1D
To the code you suggested since the transpose method seems to return a copy of the object but doesn't affect the original object.
Describe the bug
I recorded some EELS data using GMS 2 yesterday and didn't notice that the previous user had been saving in tiff and not dm4 format so saved all my spectra in this format. Thankfully the spectra are saved as tiff stacks with the all relevant axes information in the tiff header, however when I try and read these files with exspy the conversion to an EELS datatype within hyperspy is not occuring properly
To Reproduce
Steps to reproduce the behavior:
Using the exspy.signals.EELSSpectrum object more explicity:
Trying to pass the gpf.axes_manager object as the axes kwarg yielded:
Expected behavior
There might be a better way to do this conversion, if so please let me know.
Python environment:
Name Version Build Channel
hyperspy 2.1.0 pyhd8ed1ab_0 conda-forge exspy 0.2 pyhd8ed1ab_0 conda-forge python 3.12.3 hab00c5b_0_cpython conda-forge
Additional context
I can't upload the raw spectrum as it is too large but can share a onedrive link if requested.