## Where communities thrive

• Join over 1.5M+ people
• Join over 100K+ communities
• Free without limits
• Create your own community
##### Activity
• Jan 16 11:25
hakonanes commented #2867
• Jan 15 10:27
ericpre commented #2867
• Jan 14 10:33
hakonanes opened #2867
• Jan 12 18:32
ericpre unlabeled #2866
• Jan 12 18:32

ericpre on RELEASE_next_minor

Bump dask minimum requirement t… Remove use of distutils - minim… Fix JEOL test file packaging and 6 more (compare)

• Jan 12 18:32
ericpre closed #2866
• Jan 11 12:17
ericpre milestoned #2851
• Jan 09 22:07
codecov[bot] commented #2850
• Jan 09 22:07
codecov[bot] commented #2850
• Jan 09 19:48
ericpre commented #2850
• Jan 09 14:46
thomasaarholt review_requested #2850
• Jan 09 14:45
thomasaarholt commented #2850
• Jan 07 17:50
ericpre commented #2866
• Jan 07 09:24
nem1234 commented #1491
• Jan 06 10:11
ericpre commented #2850
• Jan 05 18:12

ericpre on RELEASE_next_minor

Switch non-lazy map to using da… Remove unused functions in misc… Improvements to process_functio… and 4 more (compare)

• Jan 05 18:12
ericpre closed #2703
• Jan 05 14:09
codecov[bot] commented #2703
• Jan 05 14:05
magnunor commented #2703
• Jan 05 13:59
magnunor labeled #2703
Eric R. Hoglund
@erh3cq
I remember something about setuptools being finicky
Eric R. Hoglund
@erh3cq
I have now also tried Anaconda and downgrading setuptools to 57.4.0, no luck.
and the second half of the output is missing above:
 C:\Users\Owner\Programs\Miniconda3\envs\data-analysis\include\cpython/object.h(193): note: see declaration of '_typeobject'
hyperspy\io_plugins\unbcf_fast.c(22423): warning C4996: '_PyUnicode_get_wstr_length': deprecated in 3.3
hyperspy\io_plugins\unbcf_fast.c(22439): warning C4996: '_PyUnicode_get_wstr_length': deprecated in 3.3
hyperspy\io_plugins\unbcf_fast.c(23650): warning C4996: 'PyUnicode_FromUnicode': deprecated in 3.3
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30133\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
----------------------------------------
Rolling back uninstall of hyperspy
Moving to c:\users\owner\programs\miniconda3\envs\data-analysis\lib\site-packages\hyperspy-1.6.4.dist-info\
from C:\Users\Owner\Programs\Miniconda3\envs\data-analysis\Lib\site-packages\~yperspy-1.6.4.dist-info
Moving to c:\users\owner\programs\miniconda3\envs\data-analysis\lib\site-packages\hyperspy\
from C:\Users\Owner\Programs\Miniconda3\envs\data-analysis\Lib\site-packages\~yperspy
ERROR: Command errored out with exit status 1: 'C:\Users\Owner\Programs\Miniconda3\envs\data-analysis\python.exe' -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Owner\\Documents\\GitHub\\hyperspy\\setup.py'"'"'; __file__='"'"'C:\\Users\\Owner\\Documents\\GitHub\\hyperspy\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps Check the logs for full command output.
100 replies
Eric R. Hoglund
@erh3cq
Not sure what bcf format is.
3 replies
Eric R. Hoglund
@erh3cq
I will try that after a complete uninstall of all things python and VS. Another blank slate might help. I just hope uninstalling VS doesn’t trash some other program…we will see.
Thomas Aarholt
@thomasaarholt
Good luck, and goodnight :)
New record?
Eric R. Hoglund
@erh3cq
Would deleting gitignore or anything git help?
HA! Going for gold 96
Good night Thomas. Late there
Eric R. Hoglund
@erh3cq
@thomasaarholt ... figured it out ... downgraded to python 3.8, then my local repo installed. I think the 3.9 wheels are missing or can't be built. At least it is running now! Now we know the source of the problem and it might be worth investigating or making note of.
1 reply
Eric R. Hoglund
@erh3cq
Why does it fail? Is there a way to fix rather then remove?
6 replies
DENSmerijn
@DENSmerijn

