Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to add elements to signals #98

Open
robhooley opened this issue Nov 25, 2024 · 3 comments
Open

Unable to add elements to signals #98

robhooley opened this issue Nov 25, 2024 · 3 comments

Comments

@robhooley
Copy link

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:

  • eXSpy version: 0.3.1
  • HyperSpy version: 2.2.0
  • Python version: 3.12.7

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
Copy link
Member

CSSFrancis commented Nov 25, 2024

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
Copy link
Author

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
Copy link
Member

ericpre commented Nov 26, 2024

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants