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

Issue with loading Bruker .bcf and .spx files #323

Open
ihatechickpeas opened this issue Oct 17, 2024 · 4 comments · May be fixed by #326
Open

Issue with loading Bruker .bcf and .spx files #323

ihatechickpeas opened this issue Oct 17, 2024 · 4 comments · May be fixed by #326
Labels
type: bug Something isn't working

Comments

@ihatechickpeas
Copy link

I was trying to use Hyperspy for data analysis as I prefer to do all that stuff in Python. Unfortunately, I'm getting the below error when trying to just load the file. I tried many different things, using different formats (.bcf and .spx) using the full file path of the file, trying the 'lazy' loading, but I seem to be stuck.

There's not much code to share, since it's literally one of the first steps, but this is what I did:

import hyperspy.api as hs
spectrum = hs.load('JCBbattery30x.bcf')

What I'm getting is hyperspy.io:599 and then KeyError: 'PrimaryEnergy'. I'm just wondering what could be the source of this, did I save the file incorrectly or is it the module issue? It works just fine in Bruker's Quantax70...

Python environement:

  • Python version: 3.12.4
  • HyperSpy version: 2.1.1
@ihatechickpeas ihatechickpeas added the type: bug Something isn't working label Oct 17, 2024
@CSSFrancis
Copy link
Member

@ihatechickpeas Out of curioisity what type of data are you trying to load?

Here is some more infromation:

https://hyperspy.org/rosettasciio/user_guide/supported_formats/bruker.html#bruker-format

It's likely that the change required isn't terribly large to support your data. Do you have a smallish data set that we could potentially use for testing? Often times the biggest hurdle to reading is having the right dataset to compare against.

@ihatechickpeas
Copy link
Author

@CSSFrancis it's a battery cross section scan that contains the sample scan with EDX data of it. I've attached the data file here:

JCBbattery30x.zip

I talked to a colleague of mine and he did say it's possible to override the Primary Energy error with RosettaSciIO module by adding the energy manually, but I haven't tried that yet. Still, if it's a common problem with Bruker format, or just data sets from this specific type of microscopes we're using, I think it'd be great if you managed to figure out what the issue is exactly and if it's possible to easily fix it :)

Thanks a lot for the help!

@ericpre ericpre linked a pull request Oct 22, 2024 that will close this issue
8 tasks
@ericpre
Copy link
Member

ericpre commented Oct 22, 2024

@ihatechickpeas, thank you for sharing the file. Would you able to provide a smaller file (smallest possible)? If so, please have a look at our documentation for explanation and recommendation.
#326 should fix the issue and it needs small test file.

@sem-geologist
Copy link
Contributor

sem-geologist commented Nov 25, 2024

@ihatechickpeas, AFAIK, Bruker Esprit allows to select 16x16 ROI as smallest area for Hyperspectra. That way the smallest file example can be made.

proposed workaround is short-term fix, as Hyperspy (AFAIK, please correct me) has no XRF signal. Hopefully more universal metadata structure will be setup by community, and XRF then can get full support. Additional obstacly you probably will get into is wrong live time support in Hyperspy (it expects a scalar instead of array (raster of livetimes corresponding to every pixel)). It is not a severe problem for material scientists, but absolute stopper for geoscientists, and often huge obstacle for XRF maps.
(see hyperspy/hyperspy#2534 and hyperspy/hyperspy#2898)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants