hyperspy / exspy

EDS and EELS data analysis with HyperSpy
https://hyperspy.org/exspy
GNU General Public License v3.0
11 stars 10 forks source link

Unable to add elements to signals #98

Open robhooley opened 3 days ago

robhooley commented 3 days ago

Describe the bug

Unable to add elements to signals

Minimum working example of code

image

image

Expected behavior

signal.add_elements should add the elements, as it is written in your documentation

Python environement:

image

I'm going to be completely honest, the documentation here after the split from Hyperspy to Exspy and Rosetta is outdated and does not match the real code, it is useless. It has become incredibly frustrating to use these packages after the split, even your own examples do not work, how do you expect people to pick these packages up as they have become needlessly more complex.

CSSFrancis commented 3 days ago

Hi @robhooley, sorry for the confusion and the frusteration. Thank you for reporting this, otherwise it is hard for us to know what people are stuggling with. We are always looking for help and documentation is a great way to get started if you are interested. The motivation for the split is more for developers rather than users to be honest as maintaining hyperspy was becoming unsustainable, but the hope was that the overall changes are minimal.

I tried this after installing from the hyperspy bundle it seems to work as expected.

import exspy
import hyperspy.api as hs
s = exspy.data.EDS_TEM_FePt_nanoparticles()
s.add_elements (['C', 'Mn', 'Cu', 'Al', 'Zr'])
print(exspy.__version__) # 0.3.1
print(hs.__version__) # 2.2.0
hs.print_known_signal_types()

Can you show the output for 'hs.print_known_signal_types()` it seems like for some reason exspy isn't being properly initialized.

robhooley commented 2 days ago

I have this now and it seems to be working after restarting the Jupyterlab instance: image

However yesterday when I had this problem, the import statements were the same but this was shown instead: image

ericpre commented 2 days ago

@robhooley, what you are describing is consistent with an installation issue / using the incorrect python environment in your first message. If you want something that works out of the box, you can use the hyperspy bunble: https://hyperspy.org/hyperspy-bundle and the corresponding shortcuts/instructions to initialise the correct python environment (in case multiple python environment are installed). Unfortunately, considering the way python distribution works, it is relatively easy to break python distribution and this is the motivation for providing the hyperspy bundle.