Loading 4D-STEM Data

  1. Supported formats
  2. A scan on the timeline
  3. A series of scans
  4. Raw binary import
  5. Calibration

Load a 4D-STEM acquisition the same way as any other file: with the + button next to Source Data in the Data tab, or by dragging the files onto the Nexus window (see Loading Files). You can pick any file that belongs to the acquisition; Nexus finds the rest next to it.

Only the acquisition’s header is read when it loads. Patterns are read from the file on disk when they are needed, so keep the files where they are while you work.

Supported formats

Detector / source Pick Notes
Quantum Detectors Merlin (Medipix3) the .hdr or any .mib An acquisition is one .hdr plus numbered .mib files (default1.mib, default2.mib, …). 1-, 6-, 12- and 24-bit counters, single chip and 2×2 quad. Raw mode (R64) acquisitions are refused with a message.
Thermo Fisher EMPAD the .raw or its .xml The scan shape and calibration come from the .xml sidecar. Without a scan size there, Nexus uses a scan_xNNN_yNNN file name, then a square scan if the number of patterns is a square number, and otherwise a single line of patterns.
Gatan K2 IS the .gtg or any of the eight .bin sector files The .gtg gives the scan and detector size; the eight sector files are assembled into 1860 × 2048 patterns.
Dectris ARINA the _master.h5, a _data_00000N.h5, or the STEM metadata .h5 HDF5 (.h5, .hdf5) with bitshuffle/LZ4 compression; no plugin is needed. Pixel size and scan width are read from the STEM metadata file when it is there.
Gatan DigitalMicrograph 4D cube the .dm3 / .dm4 A DM file whose image has four dimensions, or three with the 4D STEM Tags scan shape. A plain 3D stack without those tags opens as an image series instead. Calibrations are taken from the file (nm for the scan, 1/nm for the pattern).
Raw binary the .raw Any .raw that is not an EMPAD acquisition. Nexus asks for its layout, see Raw binary import below.

See also Supported File Formats.

A scan on the timeline

A scan whose file records when it was acquired loads as a 4Dt signal and sits on the timeline as one span covering the acquisition. The timeline cursor and the scan position follow each other: scrubbing through the span walks through the scan in acquisition order, and picking a position in the panel moves the cursor to the moment that pattern was recorded. A scan with no acquisition time loads as 4D and has no timeline row.

A series of scans

An in-situ experiment often records one scan after another. When you pick files from more than one Merlin acquisition, Nexus opens the Import Merlin 4D-STEM Files dialog:

  • Separate Datasets loads each acquisition as its own 4Dt scan.
  • Combined Image Series loads them as one 4Dts series, named after the folder they are in. The scans are ordered by their start time when every scan has one, and otherwise in the order you picked them. All scans must have the same scan size, pattern size and data type.

In the panel, a series adds a Scan field to the Scan section of the Selection tab, and Page Up / Page Down step through the scans. The timeline cursor follows the scan shown.

Raw binary import

A .raw file that is not an EMPAD acquisition holds one diffraction pattern after another, every pixel the same number type, and nothing in the file says how. When you load one, Nexus opens the Import raw 4D-STEM data dialog and asks for the layout:

Field Meaning
Scalar The number type of every pixel: Unsigned 8-bit, Signed 8-bit, Unsigned 16-bit, Signed 16-bit, Unsigned 32-bit, Signed 32-bit, Unsigned 64-bit, Signed 64-bit, Float 32-bit or Float 64-bit
Byte order Little-endian or Big-endian
Flip None, or Diagonal (swap x, y) for patterns stored transposed
Rotate None, 90° clockwise, 180° or 270° clockwise
Pattern width / Pattern height The size of one diffraction pattern, in pixels
Scan columns / Scan rows The size of the scan
Offset Bytes to skip before the first pattern (a file header)
Gap Bytes between one pattern and the next
Fit How many patterns the layout needs out of how many whole patterns the file holds

Fit shows straight away whether a guess is wrong: Import stays disabled until the layout fits the file. The layout is saved with the signal, so a project reopens the file the same way.

Calibration

Merlin, K2 and raw acquisitions carry no calibration of their own. Give the scan and the pattern a pixel size in the panel’s Selection tab (Pixel size under Scan and under Diffraction); see Calibration. The scale bars, the status-bar readout, exports and computed images all use it.