py4dstem / py4dstem/py4DSTEM

Error importing .mib data

Open
#449 1 comment 0 reactions 1 assignee View on GitHub

@taramatsci is already working on this.

Since Jun 8, 2023.

Dominant language
Python
Stars
279
Forks
177
PR merge metrics
No merged PRs in 30d

Description

With Python 3.19.6 and py4DSTEM 0.13.17

Hi, I was using py4DSTEM.io.import_file to load .mib files. When importing data acquired from a single chip (256X256 in the diffraction plane), that works very well.
Then I want to import a .mib file acquired from combined 4 chips (514X514 in the diffraction plane), and it comes to an error like this:

KeyError Traceback (most recent call last)
Cell In[5], line 3
-> 3 dataset_vac = py4DSTEM.io.import_file(filepath = vac_file_path, scan = (300,301))
File ~\anaconda3\envs\yining4dstem\lib\site-packages\py4DSTEM\io\import_file.py:75, in import_file(filepath, mem, binfactor, filetype, **kwargs)
72 # elif filetype == "kitware_counted":
73 # data = read_kitware_counted(filepath, mem, binfactor, metadata=metadata, **kwargs)
74 elif filetype == "mib":
-> 75 data = load_mib(filepath, mem=mem, binfactor=binfactor,**kwargs)
76 else:
77 raise Exception("Bad filetype!")

File ~\anaconda3\envs\yining4dstem\lib\site-packages\py4DSTEM\io\nonnative\read_mib.py:28, in load_mib(file_path, mem, binfactor, reshape, flip, scan, **kwargs)
26 # Get scan info from kwargs
27 header = parse_hdr(file_path)
-> 28 width = header["width"]
29 height = header["height"]
30 width_height = width * height

KeyError: 'width'

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.