Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 05:46
    codecov[bot] commented #3070
  • 05:43
    codecov[bot] commented #3070
  • 05:36
    codecov[bot] commented #3070
  • 05:34
    codecov[bot] commented #3070
  • 05:32
    codecov[bot] commented #3070
  • 05:28
    codecov[bot] commented #3070
  • 05:19
    nem1234 synchronize #3070
  • 05:18
    nem1234 synchronize #3070
  • 05:15
    nem1234 opened #3070
  • Nov 30 10:44
    ZanettaPM commented #3044
  • Nov 30 10:43
    jlaehne commented #3044
  • Nov 30 10:25
    ZanettaPM commented #3044
  • Nov 29 21:14
    jlaehne closed #2836
  • Nov 29 21:14
    jlaehne commented #2836
  • Nov 29 21:13
    jlaehne unlabeled #3062
  • Nov 29 21:12
    jlaehne unlabeled #3037
  • Nov 29 21:12
    jlaehne closed #3037
  • Nov 29 21:12

    jlaehne on RELEASE_next_major

    Remove setting `original_metada… Privatise `twin_function` (depr… Privatise `twin_inverse_functio… and 6 more (compare)

  • Nov 29 19:48
    codecov[bot] commented #3037
  • Nov 29 19:44
    codecov[bot] commented #3037
Ben Gaunt
@BenGauntRFI
But I ended up getting the following error:

KeyError Traceback (most recent call last)
Input In [9], in <cell line: 1>()
----> 1 s = hs.load("20220301_test1.asw")

File /ceph/users/gbz45948/miniconda3/envs/hyperspy_env/lib/python3.10/site-packages/hyperspy/io.py:454, in load(filenames, signal_type, stack, stack_axis, new_axis_name, lazy, convert_units, escape_square_brackets, stack_metadata, load_original_metadata, show_progressbar, kwds)
451 objects.append(signal)
452 else:
453 # No stack, so simply we load all signals in all files separately
--> 454 objects = [load_single_file(filename, lazy=lazy,
kwds)
455 for filename in filenames]
457 if len(objects) == 1:
458 objects = objects[0]

File /ceph/users/gbz45948/miniconda3/envs/hyperspy_env/lib/python3.10/site-packages/hyperspy/io.py:454, in <listcomp>(.0)
451 objects.append(signal)
452 else:
453 # No stack, so simply we load all signals in all files separately
--> 454 objects = [load_single_file(filename, lazy=lazy, **kwds)
455 for filename in filenames]
457 if len(objects) == 1:
458 objects = objects[0]

File /ceph/users/gbz45948/miniconda3/envs/hyperspy_env/lib/python3.10/site-packages/hyperspy/io.py:513, in load_single_file(filename, kwds)
506 raise ValueError(
507 "reader should be one of None, str, "
508 "or a custom file reader object"
509 )
511 try:
512 # Try and load the file
--> 513 return load_with_reader(filename=filename, reader=reader,
kwds)
515 except BaseException:
516 _logger.error(
517 "If this file format is supported, please "
518 "report this error to the HyperSpy developers."
519 )

File /ceph/users/gbz45948/miniconda3/envs/hyperspy_env/lib/python3.10/site-packages/hyperspy/io.py:533, in load_with_reader(filename, reader, signal_type, convert_units, load_original_metadata, kwds)
531 """Load a supported file with a given reader."""
532 lazy = kwds.get('lazy', False)
--> 533 file_data_list = reader.file_reader(filename,
kwds)
534 signal_list = []
536 for signal_dict in file_data_list:

File /ceph/users/gbz45948/miniconda3/envs/hyperspy_env/lib/python3.10/site-packages/hyperspy/io_plugins/jeol.py:100, in file_reader(filename, kwds)
98 if sub_ext in extension_to_reader_mapping.keys():
99 reader_function = extension_to_reader_mapping[sub_ext]
--> 100 d = reader_function(file_path, scale,
kwds)
101 if isinstance(d, list):
102 dictionary.extend(d)

File /ceph/users/gbz45948/miniconda3/envs/hyperspy_env/lib/python3.10/site-packages/hyperspy/io_plugins/jeol.py:159, in _read_img(filename, scale, **kwargs)
139 axes = [
140 {
141 "name": "y",
(...)
153 },
154 ]
156 datefile = datetime(1899, 12, 30) + timedelta(
157 days=header_long["Image"]["Created"]
158 )
--> 159 hv = header_long["Instrument"]["AccV"]
160 if hv <= 30.0:
161 mode = "SEM"

KeyError: 'AccV'

Seems like JEOL's software hasn't saved the acceleration voltage? I could add that in later, once the signal object was loaded in, but it doesn't get that far...
6 replies
Eric R. Hoglund
@erh3cq
Noticed something odd…I am fitting gaussians to background subtracted Ti-L23. Edges are already fit and fixed. It was taking 10-20 hours for 75K pixels. I just updated to 1.7 and now it says it will take 191 hours on the same data set. Any thoughts?
7 replies
taimasuki
@taimasuki
Hi everyone, I'm new to hyperspy and need some generous help. I am trying to load image by load function under version 1.7.0 in Jupyter notebook, however it failed with following message:
ImportError: cannot import name 'version' from 'hyperspy' (unknown location)
5 replies
Rosenkranz1
@Rosenkranz1
Hi everone. I cannot seem to find the algorithm used for the rebin command for EDS signals, in the HYPERSPY documentation. I am mostly curios about what kind of algorithm HYPERSPY uses to do the binning with. Can anyone point me in the right direction, or give me the name of the algorithm? Thank you
2 replies
Yisong Han
@yisonghan

Hi Everyone,

I am wondering how I may modify/edit the code for my own needs (and hopefully later I may pull/contribute). I have googled and it seems there is a lack of a comphrehensive guide.

I know from the HyperSpy website, I need to:

  1. Fork HyperSpy and have a local copy in a folder.
  2. I need to build it into Anacona in a new environment ideally (using the commands listed on the HyperSpy website).
  3. Then do I edit the code in the Anacona package folder and this will take effect automatically?
  4. Or do I edit the code in the local forked folder and reinstall or update to the Anacona? If yes, how?
  5. Or do I install the package using for example "$python setup.py develop" and edit the anancona folder directly which will be reflected in the original forked folder?
  6. Do I need to update setup.py if I make any changes?

Could you suggest a website or a video which could answer my questions if it is hard to explain by texts? Thanks very much.

4 replies
Natalie Nord
@Nordicus
Hi All,
The docs aren't entirely clear on this. When using estimate_shift2D, is the output in pixels, or calibrated distance units? I presume it would be pixels right, in case you're aligning images that don't have calibrated distances. It's hard to tell at a glance in my data, because the pixel size is very close to one.
Thank you
2 replies
vivekdevulapalli07
@vivekdevulapalli07

Sorry if this is a too naive question to ask here.

  1. I am trying to plot my EDS spectrum using hyperspy. When I add new elements using add_xray_lines_markers['Cu_Ka'] I cannot find a way to increase the size of the element labels when I plot it.

  2. Also as a personal request, it would be really helpful for the community if the more experienced colleagues can add their Jupyter notebooks to update the 'examples' folder in git with some published data.
    Thank you

7 replies
Joshua F Einsle
@jeinsle
Dear Hyperspy community - I am writing some lectures on PCA and ICA at the moment, while I love hyperspy it is not really the right tool for the course I am teaching.
I am wanting to demonstrate PCA to ICA ala the SVD and BSS demo in the documentation. I have been having a peak at the BSS soucre code here, but I am a little unclear what hyperspy is doing under the hood as it takes the factors from the PCA and then performs FastICA on them.
From what I can see FAst ICA acts on the factors from the previous decomposition, but I do not understand how we get to the new set of loadings and components. Could someone please clarify? cheers
Thomas Aarholt
@thomasaarholt
image.png
@vivekdevulapalli07 this image is the result of the code I posted in your thread. Couldn't figure out how to upload a picture into the thread reply
michaelwuww
@michaelwuww
HeY people, please have a wonderful day!
Thomas Aarholt
@thomasaarholt

Could someone on Mac try opening a new jupyter notebook instance, and typing import hyperspy.components1d.A<TAB>? Where <TAB> is pressing the tab button. It should autocomplete to Arctan, but for some reason it isn't doing so on my Mac.

Please specify if you're on one of the new M1 mac's if you try this. I'm on an M1 mac, and it doesn't work here. See #2968 for details.

Vishu9321
@Vishu9321
Hello Everyone! I am Hyperspy to analyse CL dataset generated by Attolight (.sur) format. I have 100 scans with x and y stage position data available in the metadata and wanted to stich the scans together. I just wanted to ask if there is a method already implemented in hyperspy as I could not locate one in the documentation.
4 replies
Eric Leroy
@ricounet67
is it possible to link an HAADF image to an EELS datacube in order to navigate from the image instead of the datacube ?
Eric R. Hoglund
@erh3cq
‘eels.plot(navigator=haadf)’
Eric Leroy
@ricounet67
@erh3cq thanks ! an other basic question: my haadf image has the first and last column missing. As a result the SI dimension is for exemple 487, 593 |1033 and the haadf image dimension is 485, 593.
I tried to extract a subarray with the si2=si[1:483,,] but I got the error 'EELSSpectrum is not scriptable' I thought that the EELSSpectrum was an array
Eric Leroy
@ricounet67
I found the answer : si2=si.inav[1:486] make the job
T. Nemoto
@nem1234
Hi,
Is there any example to read the image with separated metadata?
I'm trying to make reader for JEOL's FIB Image files. They are (imagename).BMP for image and (imagename).txt for metadata.
3 replies
Thomas Weatherley
@thomasfjord
Hi everyone! I'm wondering whether I can use the hyperspy multifit method to fit a custom numerical model to some hyperspectral microscopy data (as a Signal1D). I'm trying to think of how I could wrap this custom model as a method in a hyperspy Component subclass, however, the model depends on the spatial position of the spectrum. Is there a way to refer to the current navigation coordinates of the spectrum being fitted by multifit when defining the method inside the Component subclass? Sorry for my complex wording in the question, but I can't think of a simpler way to express the issue!
3 replies
Eric Leroy
@ricounet67
Sorry to ask again a newbie question. How can I get the values of the dimensions of an EELSdatacube ?
10 replies
Fanzhi Su
@FanzhiSu
Hi everyone! Has anyone tried .crop() function in hyperspy? I opened my .emi file and tried to crop an energy range out with .crop() function in hyperspy, but it outputs: 'list' object has no attribute 'crop'. I was wondeirng if anyone has met similar problem and knows how to fix it? Thanks a lot!
2 replies
Wu Michael
@belleh1234567890_gitlab
Try .isig(your energy range)
Wu Michael
@belleh1234567890_gitlab
Hi when using the HDF5 reader plugin for Digital Micrograph, the calibrations in the HDF5 file do not seem to be read by DM automatically. Any possible solution to this? Thank you!
6 replies
Eric Leroy
@ricounet67
I have an issue when importing RPL files. My raw data are larger than 1Go and when I try to import them, GMS freezes and finally crashes.
The version is GMS 2.32 64 bits and the PC is running Windows 10.
Do you have any ideas to export data from hyperspy to GMS ? I also submitted an issue in hyperspy/ImportRPL
2 replies
allisonmis
@allisonmis
Hi all,
I'm using HyperSpyUI to do background subtraction on EELS line scans (.dm3 format) before feeding it into an existing (non-python) analysis routine. Is there a way to export bg-subtracted data to a txt or csv file that keeps the energy axis values? The "Save Data as Text" option only exports the intensity.
Thank you!
Andrea Lorenzon
@andrealorenzon
Hello everyone! first of all, thank you for hyperspy, it really speeds up my job!
I've got an issue, so I opened an issue on github repo (hyperspy/hyperspy#2976 )
I'll write here too: does anyone know why my fitted model parameters ends out of provided boundaries?
Andrea Lorenzon
@andrealorenzon
note: those are my first steps in model fitting, so be patient :))
Jonas Lähnemann
@jlaehne
Just as information: In the development branch, the IO-plugins will soon be split into the new repository RosettaSciIO. Any new file readers or improvements to existing ones will then have to be contributed to that repo. For the moment, anyone familiar with the code is welcome to review the PR preparing this split: hyperspy/hyperspy#2972
2 replies
michaelwuww
@michaelwuww
Is there a way to fix the energy ranges of the plots in a 2D EELS mapping? When I navigate through the map the EELS spectrums all have different intensity ranges.
michaelwuww
@michaelwuww
image.png
Thomas Aarholt
@thomasaarholt
The docs seem to be focused on Signal2Ds, rather than Signal1Ds like EELS though.
You can choose what the y-limits should be with the matplotlib api:
import matplotlib.pyplot as plt
s.plot(autoscale="")
plt.ylim(low, high)
Wu Michael
@belleh1234567890_gitlab
Thanks, Thomas you are a hero!
Wu Michael
@belleh1234567890_gitlab
Is it possible to have two sets of signal ranges while doing background removal from signal 1D?
Thomas Aarholt
@thomasaarholt
I think that if you use the full model api (m = s.create_model() probably just with the default included background), rather than the shortcut s.remove_background, you can use m.remove_signal_range(low, high) where low and high are in calibrated units. Use it in a for loop if you have several regions you want to exclude, or remove everything by passing really low and high values and then add in the regions you want with s.add_signal_range(low, high). See here in the docs for more methods like a reset method.
Use the model api to fit to the background, export it as s_background = m.as_signal() and then subtract it s_signal = s - s_background.
Wu Michael
@belleh1234567890_gitlab
I tried that but then the in region I removed(which contains signal) after s_signal = s - s_background would not show up. May be I could add zeros to those regions? But I can't figure out how to do that.
Thomas Aarholt
@thomasaarholt
Do you mean that the subtracted region now is negative?
You can set anything that is negative to 0 by doing:
s.data[s.data < 0] = 0
Thomas Aarholt
@thomasaarholt
I didn't fully understand your sentence :) By "in region" do you mean "indium region"?
Wu Michael
@belleh1234567890_gitlab
here is how the subtracted spectrum look
image.png
the missing part contains the signals, which I had to remove so the fitting is not affected by them.
Wu Michael
@belleh1234567890_gitlab
image.png
Thomas Aarholt
@thomasaarholt
Can you send me a single spectrum? zip the file and put it here?
Wu Michael
@belleh1234567890_gitlab