I am trying to run pytest on a local development directory, but I am getting the error

ERROR: usage: pytest [options] [file_or_dir] [file_or_dir] [...]
pytest: error: unrecognized arguments: -n --dist loadfile

Do you know what is causing this issue?

2 replies
Eric R. Hoglund
@erh3cq
Anyone know the memory usage per atom in atomap Gaussian fitting? Have 25K atoms and the fitting just ran out of memory on the HPC…ha!
Thomas Aarholt
@thomasaarholt
Raises hand my bad!
At least I wrote the optimized version.
What resolution is the image?
The algorithm crops out a small square at a time from the image, centered around the atomic column in question
I'm not sure how memory intensive it is supposed to be though, since it works in a loop. Do you know where it was when it died?
Eric R. Hoglund
@erh3cq
This one is unfortunately 4k. Needed to get the full field of view and sampling
Eric R. Hoglund
@erh3cq
For EDX analysis with the super X (4 detectors), I’m assuming each detector’s signal needs to be analyzed independently to account for experimental geometry?
1 reply
Eric R. Hoglund
@erh3cq
Okkie dokkie
Luiz Tizei
@ltizei
Does anyone know if there is a way to implement a component for fitting which uses either np.piecewise() or np.heaviside()? I tried doing as described on the model fitting section of the manual, but I don't think Sympy constructs the function correctly.
4 replies
OliDG
@OliDG

Hello,

