Tutorial 1: mlgidBASE Initialization

1. From file

Before using the analysis functions of the mlgid pipeline, data preprocessing (conversion) must be performed using pygid. The resulting NeXus file is then used to initialize an instance of the mlgidBASE class:

from mlgidbase import mlgidBASE
filename = '../../example/BA2PbI4.h5'
analysis = mlgidBASE(filename=filename)
INFO - Failed to extract font properties from /usr/share/fonts/truetype/noto/NotoColorEmoji.ttf: Can not load face (unknown file format; error code 0x2)
INFO - generated new fontManager
2026-05-26 13:54:48.292843061 [W:onnxruntime:Default, device_discovery.cc:283 GetGpuDevices] Failed to detect devices under "/sys/class/drm/card0": device_discovery.cc:93 ReadFileContents Failed to open file: "/sys/class/drm/card0/device/vendor"

The NeXus file structure can be inspected.

analysis.nexus.print_file_structure()
File structure: ../../example/BA2PbI4.h5
{'entry_0000': {'axes': ['q_z', 'q_xy'],
                'description': 'cylindrical coordinate conversion for GID '
                               'geometry',
                'img_type': 'img_gid_q',
                'shape': (1, 1750, 1750)}}

In this example, the file contains a single entry (entry_0000) with one image represented in cylindrical coordinates $(q_{xy}, q_{z})$.

2. From pygid.Conversion

The details for analysis “from memory” is described in Tutorial 5