## Where communities thrive

• Join over 1.5M+ people
• Join over 100K+ communities
• Free without limits
##### Activity
• Dec 01 09:06
jheinen opened #2860
• Nov 30 08:25
jlaehne commented #110
• Nov 30 08:17
jlaehne labeled #994
• Nov 30 08:14
jlaehne commented #1718
• Nov 30 08:14
jlaehne commented #1066
• Nov 28 21:05
codecov[bot] commented #2703
• Nov 28 21:04
codecov[bot] commented #2703
• Nov 28 20:54
magnunor commented #2703
• Nov 28 20:54
magnunor commented #2703
• Nov 28 20:51
codecov[bot] commented #2703
• Nov 28 20:51
magnunor synchronize #2703
• Nov 28 20:42
codecov[bot] commented #2781
• Nov 28 20:31
codecov[bot] commented #2703
• Nov 28 20:31
codecov[bot] commented #2703
• Nov 28 20:30
din14970 edited #2781
• Nov 28 20:30
din14970 edited #2781
• Nov 28 20:30
din14970 edited #2781
• Nov 28 20:30
din14970 edited #2781
• Nov 28 20:30
din14970 edited #2781
• Nov 28 20:30
din14970 edited #2781
Thomas Aarholt
@thomasaarholt
@Mingquan_Xu_twitter is showing the result of m.plot(True), where the True first argument is to show the individual components as well as the total fit.
OliDG
@OliDG

@ericpre Hi Eric,
I try to display the hs.roi.Line2DROI(x,y,x,y,w) directly on the figure plotted with hs.plot.plot_images(my_EDS_maps) to further get the composition profile. So far I have to replot each individual maps, stack the line profiles in a list and plot them with plot_spectra(Line_profile_list).

Here is the figure details,

plt1 = hs.plot.plot_images(my_EDS_maps)

Out[54]:
[<AxesSubplot:title={'center':'Cd'}, xlabel='width axis (µm)', ylabel='height axis (µm)'>,
<AxesSubplot:title={'center':'Cu'}, xlabel='width axis (µm)', ylabel='height axis (µm)'>,
<AxesSubplot:title={'center':'Ga'}, xlabel='width axis (µm)', ylabel='height axis (µm)'>,
<AxesSubplot:title={'center':'Mo'}, xlabel='width axis (µm)', ylabel='height axis (µm)'>,
<AxesSubplot:title={'center':'Rb'}, xlabel='width axis (µm)', ylabel='height axis (µm)'>,
<AxesSubplot:title={'center':'S'}, xlabel='width axis (µm)', ylabel='height axis (µm)'>,
<AxesSubplot:title={'center':'Se'}, xlabel='width axis (µm)', ylabel='height axis (µm)'>]

But then I am stuck, finding no ways to add the line ROI on them. What could I do ?

ROI = line_roi.interactive(plt1[0])
[...]
AttributeError: 'AxesSubplot' object has no attribute 'axes_manager'

Best,

3 replies
Ruben Bjørge
@rbjorge

Hi all, I have a question about saving large datasets. Is there any way of "saving lazily"? If, for example, I don't have at least 128 GiB of memory the following will run out of memory and crash:

import hyperspy.api as hs
data = da.random.random((512, 512, 256, 256))
s = hs.signals.Signal2D(data).as_lazy()
s.save('save_test.hspy')

I see that using Zarr will probably solve this (hyperspy/hyperspy#2825), but I actually want to save the data as a Blockfile. Is that possible?

8 replies
Hugh Ramsden
@0Hughman0

I need to make use of non-uniform-axes functionality, I notice there used to be a branch for this, but this has since been incorporated into NEXT_MINOR_RELEASE, which I guess isn't stable as it's still being worked on. I'm wondering what's best for me to do here? How long will it be before NEXT_MINOR_RELEASE?

I'm actually a LumiSpy user, but their recommendation is to install this non-uniform-axes branch which no longer exists 🤔.

In any case, thanks for the great library, incredibly useful for me.

Thomas Aarholt
@thomasaarholt
Hehehe, you can just install the current next_minor_release branch
How are you normally installing things in python?
Hugh Ramsden
@0Hughman0
pip
Is next_minor_release stable enough for me to get going with?
Thomas Aarholt
@thomasaarholt
Yep
pip install https://github.com/hyperspy/hyperspy/archive/refs/heads/RELEASE_next_minor.zip
That contains the merged non-uniform functionality
Hugh Ramsden
@0Hughman0
I am reassured by the word RELEASE in that url 😜
Thomas Aarholt
@thomasaarholt
Hehehe :p
Hugh Ramsden
@0Hughman0
ty
Mingquan Xu
Hi, all, how can I map out Signal (Dynamic) in HyperSpy: when I change the energy-loss region in SI, the mapping change simultaneously.
I guess I need the interactive(), but do not find such a example in the online-documentation page.
Could you give me a hint for this?
Mingquan Xu
I have used the above method to do this, but not sure whether there is a better way?
Tan-Shengdong
@Tan-Shengdong
Hi all, when I used Hyperspy to deal with EDS data, I noted that there is some shift of the same peak (such as Pt_La) among different data.
Thomas Aarholt
@thomasaarholt
@Tan-Shengdong is there a question there? :)
@Mingquan_Xu_twitter Could you explain a bit further what you want? "map out Signal (Dynamic)" wasn't very clear.
Tan-Shengdong
@Tan-Shengdong
@thomasaarholt I just want to ask why there is a shift？ I think the x-ray position of each element should be a constant.
Thomas Aarholt
@thomasaarholt
Oh, I see. I'm not sure of the physical reason either, but I've definitely heard of shifts before - it's why the calibration functions exist.
Zanetta Pierre-marie
@ZanettaPM
@Tan-Shengdong I think that is because you use calibrate_xray_lines() it tunes the parameter of the Gaussian and among them the center position. I you just wants to change the energy resolution use calibrate_energy_resolution()