The [example code for interactive line2DROI] (hyperspy/hyperspy#2414) triggers the following valueerror for me: "The value is out of the axis limits".
Can anyone reproduce the error or it it just me? (Hyperspy is vesion 1.6.2, hyperspygui 1.4.0.)

here is the code:

#https://github.com/hyperspy/hyperspy/pull/2414
import hyperspy.api as hs

im0 = hs.datasets.example_signals.reference_hologram()
im1 = hs.datasets.example_signals.object_hologram()

im0.plot()
im1.plot()

line_profile = hs.roi.Line2DROI(400, 250, 220, 600, 2)
line0 = line_profile.interactive(im0)
line1 = line_profile.interactive(im1)

hs.plot.plot_spectra([line0, line1])

the same happens with the [exemple from the docs] (https://hyperspy.org/hyperspy-doc/current/user_guide/interactive_operations_ROIs.html)

import hyperspy.api as hs
holo = hs.datasets.example_signals.object_hologram()
roi = hs.roi.Line2DROI(x1=465.577, y1=445.15, x2=169.4, y2=387.731, linewidth=0)
holo.plot()
ss = roi.interactive(holo)

Thanks!
Olivier

3 replies
Zanetta Pierre-marie
@ZanettaPM

Hi folks !
Did anyone already mentioned that if you pass the limit of 10 X rays lines and if you try to extract their intensities to save them into the metadata to be able to save the entire signal under an .hspy format, hyperspy sort them in a weird sequence ?

import numpy as np
import hyperspy.api as hs
s=hs.datasets.example_signals.EDS_TEM_Spectrum()
s.metadata
s.add_elements(['O','Ca','O','Ti','Al','Si','Mg','C','Cu','Ga','Fe','V','Cr'])
s.add_lines()
s.metadata.Sample.intensities=s.get_lines_intensity()
s.metadata

I try to use the sort function and other tricks but I have difficulty to make the list match my list of Xray lines and kfactors for the quantification. Any ideas? should I open an issue ? It might be more convenient if the list match the Xray line order. Thanks !

4 replies
Zanetta Pierre-marie
@ZanettaPM
lnaglecocco
@lnaglecocco

Hi, I've encountered a strange issue with EELS data analysis. I have a LowLoss data file and a HighLoss data file. I can save them as Hyperspy objects and plot them, and the data is clearly all there, although for the LowLoss the zero loss peak is not at 0 eV. However when I try to align it, using the below code, I find that both the LowLoss and HighLoss datasets are somehow cut down to only exist over a very narrow range, as if they are somehow getting cropped in signal space. This only happens with some datasets, and other datasets work as they should with no issue. Does anyone know the problem here? I am able to share example data files if it would be useful for debugging

LowLoss.align_zero_loss_peak(calibrate=True,also_align=[HighLoss],subpixel=True)

6 replies
Mingquan Xu
@Mingquan_Xu_twitter
Hi, all, I have a question about the PCA algorithm. In my understanding, the PCA (or SVD) has an averaging effect when applied in our data containing tiny features. When I try to use PCA to de-noise my atomic-resolution EELS, the averaging effect is obvious. In my EELS map of ~30 atoms, only one atom has its unique feature, while after PCA, the unique feature disappears and its spectrum became similar to the sum spectrum from other atoms. Is there any other de-noise algorithm to avoid this effect?
Thomas Aarholt
@thomasaarholt
Well, with PCA, how many components are you using? Are you inspecting the loadings/factors before removing them?
7 replies
PCA only works well if you have multiple measurements of a given feature. If your unique atom is resolved only by a single pixel, PCA can't help, because it uses similar information that is present in the other pixels to help reduce the noise.
I can recommend performing curve fitting to capture the feature in question. Can you give us a screenshot of the spectrum?
Mingquan Xu
@Mingquan_Xu_twitter
one atom has 4x4 pxiels.
Mingquan Xu
@Mingquan_Xu_twitter
I use "specifying vline=True" to estimate the number of significant components in PCA scree plot, and it usually tells me 6~10 compoments for reconstruction.
Tan-Shengdong
@Tan-Shengdong
Hi, all. I have a question about EDS quantification using Hyperspy. Now I would like to get the intensity of Pt La peak (9.44KeV), but there are also Au signal (9.7KeV) in my result, although it is weak. I would like to know how to get the exact intensity of Pt peak? (My data is not eds mapping form, and it is a msa. file)
3 replies
Mingquan Xu
@Mingquan_Xu_twitter
8 replies
Hi, when I tried to do model_fit, it usually does not easily converge and I need to run the cell for several time.
Is there any way to make the convergence in a single running for the model-fitting.
Thomas Aarholt
@thomasaarholt
You can pass maxiter=10000 as a kwarg to m.fit(), I think. But in general it implies that your model is bad for the data. Do you have a screenshot of m.plot()? (maybe also m.plot(True)?
Weixin Song
@winston-song
Hi All, when I run ll_ex.isig[3.:].spikes_removal_tool(), there is an error' AttributeError: 'super' object has no attribute 'next'. anyone saw this error before? whether this is due to package update?
thanks
Tan-Shengdong
@Tan-Shengdong
Hi all, I found that after I used curve fitting function and get the peak intensity, some intensity are minus. What causes this? In this case, could we still trust the intensity of which near the 'minus peak'?
10 replies
pquinn-dls
@pquinn-dls
@Tan-Shengdong - when you remove a background from a signal (and there is very little signal) the variation or noise in the data may result in negative data points depending on the removal. If you look across a sample and you find negative and positive points then you can statistically check the results - e.g. if the mean is zero then you're not really measuring anything, just noise and you can use some statistics analysis to determine what is actual signal. If you try to enforce that the counts are always positive after a background is removed then when you integrate the data for a given element you'll always have some +ive number or a +ive bias. So negative values aren't bad - you just need to think about the errors/statistics when look at low concentrations
Mingquan Xu
@Mingquan_Xu_twitter
Hi, @thomasaarholt , this is the 'm.plot()' result.
Tan-Shengdong
@Tan-Shengdong

Hi Mingquan, when I use the m.plot, it will only show the whole curve with out the specific peak

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
import dask.array as da
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