{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "e2563325", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:53:41.088671Z", "iopub.status.busy": "2026-01-06T13:53:41.088313Z", "iopub.status.idle": "2026-01-06T13:53:41.102986Z", "shell.execute_reply": "2026-01-06T13:53:41.102308Z" }, "tags": [ "hide-in-docs" ] }, "outputs": [], "source": [ "# Check if the easydiffraction library is installed.\n", "# If not, install it with the 'visualization' extras.\n", "# Needed when running remotely (e.g. Colab) where the lib is absent.\n", "import builtins\n", "import importlib.util\n", "\n", "if (hasattr(builtins, '__IPYTHON__') and\n", " importlib.util.find_spec('easydiffraction') is None):\n", " !pip install 'easydiffraction[visualization]==0.10.1'" ] }, { "cell_type": "markdown", "id": "0", "metadata": {}, "source": [ "# Structure Refinement: LBCO, HRPT\n", "\n", "This example demonstrates how to use the EasyDiffraction API in a\n", "simplified, user-friendly manner that closely follows the GUI workflow\n", "for a Rietveld refinement of La0.5Ba0.5CoO3 crystal structure using\n", "constant wavelength neutron powder diffraction data from HRPT at PSI.\n", "\n", "It is intended for users with minimal programming experience who want\n", "to learn how to perform standard crystal structure fitting using\n", "diffraction data. This script covers creating a project, adding sample\n", "models and experiments, performing analysis, and refining parameters.\n", "\n", "Only a single import of `easydiffraction` is required, and all\n", "operations are performed through high-level components of the\n", "`project` object, such as `project.sample_models`,\n", "`project.experiments`, and `project.analysis`. The `project` object is\n", "the main container for all information." ] }, { "cell_type": "markdown", "id": "1", "metadata": {}, "source": [ "## Import Library" ] }, { "cell_type": "code", "execution_count": 2, "id": "2", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:53:41.104895Z", "iopub.status.busy": "2026-01-06T13:53:41.104778Z", "iopub.status.idle": "2026-01-06T13:53:44.345479Z", "shell.execute_reply": "2026-01-06T13:53:44.342162Z" } }, "outputs": [], "source": [ "import easydiffraction as ed" ] }, { "cell_type": "markdown", "id": "3", "metadata": {}, "source": [ "## Step 1: Create a Project\n", "\n", "This section explains how to create a project and define its metadata." ] }, { "cell_type": "markdown", "id": "4", "metadata": {}, "source": [ "#### Create Project" ] }, { "cell_type": "code", "execution_count": 3, "id": "5", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:53:44.348147Z", "iopub.status.busy": "2026-01-06T13:53:44.347576Z", "iopub.status.idle": "2026-01-06T13:53:44.522338Z", "shell.execute_reply": "2026-01-06T13:53:44.519752Z" } }, "outputs": [], "source": [ "project = ed.Project(name='lbco_hrpt')" ] }, { "cell_type": "markdown", "id": "6", "metadata": {}, "source": [ "#### Set Project Metadata" ] }, { "cell_type": "code", "execution_count": 4, "id": "7", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:53:44.524180Z", "iopub.status.busy": "2026-01-06T13:53:44.524059Z", "iopub.status.idle": "2026-01-06T13:53:44.531622Z", "shell.execute_reply": "2026-01-06T13:53:44.529711Z" } }, "outputs": [], "source": [ "project.info.title = 'La0.5Ba0.5CoO3 at HRPT@PSI'\n", "project.info.description = \"\"\"This project demonstrates a standard\n", "refinement of La0.5Ba0.5CoO3, which crystallizes in a perovskite-type\n", "structure, using neutron powder diffraction data collected in constant\n", "wavelength mode at the HRPT diffractometer (PSI).\"\"\"" ] }, { "cell_type": "markdown", "id": "8", "metadata": {}, "source": [ "#### Show Project Metadata as CIF" ] }, { "cell_type": "code", "execution_count": 5, "id": "9", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:53:44.533295Z", "iopub.status.busy": "2026-01-06T13:53:44.533187Z", "iopub.status.idle": "2026-01-06T13:53:44.874774Z", "shell.execute_reply": "2026-01-06T13:53:44.872894Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;34mProject 📦 \u001b[0m\u001b[32m'lbco_hrpt'\u001b[0m\u001b[1;34m info as CIF\u001b[0m\n" ] }, { "data": { "application/javascript": [ "\n", " (function() {\n", " var isDark = false;\n", "\n", " // Check JupyterLab theme\n", " if (document.body.classList.contains('jp-mod-dark') || \n", " document.body.classList.contains('theme-dark') ||\n", " document.body.classList.contains('vscode-dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check theme attribute\n", " var themeAttr = document.body.getAttribute('data-jp-theme-name');\n", " if (themeAttr && themeAttr.includes('dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check computed background color\n", " var notebookEl = document.querySelector('.jp-Notebook') || \n", " document.querySelector('.notebook_app') ||\n", " document.body;\n", " if (notebookEl) {\n", " var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n", " var rgb = bgColor.match(/\\d+/g);\n", " if (rgb && rgb.length >= 3) {\n", " var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n", " if (brightness < 128) {\n", " isDark = true;\n", " }\n", " }\n", " }\n", "\n", " // Store result\n", " if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n", " IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n", " }\n", " })();\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " if (typeof IPython !== 'undefined' && IPython.notebook) {\n", " IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n", " (document.body.classList.contains('theme-dark') || \n", " document.body.classList.contains('jp-mod-dark') ||\n", " (document.body.getAttribute('data-jp-theme-name') && \n", " document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n", " }\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
 CIF
1_project.id lbco_hrpt
2_project.title 'La0.5Ba0.5CoO3 at HRPT@PSI'
3_project.description
4;
5This project demonstrates a standard refinement of La0.5Ba0.5CoO3, which crystallizes in a perovskite-type structure, using neutron powder diffraction data collected in constant wavelength mode at the HRPT diffractometer (PSI).
6;
7_project.created '06 Jan 2026 13:53:44'
8_project.last_modified '06 Jan 2026 13:53:44'
\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.info.show_as_cif()" ] }, { "cell_type": "markdown", "id": "10", "metadata": {}, "source": [ "#### Save Project\n", "\n", "When saving the project for the first time, you need to specify the\n", "directory path. In the example below, the project is saved to a\n", "temporary location defined by the system." ] }, { "cell_type": "code", "execution_count": 6, "id": "11", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:53:44.882704Z", "iopub.status.busy": "2026-01-06T13:53:44.881517Z", "iopub.status.idle": "2026-01-06T13:53:44.900144Z", "shell.execute_reply": "2026-01-06T13:53:44.899321Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;34mSaving project 📦 \u001b[0m\u001b[32m'lbco_hrpt'\u001b[0m\u001b[1;34m to\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\u001b[35m/private/var/folders/sm/xrr7tmqj20s7hrsh1qhfl1d40000gn/T/\u001b[0m\u001b[95mlbco_hrpt\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "├── 📄 project.cif\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "├── 📄 analysis.cif\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "└── 📄 summary.cif\n" ] } ], "source": [ "project.save_as(dir_path='lbco_hrpt', temporary=True)" ] }, { "cell_type": "markdown", "id": "12", "metadata": {}, "source": [ "#### Set Up Data Plotter" ] }, { "cell_type": "markdown", "id": "13", "metadata": {}, "source": [ "Show supported plotting engines." ] }, { "cell_type": "code", "execution_count": 7, "id": "14", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:53:44.906356Z", "iopub.status.busy": "2026-01-06T13:53:44.906032Z", "iopub.status.idle": "2026-01-06T13:53:45.164861Z", "shell.execute_reply": "2026-01-06T13:53:45.164297Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;34mSupported engines\u001b[0m\n" ] }, { "data": { "application/javascript": [ "\n", " (function() {\n", " var isDark = false;\n", "\n", " // Check JupyterLab theme\n", " if (document.body.classList.contains('jp-mod-dark') || \n", " document.body.classList.contains('theme-dark') ||\n", " document.body.classList.contains('vscode-dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check theme attribute\n", " var themeAttr = document.body.getAttribute('data-jp-theme-name');\n", " if (themeAttr && themeAttr.includes('dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check computed background color\n", " var notebookEl = document.querySelector('.jp-Notebook') || \n", " document.querySelector('.notebook_app') ||\n", " document.body;\n", " if (notebookEl) {\n", " var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n", " var rgb = bgColor.match(/\\d+/g);\n", " if (rgb && rgb.length >= 3) {\n", " var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n", " if (brightness < 128) {\n", " isDark = true;\n", " }\n", " }\n", " }\n", "\n", " // Store result\n", " if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n", " IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n", " }\n", " })();\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " if (typeof IPython !== 'undefined' && IPython.notebook) {\n", " IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n", " (document.body.classList.contains('theme-dark') || \n", " document.body.classList.contains('jp-mod-dark') ||\n", " (document.body.getAttribute('data-jp-theme-name') && \n", " document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n", " }\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
 EngineDescription
1asciichartpyConsole ASCII line charts
2plotlyInteractive browser-based graphing library
\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.plotter.show_supported_engines()" ] }, { "cell_type": "markdown", "id": "15", "metadata": {}, "source": [ "Show current plotting configuration." ] }, { "cell_type": "code", "execution_count": 8, "id": "16", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:53:45.167155Z", "iopub.status.busy": "2026-01-06T13:53:45.166982Z", "iopub.status.idle": "2026-01-06T13:53:45.417067Z", "shell.execute_reply": "2026-01-06T13:53:45.415543Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;34mCurrent plotter configuration\u001b[0m\n" ] }, { "data": { "application/javascript": [ "\n", " (function() {\n", " var isDark = false;\n", "\n", " // Check JupyterLab theme\n", " if (document.body.classList.contains('jp-mod-dark') || \n", " document.body.classList.contains('theme-dark') ||\n", " document.body.classList.contains('vscode-dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check theme attribute\n", " var themeAttr = document.body.getAttribute('data-jp-theme-name');\n", " if (themeAttr && themeAttr.includes('dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check computed background color\n", " var notebookEl = document.querySelector('.jp-Notebook') || \n", " document.querySelector('.notebook_app') ||\n", " document.body;\n", " if (notebookEl) {\n", " var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n", " var rgb = bgColor.match(/\\d+/g);\n", " if (rgb && rgb.length >= 3) {\n", " var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n", " if (brightness < 128) {\n", " isDark = true;\n", " }\n", " }\n", " }\n", "\n", " // Store result\n", " if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n", " IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n", " }\n", " })();\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " if (typeof IPython !== 'undefined' && IPython.notebook) {\n", " IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n", " (document.body.classList.contains('theme-dark') || \n", " document.body.classList.contains('jp-mod-dark') ||\n", " (document.body.getAttribute('data-jp-theme-name') && \n", " document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n", " }\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
 ParameterValue
1Plotting engineplotly
2x-axis limits[-inf, inf]
3Chart height9
\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.plotter.show_config()" ] }, { "cell_type": "markdown", "id": "17", "metadata": {}, "source": [ "Set plotting engine." ] }, { "cell_type": "code", "execution_count": 9, "id": "18", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:53:45.420753Z", "iopub.status.busy": "2026-01-06T13:53:45.420584Z", "iopub.status.idle": "2026-01-06T13:53:45.425734Z", "shell.execute_reply": "2026-01-06T13:53:45.425285Z" } }, "outputs": [], "source": [ "# Keep the auto-selected engine. Alternatively, you can uncomment the\n", "# line below to explicitly set the engine to the required one.\n", "# project.plotter.engine = 'plotly'" ] }, { "cell_type": "markdown", "id": "19", "metadata": {}, "source": [ "## Step 2: Define Sample Model\n", "\n", "This section shows how to add sample models and modify their\n", "parameters." ] }, { "cell_type": "markdown", "id": "20", "metadata": {}, "source": [ "#### Add Sample Model" ] }, { "cell_type": "code", "execution_count": 10, "id": "21", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:53:45.427728Z", "iopub.status.busy": "2026-01-06T13:53:45.427560Z", "iopub.status.idle": "2026-01-06T13:53:45.435527Z", "shell.execute_reply": "2026-01-06T13:53:45.434739Z" } }, "outputs": [], "source": [ "project.sample_models.add(name='lbco')" ] }, { "cell_type": "markdown", "id": "22", "metadata": {}, "source": [ "#### Show Defined Sample Models\n", "\n", "Show the names of the models added. These names are used to access the\n", "model using the syntax: `project.sample_models['model_name']`. All\n", "model parameters can be accessed via the `project` object." ] }, { "cell_type": "code", "execution_count": 11, "id": "23", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:53:45.438312Z", "iopub.status.busy": "2026-01-06T13:53:45.438142Z", "iopub.status.idle": "2026-01-06T13:53:45.550049Z", "shell.execute_reply": "2026-01-06T13:53:45.545864Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;34mDefined sample models 🧩\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1m[\u001b[0m\u001b[32m'lbco'\u001b[0m\u001b[1m]\u001b[0m\n" ] } ], "source": [ "project.sample_models.show_names()" ] }, { "cell_type": "markdown", "id": "24", "metadata": {}, "source": [ "#### Set Space Group\n", "\n", "Modify the default space group parameters." ] }, { "cell_type": "code", "execution_count": 12, "id": "25", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:53:45.554589Z", "iopub.status.busy": "2026-01-06T13:53:45.554293Z", "iopub.status.idle": "2026-01-06T13:53:45.557986Z", "shell.execute_reply": "2026-01-06T13:53:45.557417Z" } }, "outputs": [], "source": [ "project.sample_models['lbco'].space_group.name_h_m = 'P m -3 m'\n", "project.sample_models['lbco'].space_group.it_coordinate_system_code = '1'" ] }, { "cell_type": "markdown", "id": "26", "metadata": {}, "source": [ "#### Set Unit Cell\n", "\n", "Modify the default unit cell parameters." ] }, { "cell_type": "code", "execution_count": 13, "id": "27", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:53:45.559840Z", "iopub.status.busy": "2026-01-06T13:53:45.559732Z", "iopub.status.idle": "2026-01-06T13:53:45.561900Z", "shell.execute_reply": "2026-01-06T13:53:45.561453Z" } }, "outputs": [], "source": [ "project.sample_models['lbco'].cell.length_a = 3.88" ] }, { "cell_type": "markdown", "id": "28", "metadata": {}, "source": [ "#### Set Atom Sites\n", "\n", "Add atom sites to the sample model." ] }, { "cell_type": "code", "execution_count": 14, "id": "29", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:53:45.563826Z", "iopub.status.busy": "2026-01-06T13:53:45.563713Z", "iopub.status.idle": "2026-01-06T13:53:45.568440Z", "shell.execute_reply": "2026-01-06T13:53:45.567961Z" } }, "outputs": [], "source": [ "project.sample_models['lbco'].atom_sites.add(\n", " label='La',\n", " type_symbol='La',\n", " fract_x=0,\n", " fract_y=0,\n", " fract_z=0,\n", " wyckoff_letter='a',\n", " b_iso=0.5,\n", " occupancy=0.5,\n", ")\n", "project.sample_models['lbco'].atom_sites.add(\n", " label='Ba',\n", " type_symbol='Ba',\n", " fract_x=0,\n", " fract_y=0,\n", " fract_z=0,\n", " wyckoff_letter='a',\n", " b_iso=0.5,\n", " occupancy=0.5,\n", ")\n", "project.sample_models['lbco'].atom_sites.add(\n", " label='Co',\n", " type_symbol='Co',\n", " fract_x=0.5,\n", " fract_y=0.5,\n", " fract_z=0.5,\n", " wyckoff_letter='b',\n", " b_iso=0.5,\n", ")\n", "project.sample_models['lbco'].atom_sites.add(\n", " label='O',\n", " type_symbol='O',\n", " fract_x=0,\n", " fract_y=0.5,\n", " fract_z=0.5,\n", " wyckoff_letter='c',\n", " b_iso=0.5,\n", ")" ] }, { "cell_type": "markdown", "id": "30", "metadata": {}, "source": [ "#### Show Sample Model as CIF" ] }, { "cell_type": "code", "execution_count": 15, "id": "31", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:53:45.570379Z", "iopub.status.busy": "2026-01-06T13:53:45.570220Z", "iopub.status.idle": "2026-01-06T13:53:45.865771Z", "shell.execute_reply": "2026-01-06T13:53:45.865348Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;34mSample model 🧩 \u001b[0m\u001b[32m'lbco'\u001b[0m\u001b[1;34m as cif\u001b[0m\n" ] }, { "data": { "application/javascript": [ "\n", " (function() {\n", " var isDark = false;\n", "\n", " // Check JupyterLab theme\n", " if (document.body.classList.contains('jp-mod-dark') || \n", " document.body.classList.contains('theme-dark') ||\n", " document.body.classList.contains('vscode-dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check theme attribute\n", " var themeAttr = document.body.getAttribute('data-jp-theme-name');\n", " if (themeAttr && themeAttr.includes('dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check computed background color\n", " var notebookEl = document.querySelector('.jp-Notebook') || \n", " document.querySelector('.notebook_app') ||\n", " document.body;\n", " if (notebookEl) {\n", " var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n", " var rgb = bgColor.match(/\\d+/g);\n", " if (rgb && rgb.length >= 3) {\n", " var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n", " if (brightness < 128) {\n", " isDark = true;\n", " }\n", " }\n", " }\n", "\n", " // Store result\n", " if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n", " IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n", " }\n", " })();\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " if (typeof IPython !== 'undefined' && IPython.notebook) {\n", " IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n", " (document.body.classList.contains('theme-dark') || \n", " document.body.classList.contains('jp-mod-dark') ||\n", " (document.body.getAttribute('data-jp-theme-name') && \n", " document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n", " }\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
 CIF
1data_lbco
2
3_cell.length_a 3.8800
4_cell.length_b 3.8800
5_cell.length_c 3.8800
6_cell.angle_alpha 90.0000
7_cell.angle_beta 90.0000
8_cell.angle_gamma 90.0000
9
10_space_group.name_H-M_alt \"P m -3 m\"
11_space_group.IT_coordinate_system_code 1
12
13loop_
14_atom_site.label
15_atom_site.type_symbol
16_atom_site.fract_x
17_atom_site.fract_y
18_atom_site.fract_z
19_atom_site.Wyckoff_letter
20_atom_site.occupancy
21_atom_site.B_iso_or_equiv
22_atom_site.adp_type
23 La La 0.0000 0.0000 0.0000 a 0.5000 0.5000 Biso
24 Ba Ba 0.0000 0.0000 0.0000 a 0.5000 0.5000 Biso
25 Co Co 0.5000 0.5000 0.5000 b 1.0000 0.5000 Biso
26 O O 0.0000 0.5000 0.5000 c 1.0000 0.5000 Biso
\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.sample_models['lbco'].show_as_cif()" ] }, { "cell_type": "markdown", "id": "32", "metadata": {}, "source": [ "#### Show Sample Model Structure" ] }, { "cell_type": "code", "execution_count": 16, "id": "33", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:53:45.867687Z", "iopub.status.busy": "2026-01-06T13:53:45.867566Z", "iopub.status.idle": "2026-01-06T13:53:45.871690Z", "shell.execute_reply": "2026-01-06T13:53:45.870942Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;34mSample model 🧩 \u001b[0m\u001b[32m'lbco'\u001b[0m\u001b[1;34m structure view\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Not implemented yet.\n" ] } ], "source": [ "project.sample_models['lbco'].show_structure()" ] }, { "cell_type": "markdown", "id": "34", "metadata": {}, "source": [ "#### Save Project State\n", "\n", "Save the project state after adding the sample model. This ensures\n", "that all changes are stored and can be accessed later. The project\n", "state is saved in the directory specified during project creation." ] }, { "cell_type": "code", "execution_count": 17, "id": "35", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:53:45.873701Z", "iopub.status.busy": "2026-01-06T13:53:45.873604Z", "iopub.status.idle": "2026-01-06T13:53:45.889230Z", "shell.execute_reply": "2026-01-06T13:53:45.888866Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;34mSaving project 📦 \u001b[0m\u001b[32m'lbco_hrpt'\u001b[0m\u001b[1;34m to\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\u001b[35m/private/var/folders/sm/xrr7tmqj20s7hrsh1qhfl1d40000gn/T/\u001b[0m\u001b[95mlbco_hrpt\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "├── 📄 project.cif\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "├── 📁 sample_models\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "│ └── 📄 lbco.cif\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "├── 📄 analysis.cif\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "└── 📄 summary.cif\n" ] } ], "source": [ "project.save()" ] }, { "cell_type": "markdown", "id": "36", "metadata": {}, "source": [ "## Step 3: Define Experiment\n", "\n", "This section shows how to add experiments, configure their parameters,\n", "and link the sample models defined in the previous step." ] }, { "cell_type": "markdown", "id": "37", "metadata": {}, "source": [ "#### Download Measured Data\n", "\n", "Download the data file from the EasyDiffraction repository on GitHub." ] }, { "cell_type": "code", "execution_count": 18, "id": "38", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:53:45.890847Z", "iopub.status.busy": "2026-01-06T13:53:45.890751Z", "iopub.status.idle": "2026-01-06T13:53:45.953457Z", "shell.execute_reply": "2026-01-06T13:53:45.947981Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;34mGetting data\u001b[0m\u001b[1;34m...\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Data #\u001b[1;36m3\u001b[0m: La0.5Ba0.5CoO3, HRPT \u001b[1m(\u001b[0mPSI\u001b[1m)\u001b[0m, \u001b[1;36m300\u001b[0m K\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "✅ Data #\u001b[1;36m3\u001b[0m downloaded to \u001b[32m'data/ed-3.xye'\u001b[0m\n" ] } ], "source": [ "data_path = ed.download_data(id=3, destination='data')" ] }, { "cell_type": "markdown", "id": "39", "metadata": {}, "source": [ "#### Add Diffraction Experiment" ] }, { "cell_type": "code", "execution_count": 19, "id": "40", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:53:45.961545Z", "iopub.status.busy": "2026-01-06T13:53:45.961390Z", "iopub.status.idle": "2026-01-06T13:53:46.315660Z", "shell.execute_reply": "2026-01-06T13:53:46.315019Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;34mData loaded successfully\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Experiment 🔬 \u001b[32m'hrpt'\u001b[0m. Number of data points: \u001b[1;36m3098\u001b[0m\n" ] } ], "source": [ "project.experiments.add(\n", " name='hrpt',\n", " data_path=data_path,\n", " sample_form='powder',\n", " beam_mode='constant wavelength',\n", " radiation_probe='neutron',\n", ")" ] }, { "cell_type": "markdown", "id": "41", "metadata": {}, "source": [ "#### Show Defined Experiments" ] }, { "cell_type": "code", "execution_count": 20, "id": "42", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:53:46.317676Z", "iopub.status.busy": "2026-01-06T13:53:46.317548Z", "iopub.status.idle": "2026-01-06T13:53:46.320728Z", "shell.execute_reply": "2026-01-06T13:53:46.320188Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;34mDefined experiments 🔬\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1m[\u001b[0m\u001b[32m'hrpt'\u001b[0m\u001b[1m]\u001b[0m\n" ] } ], "source": [ "project.experiments.show_names()" ] }, { "cell_type": "markdown", "id": "43", "metadata": {}, "source": [ "#### Show Measured Data" ] }, { "cell_type": "code", "execution_count": 21, "id": "44", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:53:46.322797Z", "iopub.status.busy": "2026-01-06T13:53:46.322707Z", "iopub.status.idle": "2026-01-06T13:53:46.379423Z", "shell.execute_reply": "2026-01-06T13:53:46.378035Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Warning: No linked phases defined. Returning empty pattern.\n" ] }, { "data": { "text/html": [ "
\n", "
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.plot_meas(expt_name='hrpt')" ] }, { "cell_type": "markdown", "id": "45", "metadata": {}, "source": [ "#### Set Instrument\n", "\n", "Modify the default instrument parameters." ] }, { "cell_type": "code", "execution_count": 22, "id": "46", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:53:46.381397Z", "iopub.status.busy": "2026-01-06T13:53:46.381255Z", "iopub.status.idle": "2026-01-06T13:53:46.383554Z", "shell.execute_reply": "2026-01-06T13:53:46.383030Z" } }, "outputs": [], "source": [ "project.experiments['hrpt'].instrument.setup_wavelength = 1.494\n", "project.experiments['hrpt'].instrument.calib_twotheta_offset = 0.6" ] }, { "cell_type": "markdown", "id": "47", "metadata": {}, "source": [ "#### Set Peak Profile\n", "\n", "Show supported peak profile types." ] }, { "cell_type": "code", "execution_count": 23, "id": "48", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:53:46.387056Z", "iopub.status.busy": "2026-01-06T13:53:46.386660Z", "iopub.status.idle": "2026-01-06T13:53:46.789369Z", "shell.execute_reply": "2026-01-06T13:53:46.787610Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;34mSupported peak profile types\u001b[0m\n" ] }, { "data": { "application/javascript": [ "\n", " (function() {\n", " var isDark = false;\n", "\n", " // Check JupyterLab theme\n", " if (document.body.classList.contains('jp-mod-dark') || \n", " document.body.classList.contains('theme-dark') ||\n", " document.body.classList.contains('vscode-dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check theme attribute\n", " var themeAttr = document.body.getAttribute('data-jp-theme-name');\n", " if (themeAttr && themeAttr.includes('dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check computed background color\n", " var notebookEl = document.querySelector('.jp-Notebook') || \n", " document.querySelector('.notebook_app') ||\n", " document.body;\n", " if (notebookEl) {\n", " var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n", " var rgb = bgColor.match(/\\d+/g);\n", " if (rgb && rgb.length >= 3) {\n", " var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n", " if (brightness < 128) {\n", " isDark = true;\n", " }\n", " }\n", " }\n", "\n", " // Store result\n", " if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n", " IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n", " }\n", " })();\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " if (typeof IPython !== 'undefined' && IPython.notebook) {\n", " IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n", " (document.body.classList.contains('theme-dark') || \n", " document.body.classList.contains('jp-mod-dark') ||\n", " (document.body.getAttribute('data-jp-theme-name') && \n", " document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n", " }\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
 Peak profile typeDescription
1pseudo-voigtPseudo-Voigt profile
2split pseudo-voigtSplit pseudo-Voigt profile with empirical asymmetry correction.
3thompson-cox-hastingsThompson-Cox-Hastings profile with FCJ asymmetry correction.
\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.experiments['hrpt'].show_supported_peak_profile_types()" ] }, { "cell_type": "markdown", "id": "49", "metadata": {}, "source": [ "Show the current peak profile type." ] }, { "cell_type": "code", "execution_count": 24, "id": "50", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:53:46.793243Z", "iopub.status.busy": "2026-01-06T13:53:46.793001Z", "iopub.status.idle": "2026-01-06T13:53:46.799691Z", "shell.execute_reply": "2026-01-06T13:53:46.799067Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;34mCurrent peak profile type\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "PeakProfileTypeEnum.PSEUDO_VOIGT\n" ] } ], "source": [ "project.experiments['hrpt'].show_current_peak_profile_type()" ] }, { "cell_type": "markdown", "id": "51", "metadata": {}, "source": [ "Select the desired peak profile type." ] }, { "cell_type": "code", "execution_count": 25, "id": "52", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:53:46.804003Z", "iopub.status.busy": "2026-01-06T13:53:46.803531Z", "iopub.status.idle": "2026-01-06T13:53:46.810147Z", "shell.execute_reply": "2026-01-06T13:53:46.809738Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;34mPeak profile type for experiment \u001b[0m\u001b[32m'hrpt'\u001b[0m\u001b[1;34m changed to\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "pseudo-voigt\n" ] } ], "source": [ "project.experiments['hrpt'].peak_profile_type = 'pseudo-voigt'" ] }, { "cell_type": "markdown", "id": "53", "metadata": {}, "source": [ "Modify default peak profile parameters." ] }, { "cell_type": "code", "execution_count": 26, "id": "54", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:53:46.815545Z", "iopub.status.busy": "2026-01-06T13:53:46.815154Z", "iopub.status.idle": "2026-01-06T13:53:46.825267Z", "shell.execute_reply": "2026-01-06T13:53:46.824165Z" } }, "outputs": [], "source": [ "project.experiments['hrpt'].peak.broad_gauss_u = 0.1\n", "project.experiments['hrpt'].peak.broad_gauss_v = -0.1\n", "project.experiments['hrpt'].peak.broad_gauss_w = 0.1\n", "project.experiments['hrpt'].peak.broad_lorentz_x = 0\n", "project.experiments['hrpt'].peak.broad_lorentz_y = 0.1" ] }, { "cell_type": "markdown", "id": "55", "metadata": {}, "source": [ "#### Set Background" ] }, { "cell_type": "markdown", "id": "56", "metadata": {}, "source": [ "Show supported background types." ] }, { "cell_type": "code", "execution_count": 27, "id": "57", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:53:46.828158Z", "iopub.status.busy": "2026-01-06T13:53:46.827839Z", "iopub.status.idle": "2026-01-06T13:53:47.201402Z", "shell.execute_reply": "2026-01-06T13:53:47.200556Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;34mSupported background types\u001b[0m\n" ] }, { "data": { "application/javascript": [ "\n", " (function() {\n", " var isDark = false;\n", "\n", " // Check JupyterLab theme\n", " if (document.body.classList.contains('jp-mod-dark') || \n", " document.body.classList.contains('theme-dark') ||\n", " document.body.classList.contains('vscode-dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check theme attribute\n", " var themeAttr = document.body.getAttribute('data-jp-theme-name');\n", " if (themeAttr && themeAttr.includes('dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check computed background color\n", " var notebookEl = document.querySelector('.jp-Notebook') || \n", " document.querySelector('.notebook_app') ||\n", " document.body;\n", " if (notebookEl) {\n", " var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n", " var rgb = bgColor.match(/\\d+/g);\n", " if (rgb && rgb.length >= 3) {\n", " var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n", " if (brightness < 128) {\n", " isDark = true;\n", " }\n", " }\n", " }\n", "\n", " // Store result\n", " if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n", " IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n", " }\n", " })();\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " if (typeof IPython !== 'undefined' && IPython.notebook) {\n", " IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n", " (document.body.classList.contains('theme-dark') || \n", " document.body.classList.contains('jp-mod-dark') ||\n", " (document.body.getAttribute('data-jp-theme-name') && \n", " document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n", " }\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
 Background typeDescription
1line-segmentLinear interpolation between points
2chebyshev polynomialChebyshev polynomial background
\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.experiments['hrpt'].show_supported_background_types()" ] }, { "cell_type": "markdown", "id": "58", "metadata": {}, "source": [ "Show current background type." ] }, { "cell_type": "code", "execution_count": 28, "id": "59", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:53:47.204288Z", "iopub.status.busy": "2026-01-06T13:53:47.204133Z", "iopub.status.idle": "2026-01-06T13:53:47.215293Z", "shell.execute_reply": "2026-01-06T13:53:47.214566Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;34mCurrent background type\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "BackgroundTypeEnum.LINE_SEGMENT\n" ] } ], "source": [ "project.experiments['hrpt'].show_current_background_type()" ] }, { "cell_type": "markdown", "id": "60", "metadata": {}, "source": [ "Select the desired background type." ] }, { "cell_type": "code", "execution_count": 29, "id": "61", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:53:47.218066Z", "iopub.status.busy": "2026-01-06T13:53:47.217616Z", "iopub.status.idle": "2026-01-06T13:53:47.223920Z", "shell.execute_reply": "2026-01-06T13:53:47.223070Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;34mBackground type for experiment \u001b[0m\u001b[32m'hrpt'\u001b[0m\u001b[1;34m changed to\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "line-segment\n" ] } ], "source": [ "project.experiments['hrpt'].background_type = 'line-segment'" ] }, { "cell_type": "markdown", "id": "62", "metadata": {}, "source": [ "Add background points." ] }, { "cell_type": "code", "execution_count": 30, "id": "63", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:53:47.226358Z", "iopub.status.busy": "2026-01-06T13:53:47.226185Z", "iopub.status.idle": "2026-01-06T13:53:47.229766Z", "shell.execute_reply": "2026-01-06T13:53:47.229391Z" } }, "outputs": [], "source": [ "project.experiments['hrpt'].background.add(id='10', x=10, y=170)\n", "project.experiments['hrpt'].background.add(id='30', x=30, y=170)\n", "project.experiments['hrpt'].background.add(id='50', x=50, y=170)\n", "project.experiments['hrpt'].background.add(id='110', x=110, y=170)\n", "project.experiments['hrpt'].background.add(id='165', x=165, y=170)" ] }, { "cell_type": "markdown", "id": "64", "metadata": {}, "source": [ "Show current background points." ] }, { "cell_type": "code", "execution_count": 31, "id": "65", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:53:47.231281Z", "iopub.status.busy": "2026-01-06T13:53:47.231171Z", "iopub.status.idle": "2026-01-06T13:53:47.594344Z", "shell.execute_reply": "2026-01-06T13:53:47.593812Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;34mLine-segment background points\u001b[0m\n" ] }, { "data": { "application/javascript": [ "\n", " (function() {\n", " var isDark = false;\n", "\n", " // Check JupyterLab theme\n", " if (document.body.classList.contains('jp-mod-dark') || \n", " document.body.classList.contains('theme-dark') ||\n", " document.body.classList.contains('vscode-dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check theme attribute\n", " var themeAttr = document.body.getAttribute('data-jp-theme-name');\n", " if (themeAttr && themeAttr.includes('dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check computed background color\n", " var notebookEl = document.querySelector('.jp-Notebook') || \n", " document.querySelector('.notebook_app') ||\n", " document.body;\n", " if (notebookEl) {\n", " var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n", " var rgb = bgColor.match(/\\d+/g);\n", " if (rgb && rgb.length >= 3) {\n", " var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n", " if (brightness < 128) {\n", " isDark = true;\n", " }\n", " }\n", " }\n", "\n", " // Store result\n", " if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n", " IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n", " }\n", " })();\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " if (typeof IPython !== 'undefined' && IPython.notebook) {\n", " IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n", " (document.body.classList.contains('theme-dark') || \n", " document.body.classList.contains('jp-mod-dark') ||\n", " (document.body.getAttribute('data-jp-theme-name') && \n", " document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n", " }\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
 XIntensity
110170
230170
350170
4110170
5165170
\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.experiments['hrpt'].background.show()" ] }, { "cell_type": "markdown", "id": "66", "metadata": {}, "source": [ "#### Set Linked Phases\n", "\n", "Link the sample model defined in the previous step to the experiment." ] }, { "cell_type": "code", "execution_count": 32, "id": "67", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:53:47.596183Z", "iopub.status.busy": "2026-01-06T13:53:47.596067Z", "iopub.status.idle": "2026-01-06T13:53:47.602768Z", "shell.execute_reply": "2026-01-06T13:53:47.602234Z" } }, "outputs": [], "source": [ "project.experiments['hrpt'].linked_phases.add(id='lbco', scale=10.0)" ] }, { "cell_type": "markdown", "id": "68", "metadata": {}, "source": [ "#### Show Experiment as CIF" ] }, { "cell_type": "code", "execution_count": 33, "id": "69", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:53:47.604641Z", "iopub.status.busy": "2026-01-06T13:53:47.604517Z", "iopub.status.idle": "2026-01-06T13:53:48.235617Z", "shell.execute_reply": "2026-01-06T13:53:48.229167Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;34mExperiment 🔬 \u001b[0m\u001b[32m'hrpt'\u001b[0m\u001b[1;34m as cif\u001b[0m\n" ] }, { "data": { "application/javascript": [ "\n", " (function() {\n", " var isDark = false;\n", "\n", " // Check JupyterLab theme\n", " if (document.body.classList.contains('jp-mod-dark') || \n", " document.body.classList.contains('theme-dark') ||\n", " document.body.classList.contains('vscode-dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check theme attribute\n", " var themeAttr = document.body.getAttribute('data-jp-theme-name');\n", " if (themeAttr && themeAttr.includes('dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check computed background color\n", " var notebookEl = document.querySelector('.jp-Notebook') || \n", " document.querySelector('.notebook_app') ||\n", " document.body;\n", " if (notebookEl) {\n", " var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n", " var rgb = bgColor.match(/\\d+/g);\n", " if (rgb && rgb.length >= 3) {\n", " var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n", " if (brightness < 128) {\n", " isDark = true;\n", " }\n", " }\n", " }\n", "\n", " // Store result\n", " if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n", " IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n", " }\n", " })();\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " if (typeof IPython !== 'undefined' && IPython.notebook) {\n", " IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n", " (document.body.classList.contains('theme-dark') || \n", " document.body.classList.contains('jp-mod-dark') ||\n", " (document.body.getAttribute('data-jp-theme-name') && \n", " document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n", " }\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
 CIF
1data_hrpt
2
3_expt_type.sample_form powder
4_expt_type.beam_mode \"constant wavelength\"
5_expt_type.radiation_probe neutron
6_expt_type.scattering_type bragg
7
8_peak.broad_gauss_u 0.1000
9_peak.broad_gauss_v -0.1000
10_peak.broad_gauss_w 0.1000
11_peak.broad_lorentz_x 0.0000
12_peak.broad_lorentz_y 0.1000
13
14_instr.wavelength 1.4940
15_instr.2theta_offset 0.6000
16
17loop_
18_pd_phase_block.id
19_pd_phase_block.scale
20 lbco 10.0000
21
22
23
24loop_
25_pd_proc.2theta_scan
26_pd_data.point_id
27_pd_proc.d_spacing
28_pd_meas.intensity_total
29_pd_meas.intensity_total_su
30_pd_calc.intensity_total
31_pd_calc.intensity_bkg
32_pd_data.refinement_status
33 10.0000 1 8.5709 167.0000 12.6000 172.3278 170.0000 incl
34 10.0500 2 8.5283 157.0000 12.5000 172.3086 170.0000 incl
35 10.1000 3 8.4862 187.0000 13.3000 172.2897 170.0000 incl
36 10.1500 4 8.4445 197.0000 14.0000 172.2711 170.0000 incl
37 10.2000 5 8.4032 164.0000 12.5000 172.2528 170.0000 incl
38 10.2500 6 8.3624 171.0000 13.0000 172.2347 170.0000 incl
39 10.3000 7 8.3219 190.0000 13.4000 172.2169 170.0000 incl
40 10.3500 8 8.2818 182.0000 13.5000 172.1994 170.0000 incl
41 10.4000 9 8.2421 166.0000 12.6000 172.1822 170.0000 incl
42 10.4500 10 8.2027 203.0000 14.3000 172.1652 170.0000 incl
43...
44164.4000 3089 0.7540 202.0000 18.5000 172.6004 170.0000 incl
45164.4500 3090 0.7539 178.0000 20.4000 172.5970 170.0000 incl
46164.5000 3091 0.7539 153.0000 18.0000 172.5938 170.0000 incl
47164.5500 3092 0.7538 197.0000 25.3000 172.5909 170.0000 incl
48164.6000 3093 0.7538 153.0000 20.7000 172.5883 170.0000 incl
49164.6500 3094 0.7538 173.0000 30.1000 172.5859 170.0000 incl
50164.7000 3095 0.7537 187.0000 27.9000 172.5838 170.0000 incl
51164.7500 3096 0.7537 175.0000 38.2000 172.5819 170.0000 incl
52164.8000 3097 0.7536 168.0000 30.9000 172.5803 170.0000 incl
53164.8500 3098 0.7536 109.0000 41.2000 172.5789 170.0000 incl
54
55loop_
56_pd_background.id
57_pd_background.line_segment_X
58_pd_background.line_segment_intensity
59 10 10.0000 170.0000
60 30 30.0000 170.0000
61 50 50.0000 170.0000
62 110 110.0000 170.0000
63 165 165.0000 170.0000
\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.experiments['hrpt'].show_as_cif()" ] }, { "cell_type": "markdown", "id": "70", "metadata": {}, "source": [ "#### Save Project State" ] }, { "cell_type": "code", "execution_count": 34, "id": "71", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:53:48.243765Z", "iopub.status.busy": "2026-01-06T13:53:48.243184Z", "iopub.status.idle": "2026-01-06T13:53:48.367810Z", "shell.execute_reply": "2026-01-06T13:53:48.367214Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;34mSaving project 📦 \u001b[0m\u001b[32m'lbco_hrpt'\u001b[0m\u001b[1;34m to\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\u001b[35m/private/var/folders/sm/xrr7tmqj20s7hrsh1qhfl1d40000gn/T/\u001b[0m\u001b[95mlbco_hrpt\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "├── 📄 project.cif\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "├── 📁 sample_models\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "│ └── 📄 lbco.cif\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "├── 📁 experiments\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "│ └── 📄 hrpt.cif\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "├── 📄 analysis.cif\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "└── 📄 summary.cif\n" ] } ], "source": [ "project.save()" ] }, { "cell_type": "markdown", "id": "72", "metadata": {}, "source": [ "## Step 4: Perform Analysis\n", "\n", "This section explains the analysis process, including how to set up\n", "calculation and fitting engines.\n", "\n", "#### Set Calculator\n", "\n", "Show supported calculation engines." ] }, { "cell_type": "code", "execution_count": 35, "id": "73", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:53:48.373605Z", "iopub.status.busy": "2026-01-06T13:53:48.372257Z", "iopub.status.idle": "2026-01-06T13:53:48.706797Z", "shell.execute_reply": "2026-01-06T13:53:48.706430Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;34mSupported calculators\u001b[0m\n" ] }, { "data": { "application/javascript": [ "\n", " (function() {\n", " var isDark = false;\n", "\n", " // Check JupyterLab theme\n", " if (document.body.classList.contains('jp-mod-dark') || \n", " document.body.classList.contains('theme-dark') ||\n", " document.body.classList.contains('vscode-dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check theme attribute\n", " var themeAttr = document.body.getAttribute('data-jp-theme-name');\n", " if (themeAttr && themeAttr.includes('dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check computed background color\n", " var notebookEl = document.querySelector('.jp-Notebook') || \n", " document.querySelector('.notebook_app') ||\n", " document.body;\n", " if (notebookEl) {\n", " var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n", " var rgb = bgColor.match(/\\d+/g);\n", " if (rgb && rgb.length >= 3) {\n", " var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n", " if (brightness < 128) {\n", " isDark = true;\n", " }\n", " }\n", " }\n", "\n", " // Store result\n", " if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n", " IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n", " }\n", " })();\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " if (typeof IPython !== 'undefined' && IPython.notebook) {\n", " IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n", " (document.body.classList.contains('theme-dark') || \n", " document.body.classList.contains('jp-mod-dark') ||\n", " (document.body.getAttribute('data-jp-theme-name') && \n", " document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n", " }\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
 CalculatorDescription
1cryspyCrysPy library for crystallographic calculations
2pdffitPDFfit2 library for pair distribution function calculations
\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.analysis.show_supported_calculators()" ] }, { "cell_type": "markdown", "id": "74", "metadata": {}, "source": [ "Show current calculation engine." ] }, { "cell_type": "code", "execution_count": 36, "id": "75", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:53:48.708682Z", "iopub.status.busy": "2026-01-06T13:53:48.708555Z", "iopub.status.idle": "2026-01-06T13:53:48.714955Z", "shell.execute_reply": "2026-01-06T13:53:48.714548Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;34mCurrent calculator\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "cryspy\n" ] } ], "source": [ "project.analysis.show_current_calculator()" ] }, { "cell_type": "markdown", "id": "76", "metadata": {}, "source": [ "Select the desired calculation engine." ] }, { "cell_type": "code", "execution_count": 37, "id": "77", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:53:48.716873Z", "iopub.status.busy": "2026-01-06T13:53:48.716755Z", "iopub.status.idle": "2026-01-06T13:53:48.724107Z", "shell.execute_reply": "2026-01-06T13:53:48.723669Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;34mCurrent calculator changed to\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "cryspy\n" ] } ], "source": [ "project.analysis.current_calculator = 'cryspy'" ] }, { "cell_type": "markdown", "id": "78", "metadata": {}, "source": [ "#### Show Calculated Data" ] }, { "cell_type": "code", "execution_count": 38, "id": "79", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:53:48.725889Z", "iopub.status.busy": "2026-01-06T13:53:48.725794Z", "iopub.status.idle": "2026-01-06T13:53:49.121102Z", "shell.execute_reply": "2026-01-06T13:53:49.120690Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.plot_calc(expt_name='hrpt')" ] }, { "cell_type": "markdown", "id": "80", "metadata": {}, "source": [ "#### Plot Measured vs Calculated" ] }, { "cell_type": "code", "execution_count": 39, "id": "81", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:53:49.123214Z", "iopub.status.busy": "2026-01-06T13:53:49.123056Z", "iopub.status.idle": "2026-01-06T13:53:49.402173Z", "shell.execute_reply": "2026-01-06T13:53:49.401709Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.plot_meas_vs_calc(expt_name='hrpt', show_residual=True)" ] }, { "cell_type": "code", "execution_count": 40, "id": "82", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:53:49.404009Z", "iopub.status.busy": "2026-01-06T13:53:49.403903Z", "iopub.status.idle": "2026-01-06T13:53:49.756950Z", "shell.execute_reply": "2026-01-06T13:53:49.756114Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.plot_meas_vs_calc(expt_name='hrpt', x_min=38, x_max=41, show_residual=True)" ] }, { "cell_type": "markdown", "id": "83", "metadata": {}, "source": [ "#### Show Parameters\n", "\n", "Show all parameters of the project." ] }, { "cell_type": "code", "execution_count": 41, "id": "84", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:53:49.760886Z", "iopub.status.busy": "2026-01-06T13:53:49.760092Z", "iopub.status.idle": "2026-01-06T13:53:49.762823Z", "shell.execute_reply": "2026-01-06T13:53:49.762290Z" } }, "outputs": [], "source": [ "# project.analysis.show_all_params()" ] }, { "cell_type": "markdown", "id": "85", "metadata": {}, "source": [ "Show all fittable parameters." ] }, { "cell_type": "code", "execution_count": 42, "id": "86", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:53:49.764957Z", "iopub.status.busy": "2026-01-06T13:53:49.764368Z", "iopub.status.idle": "2026-01-06T13:53:50.480726Z", "shell.execute_reply": "2026-01-06T13:53:50.480188Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;34mFittable parameters for all sample models \u001b[0m\u001b[1;34m(\u001b[0m\u001b[1;34m🧩 data blocks\u001b[0m\u001b[1;34m)\u001b[0m\n" ] }, { "data": { "application/javascript": [ "\n", " (function() {\n", " var isDark = false;\n", "\n", " // Check JupyterLab theme\n", " if (document.body.classList.contains('jp-mod-dark') || \n", " document.body.classList.contains('theme-dark') ||\n", " document.body.classList.contains('vscode-dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check theme attribute\n", " var themeAttr = document.body.getAttribute('data-jp-theme-name');\n", " if (themeAttr && themeAttr.includes('dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check computed background color\n", " var notebookEl = document.querySelector('.jp-Notebook') || \n", " document.querySelector('.notebook_app') ||\n", " document.body;\n", " if (notebookEl) {\n", " var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n", " var rgb = bgColor.match(/\\d+/g);\n", " if (rgb && rgb.length >= 3) {\n", " var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n", " if (brightness < 128) {\n", " isDark = true;\n", " }\n", " }\n", " }\n", "\n", " // Store result\n", " if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n", " IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n", " }\n", " })();\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " if (typeof IPython !== 'undefined' && IPython.notebook) {\n", " IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n", " (document.body.classList.contains('theme-dark') || \n", " document.body.classList.contains('jp-mod-dark') ||\n", " (document.body.getAttribute('data-jp-theme-name') && \n", " document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n", " }\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
 datablockcategoryentryparametervalueuncertaintyunitsfree
1lbcocelllength_a3.88000ÅFalse
2lbcocelllength_b3.88000ÅFalse
3lbcocelllength_c3.88000ÅFalse
4lbcocellangle_alpha90.00000degFalse
5lbcocellangle_beta90.00000degFalse
6lbcocellangle_gamma90.00000degFalse
7lbcoatom_siteLafract_x0.00000False
8lbcoatom_siteLafract_y0.00000False
9lbcoatom_siteLafract_z0.00000False
10lbcoatom_siteLaoccupancy0.50000False
11lbcoatom_siteLab_iso0.50000ŲFalse
12lbcoatom_siteBafract_x0.00000False
13lbcoatom_siteBafract_y0.00000False
14lbcoatom_siteBafract_z0.00000False
15lbcoatom_siteBaoccupancy0.50000False
16lbcoatom_siteBab_iso0.50000ŲFalse
17lbcoatom_siteCofract_x0.50000False
18lbcoatom_siteCofract_y0.50000False
19lbcoatom_siteCofract_z0.50000False
20lbcoatom_siteCooccupancy1.00000False
21lbcoatom_siteCob_iso0.50000ŲFalse
22lbcoatom_siteOfract_x0.00000False
23lbcoatom_siteOfract_y0.50000False
24lbcoatom_siteOfract_z0.50000False
25lbcoatom_siteOoccupancy1.00000False
26lbcoatom_siteOb_iso0.50000ŲFalse
\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;34mFittable parameters for all experiments \u001b[0m\u001b[1;34m(\u001b[0m\u001b[1;34m🔬 data blocks\u001b[0m\u001b[1;34m)\u001b[0m\n" ] }, { "data": { "application/javascript": [ "\n", " (function() {\n", " var isDark = false;\n", "\n", " // Check JupyterLab theme\n", " if (document.body.classList.contains('jp-mod-dark') || \n", " document.body.classList.contains('theme-dark') ||\n", " document.body.classList.contains('vscode-dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check theme attribute\n", " var themeAttr = document.body.getAttribute('data-jp-theme-name');\n", " if (themeAttr && themeAttr.includes('dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check computed background color\n", " var notebookEl = document.querySelector('.jp-Notebook') || \n", " document.querySelector('.notebook_app') ||\n", " document.body;\n", " if (notebookEl) {\n", " var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n", " var rgb = bgColor.match(/\\d+/g);\n", " if (rgb && rgb.length >= 3) {\n", " var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n", " if (brightness < 128) {\n", " isDark = true;\n", " }\n", " }\n", " }\n", "\n", " // Store result\n", " if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n", " IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n", " }\n", " })();\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " if (typeof IPython !== 'undefined' && IPython.notebook) {\n", " IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n", " (document.body.classList.contains('theme-dark') || \n", " document.body.classList.contains('jp-mod-dark') ||\n", " (document.body.getAttribute('data-jp-theme-name') && \n", " document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n", " }\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
 datablockcategoryentryparametervalueuncertaintyunitsfree
1hrptlinked_phaseslbcoscale10.00000False
2hrptpeakbroad_gauss_u0.10000deg²False
3hrptpeakbroad_gauss_v-0.10000deg²False
4hrptpeakbroad_gauss_w0.10000deg²False
5hrptpeakbroad_lorentz_x0.00000degFalse
6hrptpeakbroad_lorentz_y0.10000degFalse
7hrptinstrumentwavelength1.49400ÅFalse
8hrptinstrumenttwotheta_offset0.60000degFalse
9hrptbackground10y170.00000False
10hrptbackground30y170.00000False
11hrptbackground50y170.00000False
12hrptbackground110y170.00000False
13hrptbackground165y170.00000False
\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.analysis.show_fittable_params()" ] }, { "cell_type": "markdown", "id": "87", "metadata": {}, "source": [ "Show only free parameters." ] }, { "cell_type": "code", "execution_count": 43, "id": "88", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:53:50.483840Z", "iopub.status.busy": "2026-01-06T13:53:50.483672Z", "iopub.status.idle": "2026-01-06T13:53:50.500969Z", "shell.execute_reply": "2026-01-06T13:53:50.500262Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "⚠️ No free parameters found. \n" ] } ], "source": [ "project.analysis.show_free_params()" ] }, { "cell_type": "markdown", "id": "89", "metadata": {}, "source": [ "Show how to access parameters in the code." ] }, { "cell_type": "code", "execution_count": 44, "id": "90", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:53:50.504046Z", "iopub.status.busy": "2026-01-06T13:53:50.503658Z", "iopub.status.idle": "2026-01-06T13:53:50.507718Z", "shell.execute_reply": "2026-01-06T13:53:50.507302Z" } }, "outputs": [], "source": [ "# project.analysis.how_to_access_parameters()" ] }, { "cell_type": "markdown", "id": "91", "metadata": {}, "source": [ "#### Set Fit Mode\n", "\n", "Show supported fit modes." ] }, { "cell_type": "code", "execution_count": 45, "id": "92", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:53:50.509978Z", "iopub.status.busy": "2026-01-06T13:53:50.509784Z", "iopub.status.idle": "2026-01-06T13:53:50.883821Z", "shell.execute_reply": "2026-01-06T13:53:50.883260Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;34mAvailable fit modes\u001b[0m\n" ] }, { "data": { "application/javascript": [ "\n", " (function() {\n", " var isDark = false;\n", "\n", " // Check JupyterLab theme\n", " if (document.body.classList.contains('jp-mod-dark') || \n", " document.body.classList.contains('theme-dark') ||\n", " document.body.classList.contains('vscode-dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check theme attribute\n", " var themeAttr = document.body.getAttribute('data-jp-theme-name');\n", " if (themeAttr && themeAttr.includes('dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check computed background color\n", " var notebookEl = document.querySelector('.jp-Notebook') || \n", " document.querySelector('.notebook_app') ||\n", " document.body;\n", " if (notebookEl) {\n", " var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n", " var rgb = bgColor.match(/\\d+/g);\n", " if (rgb && rgb.length >= 3) {\n", " var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n", " if (brightness < 128) {\n", " isDark = true;\n", " }\n", " }\n", " }\n", "\n", " // Store result\n", " if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n", " IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n", " }\n", " })();\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " if (typeof IPython !== 'undefined' && IPython.notebook) {\n", " IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n", " (document.body.classList.contains('theme-dark') || \n", " document.body.classList.contains('jp-mod-dark') ||\n", " (document.body.getAttribute('data-jp-theme-name') && \n", " document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n", " }\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
 StrategyDescription
1singleIndependent fitting of each experiment; no shared parameters
2jointSimultaneous fitting of all experiments; some parameters are shared
\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.analysis.show_available_fit_modes()" ] }, { "cell_type": "markdown", "id": "93", "metadata": {}, "source": [ "Show current fit mode." ] }, { "cell_type": "code", "execution_count": 46, "id": "94", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:53:50.885462Z", "iopub.status.busy": "2026-01-06T13:53:50.885349Z", "iopub.status.idle": "2026-01-06T13:53:50.889032Z", "shell.execute_reply": "2026-01-06T13:53:50.888690Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;34mCurrent fit mode\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "single\n" ] } ], "source": [ "project.analysis.show_current_fit_mode()" ] }, { "cell_type": "markdown", "id": "95", "metadata": {}, "source": [ "Select desired fit mode." ] }, { "cell_type": "code", "execution_count": 47, "id": "96", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:53:50.890483Z", "iopub.status.busy": "2026-01-06T13:53:50.890361Z", "iopub.status.idle": "2026-01-06T13:53:50.893368Z", "shell.execute_reply": "2026-01-06T13:53:50.893049Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;34mCurrent fit mode changed to\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "single\n" ] } ], "source": [ "project.analysis.fit_mode = 'single'" ] }, { "cell_type": "markdown", "id": "97", "metadata": {}, "source": [ "#### Set Minimizer\n", "\n", "Show supported fitting engines." ] }, { "cell_type": "code", "execution_count": 48, "id": "98", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:53:50.894788Z", "iopub.status.busy": "2026-01-06T13:53:50.894688Z", "iopub.status.idle": "2026-01-06T13:53:51.273249Z", "shell.execute_reply": "2026-01-06T13:53:51.272862Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;34mSupported minimizers\u001b[0m\n" ] }, { "data": { "application/javascript": [ "\n", " (function() {\n", " var isDark = false;\n", "\n", " // Check JupyterLab theme\n", " if (document.body.classList.contains('jp-mod-dark') || \n", " document.body.classList.contains('theme-dark') ||\n", " document.body.classList.contains('vscode-dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check theme attribute\n", " var themeAttr = document.body.getAttribute('data-jp-theme-name');\n", " if (themeAttr && themeAttr.includes('dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check computed background color\n", " var notebookEl = document.querySelector('.jp-Notebook') || \n", " document.querySelector('.notebook_app') ||\n", " document.body;\n", " if (notebookEl) {\n", " var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n", " var rgb = bgColor.match(/\\d+/g);\n", " if (rgb && rgb.length >= 3) {\n", " var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n", " if (brightness < 128) {\n", " isDark = true;\n", " }\n", " }\n", " }\n", "\n", " // Store result\n", " if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n", " IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n", " }\n", " })();\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " if (typeof IPython !== 'undefined' && IPython.notebook) {\n", " IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n", " (document.body.classList.contains('theme-dark') || \n", " document.body.classList.contains('jp-mod-dark') ||\n", " (document.body.getAttribute('data-jp-theme-name') && \n", " document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n", " }\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
 MinimizerDescription
1lmfitLMFIT library using the default Levenberg-Marquardt least squares method
2lmfit (leastsq)LMFIT library with Levenberg-Marquardt least squares method
3lmfit (least_squares)LMFIT library with SciPy’s trust region reflective algorithm
4dfolsDFO-LS library for derivative-free least-squares optimization
\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.analysis.show_available_minimizers()" ] }, { "cell_type": "markdown", "id": "99", "metadata": {}, "source": [ "Show current fitting engine." ] }, { "cell_type": "code", "execution_count": 49, "id": "100", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:53:51.275441Z", "iopub.status.busy": "2026-01-06T13:53:51.275314Z", "iopub.status.idle": "2026-01-06T13:53:51.279604Z", "shell.execute_reply": "2026-01-06T13:53:51.278893Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;34mCurrent minimizer\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "lmfit \u001b[1m(\u001b[0mleastsq\u001b[1m)\u001b[0m\n" ] } ], "source": [ "project.analysis.show_current_minimizer()" ] }, { "cell_type": "markdown", "id": "101", "metadata": {}, "source": [ "Select desired fitting engine." ] }, { "cell_type": "code", "execution_count": 50, "id": "102", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:53:51.281974Z", "iopub.status.busy": "2026-01-06T13:53:51.281876Z", "iopub.status.idle": "2026-01-06T13:53:51.286469Z", "shell.execute_reply": "2026-01-06T13:53:51.285235Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;34mCurrent minimizer changed to\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "lmfit \u001b[1m(\u001b[0mleastsq\u001b[1m)\u001b[0m\n" ] } ], "source": [ "project.analysis.current_minimizer = 'lmfit (leastsq)'" ] }, { "cell_type": "markdown", "id": "103", "metadata": {}, "source": [ "### Perform Fit 1/5\n", "\n", "Set sample model parameters to be refined." ] }, { "cell_type": "code", "execution_count": 51, "id": "104", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:53:51.288616Z", "iopub.status.busy": "2026-01-06T13:53:51.288513Z", "iopub.status.idle": "2026-01-06T13:53:51.294019Z", "shell.execute_reply": "2026-01-06T13:53:51.293375Z" } }, "outputs": [], "source": [ "project.sample_models['lbco'].cell.length_a.free = True" ] }, { "cell_type": "markdown", "id": "105", "metadata": {}, "source": [ "Set experiment parameters to be refined." ] }, { "cell_type": "code", "execution_count": 52, "id": "106", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:53:51.295966Z", "iopub.status.busy": "2026-01-06T13:53:51.295870Z", "iopub.status.idle": "2026-01-06T13:53:51.298749Z", "shell.execute_reply": "2026-01-06T13:53:51.298380Z" } }, "outputs": [], "source": [ "project.experiments['hrpt'].linked_phases['lbco'].scale.free = True\n", "project.experiments['hrpt'].instrument.calib_twotheta_offset.free = True\n", "project.experiments['hrpt'].background['10'].y.free = True\n", "project.experiments['hrpt'].background['30'].y.free = True\n", "project.experiments['hrpt'].background['50'].y.free = True\n", "project.experiments['hrpt'].background['110'].y.free = True\n", "project.experiments['hrpt'].background['165'].y.free = True" ] }, { "cell_type": "markdown", "id": "107", "metadata": {}, "source": [ "Show free parameters after selection." ] }, { "cell_type": "code", "execution_count": 53, "id": "108", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:53:51.300990Z", "iopub.status.busy": "2026-01-06T13:53:51.300831Z", "iopub.status.idle": "2026-01-06T13:53:51.623074Z", "shell.execute_reply": "2026-01-06T13:53:51.622623Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;34mFree parameters for both sample models \u001b[0m\u001b[1;34m(\u001b[0m\u001b[1;34m🧩 data blocks\u001b[0m\u001b[1;34m)\u001b[0m\u001b[1;34m and experiments \u001b[0m\u001b[1;34m(\u001b[0m\u001b[1;34m🔬 data blocks\u001b[0m\u001b[1;34m)\u001b[0m\n" ] }, { "data": { "application/javascript": [ "\n", " (function() {\n", " var isDark = false;\n", "\n", " // Check JupyterLab theme\n", " if (document.body.classList.contains('jp-mod-dark') || \n", " document.body.classList.contains('theme-dark') ||\n", " document.body.classList.contains('vscode-dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check theme attribute\n", " var themeAttr = document.body.getAttribute('data-jp-theme-name');\n", " if (themeAttr && themeAttr.includes('dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check computed background color\n", " var notebookEl = document.querySelector('.jp-Notebook') || \n", " document.querySelector('.notebook_app') ||\n", " document.body;\n", " if (notebookEl) {\n", " var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n", " var rgb = bgColor.match(/\\d+/g);\n", " if (rgb && rgb.length >= 3) {\n", " var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n", " if (brightness < 128) {\n", " isDark = true;\n", " }\n", " }\n", " }\n", "\n", " // Store result\n", " if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n", " IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n", " }\n", " })();\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " if (typeof IPython !== 'undefined' && IPython.notebook) {\n", " IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n", " (document.body.classList.contains('theme-dark') || \n", " document.body.classList.contains('jp-mod-dark') ||\n", " (document.body.getAttribute('data-jp-theme-name') && \n", " document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n", " }\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
 datablockcategoryentryparametervalueuncertaintyminmaxunits
1lbcocelllength_a3.88000-infinfÅ
2hrptlinked_phaseslbcoscale10.00000-infinf
3hrptinstrumenttwotheta_offset0.60000-infinfdeg
4hrptbackground10y170.00000-infinf
5hrptbackground30y170.00000-infinf
6hrptbackground50y170.00000-infinf
7hrptbackground110y170.00000-infinf
8hrptbackground165y170.00000-infinf
\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.analysis.show_free_params()" ] }, { "cell_type": "markdown", "id": "109", "metadata": {}, "source": [ "#### Run Fitting" ] }, { "cell_type": "code", "execution_count": 54, "id": "110", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:53:51.624830Z", "iopub.status.busy": "2026-01-06T13:53:51.624678Z", "iopub.status.idle": "2026-01-06T13:53:57.955255Z", "shell.execute_reply": "2026-01-06T13:53:57.949139Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;34mUsing experiment 🔬 \u001b[0m\u001b[32m'hrpt'\u001b[0m\u001b[1;34m for \u001b[0m\u001b[32m'single'\u001b[0m\u001b[1;34m fitting\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "🚀 Starting fit process with \u001b[32m'lmfit \u001b[0m\u001b[32m(\u001b[0m\u001b[32mleastsq\u001b[0m\u001b[32m)\u001b[0m\u001b[32m'\u001b[0m\u001b[33m...\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "📈 Goodness-of-fit \u001b[1m(\u001b[0mreduced χ²\u001b[1m)\u001b[0m change:\n" ] }, { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
 iterationχ²improvement [%]
11164.59
21233.4379.7% ↓
32113.2260.4% ↓
4305.7856.3% ↓
5393.1545.6% ↓
6773.14
\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " (function() {\n", " var isDark = false;\n", "\n", " // Check JupyterLab theme\n", " if (document.body.classList.contains('jp-mod-dark') || \n", " document.body.classList.contains('theme-dark') ||\n", " document.body.classList.contains('vscode-dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check theme attribute\n", " var themeAttr = document.body.getAttribute('data-jp-theme-name');\n", " if (themeAttr && themeAttr.includes('dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check computed background color\n", " var notebookEl = document.querySelector('.jp-Notebook') || \n", " document.querySelector('.notebook_app') ||\n", " document.body;\n", " if (notebookEl) {\n", " var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n", " var rgb = bgColor.match(/\\d+/g);\n", " if (rgb && rgb.length >= 3) {\n", " var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n", " if (brightness < 128) {\n", " isDark = true;\n", " }\n", " }\n", " }\n", "\n", " // Store result\n", " if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n", " IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n", " }\n", " })();\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " if (typeof IPython !== 'undefined' && IPython.notebook) {\n", " IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n", " (document.body.classList.contains('theme-dark') || \n", " document.body.classList.contains('jp-mod-dark') ||\n", " (document.body.getAttribute('data-jp-theme-name') && \n", " document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n", " }\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " (function() {\n", " var isDark = false;\n", "\n", " // Check JupyterLab theme\n", " if (document.body.classList.contains('jp-mod-dark') || \n", " document.body.classList.contains('theme-dark') ||\n", " document.body.classList.contains('vscode-dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check theme attribute\n", " var themeAttr = document.body.getAttribute('data-jp-theme-name');\n", " if (themeAttr && themeAttr.includes('dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check computed background color\n", " var notebookEl = document.querySelector('.jp-Notebook') || \n", " document.querySelector('.notebook_app') ||\n", " document.body;\n", " if (notebookEl) {\n", " var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n", " var rgb = bgColor.match(/\\d+/g);\n", " if (rgb && rgb.length >= 3) {\n", " var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n", " if (brightness < 128) {\n", " isDark = true;\n", " }\n", " }\n", " }\n", "\n", " // Store result\n", " if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n", " IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n", " }\n", " })();\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " if (typeof IPython !== 'undefined' && IPython.notebook) {\n", " IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n", " (document.body.classList.contains('theme-dark') || \n", " document.body.classList.contains('jp-mod-dark') ||\n", " (document.body.getAttribute('data-jp-theme-name') && \n", " document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n", " }\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " (function() {\n", " var isDark = false;\n", "\n", " // Check JupyterLab theme\n", " if (document.body.classList.contains('jp-mod-dark') || \n", " document.body.classList.contains('theme-dark') ||\n", " document.body.classList.contains('vscode-dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check theme attribute\n", " var themeAttr = document.body.getAttribute('data-jp-theme-name');\n", " if (themeAttr && themeAttr.includes('dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check computed background color\n", " var notebookEl = document.querySelector('.jp-Notebook') || \n", " document.querySelector('.notebook_app') ||\n", " document.body;\n", " if (notebookEl) {\n", " var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n", " var rgb = bgColor.match(/\\d+/g);\n", " if (rgb && rgb.length >= 3) {\n", " var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n", " if (brightness < 128) {\n", " isDark = true;\n", " }\n", " }\n", " }\n", "\n", " // Store result\n", " if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n", " IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n", " }\n", " })();\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " if (typeof IPython !== 'undefined' && IPython.notebook) {\n", " IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n", " (document.body.classList.contains('theme-dark') || \n", " document.body.classList.contains('jp-mod-dark') ||\n", " (document.body.getAttribute('data-jp-theme-name') && \n", " document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n", " }\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " (function() {\n", " var isDark = false;\n", "\n", " // Check JupyterLab theme\n", " if (document.body.classList.contains('jp-mod-dark') || \n", " document.body.classList.contains('theme-dark') ||\n", " document.body.classList.contains('vscode-dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check theme attribute\n", " var themeAttr = document.body.getAttribute('data-jp-theme-name');\n", " if (themeAttr && themeAttr.includes('dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check computed background color\n", " var notebookEl = document.querySelector('.jp-Notebook') || \n", " document.querySelector('.notebook_app') ||\n", " document.body;\n", " if (notebookEl) {\n", " var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n", " var rgb = bgColor.match(/\\d+/g);\n", " if (rgb && rgb.length >= 3) {\n", " var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n", " if (brightness < 128) {\n", " isDark = true;\n", " }\n", " }\n", " }\n", "\n", " // Store result\n", " if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n", " IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n", " }\n", " })();\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " if (typeof IPython !== 'undefined' && IPython.notebook) {\n", " IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n", " (document.body.classList.contains('theme-dark') || \n", " document.body.classList.contains('jp-mod-dark') ||\n", " (document.body.getAttribute('data-jp-theme-name') && \n", " document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n", " }\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " (function() {\n", " var isDark = false;\n", "\n", " // Check JupyterLab theme\n", " if (document.body.classList.contains('jp-mod-dark') || \n", " document.body.classList.contains('theme-dark') ||\n", " document.body.classList.contains('vscode-dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check theme attribute\n", " var themeAttr = document.body.getAttribute('data-jp-theme-name');\n", " if (themeAttr && themeAttr.includes('dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check computed background color\n", " var notebookEl = document.querySelector('.jp-Notebook') || \n", " document.querySelector('.notebook_app') ||\n", " document.body;\n", " if (notebookEl) {\n", " var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n", " var rgb = bgColor.match(/\\d+/g);\n", " if (rgb && rgb.length >= 3) {\n", " var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n", " if (brightness < 128) {\n", " isDark = true;\n", " }\n", " }\n", " }\n", "\n", " // Store result\n", " if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n", " IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n", " }\n", " })();\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " if (typeof IPython !== 'undefined' && IPython.notebook) {\n", " IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n", " (document.body.classList.contains('theme-dark') || \n", " document.body.classList.contains('jp-mod-dark') ||\n", " (document.body.getAttribute('data-jp-theme-name') && \n", " document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n", " }\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " (function() {\n", " var isDark = false;\n", "\n", " // Check JupyterLab theme\n", " if (document.body.classList.contains('jp-mod-dark') || \n", " document.body.classList.contains('theme-dark') ||\n", " document.body.classList.contains('vscode-dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check theme attribute\n", " var themeAttr = document.body.getAttribute('data-jp-theme-name');\n", " if (themeAttr && themeAttr.includes('dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check computed background color\n", " var notebookEl = document.querySelector('.jp-Notebook') || \n", " document.querySelector('.notebook_app') ||\n", " document.body;\n", " if (notebookEl) {\n", " var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n", " var rgb = bgColor.match(/\\d+/g);\n", " if (rgb && rgb.length >= 3) {\n", " var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n", " if (brightness < 128) {\n", " isDark = true;\n", " }\n", " }\n", " }\n", "\n", " // Store result\n", " if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n", " IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n", " }\n", " })();\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " if (typeof IPython !== 'undefined' && IPython.notebook) {\n", " IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n", " (document.body.classList.contains('theme-dark') || \n", " document.body.classList.contains('jp-mod-dark') ||\n", " (document.body.getAttribute('data-jp-theme-name') && \n", " document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n", " }\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " (function() {\n", " var isDark = false;\n", "\n", " // Check JupyterLab theme\n", " if (document.body.classList.contains('jp-mod-dark') || \n", " document.body.classList.contains('theme-dark') ||\n", " document.body.classList.contains('vscode-dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check theme attribute\n", " var themeAttr = document.body.getAttribute('data-jp-theme-name');\n", " if (themeAttr && themeAttr.includes('dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check computed background color\n", " var notebookEl = document.querySelector('.jp-Notebook') || \n", " document.querySelector('.notebook_app') ||\n", " document.body;\n", " if (notebookEl) {\n", " var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n", " var rgb = bgColor.match(/\\d+/g);\n", " if (rgb && rgb.length >= 3) {\n", " var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n", " if (brightness < 128) {\n", " isDark = true;\n", " }\n", " }\n", " }\n", "\n", " // Store result\n", " if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n", " IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n", " }\n", " })();\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " if (typeof IPython !== 'undefined' && IPython.notebook) {\n", " IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n", " (document.body.classList.contains('theme-dark') || \n", " document.body.classList.contains('jp-mod-dark') ||\n", " (document.body.getAttribute('data-jp-theme-name') && \n", " document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n", " }\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "🏆 Best goodness-of-fit \u001b[1m(\u001b[0mreduced χ²\u001b[1m)\u001b[0m is \u001b[1;36m3.14\u001b[0m at iteration \u001b[1;36m69\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "✅ Fitting complete.\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;34mFit results\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "✅ Success: \u001b[3;92mTrue\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "⏱️ Fitting time: \u001b[1;36m5.06\u001b[0m seconds\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "📏 Goodness-of-fit \u001b[1m(\u001b[0mreduced χ²\u001b[1m)\u001b[0m: \u001b[1;36m3.14\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "📏 R-factor \u001b[1m(\u001b[0mRf\u001b[1m)\u001b[0m: \u001b[1;36m8.42\u001b[0m%\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "📏 R-factor squared \u001b[1m(\u001b[0mRf²\u001b[1m)\u001b[0m: \u001b[1;36m11.79\u001b[0m%\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "📏 Weighted R-factor \u001b[1m(\u001b[0mwR\u001b[1m)\u001b[0m: \u001b[1;36m11.63\u001b[0m%\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "📈 Fitted parameters:\n" ] }, { "data": { "application/javascript": [ "\n", " (function() {\n", " var isDark = false;\n", "\n", " // Check JupyterLab theme\n", " if (document.body.classList.contains('jp-mod-dark') || \n", " document.body.classList.contains('theme-dark') ||\n", " document.body.classList.contains('vscode-dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check theme attribute\n", " var themeAttr = document.body.getAttribute('data-jp-theme-name');\n", " if (themeAttr && themeAttr.includes('dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check computed background color\n", " var notebookEl = document.querySelector('.jp-Notebook') || \n", " document.querySelector('.notebook_app') ||\n", " document.body;\n", " if (notebookEl) {\n", " var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n", " var rgb = bgColor.match(/\\d+/g);\n", " if (rgb && rgb.length >= 3) {\n", " var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n", " if (brightness < 128) {\n", " isDark = true;\n", " }\n", " }\n", " }\n", "\n", " // Store result\n", " if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n", " IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n", " }\n", " })();\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " if (typeof IPython !== 'undefined' && IPython.notebook) {\n", " IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n", " (document.body.classList.contains('theme-dark') || \n", " document.body.classList.contains('jp-mod-dark') ||\n", " (document.body.getAttribute('data-jp-theme-name') && \n", " document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n", " }\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
 datablockcategoryentryparameterstartfitteduncertaintyunitschange
1lbcocelllength_a3.88003.89100.0001Å0.28 % ↑
2hrptlinked_phaseslbcoscale10.00007.34090.035026.59 % ↓
3hrptinstrumenttwotheta_offset0.60000.62430.0018deg4.05 % ↑
4hrptbackground10y170.0000167.70662.13001.35 % ↓
5hrptbackground30y170.0000166.03381.54042.33 % ↓
6hrptbackground50y170.0000169.94951.10250.03 % ↓
7hrptbackground110y170.0000170.08020.97880.05 % ↑
8hrptbackground165y170.0000179.66561.32895.69 % ↑
\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.analysis.fit()\n", "project.analysis.show_fit_results()" ] }, { "cell_type": "markdown", "id": "111", "metadata": {}, "source": [ "#### Plot Measured vs Calculated" ] }, { "cell_type": "code", "execution_count": 55, "id": "112", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:53:57.973462Z", "iopub.status.busy": "2026-01-06T13:53:57.973269Z", "iopub.status.idle": "2026-01-06T13:53:58.417557Z", "shell.execute_reply": "2026-01-06T13:53:58.403909Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.plot_meas_vs_calc(expt_name='hrpt', show_residual=True)" ] }, { "cell_type": "code", "execution_count": 56, "id": "113", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:53:58.426664Z", "iopub.status.busy": "2026-01-06T13:53:58.426493Z", "iopub.status.idle": "2026-01-06T13:53:58.805744Z", "shell.execute_reply": "2026-01-06T13:53:58.804447Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.plot_meas_vs_calc(expt_name='hrpt', x_min=38, x_max=41, show_residual=True)" ] }, { "cell_type": "markdown", "id": "114", "metadata": {}, "source": [ "#### Save Project State" ] }, { "cell_type": "code", "execution_count": 57, "id": "115", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:53:58.808510Z", "iopub.status.busy": "2026-01-06T13:53:58.808140Z", "iopub.status.idle": "2026-01-06T13:53:58.840943Z", "shell.execute_reply": "2026-01-06T13:53:58.839574Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;34mSaving project 📦 \u001b[0m\u001b[32m'lbco_hrpt'\u001b[0m\u001b[1;34m to\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\u001b[35m/private/var/folders/sm/xrr7tmqj20s7hrsh1qhfl1d40000gn/T/\u001b[0m\u001b[95mlbco_hrpt\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "├── 📄 project.cif\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "├── 📁 sample_models\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "│ └── 📄 lbco.cif\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "├── 📁 experiments\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "│ └── 📄 hrpt.cif\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "├── 📄 analysis.cif\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "└── 📄 summary.cif\n" ] } ], "source": [ "project.save_as(dir_path='lbco_hrpt', temporary=True)" ] }, { "cell_type": "markdown", "id": "116", "metadata": {}, "source": [ "### Perform Fit 2/5\n", "\n", "Set more parameters to be refined." ] }, { "cell_type": "code", "execution_count": 58, "id": "117", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:53:58.845278Z", "iopub.status.busy": "2026-01-06T13:53:58.844767Z", "iopub.status.idle": "2026-01-06T13:53:58.850595Z", "shell.execute_reply": "2026-01-06T13:53:58.849497Z" } }, "outputs": [], "source": [ "project.experiments['hrpt'].peak.broad_gauss_u.free = True\n", "project.experiments['hrpt'].peak.broad_gauss_v.free = True\n", "project.experiments['hrpt'].peak.broad_gauss_w.free = True\n", "project.experiments['hrpt'].peak.broad_lorentz_y.free = True" ] }, { "cell_type": "markdown", "id": "118", "metadata": {}, "source": [ "Show free parameters after selection." ] }, { "cell_type": "code", "execution_count": 59, "id": "119", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:53:58.852595Z", "iopub.status.busy": "2026-01-06T13:53:58.852442Z", "iopub.status.idle": "2026-01-06T13:53:59.199726Z", "shell.execute_reply": "2026-01-06T13:53:59.197953Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;34mFree parameters for both sample models \u001b[0m\u001b[1;34m(\u001b[0m\u001b[1;34m🧩 data blocks\u001b[0m\u001b[1;34m)\u001b[0m\u001b[1;34m and experiments \u001b[0m\u001b[1;34m(\u001b[0m\u001b[1;34m🔬 data blocks\u001b[0m\u001b[1;34m)\u001b[0m\n" ] }, { "data": { "application/javascript": [ "\n", " (function() {\n", " var isDark = false;\n", "\n", " // Check JupyterLab theme\n", " if (document.body.classList.contains('jp-mod-dark') || \n", " document.body.classList.contains('theme-dark') ||\n", " document.body.classList.contains('vscode-dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check theme attribute\n", " var themeAttr = document.body.getAttribute('data-jp-theme-name');\n", " if (themeAttr && themeAttr.includes('dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check computed background color\n", " var notebookEl = document.querySelector('.jp-Notebook') || \n", " document.querySelector('.notebook_app') ||\n", " document.body;\n", " if (notebookEl) {\n", " var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n", " var rgb = bgColor.match(/\\d+/g);\n", " if (rgb && rgb.length >= 3) {\n", " var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n", " if (brightness < 128) {\n", " isDark = true;\n", " }\n", " }\n", " }\n", "\n", " // Store result\n", " if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n", " IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n", " }\n", " })();\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " if (typeof IPython !== 'undefined' && IPython.notebook) {\n", " IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n", " (document.body.classList.contains('theme-dark') || \n", " document.body.classList.contains('jp-mod-dark') ||\n", " (document.body.getAttribute('data-jp-theme-name') && \n", " document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n", " }\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
 datablockcategoryentryparametervalueuncertaintyminmaxunits
1lbcocelllength_a3.890990.00006-infinfÅ
2hrptlinked_phaseslbcoscale7.340880.03496-infinf
3hrptpeakbroad_gauss_u0.10000-infinfdeg²
4hrptpeakbroad_gauss_v-0.10000-infinfdeg²
5hrptpeakbroad_gauss_w0.10000-infinfdeg²
6hrptpeakbroad_lorentz_y0.10000-infinfdeg
7hrptinstrumenttwotheta_offset0.624320.00181-infinfdeg
8hrptbackground10y167.706622.13004-infinf
9hrptbackground30y166.033831.54041-infinf
10hrptbackground50y169.949491.10249-infinf
11hrptbackground110y170.080230.97879-infinf
12hrptbackground165y179.665571.32895-infinf
\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.analysis.show_free_params()" ] }, { "cell_type": "markdown", "id": "120", "metadata": {}, "source": [ "#### Run Fitting" ] }, { "cell_type": "code", "execution_count": 60, "id": "121", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:53:59.203533Z", "iopub.status.busy": "2026-01-06T13:53:59.202034Z", "iopub.status.idle": "2026-01-06T13:54:03.457257Z", "shell.execute_reply": "2026-01-06T13:54:03.456682Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;34mUsing experiment 🔬 \u001b[0m\u001b[32m'hrpt'\u001b[0m\u001b[1;34m for \u001b[0m\u001b[32m'single'\u001b[0m\u001b[1;34m fitting\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "🚀 Starting fit process with \u001b[32m'lmfit \u001b[0m\u001b[32m(\u001b[0m\u001b[32mleastsq\u001b[0m\u001b[32m)\u001b[0m\u001b[32m'\u001b[0m\u001b[33m...\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "📈 Goodness-of-fit \u001b[1m(\u001b[0mreduced χ²\u001b[1m)\u001b[0m change:\n" ] }, { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
 iterationχ²improvement [%]
113.14
2162.859.1% ↓
3692.85
\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " (function() {\n", " var isDark = false;\n", "\n", " // Check JupyterLab theme\n", " if (document.body.classList.contains('jp-mod-dark') || \n", " document.body.classList.contains('theme-dark') ||\n", " document.body.classList.contains('vscode-dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check theme attribute\n", " var themeAttr = document.body.getAttribute('data-jp-theme-name');\n", " if (themeAttr && themeAttr.includes('dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check computed background color\n", " var notebookEl = document.querySelector('.jp-Notebook') || \n", " document.querySelector('.notebook_app') ||\n", " document.body;\n", " if (notebookEl) {\n", " var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n", " var rgb = bgColor.match(/\\d+/g);\n", " if (rgb && rgb.length >= 3) {\n", " var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n", " if (brightness < 128) {\n", " isDark = true;\n", " }\n", " }\n", " }\n", "\n", " // Store result\n", " if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n", " IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n", " }\n", " })();\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " if (typeof IPython !== 'undefined' && IPython.notebook) {\n", " IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n", " (document.body.classList.contains('theme-dark') || \n", " document.body.classList.contains('jp-mod-dark') ||\n", " (document.body.getAttribute('data-jp-theme-name') && \n", " document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n", " }\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " (function() {\n", " var isDark = false;\n", "\n", " // Check JupyterLab theme\n", " if (document.body.classList.contains('jp-mod-dark') || \n", " document.body.classList.contains('theme-dark') ||\n", " document.body.classList.contains('vscode-dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check theme attribute\n", " var themeAttr = document.body.getAttribute('data-jp-theme-name');\n", " if (themeAttr && themeAttr.includes('dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check computed background color\n", " var notebookEl = document.querySelector('.jp-Notebook') || \n", " document.querySelector('.notebook_app') ||\n", " document.body;\n", " if (notebookEl) {\n", " var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n", " var rgb = bgColor.match(/\\d+/g);\n", " if (rgb && rgb.length >= 3) {\n", " var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n", " if (brightness < 128) {\n", " isDark = true;\n", " }\n", " }\n", " }\n", "\n", " // Store result\n", " if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n", " IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n", " }\n", " })();\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " if (typeof IPython !== 'undefined' && IPython.notebook) {\n", " IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n", " (document.body.classList.contains('theme-dark') || \n", " document.body.classList.contains('jp-mod-dark') ||\n", " (document.body.getAttribute('data-jp-theme-name') && \n", " document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n", " }\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " (function() {\n", " var isDark = false;\n", "\n", " // Check JupyterLab theme\n", " if (document.body.classList.contains('jp-mod-dark') || \n", " document.body.classList.contains('theme-dark') ||\n", " document.body.classList.contains('vscode-dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check theme attribute\n", " var themeAttr = document.body.getAttribute('data-jp-theme-name');\n", " if (themeAttr && themeAttr.includes('dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check computed background color\n", " var notebookEl = document.querySelector('.jp-Notebook') || \n", " document.querySelector('.notebook_app') ||\n", " document.body;\n", " if (notebookEl) {\n", " var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n", " var rgb = bgColor.match(/\\d+/g);\n", " if (rgb && rgb.length >= 3) {\n", " var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n", " if (brightness < 128) {\n", " isDark = true;\n", " }\n", " }\n", " }\n", "\n", " // Store result\n", " if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n", " IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n", " }\n", " })();\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " if (typeof IPython !== 'undefined' && IPython.notebook) {\n", " IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n", " (document.body.classList.contains('theme-dark') || \n", " document.body.classList.contains('jp-mod-dark') ||\n", " (document.body.getAttribute('data-jp-theme-name') && \n", " document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n", " }\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " (function() {\n", " var isDark = false;\n", "\n", " // Check JupyterLab theme\n", " if (document.body.classList.contains('jp-mod-dark') || \n", " document.body.classList.contains('theme-dark') ||\n", " document.body.classList.contains('vscode-dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check theme attribute\n", " var themeAttr = document.body.getAttribute('data-jp-theme-name');\n", " if (themeAttr && themeAttr.includes('dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check computed background color\n", " var notebookEl = document.querySelector('.jp-Notebook') || \n", " document.querySelector('.notebook_app') ||\n", " document.body;\n", " if (notebookEl) {\n", " var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n", " var rgb = bgColor.match(/\\d+/g);\n", " if (rgb && rgb.length >= 3) {\n", " var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n", " if (brightness < 128) {\n", " isDark = true;\n", " }\n", " }\n", " }\n", "\n", " // Store result\n", " if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n", " IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n", " }\n", " })();\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " if (typeof IPython !== 'undefined' && IPython.notebook) {\n", " IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n", " (document.body.classList.contains('theme-dark') || \n", " document.body.classList.contains('jp-mod-dark') ||\n", " (document.body.getAttribute('data-jp-theme-name') && \n", " document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n", " }\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "🏆 Best goodness-of-fit \u001b[1m(\u001b[0mreduced χ²\u001b[1m)\u001b[0m is \u001b[1;36m2.85\u001b[0m at iteration \u001b[1;36m68\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "✅ Fitting complete.\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;34mFit results\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "✅ Success: \u001b[3;92mTrue\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "⏱️ Fitting time: \u001b[1;36m2.94\u001b[0m seconds\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "📏 Goodness-of-fit \u001b[1m(\u001b[0mreduced χ²\u001b[1m)\u001b[0m: \u001b[1;36m2.85\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "📏 R-factor \u001b[1m(\u001b[0mRf\u001b[1m)\u001b[0m: \u001b[1;36m8.30\u001b[0m%\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "📏 R-factor squared \u001b[1m(\u001b[0mRf²\u001b[1m)\u001b[0m: \u001b[1;36m11.85\u001b[0m%\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "📏 Weighted R-factor \u001b[1m(\u001b[0mwR\u001b[1m)\u001b[0m: \u001b[1;36m11.90\u001b[0m%\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "📈 Fitted parameters:\n" ] }, { "data": { "application/javascript": [ "\n", " (function() {\n", " var isDark = false;\n", "\n", " // Check JupyterLab theme\n", " if (document.body.classList.contains('jp-mod-dark') || \n", " document.body.classList.contains('theme-dark') ||\n", " document.body.classList.contains('vscode-dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check theme attribute\n", " var themeAttr = document.body.getAttribute('data-jp-theme-name');\n", " if (themeAttr && themeAttr.includes('dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check computed background color\n", " var notebookEl = document.querySelector('.jp-Notebook') || \n", " document.querySelector('.notebook_app') ||\n", " document.body;\n", " if (notebookEl) {\n", " var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n", " var rgb = bgColor.match(/\\d+/g);\n", " if (rgb && rgb.length >= 3) {\n", " var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n", " if (brightness < 128) {\n", " isDark = true;\n", " }\n", " }\n", " }\n", "\n", " // Store result\n", " if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n", " IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n", " }\n", " })();\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " if (typeof IPython !== 'undefined' && IPython.notebook) {\n", " IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n", " (document.body.classList.contains('theme-dark') || \n", " document.body.classList.contains('jp-mod-dark') ||\n", " (document.body.getAttribute('data-jp-theme-name') && \n", " document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n", " }\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
 datablockcategoryentryparameterstartfitteduncertaintyunitschange
1lbcocelllength_a3.89103.89090.0001Å0.00 % ↓
2hrptlinked_phaseslbcoscale7.34097.21200.04061.76 % ↓
3hrptpeakbroad_gauss_u0.10000.08030.0047deg²19.74 % ↓
4hrptpeakbroad_gauss_v-0.1000-0.10290.0104deg²2.93 % ↑
5hrptpeakbroad_gauss_w0.10000.10770.0051deg²7.66 % ↑
6hrptpeakbroad_lorentz_y0.10000.08930.0032deg10.67 % ↓
7hrptinstrumenttwotheta_offset0.62430.62310.0017deg0.19 % ↓
8hrptbackground10y167.7066167.51672.03110.11 % ↓
9hrptbackground30y166.0338166.76271.47940.44 % ↑
10hrptbackground50y169.9495170.83301.08080.52 % ↑
11hrptbackground110y170.0802172.25460.96601.28 % ↑
12hrptbackground165y179.6656180.64051.27370.54 % ↑
\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.analysis.fit()\n", "project.analysis.show_fit_results()" ] }, { "cell_type": "markdown", "id": "122", "metadata": {}, "source": [ "#### Plot Measured vs Calculated" ] }, { "cell_type": "code", "execution_count": 61, "id": "123", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:54:03.459953Z", "iopub.status.busy": "2026-01-06T13:54:03.459723Z", "iopub.status.idle": "2026-01-06T13:54:03.796642Z", "shell.execute_reply": "2026-01-06T13:54:03.794393Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.plot_meas_vs_calc(expt_name='hrpt', show_residual=True)" ] }, { "cell_type": "code", "execution_count": 62, "id": "124", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:54:03.799721Z", "iopub.status.busy": "2026-01-06T13:54:03.799272Z", "iopub.status.idle": "2026-01-06T13:54:04.354992Z", "shell.execute_reply": "2026-01-06T13:54:04.353951Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.plot_meas_vs_calc(expt_name='hrpt', x_min=38, x_max=41, show_residual=True)" ] }, { "cell_type": "markdown", "id": "125", "metadata": {}, "source": [ "#### Save Project State" ] }, { "cell_type": "code", "execution_count": 63, "id": "126", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:54:04.358586Z", "iopub.status.busy": "2026-01-06T13:54:04.358422Z", "iopub.status.idle": "2026-01-06T13:54:04.396219Z", "shell.execute_reply": "2026-01-06T13:54:04.395419Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;34mSaving project 📦 \u001b[0m\u001b[32m'lbco_hrpt'\u001b[0m\u001b[1;34m to\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\u001b[35m/private/var/folders/sm/xrr7tmqj20s7hrsh1qhfl1d40000gn/T/\u001b[0m\u001b[95mlbco_hrpt\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "├── 📄 project.cif\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "├── 📁 sample_models\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "│ └── 📄 lbco.cif\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "├── 📁 experiments\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "│ └── 📄 hrpt.cif\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "├── 📄 analysis.cif\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "└── 📄 summary.cif\n" ] } ], "source": [ "project.save_as(dir_path='lbco_hrpt', temporary=True)" ] }, { "cell_type": "markdown", "id": "127", "metadata": {}, "source": [ "### Perform Fit 3/5\n", "\n", "Set more parameters to be refined." ] }, { "cell_type": "code", "execution_count": 64, "id": "128", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:54:04.402079Z", "iopub.status.busy": "2026-01-06T13:54:04.401864Z", "iopub.status.idle": "2026-01-06T13:54:04.406889Z", "shell.execute_reply": "2026-01-06T13:54:04.406278Z" } }, "outputs": [], "source": [ "project.sample_models['lbco'].atom_sites['La'].b_iso.free = True\n", "project.sample_models['lbco'].atom_sites['Ba'].b_iso.free = True\n", "project.sample_models['lbco'].atom_sites['Co'].b_iso.free = True\n", "project.sample_models['lbco'].atom_sites['O'].b_iso.free = True" ] }, { "cell_type": "markdown", "id": "129", "metadata": {}, "source": [ "Show free parameters after selection." ] }, { "cell_type": "code", "execution_count": 65, "id": "130", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:54:04.409513Z", "iopub.status.busy": "2026-01-06T13:54:04.409202Z", "iopub.status.idle": "2026-01-06T13:54:04.696924Z", "shell.execute_reply": "2026-01-06T13:54:04.696548Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;34mFree parameters for both sample models \u001b[0m\u001b[1;34m(\u001b[0m\u001b[1;34m🧩 data blocks\u001b[0m\u001b[1;34m)\u001b[0m\u001b[1;34m and experiments \u001b[0m\u001b[1;34m(\u001b[0m\u001b[1;34m🔬 data blocks\u001b[0m\u001b[1;34m)\u001b[0m\n" ] }, { "data": { "application/javascript": [ "\n", " (function() {\n", " var isDark = false;\n", "\n", " // Check JupyterLab theme\n", " if (document.body.classList.contains('jp-mod-dark') || \n", " document.body.classList.contains('theme-dark') ||\n", " document.body.classList.contains('vscode-dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check theme attribute\n", " var themeAttr = document.body.getAttribute('data-jp-theme-name');\n", " if (themeAttr && themeAttr.includes('dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check computed background color\n", " var notebookEl = document.querySelector('.jp-Notebook') || \n", " document.querySelector('.notebook_app') ||\n", " document.body;\n", " if (notebookEl) {\n", " var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n", " var rgb = bgColor.match(/\\d+/g);\n", " if (rgb && rgb.length >= 3) {\n", " var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n", " if (brightness < 128) {\n", " isDark = true;\n", " }\n", " }\n", " }\n", "\n", " // Store result\n", " if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n", " IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n", " }\n", " })();\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " if (typeof IPython !== 'undefined' && IPython.notebook) {\n", " IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n", " (document.body.classList.contains('theme-dark') || \n", " document.body.classList.contains('jp-mod-dark') ||\n", " (document.body.getAttribute('data-jp-theme-name') && \n", " document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n", " }\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
 datablockcategoryentryparametervalueuncertaintyminmaxunits
1lbcocelllength_a3.890910.00005-infinfÅ
2lbcoatom_siteLab_iso0.50000-infinfŲ
3lbcoatom_siteBab_iso0.50000-infinfŲ
4lbcoatom_siteCob_iso0.50000-infinfŲ
5lbcoatom_siteOb_iso0.50000-infinfŲ
6hrptlinked_phaseslbcoscale7.211990.04057-infinf
7hrptpeakbroad_gauss_u0.080260.00472-infinfdeg²
8hrptpeakbroad_gauss_v-0.102930.01036-infinfdeg²
9hrptpeakbroad_gauss_w0.107660.00515-infinfdeg²
10hrptpeakbroad_lorentz_y0.089330.00320-infinfdeg
11hrptinstrumenttwotheta_offset0.623140.00167-infinfdeg
12hrptbackground10y167.516692.03112-infinf
13hrptbackground30y166.762681.47937-infinf
14hrptbackground50y170.833051.08080-infinf
15hrptbackground110y172.254580.96599-infinf
16hrptbackground165y180.640541.27368-infinf
\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.analysis.show_free_params()" ] }, { "cell_type": "markdown", "id": "131", "metadata": {}, "source": [ "#### Run Fitting" ] }, { "cell_type": "code", "execution_count": 66, "id": "132", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:54:04.698864Z", "iopub.status.busy": "2026-01-06T13:54:04.698737Z", "iopub.status.idle": "2026-01-06T13:54:16.779179Z", "shell.execute_reply": "2026-01-06T13:54:16.778734Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;34mUsing experiment 🔬 \u001b[0m\u001b[32m'hrpt'\u001b[0m\u001b[1;34m for \u001b[0m\u001b[32m'single'\u001b[0m\u001b[1;34m fitting\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "🚀 Starting fit process with \u001b[32m'lmfit \u001b[0m\u001b[32m(\u001b[0m\u001b[32mleastsq\u001b[0m\u001b[32m)\u001b[0m\u001b[32m'\u001b[0m\u001b[33m...\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "📈 Goodness-of-fit \u001b[1m(\u001b[0mreduced χ²\u001b[1m)\u001b[0m change:\n" ] }, { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
 iterationχ²improvement [%]
112.85
2282.2819.9% ↓
3451.6228.9% ↓
4621.479.6% ↓
5791.367.0% ↓
6971.295.4% ↓
72041.29
\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " (function() {\n", " var isDark = false;\n", "\n", " // Check JupyterLab theme\n", " if (document.body.classList.contains('jp-mod-dark') || \n", " document.body.classList.contains('theme-dark') ||\n", " document.body.classList.contains('vscode-dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check theme attribute\n", " var themeAttr = document.body.getAttribute('data-jp-theme-name');\n", " if (themeAttr && themeAttr.includes('dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check computed background color\n", " var notebookEl = document.querySelector('.jp-Notebook') || \n", " document.querySelector('.notebook_app') ||\n", " document.body;\n", " if (notebookEl) {\n", " var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n", " var rgb = bgColor.match(/\\d+/g);\n", " if (rgb && rgb.length >= 3) {\n", " var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n", " if (brightness < 128) {\n", " isDark = true;\n", " }\n", " }\n", " }\n", "\n", " // Store result\n", " if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n", " IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n", " }\n", " })();\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " if (typeof IPython !== 'undefined' && IPython.notebook) {\n", " IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n", " (document.body.classList.contains('theme-dark') || \n", " document.body.classList.contains('jp-mod-dark') ||\n", " (document.body.getAttribute('data-jp-theme-name') && \n", " document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n", " }\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " (function() {\n", " var isDark = false;\n", "\n", " // Check JupyterLab theme\n", " if (document.body.classList.contains('jp-mod-dark') || \n", " document.body.classList.contains('theme-dark') ||\n", " document.body.classList.contains('vscode-dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check theme attribute\n", " var themeAttr = document.body.getAttribute('data-jp-theme-name');\n", " if (themeAttr && themeAttr.includes('dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check computed background color\n", " var notebookEl = document.querySelector('.jp-Notebook') || \n", " document.querySelector('.notebook_app') ||\n", " document.body;\n", " if (notebookEl) {\n", " var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n", " var rgb = bgColor.match(/\\d+/g);\n", " if (rgb && rgb.length >= 3) {\n", " var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n", " if (brightness < 128) {\n", " isDark = true;\n", " }\n", " }\n", " }\n", "\n", " // Store result\n", " if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n", " IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n", " }\n", " })();\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " if (typeof IPython !== 'undefined' && IPython.notebook) {\n", " IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n", " (document.body.classList.contains('theme-dark') || \n", " document.body.classList.contains('jp-mod-dark') ||\n", " (document.body.getAttribute('data-jp-theme-name') && \n", " document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n", " }\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " (function() {\n", " var isDark = false;\n", "\n", " // Check JupyterLab theme\n", " if (document.body.classList.contains('jp-mod-dark') || \n", " document.body.classList.contains('theme-dark') ||\n", " document.body.classList.contains('vscode-dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check theme attribute\n", " var themeAttr = document.body.getAttribute('data-jp-theme-name');\n", " if (themeAttr && themeAttr.includes('dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check computed background color\n", " var notebookEl = document.querySelector('.jp-Notebook') || \n", " document.querySelector('.notebook_app') ||\n", " document.body;\n", " if (notebookEl) {\n", " var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n", " var rgb = bgColor.match(/\\d+/g);\n", " if (rgb && rgb.length >= 3) {\n", " var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n", " if (brightness < 128) {\n", " isDark = true;\n", " }\n", " }\n", " }\n", "\n", " // Store result\n", " if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n", " IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n", " }\n", " })();\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " if (typeof IPython !== 'undefined' && IPython.notebook) {\n", " IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n", " (document.body.classList.contains('theme-dark') || \n", " document.body.classList.contains('jp-mod-dark') ||\n", " (document.body.getAttribute('data-jp-theme-name') && \n", " document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n", " }\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " (function() {\n", " var isDark = false;\n", "\n", " // Check JupyterLab theme\n", " if (document.body.classList.contains('jp-mod-dark') || \n", " document.body.classList.contains('theme-dark') ||\n", " document.body.classList.contains('vscode-dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check theme attribute\n", " var themeAttr = document.body.getAttribute('data-jp-theme-name');\n", " if (themeAttr && themeAttr.includes('dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check computed background color\n", " var notebookEl = document.querySelector('.jp-Notebook') || \n", " document.querySelector('.notebook_app') ||\n", " document.body;\n", " if (notebookEl) {\n", " var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n", " var rgb = bgColor.match(/\\d+/g);\n", " if (rgb && rgb.length >= 3) {\n", " var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n", " if (brightness < 128) {\n", " isDark = true;\n", " }\n", " }\n", " }\n", "\n", " // Store result\n", " if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n", " IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n", " }\n", " })();\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " if (typeof IPython !== 'undefined' && IPython.notebook) {\n", " IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n", " (document.body.classList.contains('theme-dark') || \n", " document.body.classList.contains('jp-mod-dark') ||\n", " (document.body.getAttribute('data-jp-theme-name') && \n", " document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n", " }\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " (function() {\n", " var isDark = false;\n", "\n", " // Check JupyterLab theme\n", " if (document.body.classList.contains('jp-mod-dark') || \n", " document.body.classList.contains('theme-dark') ||\n", " document.body.classList.contains('vscode-dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check theme attribute\n", " var themeAttr = document.body.getAttribute('data-jp-theme-name');\n", " if (themeAttr && themeAttr.includes('dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check computed background color\n", " var notebookEl = document.querySelector('.jp-Notebook') || \n", " document.querySelector('.notebook_app') ||\n", " document.body;\n", " if (notebookEl) {\n", " var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n", " var rgb = bgColor.match(/\\d+/g);\n", " if (rgb && rgb.length >= 3) {\n", " var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n", " if (brightness < 128) {\n", " isDark = true;\n", " }\n", " }\n", " }\n", "\n", " // Store result\n", " if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n", " IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n", " }\n", " })();\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " if (typeof IPython !== 'undefined' && IPython.notebook) {\n", " IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n", " (document.body.classList.contains('theme-dark') || \n", " document.body.classList.contains('jp-mod-dark') ||\n", " (document.body.getAttribute('data-jp-theme-name') && \n", " document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n", " }\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " (function() {\n", " var isDark = false;\n", "\n", " // Check JupyterLab theme\n", " if (document.body.classList.contains('jp-mod-dark') || \n", " document.body.classList.contains('theme-dark') ||\n", " document.body.classList.contains('vscode-dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check theme attribute\n", " var themeAttr = document.body.getAttribute('data-jp-theme-name');\n", " if (themeAttr && themeAttr.includes('dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check computed background color\n", " var notebookEl = document.querySelector('.jp-Notebook') || \n", " document.querySelector('.notebook_app') ||\n", " document.body;\n", " if (notebookEl) {\n", " var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n", " var rgb = bgColor.match(/\\d+/g);\n", " if (rgb && rgb.length >= 3) {\n", " var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n", " if (brightness < 128) {\n", " isDark = true;\n", " }\n", " }\n", " }\n", "\n", " // Store result\n", " if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n", " IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n", " }\n", " })();\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " if (typeof IPython !== 'undefined' && IPython.notebook) {\n", " IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n", " (document.body.classList.contains('theme-dark') || \n", " document.body.classList.contains('jp-mod-dark') ||\n", " (document.body.getAttribute('data-jp-theme-name') && \n", " document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n", " }\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " (function() {\n", " var isDark = false;\n", "\n", " // Check JupyterLab theme\n", " if (document.body.classList.contains('jp-mod-dark') || \n", " document.body.classList.contains('theme-dark') ||\n", " document.body.classList.contains('vscode-dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check theme attribute\n", " var themeAttr = document.body.getAttribute('data-jp-theme-name');\n", " if (themeAttr && themeAttr.includes('dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check computed background color\n", " var notebookEl = document.querySelector('.jp-Notebook') || \n", " document.querySelector('.notebook_app') ||\n", " document.body;\n", " if (notebookEl) {\n", " var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n", " var rgb = bgColor.match(/\\d+/g);\n", " if (rgb && rgb.length >= 3) {\n", " var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n", " if (brightness < 128) {\n", " isDark = true;\n", " }\n", " }\n", " }\n", "\n", " // Store result\n", " if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n", " IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n", " }\n", " })();\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " if (typeof IPython !== 'undefined' && IPython.notebook) {\n", " IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n", " (document.body.classList.contains('theme-dark') || \n", " document.body.classList.contains('jp-mod-dark') ||\n", " (document.body.getAttribute('data-jp-theme-name') && \n", " document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n", " }\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " (function() {\n", " var isDark = false;\n", "\n", " // Check JupyterLab theme\n", " if (document.body.classList.contains('jp-mod-dark') || \n", " document.body.classList.contains('theme-dark') ||\n", " document.body.classList.contains('vscode-dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check theme attribute\n", " var themeAttr = document.body.getAttribute('data-jp-theme-name');\n", " if (themeAttr && themeAttr.includes('dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check computed background color\n", " var notebookEl = document.querySelector('.jp-Notebook') || \n", " document.querySelector('.notebook_app') ||\n", " document.body;\n", " if (notebookEl) {\n", " var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n", " var rgb = bgColor.match(/\\d+/g);\n", " if (rgb && rgb.length >= 3) {\n", " var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n", " if (brightness < 128) {\n", " isDark = true;\n", " }\n", " }\n", " }\n", "\n", " // Store result\n", " if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n", " IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n", " }\n", " })();\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " if (typeof IPython !== 'undefined' && IPython.notebook) {\n", " IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n", " (document.body.classList.contains('theme-dark') || \n", " document.body.classList.contains('jp-mod-dark') ||\n", " (document.body.getAttribute('data-jp-theme-name') && \n", " document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n", " }\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "🏆 Best goodness-of-fit \u001b[1m(\u001b[0mreduced χ²\u001b[1m)\u001b[0m is \u001b[1;36m1.29\u001b[0m at iteration \u001b[1;36m187\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "✅ Fitting complete.\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;34mFit results\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "✅ Success: \u001b[3;92mTrue\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "⏱️ Fitting time: \u001b[1;36m10.67\u001b[0m seconds\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "📏 Goodness-of-fit \u001b[1m(\u001b[0mreduced χ²\u001b[1m)\u001b[0m: \u001b[1;36m1.29\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "📏 R-factor \u001b[1m(\u001b[0mRf\u001b[1m)\u001b[0m: \u001b[1;36m5.65\u001b[0m%\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "📏 R-factor squared \u001b[1m(\u001b[0mRf²\u001b[1m)\u001b[0m: \u001b[1;36m5.30\u001b[0m%\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "📏 Weighted R-factor \u001b[1m(\u001b[0mwR\u001b[1m)\u001b[0m: \u001b[1;36m4.47\u001b[0m%\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "📈 Fitted parameters:\n" ] }, { "data": { "application/javascript": [ "\n", " (function() {\n", " var isDark = false;\n", "\n", " // Check JupyterLab theme\n", " if (document.body.classList.contains('jp-mod-dark') || \n", " document.body.classList.contains('theme-dark') ||\n", " document.body.classList.contains('vscode-dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check theme attribute\n", " var themeAttr = document.body.getAttribute('data-jp-theme-name');\n", " if (themeAttr && themeAttr.includes('dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check computed background color\n", " var notebookEl = document.querySelector('.jp-Notebook') || \n", " document.querySelector('.notebook_app') ||\n", " document.body;\n", " if (notebookEl) {\n", " var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n", " var rgb = bgColor.match(/\\d+/g);\n", " if (rgb && rgb.length >= 3) {\n", " var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n", " if (brightness < 128) {\n", " isDark = true;\n", " }\n", " }\n", " }\n", "\n", " // Store result\n", " if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n", " IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n", " }\n", " })();\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " if (typeof IPython !== 'undefined' && IPython.notebook) {\n", " IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n", " (document.body.classList.contains('theme-dark') || \n", " document.body.classList.contains('jp-mod-dark') ||\n", " (document.body.getAttribute('data-jp-theme-name') && \n", " document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n", " }\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
 datablockcategoryentryparameterstartfitteduncertaintyunitschange
1lbcocelllength_a3.89093.89090.0000Å0.00 % ↓
2lbcoatom_siteLab_iso0.50000.50511216.0511Ų1.02 % ↑
3lbcoatom_siteBab_iso0.50000.50481976.1818Ų0.96 % ↑
4lbcoatom_siteCob_iso0.50000.23710.0612Ų52.59 % ↓
5lbcoatom_siteOb_iso0.50001.39350.0167Ų178.71 % ↑
6hrptlinked_phaseslbcoscale7.21209.13500.064126.66 % ↑
7hrptpeakbroad_gauss_u0.08030.08160.0031deg²1.63 % ↑
8hrptpeakbroad_gauss_v-0.1029-0.11590.0067deg²12.62 % ↑
9hrptpeakbroad_gauss_w0.10770.12040.0033deg²11.88 % ↑
10hrptpeakbroad_lorentz_y0.08930.08440.0021deg5.47 % ↓
11hrptinstrumenttwotheta_offset0.62310.62260.0010deg0.09 % ↓
12hrptbackground10y167.5167168.55851.36710.62 % ↑
13hrptbackground30y166.7627164.33570.99921.46 % ↓
14hrptbackground50y170.8330166.88810.73882.31 % ↓
15hrptbackground110y172.2546175.40040.65711.83 % ↑
16hrptbackground165y180.6405174.28110.91133.52 % ↓
\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.analysis.fit()\n", "project.analysis.show_fit_results()" ] }, { "cell_type": "markdown", "id": "133", "metadata": {}, "source": [ "#### Plot Measured vs Calculated" ] }, { "cell_type": "code", "execution_count": 67, "id": "134", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:54:16.781623Z", "iopub.status.busy": "2026-01-06T13:54:16.781465Z", "iopub.status.idle": "2026-01-06T13:54:17.136295Z", "shell.execute_reply": "2026-01-06T13:54:17.135895Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.plot_meas_vs_calc(expt_name='hrpt', show_residual=True)" ] }, { "cell_type": "code", "execution_count": 68, "id": "135", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:54:17.138725Z", "iopub.status.busy": "2026-01-06T13:54:17.138577Z", "iopub.status.idle": "2026-01-06T13:54:17.509158Z", "shell.execute_reply": "2026-01-06T13:54:17.508590Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.plot_meas_vs_calc(expt_name='hrpt', x_min=38, x_max=41, show_residual=True)" ] }, { "cell_type": "markdown", "id": "136", "metadata": {}, "source": [ "#### Save Project State" ] }, { "cell_type": "code", "execution_count": 69, "id": "137", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:54:17.511338Z", "iopub.status.busy": "2026-01-06T13:54:17.511200Z", "iopub.status.idle": "2026-01-06T13:54:17.534771Z", "shell.execute_reply": "2026-01-06T13:54:17.534198Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;34mSaving project 📦 \u001b[0m\u001b[32m'lbco_hrpt'\u001b[0m\u001b[1;34m to\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\u001b[35m/private/var/folders/sm/xrr7tmqj20s7hrsh1qhfl1d40000gn/T/\u001b[0m\u001b[95mlbco_hrpt\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "├── 📄 project.cif\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "├── 📁 sample_models\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "│ └── 📄 lbco.cif\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "├── 📁 experiments\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "│ └── 📄 hrpt.cif\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "├── 📄 analysis.cif\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "└── 📄 summary.cif\n" ] } ], "source": [ "project.save_as(dir_path='lbco_hrpt', temporary=True)" ] }, { "cell_type": "markdown", "id": "138", "metadata": {}, "source": [ "### Perform Fit 4/5\n", "\n", "#### Set Constraints\n", "\n", "Set aliases for parameters." ] }, { "cell_type": "code", "execution_count": 70, "id": "139", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:54:17.537150Z", "iopub.status.busy": "2026-01-06T13:54:17.537008Z", "iopub.status.idle": "2026-01-06T13:54:17.540125Z", "shell.execute_reply": "2026-01-06T13:54:17.539629Z" } }, "outputs": [], "source": [ "project.analysis.aliases.add(\n", " label='biso_La',\n", " param_uid=project.sample_models['lbco'].atom_sites['La'].b_iso.uid,\n", ")\n", "project.analysis.aliases.add(\n", " label='biso_Ba',\n", " param_uid=project.sample_models['lbco'].atom_sites['Ba'].b_iso.uid,\n", ")" ] }, { "cell_type": "markdown", "id": "140", "metadata": {}, "source": [ "Set constraints." ] }, { "cell_type": "code", "execution_count": 71, "id": "141", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:54:17.542081Z", "iopub.status.busy": "2026-01-06T13:54:17.541928Z", "iopub.status.idle": "2026-01-06T13:54:17.544196Z", "shell.execute_reply": "2026-01-06T13:54:17.543755Z" } }, "outputs": [], "source": [ "project.analysis.constraints.add(lhs_alias='biso_Ba', rhs_expr='biso_La')" ] }, { "cell_type": "markdown", "id": "142", "metadata": {}, "source": [ "Show defined constraints." ] }, { "cell_type": "code", "execution_count": 72, "id": "143", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:54:17.545809Z", "iopub.status.busy": "2026-01-06T13:54:17.545682Z", "iopub.status.idle": "2026-01-06T13:54:17.931363Z", "shell.execute_reply": "2026-01-06T13:54:17.930907Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;34mUser defined constraints\u001b[0m\n" ] }, { "data": { "application/javascript": [ "\n", " (function() {\n", " var isDark = false;\n", "\n", " // Check JupyterLab theme\n", " if (document.body.classList.contains('jp-mod-dark') || \n", " document.body.classList.contains('theme-dark') ||\n", " document.body.classList.contains('vscode-dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check theme attribute\n", " var themeAttr = document.body.getAttribute('data-jp-theme-name');\n", " if (themeAttr && themeAttr.includes('dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check computed background color\n", " var notebookEl = document.querySelector('.jp-Notebook') || \n", " document.querySelector('.notebook_app') ||\n", " document.body;\n", " if (notebookEl) {\n", " var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n", " var rgb = bgColor.match(/\\d+/g);\n", " if (rgb && rgb.length >= 3) {\n", " var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n", " if (brightness < 128) {\n", " isDark = true;\n", " }\n", " }\n", " }\n", "\n", " // Store result\n", " if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n", " IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n", " }\n", " })();\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " if (typeof IPython !== 'undefined' && IPython.notebook) {\n", " IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n", " (document.body.classList.contains('theme-dark') || \n", " document.body.classList.contains('jp-mod-dark') ||\n", " (document.body.getAttribute('data-jp-theme-name') && \n", " document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n", " }\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
 lhs_aliasrhs_exprfull expression
1biso_Babiso_Labiso_Ba = biso_La
\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.analysis.show_constraints()" ] }, { "cell_type": "markdown", "id": "144", "metadata": {}, "source": [ "Show free parameters before applying constraints." ] }, { "cell_type": "code", "execution_count": 73, "id": "145", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:54:17.933768Z", "iopub.status.busy": "2026-01-06T13:54:17.933591Z", "iopub.status.idle": "2026-01-06T13:54:18.326759Z", "shell.execute_reply": "2026-01-06T13:54:18.325592Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;34mFree parameters for both sample models \u001b[0m\u001b[1;34m(\u001b[0m\u001b[1;34m🧩 data blocks\u001b[0m\u001b[1;34m)\u001b[0m\u001b[1;34m and experiments \u001b[0m\u001b[1;34m(\u001b[0m\u001b[1;34m🔬 data blocks\u001b[0m\u001b[1;34m)\u001b[0m\n" ] }, { "data": { "application/javascript": [ "\n", " (function() {\n", " var isDark = false;\n", "\n", " // Check JupyterLab theme\n", " if (document.body.classList.contains('jp-mod-dark') || \n", " document.body.classList.contains('theme-dark') ||\n", " document.body.classList.contains('vscode-dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check theme attribute\n", " var themeAttr = document.body.getAttribute('data-jp-theme-name');\n", " if (themeAttr && themeAttr.includes('dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check computed background color\n", " var notebookEl = document.querySelector('.jp-Notebook') || \n", " document.querySelector('.notebook_app') ||\n", " document.body;\n", " if (notebookEl) {\n", " var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n", " var rgb = bgColor.match(/\\d+/g);\n", " if (rgb && rgb.length >= 3) {\n", " var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n", " if (brightness < 128) {\n", " isDark = true;\n", " }\n", " }\n", " }\n", "\n", " // Store result\n", " if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n", " IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n", " }\n", " })();\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " if (typeof IPython !== 'undefined' && IPython.notebook) {\n", " IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n", " (document.body.classList.contains('theme-dark') || \n", " document.body.classList.contains('jp-mod-dark') ||\n", " (document.body.getAttribute('data-jp-theme-name') && \n", " document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n", " }\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
 datablockcategoryentryparametervalueuncertaintyminmaxunits
1lbcocelllength_a3.890870.00004-infinfÅ
2lbcoatom_siteLab_iso0.505091216.05113-infinfŲ
3lbcoatom_siteBab_iso0.504811976.18178-infinfŲ
4lbcoatom_siteCob_iso0.237070.06119-infinfŲ
5lbcoatom_siteOb_iso1.393540.01668-infinfŲ
6hrptlinked_phaseslbcoscale9.135030.06407-infinf
7hrptpeakbroad_gauss_u0.081570.00314-infinfdeg²
8hrptpeakbroad_gauss_v-0.115920.00672-infinfdeg²
9hrptpeakbroad_gauss_w0.120450.00328-infinfdeg²
10hrptpeakbroad_lorentz_y0.084450.00215-infinfdeg
11hrptinstrumenttwotheta_offset0.622580.00104-infinfdeg
12hrptbackground10y168.558491.36709-infinf
13hrptbackground30y164.335710.99917-infinf
14hrptbackground50y166.888140.73884-infinf
15hrptbackground110y175.400400.65706-infinf
16hrptbackground165y174.281130.91128-infinf
\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.analysis.show_free_params()" ] }, { "cell_type": "markdown", "id": "146", "metadata": {}, "source": [ "Apply constraints." ] }, { "cell_type": "code", "execution_count": 74, "id": "147", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:54:18.330964Z", "iopub.status.busy": "2026-01-06T13:54:18.330787Z", "iopub.status.idle": "2026-01-06T13:54:18.336053Z", "shell.execute_reply": "2026-01-06T13:54:18.334365Z" } }, "outputs": [], "source": [ "project.analysis.apply_constraints()" ] }, { "cell_type": "markdown", "id": "148", "metadata": {}, "source": [ "Show free parameters after applying constraints." ] }, { "cell_type": "code", "execution_count": 75, "id": "149", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:54:18.339912Z", "iopub.status.busy": "2026-01-06T13:54:18.339754Z", "iopub.status.idle": "2026-01-06T13:54:18.750285Z", "shell.execute_reply": "2026-01-06T13:54:18.748386Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;34mFree parameters for both sample models \u001b[0m\u001b[1;34m(\u001b[0m\u001b[1;34m🧩 data blocks\u001b[0m\u001b[1;34m)\u001b[0m\u001b[1;34m and experiments \u001b[0m\u001b[1;34m(\u001b[0m\u001b[1;34m🔬 data blocks\u001b[0m\u001b[1;34m)\u001b[0m\n" ] }, { "data": { "application/javascript": [ "\n", " (function() {\n", " var isDark = false;\n", "\n", " // Check JupyterLab theme\n", " if (document.body.classList.contains('jp-mod-dark') || \n", " document.body.classList.contains('theme-dark') ||\n", " document.body.classList.contains('vscode-dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check theme attribute\n", " var themeAttr = document.body.getAttribute('data-jp-theme-name');\n", " if (themeAttr && themeAttr.includes('dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check computed background color\n", " var notebookEl = document.querySelector('.jp-Notebook') || \n", " document.querySelector('.notebook_app') ||\n", " document.body;\n", " if (notebookEl) {\n", " var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n", " var rgb = bgColor.match(/\\d+/g);\n", " if (rgb && rgb.length >= 3) {\n", " var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n", " if (brightness < 128) {\n", " isDark = true;\n", " }\n", " }\n", " }\n", "\n", " // Store result\n", " if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n", " IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n", " }\n", " })();\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " if (typeof IPython !== 'undefined' && IPython.notebook) {\n", " IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n", " (document.body.classList.contains('theme-dark') || \n", " document.body.classList.contains('jp-mod-dark') ||\n", " (document.body.getAttribute('data-jp-theme-name') && \n", " document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n", " }\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
 datablockcategoryentryparametervalueuncertaintyminmaxunits
1lbcocelllength_a3.890870.00004-infinfÅ
2lbcoatom_siteLab_iso0.505091216.05113-infinfŲ
3lbcoatom_siteCob_iso0.237070.06119-infinfŲ
4lbcoatom_siteOb_iso1.393540.01668-infinfŲ
5hrptlinked_phaseslbcoscale9.135030.06407-infinf
6hrptpeakbroad_gauss_u0.081570.00314-infinfdeg²
7hrptpeakbroad_gauss_v-0.115920.00672-infinfdeg²
8hrptpeakbroad_gauss_w0.120450.00328-infinfdeg²
9hrptpeakbroad_lorentz_y0.084450.00215-infinfdeg
10hrptinstrumenttwotheta_offset0.622580.00104-infinfdeg
11hrptbackground10y168.558491.36709-infinf
12hrptbackground30y164.335710.99917-infinf
13hrptbackground50y166.888140.73884-infinf
14hrptbackground110y175.400400.65706-infinf
15hrptbackground165y174.281130.91128-infinf
\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.analysis.show_free_params()" ] }, { "cell_type": "markdown", "id": "150", "metadata": {}, "source": [ "#### Run Fitting" ] }, { "cell_type": "code", "execution_count": 76, "id": "151", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:54:18.754852Z", "iopub.status.busy": "2026-01-06T13:54:18.754314Z", "iopub.status.idle": "2026-01-06T13:54:21.450282Z", "shell.execute_reply": "2026-01-06T13:54:21.449808Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;34mUsing experiment 🔬 \u001b[0m\u001b[32m'hrpt'\u001b[0m\u001b[1;34m for \u001b[0m\u001b[32m'single'\u001b[0m\u001b[1;34m fitting\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "🚀 Starting fit process with \u001b[32m'lmfit \u001b[0m\u001b[32m(\u001b[0m\u001b[32mleastsq\u001b[0m\u001b[32m)\u001b[0m\u001b[32m'\u001b[0m\u001b[33m...\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "📈 Goodness-of-fit \u001b[1m(\u001b[0mreduced χ²\u001b[1m)\u001b[0m change:\n" ] }, { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
 iterationχ²improvement [%]
111.29
2201.29
\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " (function() {\n", " var isDark = false;\n", "\n", " // Check JupyterLab theme\n", " if (document.body.classList.contains('jp-mod-dark') || \n", " document.body.classList.contains('theme-dark') ||\n", " document.body.classList.contains('vscode-dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check theme attribute\n", " var themeAttr = document.body.getAttribute('data-jp-theme-name');\n", " if (themeAttr && themeAttr.includes('dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check computed background color\n", " var notebookEl = document.querySelector('.jp-Notebook') || \n", " document.querySelector('.notebook_app') ||\n", " document.body;\n", " if (notebookEl) {\n", " var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n", " var rgb = bgColor.match(/\\d+/g);\n", " if (rgb && rgb.length >= 3) {\n", " var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n", " if (brightness < 128) {\n", " isDark = true;\n", " }\n", " }\n", " }\n", "\n", " // Store result\n", " if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n", " IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n", " }\n", " })();\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " if (typeof IPython !== 'undefined' && IPython.notebook) {\n", " IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n", " (document.body.classList.contains('theme-dark') || \n", " document.body.classList.contains('jp-mod-dark') ||\n", " (document.body.getAttribute('data-jp-theme-name') && \n", " document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n", " }\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " (function() {\n", " var isDark = false;\n", "\n", " // Check JupyterLab theme\n", " if (document.body.classList.contains('jp-mod-dark') || \n", " document.body.classList.contains('theme-dark') ||\n", " document.body.classList.contains('vscode-dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check theme attribute\n", " var themeAttr = document.body.getAttribute('data-jp-theme-name');\n", " if (themeAttr && themeAttr.includes('dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check computed background color\n", " var notebookEl = document.querySelector('.jp-Notebook') || \n", " document.querySelector('.notebook_app') ||\n", " document.body;\n", " if (notebookEl) {\n", " var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n", " var rgb = bgColor.match(/\\d+/g);\n", " if (rgb && rgb.length >= 3) {\n", " var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n", " if (brightness < 128) {\n", " isDark = true;\n", " }\n", " }\n", " }\n", "\n", " // Store result\n", " if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n", " IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n", " }\n", " })();\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " if (typeof IPython !== 'undefined' && IPython.notebook) {\n", " IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n", " (document.body.classList.contains('theme-dark') || \n", " document.body.classList.contains('jp-mod-dark') ||\n", " (document.body.getAttribute('data-jp-theme-name') && \n", " document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n", " }\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " (function() {\n", " var isDark = false;\n", "\n", " // Check JupyterLab theme\n", " if (document.body.classList.contains('jp-mod-dark') || \n", " document.body.classList.contains('theme-dark') ||\n", " document.body.classList.contains('vscode-dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check theme attribute\n", " var themeAttr = document.body.getAttribute('data-jp-theme-name');\n", " if (themeAttr && themeAttr.includes('dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check computed background color\n", " var notebookEl = document.querySelector('.jp-Notebook') || \n", " document.querySelector('.notebook_app') ||\n", " document.body;\n", " if (notebookEl) {\n", " var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n", " var rgb = bgColor.match(/\\d+/g);\n", " if (rgb && rgb.length >= 3) {\n", " var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n", " if (brightness < 128) {\n", " isDark = true;\n", " }\n", " }\n", " }\n", "\n", " // Store result\n", " if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n", " IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n", " }\n", " })();\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " if (typeof IPython !== 'undefined' && IPython.notebook) {\n", " IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n", " (document.body.classList.contains('theme-dark') || \n", " document.body.classList.contains('jp-mod-dark') ||\n", " (document.body.getAttribute('data-jp-theme-name') && \n", " document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n", " }\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "🏆 Best goodness-of-fit \u001b[1m(\u001b[0mreduced χ²\u001b[1m)\u001b[0m is \u001b[1;36m1.29\u001b[0m at iteration \u001b[1;36m19\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "✅ Fitting complete.\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;34mFit results\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "✅ Success: \u001b[3;92mTrue\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "⏱️ Fitting time: \u001b[1;36m1.22\u001b[0m seconds\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "📏 Goodness-of-fit \u001b[1m(\u001b[0mreduced χ²\u001b[1m)\u001b[0m: \u001b[1;36m1.29\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "📏 R-factor \u001b[1m(\u001b[0mRf\u001b[1m)\u001b[0m: \u001b[1;36m5.65\u001b[0m%\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "📏 R-factor squared \u001b[1m(\u001b[0mRf²\u001b[1m)\u001b[0m: \u001b[1;36m5.30\u001b[0m%\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "📏 Weighted R-factor \u001b[1m(\u001b[0mwR\u001b[1m)\u001b[0m: \u001b[1;36m4.47\u001b[0m%\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "📈 Fitted parameters:\n" ] }, { "data": { "application/javascript": [ "\n", " (function() {\n", " var isDark = false;\n", "\n", " // Check JupyterLab theme\n", " if (document.body.classList.contains('jp-mod-dark') || \n", " document.body.classList.contains('theme-dark') ||\n", " document.body.classList.contains('vscode-dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check theme attribute\n", " var themeAttr = document.body.getAttribute('data-jp-theme-name');\n", " if (themeAttr && themeAttr.includes('dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check computed background color\n", " var notebookEl = document.querySelector('.jp-Notebook') || \n", " document.querySelector('.notebook_app') ||\n", " document.body;\n", " if (notebookEl) {\n", " var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n", " var rgb = bgColor.match(/\\d+/g);\n", " if (rgb && rgb.length >= 3) {\n", " var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n", " if (brightness < 128) {\n", " isDark = true;\n", " }\n", " }\n", " }\n", "\n", " // Store result\n", " if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n", " IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n", " }\n", " })();\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " if (typeof IPython !== 'undefined' && IPython.notebook) {\n", " IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n", " (document.body.classList.contains('theme-dark') || \n", " document.body.classList.contains('jp-mod-dark') ||\n", " (document.body.getAttribute('data-jp-theme-name') && \n", " document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n", " }\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
 datablockcategoryentryparameterstartfitteduncertaintyunitschange
1lbcocelllength_a3.89093.89090.0000Å0.00 % ↑
2lbcoatom_siteLab_iso0.50510.50510.0278Ų0.00 % ↓
3lbcoatom_siteCob_iso0.23710.23700.0564Ų0.03 % ↓
4lbcoatom_siteOb_iso1.39351.39350.0160Ų0.00 % ↑
5hrptlinked_phaseslbcoscale9.13509.13510.05380.00 % ↑
6hrptpeakbroad_gauss_u0.08160.08160.0031deg²0.00 % ↑
7hrptpeakbroad_gauss_v-0.1159-0.11590.0066deg²0.00 % ↑
8hrptpeakbroad_gauss_w0.12040.12040.0032deg²0.00 % ↑
9hrptpeakbroad_lorentz_y0.08440.08440.0021deg0.00 % ↓
10hrptinstrumenttwotheta_offset0.62260.62260.0010deg0.00 % ↑
11hrptbackground10y168.5585168.55851.36690.00 % ↓
12hrptbackground30y164.3357164.33570.99900.00 % ↓
13hrptbackground50y166.8881166.88810.73860.00 % ↓
14hrptbackground110y175.4004175.40060.64880.00 % ↑
15hrptbackground165y174.2811174.28120.89440.00 % ↑
\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.analysis.fit()\n", "project.analysis.show_fit_results()" ] }, { "cell_type": "markdown", "id": "152", "metadata": {}, "source": [ "#### Plot Measured vs Calculated" ] }, { "cell_type": "code", "execution_count": 77, "id": "153", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:54:21.452505Z", "iopub.status.busy": "2026-01-06T13:54:21.452387Z", "iopub.status.idle": "2026-01-06T13:54:21.769636Z", "shell.execute_reply": "2026-01-06T13:54:21.768790Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.plot_meas_vs_calc(expt_name='hrpt', show_residual=True)" ] }, { "cell_type": "code", "execution_count": 78, "id": "154", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:54:21.773240Z", "iopub.status.busy": "2026-01-06T13:54:21.772792Z", "iopub.status.idle": "2026-01-06T13:54:22.129328Z", "shell.execute_reply": "2026-01-06T13:54:22.128741Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.plot_meas_vs_calc(expt_name='hrpt', x_min=38, x_max=41, show_residual=True)" ] }, { "cell_type": "markdown", "id": "155", "metadata": {}, "source": [ "#### Save Project State" ] }, { "cell_type": "code", "execution_count": 79, "id": "156", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:54:22.132029Z", "iopub.status.busy": "2026-01-06T13:54:22.131887Z", "iopub.status.idle": "2026-01-06T13:54:22.157796Z", "shell.execute_reply": "2026-01-06T13:54:22.156595Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;34mSaving project 📦 \u001b[0m\u001b[32m'lbco_hrpt'\u001b[0m\u001b[1;34m to\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\u001b[35m/private/var/folders/sm/xrr7tmqj20s7hrsh1qhfl1d40000gn/T/\u001b[0m\u001b[95mlbco_hrpt\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "├── 📄 project.cif\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "├── 📁 sample_models\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "│ └── 📄 lbco.cif\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "├── 📁 experiments\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "│ └── 📄 hrpt.cif\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "├── 📄 analysis.cif\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "└── 📄 summary.cif\n" ] } ], "source": [ "project.save_as(dir_path='lbco_hrpt', temporary=True)" ] }, { "cell_type": "markdown", "id": "157", "metadata": {}, "source": [ "### Perform Fit 5/5\n", "\n", "#### Set Constraints\n", "\n", "Set more aliases for parameters." ] }, { "cell_type": "code", "execution_count": 80, "id": "158", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:54:22.162822Z", "iopub.status.busy": "2026-01-06T13:54:22.162625Z", "iopub.status.idle": "2026-01-06T13:54:22.167237Z", "shell.execute_reply": "2026-01-06T13:54:22.166005Z" } }, "outputs": [], "source": [ "project.analysis.aliases.add(\n", " label='occ_La',\n", " param_uid=project.sample_models['lbco'].atom_sites['La'].occupancy.uid,\n", ")\n", "project.analysis.aliases.add(\n", " label='occ_Ba',\n", " param_uid=project.sample_models['lbco'].atom_sites['Ba'].occupancy.uid,\n", ")" ] }, { "cell_type": "markdown", "id": "159", "metadata": {}, "source": [ "Set more constraints." ] }, { "cell_type": "code", "execution_count": 81, "id": "160", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:54:22.171275Z", "iopub.status.busy": "2026-01-06T13:54:22.170760Z", "iopub.status.idle": "2026-01-06T13:54:22.176921Z", "shell.execute_reply": "2026-01-06T13:54:22.175927Z" } }, "outputs": [], "source": [ "project.analysis.constraints.add(\n", " lhs_alias='occ_Ba',\n", " rhs_expr='1 - occ_La',\n", ")" ] }, { "cell_type": "markdown", "id": "161", "metadata": {}, "source": [ "Show defined constraints." ] }, { "cell_type": "code", "execution_count": 82, "id": "162", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:54:22.178915Z", "iopub.status.busy": "2026-01-06T13:54:22.178786Z", "iopub.status.idle": "2026-01-06T13:54:22.465802Z", "shell.execute_reply": "2026-01-06T13:54:22.465353Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;34mUser defined constraints\u001b[0m\n" ] }, { "data": { "application/javascript": [ "\n", " (function() {\n", " var isDark = false;\n", "\n", " // Check JupyterLab theme\n", " if (document.body.classList.contains('jp-mod-dark') || \n", " document.body.classList.contains('theme-dark') ||\n", " document.body.classList.contains('vscode-dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check theme attribute\n", " var themeAttr = document.body.getAttribute('data-jp-theme-name');\n", " if (themeAttr && themeAttr.includes('dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check computed background color\n", " var notebookEl = document.querySelector('.jp-Notebook') || \n", " document.querySelector('.notebook_app') ||\n", " document.body;\n", " if (notebookEl) {\n", " var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n", " var rgb = bgColor.match(/\\d+/g);\n", " if (rgb && rgb.length >= 3) {\n", " var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n", " if (brightness < 128) {\n", " isDark = true;\n", " }\n", " }\n", " }\n", "\n", " // Store result\n", " if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n", " IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n", " }\n", " })();\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " if (typeof IPython !== 'undefined' && IPython.notebook) {\n", " IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n", " (document.body.classList.contains('theme-dark') || \n", " document.body.classList.contains('jp-mod-dark') ||\n", " (document.body.getAttribute('data-jp-theme-name') && \n", " document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n", " }\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
 lhs_aliasrhs_exprfull expression
1biso_Babiso_Labiso_Ba = biso_La
2occ_Ba1 - occ_Laocc_Ba = 1 - occ_La
\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.analysis.show_constraints()" ] }, { "cell_type": "markdown", "id": "163", "metadata": {}, "source": [ "Apply constraints." ] }, { "cell_type": "code", "execution_count": 83, "id": "164", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:54:22.470196Z", "iopub.status.busy": "2026-01-06T13:54:22.470003Z", "iopub.status.idle": "2026-01-06T13:54:22.473365Z", "shell.execute_reply": "2026-01-06T13:54:22.472713Z" } }, "outputs": [], "source": [ "project.analysis.apply_constraints()" ] }, { "cell_type": "markdown", "id": "165", "metadata": {}, "source": [ "Set sample model parameters to be refined." ] }, { "cell_type": "code", "execution_count": 84, "id": "166", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:54:22.475191Z", "iopub.status.busy": "2026-01-06T13:54:22.475075Z", "iopub.status.idle": "2026-01-06T13:54:22.481103Z", "shell.execute_reply": "2026-01-06T13:54:22.479475Z" } }, "outputs": [], "source": [ "project.sample_models['lbco'].atom_sites['La'].occupancy.free = True" ] }, { "cell_type": "markdown", "id": "167", "metadata": {}, "source": [ "Show free parameters after selection." ] }, { "cell_type": "code", "execution_count": 85, "id": "168", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:54:22.483193Z", "iopub.status.busy": "2026-01-06T13:54:22.483043Z", "iopub.status.idle": "2026-01-06T13:54:22.920884Z", "shell.execute_reply": "2026-01-06T13:54:22.919291Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;34mFree parameters for both sample models \u001b[0m\u001b[1;34m(\u001b[0m\u001b[1;34m🧩 data blocks\u001b[0m\u001b[1;34m)\u001b[0m\u001b[1;34m and experiments \u001b[0m\u001b[1;34m(\u001b[0m\u001b[1;34m🔬 data blocks\u001b[0m\u001b[1;34m)\u001b[0m\n" ] }, { "data": { "application/javascript": [ "\n", " (function() {\n", " var isDark = false;\n", "\n", " // Check JupyterLab theme\n", " if (document.body.classList.contains('jp-mod-dark') || \n", " document.body.classList.contains('theme-dark') ||\n", " document.body.classList.contains('vscode-dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check theme attribute\n", " var themeAttr = document.body.getAttribute('data-jp-theme-name');\n", " if (themeAttr && themeAttr.includes('dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check computed background color\n", " var notebookEl = document.querySelector('.jp-Notebook') || \n", " document.querySelector('.notebook_app') ||\n", " document.body;\n", " if (notebookEl) {\n", " var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n", " var rgb = bgColor.match(/\\d+/g);\n", " if (rgb && rgb.length >= 3) {\n", " var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n", " if (brightness < 128) {\n", " isDark = true;\n", " }\n", " }\n", " }\n", "\n", " // Store result\n", " if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n", " IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n", " }\n", " })();\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " if (typeof IPython !== 'undefined' && IPython.notebook) {\n", " IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n", " (document.body.classList.contains('theme-dark') || \n", " document.body.classList.contains('jp-mod-dark') ||\n", " (document.body.getAttribute('data-jp-theme-name') && \n", " document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n", " }\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
 datablockcategoryentryparametervalueuncertaintyminmaxunits
1lbcocelllength_a3.890870.00004-infinfÅ
2lbcoatom_siteLaoccupancy0.50000-infinf
3lbcoatom_siteLab_iso0.505080.02777-infinfŲ
4lbcoatom_siteCob_iso0.236990.05643-infinfŲ
5lbcoatom_siteOb_iso1.393550.01599-infinfŲ
6hrptlinked_phaseslbcoscale9.135090.05380-infinf
7hrptpeakbroad_gauss_u0.081570.00310-infinfdeg²
8hrptpeakbroad_gauss_v-0.115930.00664-infinfdeg²
9hrptpeakbroad_gauss_w0.120450.00325-infinfdeg²
10hrptpeakbroad_lorentz_y0.084450.00214-infinfdeg
11hrptinstrumenttwotheta_offset0.622580.00103-infinfdeg
12hrptbackground10y168.558491.36685-infinf
13hrptbackground30y164.335690.99900-infinf
14hrptbackground50y166.888080.73857-infinf
15hrptbackground110y175.400560.64879-infinf
16hrptbackground165y174.281240.89439-infinf
\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.analysis.show_free_params()" ] }, { "cell_type": "markdown", "id": "169", "metadata": {}, "source": [ "#### Run Fitting" ] }, { "cell_type": "code", "execution_count": 86, "id": "170", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:54:22.924973Z", "iopub.status.busy": "2026-01-06T13:54:22.924130Z", "iopub.status.idle": "2026-01-06T13:54:28.124890Z", "shell.execute_reply": "2026-01-06T13:54:28.123374Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;34mUsing experiment 🔬 \u001b[0m\u001b[32m'hrpt'\u001b[0m\u001b[1;34m for \u001b[0m\u001b[32m'single'\u001b[0m\u001b[1;34m fitting\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "🚀 Starting fit process with \u001b[32m'lmfit \u001b[0m\u001b[32m(\u001b[0m\u001b[32mleastsq\u001b[0m\u001b[32m)\u001b[0m\u001b[32m'\u001b[0m\u001b[33m...\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "📈 Goodness-of-fit \u001b[1m(\u001b[0mreduced χ²\u001b[1m)\u001b[0m change:\n" ] }, { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
 iterationχ²improvement [%]
111.29
2551.28
\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " (function() {\n", " var isDark = false;\n", "\n", " // Check JupyterLab theme\n", " if (document.body.classList.contains('jp-mod-dark') || \n", " document.body.classList.contains('theme-dark') ||\n", " document.body.classList.contains('vscode-dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check theme attribute\n", " var themeAttr = document.body.getAttribute('data-jp-theme-name');\n", " if (themeAttr && themeAttr.includes('dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check computed background color\n", " var notebookEl = document.querySelector('.jp-Notebook') || \n", " document.querySelector('.notebook_app') ||\n", " document.body;\n", " if (notebookEl) {\n", " var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n", " var rgb = bgColor.match(/\\d+/g);\n", " if (rgb && rgb.length >= 3) {\n", " var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n", " if (brightness < 128) {\n", " isDark = true;\n", " }\n", " }\n", " }\n", "\n", " // Store result\n", " if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n", " IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n", " }\n", " })();\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " if (typeof IPython !== 'undefined' && IPython.notebook) {\n", " IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n", " (document.body.classList.contains('theme-dark') || \n", " document.body.classList.contains('jp-mod-dark') ||\n", " (document.body.getAttribute('data-jp-theme-name') && \n", " document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n", " }\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " (function() {\n", " var isDark = false;\n", "\n", " // Check JupyterLab theme\n", " if (document.body.classList.contains('jp-mod-dark') || \n", " document.body.classList.contains('theme-dark') ||\n", " document.body.classList.contains('vscode-dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check theme attribute\n", " var themeAttr = document.body.getAttribute('data-jp-theme-name');\n", " if (themeAttr && themeAttr.includes('dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check computed background color\n", " var notebookEl = document.querySelector('.jp-Notebook') || \n", " document.querySelector('.notebook_app') ||\n", " document.body;\n", " if (notebookEl) {\n", " var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n", " var rgb = bgColor.match(/\\d+/g);\n", " if (rgb && rgb.length >= 3) {\n", " var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n", " if (brightness < 128) {\n", " isDark = true;\n", " }\n", " }\n", " }\n", "\n", " // Store result\n", " if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n", " IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n", " }\n", " })();\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " if (typeof IPython !== 'undefined' && IPython.notebook) {\n", " IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n", " (document.body.classList.contains('theme-dark') || \n", " document.body.classList.contains('jp-mod-dark') ||\n", " (document.body.getAttribute('data-jp-theme-name') && \n", " document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n", " }\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " (function() {\n", " var isDark = false;\n", "\n", " // Check JupyterLab theme\n", " if (document.body.classList.contains('jp-mod-dark') || \n", " document.body.classList.contains('theme-dark') ||\n", " document.body.classList.contains('vscode-dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check theme attribute\n", " var themeAttr = document.body.getAttribute('data-jp-theme-name');\n", " if (themeAttr && themeAttr.includes('dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check computed background color\n", " var notebookEl = document.querySelector('.jp-Notebook') || \n", " document.querySelector('.notebook_app') ||\n", " document.body;\n", " if (notebookEl) {\n", " var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n", " var rgb = bgColor.match(/\\d+/g);\n", " if (rgb && rgb.length >= 3) {\n", " var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n", " if (brightness < 128) {\n", " isDark = true;\n", " }\n", " }\n", " }\n", "\n", " // Store result\n", " if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n", " IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n", " }\n", " })();\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " if (typeof IPython !== 'undefined' && IPython.notebook) {\n", " IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n", " (document.body.classList.contains('theme-dark') || \n", " document.body.classList.contains('jp-mod-dark') ||\n", " (document.body.getAttribute('data-jp-theme-name') && \n", " document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n", " }\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "🏆 Best goodness-of-fit \u001b[1m(\u001b[0mreduced χ²\u001b[1m)\u001b[0m is \u001b[1;36m1.28\u001b[0m at iteration \u001b[1;36m54\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "✅ Fitting complete.\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;34mFit results\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "✅ Success: \u001b[3;92mTrue\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "⏱️ Fitting time: \u001b[1;36m3.64\u001b[0m seconds\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "📏 Goodness-of-fit \u001b[1m(\u001b[0mreduced χ²\u001b[1m)\u001b[0m: \u001b[1;36m1.28\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "📏 R-factor \u001b[1m(\u001b[0mRf\u001b[1m)\u001b[0m: \u001b[1;36m5.63\u001b[0m%\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "📏 R-factor squared \u001b[1m(\u001b[0mRf²\u001b[1m)\u001b[0m: \u001b[1;36m5.28\u001b[0m%\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "📏 Weighted R-factor \u001b[1m(\u001b[0mwR\u001b[1m)\u001b[0m: \u001b[1;36m4.44\u001b[0m%\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "📈 Fitted parameters:\n" ] }, { "data": { "application/javascript": [ "\n", " (function() {\n", " var isDark = false;\n", "\n", " // Check JupyterLab theme\n", " if (document.body.classList.contains('jp-mod-dark') || \n", " document.body.classList.contains('theme-dark') ||\n", " document.body.classList.contains('vscode-dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check theme attribute\n", " var themeAttr = document.body.getAttribute('data-jp-theme-name');\n", " if (themeAttr && themeAttr.includes('dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check computed background color\n", " var notebookEl = document.querySelector('.jp-Notebook') || \n", " document.querySelector('.notebook_app') ||\n", " document.body;\n", " if (notebookEl) {\n", " var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n", " var rgb = bgColor.match(/\\d+/g);\n", " if (rgb && rgb.length >= 3) {\n", " var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n", " if (brightness < 128) {\n", " isDark = true;\n", " }\n", " }\n", " }\n", "\n", " // Store result\n", " if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n", " IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n", " }\n", " })();\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " if (typeof IPython !== 'undefined' && IPython.notebook) {\n", " IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n", " (document.body.classList.contains('theme-dark') || \n", " document.body.classList.contains('jp-mod-dark') ||\n", " (document.body.getAttribute('data-jp-theme-name') && \n", " document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n", " }\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
 datablockcategoryentryparameterstartfitteduncertaintyunitschange
1lbcocelllength_a3.89093.89090.0000Å0.00 % ↑
2lbcoatom_siteLaoccupancy0.50000.58400.020316.81 % ↑
3lbcoatom_siteLab_iso0.50510.59830.0355Ų18.46 % ↑
4lbcoatom_siteCob_iso0.23700.16650.0580Ų29.74 % ↓
5lbcoatom_siteOb_iso1.39351.34910.0192Ų3.19 % ↓
6hrptlinked_phaseslbcoscale9.13518.90570.07612.51 % ↓
7hrptpeakbroad_gauss_u0.08160.08120.0031deg²0.43 % ↓
8hrptpeakbroad_gauss_v-0.1159-0.11540.0066deg²0.48 % ↓
9hrptpeakbroad_gauss_w0.12040.12030.0032deg²0.14 % ↓
10hrptpeakbroad_lorentz_y0.08440.08460.0021deg0.18 % ↑
11hrptinstrumenttwotheta_offset0.62260.62260.0010deg0.00 % ↑
12hrptbackground10y168.5585168.97801.36660.25 % ↑
13hrptbackground30y164.3357164.05350.99920.17 % ↓
14hrptbackground50y166.8881166.91250.73640.01 % ↑
15hrptbackground110y175.4006175.26990.64790.07 % ↓
16hrptbackground165y174.2812174.55800.89350.16 % ↑
\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.analysis.fit()\n", "project.analysis.show_fit_results()" ] }, { "cell_type": "markdown", "id": "171", "metadata": {}, "source": [ "#### Plot Measured vs Calculated" ] }, { "cell_type": "code", "execution_count": 87, "id": "172", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:54:28.128450Z", "iopub.status.busy": "2026-01-06T13:54:28.128261Z", "iopub.status.idle": "2026-01-06T13:54:28.542299Z", "shell.execute_reply": "2026-01-06T13:54:28.540299Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.plot_meas_vs_calc(expt_name='hrpt', show_residual=True)" ] }, { "cell_type": "code", "execution_count": 88, "id": "173", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:54:28.544651Z", "iopub.status.busy": "2026-01-06T13:54:28.544498Z", "iopub.status.idle": "2026-01-06T13:54:28.919652Z", "shell.execute_reply": "2026-01-06T13:54:28.919091Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.plot_meas_vs_calc(expt_name='hrpt', x_min=38, x_max=41, show_residual=True)" ] }, { "cell_type": "markdown", "id": "174", "metadata": {}, "source": [ "#### Save Project State" ] }, { "cell_type": "code", "execution_count": 89, "id": "175", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:54:28.921332Z", "iopub.status.busy": "2026-01-06T13:54:28.921213Z", "iopub.status.idle": "2026-01-06T13:54:28.955875Z", "shell.execute_reply": "2026-01-06T13:54:28.955370Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;34mSaving project 📦 \u001b[0m\u001b[32m'lbco_hrpt'\u001b[0m\u001b[1;34m to\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\u001b[35m/private/var/folders/sm/xrr7tmqj20s7hrsh1qhfl1d40000gn/T/\u001b[0m\u001b[95mlbco_hrpt\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "├── 📄 project.cif\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "├── 📁 sample_models\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "│ └── 📄 lbco.cif\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "├── 📁 experiments\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "│ └── 📄 hrpt.cif\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "├── 📄 analysis.cif\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "└── 📄 summary.cif\n" ] } ], "source": [ "project.save_as(dir_path='lbco_hrpt', temporary=True)" ] }, { "cell_type": "markdown", "id": "176", "metadata": {}, "source": [ "## Step 5: Summary\n", "\n", "This final section shows how to review the results of the analysis." ] }, { "cell_type": "markdown", "id": "177", "metadata": {}, "source": [ "#### Show Project Summary" ] }, { "cell_type": "code", "execution_count": 90, "id": "178", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:54:28.962555Z", "iopub.status.busy": "2026-01-06T13:54:28.961792Z", "iopub.status.idle": "2026-01-06T13:54:30.669311Z", "shell.execute_reply": "2026-01-06T13:54:30.668688Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;32m————————————\u001b[0m\n", "\u001b[1;32mPROJECT INFO\u001b[0m\n", "\u001b[1;32m————————————\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;34mTitle\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "La0.5Ba0.5CoO3 at HRPT@PSI\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;34mDescription\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "This project demonstrates a standard refinement of\n", "La0.5Ba0.5CoO3, which crystallizes in a perovskite-type\n", "structure, using neutron powder diffraction data collected\n", "in constant wavelength mode at the HRPT diffractometer\n", "(PSI).\n", "\u001b[1;32m—————————————————————\u001b[0m\n", "\u001b[1;32mCRYSTALLOGRAPHIC DATA\u001b[0m\n", "\u001b[1;32m—————————————————————\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;34mPhase datablock\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "🧩 lbco\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;34mSpace group\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "P m \u001b[1;36m-3\u001b[0m m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;34mCell parameters\u001b[0m\n" ] }, { "data": { "application/javascript": [ "\n", " (function() {\n", " var isDark = false;\n", "\n", " // Check JupyterLab theme\n", " if (document.body.classList.contains('jp-mod-dark') || \n", " document.body.classList.contains('theme-dark') ||\n", " document.body.classList.contains('vscode-dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check theme attribute\n", " var themeAttr = document.body.getAttribute('data-jp-theme-name');\n", " if (themeAttr && themeAttr.includes('dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check computed background color\n", " var notebookEl = document.querySelector('.jp-Notebook') || \n", " document.querySelector('.notebook_app') ||\n", " document.body;\n", " if (notebookEl) {\n", " var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n", " var rgb = bgColor.match(/\\d+/g);\n", " if (rgb && rgb.length >= 3) {\n", " var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n", " if (brightness < 128) {\n", " isDark = true;\n", " }\n", " }\n", " }\n", "\n", " // Store result\n", " if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n", " IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n", " }\n", " })();\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " if (typeof IPython !== 'undefined' && IPython.notebook) {\n", " IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n", " (document.body.classList.contains('theme-dark') || \n", " document.body.classList.contains('jp-mod-dark') ||\n", " (document.body.getAttribute('data-jp-theme-name') && \n", " document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n", " }\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
 ParameterValue
1a3.89087
2b3.89087
3c3.89087
4alpha90.00000
5beta90.00000
6gamma90.00000
\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;34mAtom sites\u001b[0m\n" ] }, { "data": { "application/javascript": [ "\n", " (function() {\n", " var isDark = false;\n", "\n", " // Check JupyterLab theme\n", " if (document.body.classList.contains('jp-mod-dark') || \n", " document.body.classList.contains('theme-dark') ||\n", " document.body.classList.contains('vscode-dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check theme attribute\n", " var themeAttr = document.body.getAttribute('data-jp-theme-name');\n", " if (themeAttr && themeAttr.includes('dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check computed background color\n", " var notebookEl = document.querySelector('.jp-Notebook') || \n", " document.querySelector('.notebook_app') ||\n", " document.body;\n", " if (notebookEl) {\n", " var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n", " var rgb = bgColor.match(/\\d+/g);\n", " if (rgb && rgb.length >= 3) {\n", " var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n", " if (brightness < 128) {\n", " isDark = true;\n", " }\n", " }\n", " }\n", "\n", " // Store result\n", " if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n", " IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n", " }\n", " })();\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " if (typeof IPython !== 'undefined' && IPython.notebook) {\n", " IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n", " (document.body.classList.contains('theme-dark') || \n", " document.body.classList.contains('jp-mod-dark') ||\n", " (document.body.getAttribute('data-jp-theme-name') && \n", " document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n", " }\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
 labeltypexyzoccBiso
1LaLa0.000000.000000.000000.584030.59832
2BaBa0.000000.000000.000000.415970.59832
3CoCo0.500000.500000.500001.000000.16651
4OO0.000000.500000.500001.000001.34914
\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;32m———————————\u001b[0m\n", "\u001b[1;32mEXPERIMENTS\u001b[0m\n", "\u001b[1;32m———————————\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;34mExperiment datablock\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "🔬 hrpt\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;34mExperiment type\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "powder, neutron, constant wavelength\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;34mWavelength\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36m1.49400\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;34m2θ offset\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36m0.62261\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;34mProfile type\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "PeakProfileTypeEnum.PSEUDO_VOIGT\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;34mPeak broadening \u001b[0m\u001b[1;34m(\u001b[0m\u001b[1;34mGaussian\u001b[0m\u001b[1;34m)\u001b[0m\n" ] }, { "data": { "application/javascript": [ "\n", " (function() {\n", " var isDark = false;\n", "\n", " // Check JupyterLab theme\n", " if (document.body.classList.contains('jp-mod-dark') || \n", " document.body.classList.contains('theme-dark') ||\n", " document.body.classList.contains('vscode-dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check theme attribute\n", " var themeAttr = document.body.getAttribute('data-jp-theme-name');\n", " if (themeAttr && themeAttr.includes('dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check computed background color\n", " var notebookEl = document.querySelector('.jp-Notebook') || \n", " document.querySelector('.notebook_app') ||\n", " document.body;\n", " if (notebookEl) {\n", " var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n", " var rgb = bgColor.match(/\\d+/g);\n", " if (rgb && rgb.length >= 3) {\n", " var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n", " if (brightness < 128) {\n", " isDark = true;\n", " }\n", " }\n", " }\n", "\n", " // Store result\n", " if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n", " IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n", " }\n", " })();\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " if (typeof IPython !== 'undefined' && IPython.notebook) {\n", " IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n", " (document.body.classList.contains('theme-dark') || \n", " document.body.classList.contains('jp-mod-dark') ||\n", " (document.body.getAttribute('data-jp-theme-name') && \n", " document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n", " }\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
 ParameterValue
1U0.08122
2V-0.11537
3W0.12028
\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;34mPeak broadening \u001b[0m\u001b[1;34m(\u001b[0m\u001b[1;34mLorentzian\u001b[0m\u001b[1;34m)\u001b[0m\n" ] }, { "data": { "application/javascript": [ "\n", " (function() {\n", " var isDark = false;\n", "\n", " // Check JupyterLab theme\n", " if (document.body.classList.contains('jp-mod-dark') || \n", " document.body.classList.contains('theme-dark') ||\n", " document.body.classList.contains('vscode-dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check theme attribute\n", " var themeAttr = document.body.getAttribute('data-jp-theme-name');\n", " if (themeAttr && themeAttr.includes('dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check computed background color\n", " var notebookEl = document.querySelector('.jp-Notebook') || \n", " document.querySelector('.notebook_app') ||\n", " document.body;\n", " if (notebookEl) {\n", " var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n", " var rgb = bgColor.match(/\\d+/g);\n", " if (rgb && rgb.length >= 3) {\n", " var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n", " if (brightness < 128) {\n", " isDark = true;\n", " }\n", " }\n", " }\n", "\n", " // Store result\n", " if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n", " IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n", " }\n", " })();\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " if (typeof IPython !== 'undefined' && IPython.notebook) {\n", " IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n", " (document.body.classList.contains('theme-dark') || \n", " document.body.classList.contains('jp-mod-dark') ||\n", " (document.body.getAttribute('data-jp-theme-name') && \n", " document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n", " }\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
 ParameterValue
1X0.00000
2Y0.08460
\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;32m———————\u001b[0m\n", "\u001b[1;32mFITTING\u001b[0m\n", "\u001b[1;32m———————\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;34mCalculation engine\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "cryspy\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;34mMinimization engine\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "lmfit \u001b[1m(\u001b[0mleastsq\u001b[1m)\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;34mFit quality\u001b[0m\n" ] }, { "data": { "application/javascript": [ "\n", " (function() {\n", " var isDark = false;\n", "\n", " // Check JupyterLab theme\n", " if (document.body.classList.contains('jp-mod-dark') || \n", " document.body.classList.contains('theme-dark') ||\n", " document.body.classList.contains('vscode-dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check theme attribute\n", " var themeAttr = document.body.getAttribute('data-jp-theme-name');\n", " if (themeAttr && themeAttr.includes('dark')) {\n", " isDark = true;\n", " }\n", "\n", " // Check computed background color\n", " var notebookEl = document.querySelector('.jp-Notebook') || \n", " document.querySelector('.notebook_app') ||\n", " document.body;\n", " if (notebookEl) {\n", " var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n", " var rgb = bgColor.match(/\\d+/g);\n", " if (rgb && rgb.length >= 3) {\n", " var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n", " if (brightness < 128) {\n", " isDark = true;\n", " }\n", " }\n", " }\n", "\n", " // Store result\n", " if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n", " IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n", " }\n", " })();\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", " if (typeof IPython !== 'undefined' && IPython.notebook) {\n", " IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n", " (document.body.classList.contains('theme-dark') || \n", " document.body.classList.contains('jp-mod-dark') ||\n", " (document.body.getAttribute('data-jp-theme-name') && \n", " document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n", " }\n", " " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
 metricvalue
1Goodness-of-fit (reduced χ²)1.28
\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.summary.show_report()" ] }, { "cell_type": "code", "execution_count": null, "id": "179", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "jupytext": { "cell_metadata_filter": "-all", "main_language": "python", "notebook_metadata_filter": "-all" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.13.11" } }, "nbformat": 4, "nbformat_minor": 5 }