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
Key error loading Bruker .bcf file #2881
Comments
Hi @TMoon96, I'm not very familiar with the .bcf IO plugin, but it seems to me like it is too strict, as this try/except block should also except your hyperspy/hyperspy/io_plugins/bruker.py Lines 732 to 749 in db5743b
If you change the line to |
Thanks, that worked as you described. I'm wondering if I just didn't save the file with elements identified, but since the code should work in either case the change should probably still get made. |
Great!
I agree, you should be able to read either way. Do you want to make a PR? |
It would be good to make a PR to fix it, if bruker software can open the file, it would be fair to expect hyperspy to be able to open it, even if some metadata are missing, even if we don't know why this specific file doesn't have this metadata. There is a tradeoff between letting the code fails to get user to report issue and convenience. In this case, maybe, a warning could be raised when loading the file? |
Raise the log entry to a warning, or in addition? |
Catch the error to allow loading the file and raise a warning (using the logger?) to inform the user that some information may be missing. |
Currently, the try/except clause catches an attribute error, presumably raised by hyperspy/hyperspy/io_plugins/bruker.py Lines 748 to 749 in db5743b
I think the log message describes the present error nicely, and suggest to just catch the present |
@TMoon96, could You send the erroring bcf file? I guess that You had selected some elements. In some versions/implementations/adaptations of Esprit, some of XML nodes are not populated. Or at least tell us what elements had You selected. In some cases it could be that element has not much lines to chose from, and Esprit could try omit that information. the PR #2900 tries to skip past the error instead of handling it correctly, as a consequence You will get no list of elements selected in Hyperspy metadata. Proper fix, should still keep the parsed element (abbreviation), catch the missing |
I'm trying to load a EDS map .bcf file using the most basic method (define path name and using hs.load(path), and get the error "Key error: 'Line'." Setting load_original_metadata to false does not resolve this. This file was recorded the same day as two others, one of which gives the same error but the third loads just fine. The files also open just fine in Bruker's ESPIRIT software.
The text was updated successfully, but these errors were encountered: