Skip to content

Shape of 4DSTEM .mib data triggered with lineskip=1 #270

@emichr

Description

@emichr

Describe the bug

When loading 4DSTEM .mib data (hdr file:
SPEDSTEM_256x256_8cm_100pct.txt) with lineskip=1, hyperspy.api.load() throws an IO error:
error_msg.txt. The error disappears when navigation_shape=(256,256) is given, but the resulting signal is distorted:
Figure 3
To load the data correctly with the current version of rsciio, an extra frame must be given in the x-axis of the navigation shape: navigation_shape=(257, 256) and this gives
Figure 5
As a workaround this is fine, but maybe some improvements can be made to the reader.

The data is available at: https://drive.google.com/drive/folders/1jFQIKGnT1Ru0faFC_rLzbhrjrVIqx_8q?usp=drive_link.

To Reproduce

Steps to reproduce the behavior:

signal = hs.load("SPEDSTEM_256x256_8cm_100pct.mib", lazy=True) #Throws IO error
signal = hs.load("SPEDSTEM_256x256_8cm_100pct.mib", lazy=True, navigation_shape=(256,256)) #Works but resulting signal is distorted.
signal = hs.load("SPEDSTEM_256x256_8cm_100pct.mib", lazy=True, navigation_shape=(257,256)) #Works and resulting signal is correct.

Expected behavior

The raw .mib data has a total of 65792 frames (as seen in the .hdr file), where $256\times256=65536$ frames contain the actual data (can be seen from the .hdr ScanX and ScanY parameters). Then hs.load("SPEDSTEM_256x256_8cm_100pct.mib", lazy=True, navigation_shape=(256,256)) should skip every 256th frame (counting from 0) as this is the most usual way of interpreting the navigation shape. It should be possible to get the required information from the .hdr file and thus avoid the need for specifying the navigation shape when reading the data.

Python environement:

  • RosettaSciIO version: 0.4
  • Python version: 3.11.9
  • HyperSpy version: 2.1.0
  • Pyxem version: 0.19.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions