hyperspyUI
hyperspyUI copied to clipboard
FFT not working for 2D signals
trafficstars
Pressing the FFT button for the signal s = hs.signals.Signal2D(np.random.random(size=(100,100))) gives:
Traceback (most recent call last):
File "/home/magnunor/.virtualenvs/hyperspy_dev/lib/python3.5/site-packages/hyperspyui/plugins/fft.py", line 167, in fft
for i in do_ffts():
File "/home/magnunor/.virtualenvs/hyperspy_dev/lib/python3.5/site-packages/hyperspyui/plugins/fft.py", line 149, in do_ffts
if u.endswith('-1'):
AttributeError: '_Undefined' object has no attribute 'endswith'
The changes in this commit fixes this, but its quite sloppy: https://github.com/magnunor/hyperspyUI/commit/7124b1ec41556bc3f9e0b990f00dd44109fcf7b2
The fs.data = np.abs(fs.data) is due to matplotlib not being able to handle imaginary data.
The if str(u.__class__) == "<class 'traits.trait_base._Undefined'>": is due to the traits.trait_base._Undefined class not having an .endswith function.