hyperspy / exspy

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

Cannot find element database and get_xray_lines_near_energy() #45

Closed Sl4artiB4rtF4rst closed 2 weeks ago

Sl4artiB4rtF4rst commented 4 months ago

Dear team of Exspy! I really love the work you have done with exspy and hyperspy in general. I am just getting started in evaluating and analyzing EDS (TEM) data. I wanted to use the elemental database as well as the get_xray_lines_near_energy() function but cannot find it both in the Exspy and well as the hyperspy references. I noticed proviously that some functions where relocated to other (sub) libraries - maybe herin lies the problem.

Can you help me out where exactly to find the functions and possibly update the references as well as the EDS user guide (https://hyperspy.org/exspy/user_guide/eds.html) to show the correct usage.

I am using hyperspy and exspy in anaconda and have installed the newest versions (from conda forge). I could not, however find the correct command to check which version I have installed exactly, sorry.

Thank you in advance and kind regards!

ericpre commented 4 months ago

Here are the database: https://github.com/hyperspy/exspy/blob/main/exspy/misc/elements.py https://github.com/hyperspy/exspy/blob/main/exspy/misc/elements.py

And the get_xray_lines_near_energy function (which I found by putting the function name in the search bar of this repository): https://github.com/hyperspy/exspy/blob/e70cd5cc65ffb998ffb00273fb85119cf6abf8dd/exspy/misc/eds/utils.py#L88-L124

jlaehne commented 4 months ago

But indeed, we should update the user guide to give working examples! Thanks for the catch.

By the way, the test datasets now reside in exspy.data.

OliDG commented 3 months ago

Hi ,

as a related problem, the "misc" module doesn't appear in the list while eXSpy is loaded and accessible. Is it a docstring issue?

image

ericpre commented 3 months ago

This is designed to use internally and therefore not part of the public API. Do you think that they is a use case to make it part of the public API? If so, what would it be?

OliDG commented 2 months ago

oooh I see, I started to code a simple procedure to get an auto-detection of the elements present in my EDS maps to simplify my work (c.f. below), I understand that you want to simplify the API for the public, but is there a list of all the internal API tools available somewhere? a developper documentation ? I found this function from older hyperspy documentation but that would be a pity to re-write something already existing...

image 0.39 kV: ['N_Ka', 'Sc_La', 'Ca_La', 'Ti_La'] 0.52 kV: ['O_Ka', 'V_La', 'Cr_La', 'Ti_La'] 0.93 kV: ['Cu_La', 'Ne_Kb', 'Zn_La', 'Ni_La', 'Ne_Ka'] 1.49 kV: ['Al_Ka', 'Br_La', 'Al_Kb'] 8.03 kV: ['Cu_Ka']

ericpre commented 2 months ago

The main concern is the potential added maintenance burden if the elements database is part of the public API. Are you referring to the elements database or the function? For the function, it should be find to make a submodule with these type of functions.

OliDG commented 2 months ago

The function ex.misc.eds.utils.get_xray_lines_near_energy() as it is now it seems that I need to read the source code to find what is available, the dir() only shows the public side of eXSpy.

dir(ex)
Out[149]: 
['__version__',
 'components',
 'data',
 'material',
 'models',
 'preferences',
 'signals']
ericpre commented 2 months ago

Yes, this is expected, why should it lists what is not part of the public API?

OliDG commented 2 months ago

Sorry if I bother you. I am simply looking for a way to see what functions are already implemented.

ericpre commented 2 months ago

If you want to know more about functionalities that is not public, you will need to search the source code. If you are interested in eds, it is only a few files.

ericpre commented 2 months ago

This should be fixed in #59: some of the functionalities were removed from the public API when splitting from hyperspy but it does make sense to add it back!