Hello,

I am using VSCode as an IDE. I use the jupyter plugin that enables jupyter notebooks to be used in the interface of VSCode. Everything was working well until recently. Now when I have a cell with :

import hyperspy.api as hs

The kernel dies. It is working well with import hyperspy though. Is that a known issue ? Is anybody else using VSCode and the hyperspy api ?

Thomas Aarholt
@thomasaarholt
Interesting! I can give it a shot later this weekend. Any idea how recently it was working?
18 replies
Abohaitham92
@Abohaitham92
Hello all, I have a question regarding loading an .edm file and then saving it to hdf5 file, i just loaded an edm file using s = hs.load(edm_file), which gave me a list of signals, what is the best way to save all of these signals into one hdf5 file ? I used to save one signal using s.save(test.hdf5). But now using the save command for each signal in my list on the same file will overwrite the file.
lnaglecocco
@lnaglecocco
Hi, I think someone explained this to me before but I don't remember the explanation and can't find it - sorry. When I plot a model with plot_components=True, some of the components have features which shouldn't be part of the component. For example the red peak here is a GaussianHF yet it has features around 800 eV which contribute to the overall fit. What is that all about?
2 replies
lnaglecocco
@lnaglecocco
Another unrelated question, and thank you in advance. I have a dataset for which fitting a model can be quite time-consuming. So rather than re-fitting every time I load it up and want to look at it, I'd like to save it and simply load the file. However - when I try code like ".model.save("model",extension="hspy")", and then "model_2 = hs.load("model.hspy")", model_2 doesn't seem to have the model, just the experimental data. How can I save a model?
2 replies
DENSmerijn
@DENSmerijn
Hi all, we are trying to load a Velox .mrc file but we keep getting the following error: ValueError: cannot convert float NaN to integer
We have tried multiple files, all with the same outcome. Any idea what could be causing this issue?
7 replies
Mingquan Xu
If I want to fit a fractional energy-range in my spectrum, how can I use the m.fit() function?
Like only fit the energy range marked in orange above
2 replies
Mingquan Xu
3 replies
Hi, all, if I want to get the data-points of my model-fitting, the green line, how to do it? Because I want use those data-points to plot it individually.
Mingquan Xu
Hi, all, recnetly I am trying Matlab to treat my spectrum image data, but I donot know how to expot the data after processing. Are there any matlab scripts can write the spectrum image data? such as to .mrc ?
lnaglecocco
@lnaglecocco
Hi, is there a way to exclude certain pixels (with each pixel containing a spectrum) from a model before fitting? I've written an algorithm which produces an array of coordinates representing pixels which are not part of my sample, but I'm not sure how to make that happen. I know I can use .inav[x1:x2,y1:y2] but my sample is not a perfect square so just cropping isn't quite what I want to do
8 replies
lnaglecocco
@lnaglecocco
I have another question which probably has a very simple fix. When I do model.plot() the spectrum at each pixel is normalised such that the plot fits perfectly. However, when I set plot_components=True, I get it so that only part of the data fits in the y axis. I've figured out that this is because it's setting the y-axis bounds for the graph based on a single component, rather than the total fit. How can I fix this so that model.plot(plot_components=True) gives each pixel normalised to the total fit rather than the y-span of a single component?
2 replies
OliDG
@OliDG
Hi,
I try to find a way to save my "file.hspy" using the save() function to a specific path, but I can't see a "path" argument in the function description. Ideally, I was hoping to get the path from the hs.load() function ("load.path/of/my/loadedfile") and use it to save to the same folder without having to manually enter a path ( I have many datasets from many different folders).
20 replies
Jędrzej Morzy
@JMorzy

Is there a way of adapting 'fit_component' function to work using multiple threads on a CPU? The only mention of parallel processes that I found in the docs was in SAMFire and in the map function. I have a relatively specific order of component fits (for EELS core-loss data) that I wouldn't want to change. Any advice on how to approach this would be appreciated!

(I just recently got my hands on a computer, where parallelising would save a significant amount of time)

2 replies
Rosenkranz1
@Rosenkranz1
Hello. I am fairly new to programming, and i am trying to write some extensions to the HyperSpy program. I know how to write a class and have the class inherit etc, but when i create a class for a HyperSpy extension, which should basically inherit the "whole" of HyperSpy so i can use the methodes in HyperSpy in my extension, what is the best approach for this?
I should fork the github repo, but for me it is not very intuitive, what the best way to write extensions are.
I have read the documentation on this, from HyperSpys websites, but i need some elaboration.
6 replies
Rosenkranz1
@Rosenkranz1

Hello, i have a followup question for my question above.

I want to contribute to a package that already excist (The eds packages). How would i go about using my contribution? By forking the repo and including my methodes in the relevant classes or should i create my own class, and have that inherit from eds? In the latter case, i am struggeling to get the inheritance to work properly, i have written some code, but when i try to apply my method too a dataset it exclaim that EDSSpectrum does not have the attribute, should correct inheritance not fix this? Or is the only way to create my code in a forked repo of the relevant signal?
This might be a trivial question but i cant seem to find the answer. (Maybe i lack some understandig of classes)

6 replies
Weixin Song
@winston-song
Hi All, I use DM to record some EDX spectral images, when I process them using PCA, it shows 'ValueError: zero-size array to reduction operation minimum which has no identity' whether anyone knows how to resolve this problem? thanks
Weixin Song
@winston-song