-
Notifications
You must be signed in to change notification settings - Fork 207
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
Addition of mib importer #2043
Addition of mib importer #2043
Conversation
Importer for .mib files from Merlin/Medipix direct electron detectors. This is a hack of the raw/rpl importer.
Nice! This is the same code which pyXem uses? In the example you use the header file to load the data, does the reader itself require the header file? I think all the data you really need is in the binary files. |
@magnunor it is similar to the pyXem code, with some updates to deal will all bit depths. You are correct that all the relevant information is in the inter-frame headers in the binary files, but prior to attempting to open the binary file you don't know the bit depth. As the hdr file is always there and states the bit-depth of the mib file I felt this was simpler. I'm happy to try to get it working without using the hdr files if this is preferable. |
I do it without the header file in my simple reader in See https://gitlab.com/pixstem/pixstem/blob/master/pixstem/io_tools.py#L76 for how to grab just the header part in the binary file. It might also be nice to be able to specify what the probe dimensions should be, and removal of things like flyback pixels. This can be done as optional parameters. Possible implementation of that: https://gitlab.com/pixstem/pixstem/blob/master/pixstem/io_tools.py#L85 No worries if you don't have time to do all these things in this pull request. The basic functionality can be added first, and subsequent pull requests can expand upon the functionality later. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not review, just want to point a few caveats
import numpy as np | ||
|
||
from hyperspy.misc.io.utils_readfile import * | ||
from hyperspy import Release |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these two lines.
Please review the dependency, it should not depend from hyperspy (exception is hyperspy.misc.io.utils_readfile
as it will go together with io_plugins to splited library).
It would be great idea not to use DictionaryTreeBrowser
in io library for metadata tree building. It is better to expose all metadata as original_metadata
and use mapping dictionary to build proper hyperspy tree.
units = ['', '', ''] | ||
sizes = [hdr_info[names[i]] for i in range(3)] | ||
|
||
if 'date' not in hdr_info: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all these if
s could be simplified with using mapping
I think this is now out of scope until after the split of hyperspy - can we close it and re-visit after a split? |
Agreed, closing. |
Importer for .mib files from Merlin/Medipix direct electron detectors. This is a hack of the raw/rpl importer. mib files are always saved in mib/hdr pairs. When loading into hyperspy it is the hdr file which must be loaded.
Added mib to io_plugins init.py
Added mib.py
Read meta-data from .hdr file
Import various bit depth data (1,6, 12,24)
split inter-frame headers from data
lazy loading of data
get frame time from inter-frame headers
update docstring
update user guide
add tests
ready for review.
Minimal example of the bug fix or the new feature