{ "cells": [ { "metadata": { "collapsed": true }, "cell_type": "markdown", "source": [ "# Tutorial 1: mlgidBASE Initialization\n", "\n", "## 1. From file\n", "\n", "Before using the analysis functions of the `mlgid` pipeline, data preprocessing (conversion) must be performed using [`pygid`](https://pygid.readthedocs.io/en/latest/index.html). The resulting NeXus file is then used to initialize an instance of the `mlgidBASE` class:\n" ], "id": "748ca512f84ff395" }, { "metadata": { "ExecuteTime": { "end_time": "2026-03-26T15:25:15.499449939Z", "start_time": "2026-03-26T15:25:15.492695461Z" } }, "cell_type": "code", "source": [ "from mlgidbase import mlgidBASE\n", "filename = '../../example/BA2PbI4.h5'\n", "analysis = mlgidBASE(filename=filename)" ], "id": "282d65d835457da8", "outputs": [], "execution_count": 2 }, { "metadata": {}, "cell_type": "markdown", "source": "The [NeXus file structure](https://pygid.readthedocs.io/en/latest/tutorials/output_file_format.html) can be inspected.", "id": "e8db1df36f157b5c" }, { "metadata": { "ExecuteTime": { "end_time": "2026-03-26T15:32:29.745999713Z", "start_time": "2026-03-26T15:32:29.729987985Z" } }, "cell_type": "code", "source": "analysis.nexus.print_file_structure()", "id": "8c496edd6c33329", "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "File structure: ../../example/BA2PbI4.h5\n", "{'entry_0000': {'axes': ['q_z', 'q_xy'],\n", " 'description': 'cylindrical coordinate conversion for GID '\n", " 'geometry',\n", " 'img_type': 'img_gid_q',\n", " 'shape': (1, 1750, 1750)}}\n" ] } ], "execution_count": 7 }, { "metadata": {}, "cell_type": "markdown", "source": "In this example, the file contains a single entry (`entry_0000`) with one image represented in cylindrical coordinates $(q_{xy}, q_{z})$.", "id": "9e8cd91c25c31c32" }, { "metadata": {}, "cell_type": "markdown", "source": [ "\n", "\n", "## 2. From pygid.Conversion\n", "The details for analysis \"from memory\" is described in [Tutorial 5](tutorial_05_from_memory.ipynb)" ], "id": "32e9a54743ddfbe1" } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.6" } }, "nbformat": 4, "nbformat_minor": 5 }