{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "a29a5e22", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:53:34.942400Z", "iopub.status.busy": "2026-01-06T13:53:34.942012Z", "iopub.status.idle": "2026-01-06T13:53:34.948542Z", "shell.execute_reply": "2026-01-06T13:53:34.947489Z" }, "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": [ "# Pair Distribution Function: Ni, NPD\n", "\n", "This example demonstrates a pair distribution function (PDF) analysis\n", "of Ni, based on data collected from a constant wavelength neutron\n", "powder diffraction experiment.\n", "\n", "The dataset is taken from:\n", "https://github.com/diffpy/cmi_exchange/tree/main/cmi_scripts/fitNiPDF" ] }, { "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:34.951577Z", "iopub.status.busy": "2026-01-06T13:53:34.951381Z", "iopub.status.idle": "2026-01-06T13:53:37.603516Z", "shell.execute_reply": "2026-01-06T13:53:37.603036Z" } }, "outputs": [], "source": [ "import easydiffraction as ed" ] }, { "cell_type": "markdown", "id": "3", "metadata": {}, "source": [ "## Create Project" ] }, { "cell_type": "code", "execution_count": 3, "id": "4", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:53:37.605339Z", "iopub.status.busy": "2026-01-06T13:53:37.605173Z", "iopub.status.idle": "2026-01-06T13:53:37.719101Z", "shell.execute_reply": "2026-01-06T13:53:37.718658Z" } }, "outputs": [], "source": [ "project = ed.Project()" ] }, { "cell_type": "markdown", "id": "5", "metadata": {}, "source": [ "## Add Sample Model" ] }, { "cell_type": "code", "execution_count": 4, "id": "6", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:53:37.721044Z", "iopub.status.busy": "2026-01-06T13:53:37.720921Z", "iopub.status.idle": "2026-01-06T13:53:37.730328Z", "shell.execute_reply": "2026-01-06T13:53:37.729753Z" } }, "outputs": [], "source": [ "project.sample_models.add(name='ni')" ] }, { "cell_type": "code", "execution_count": 5, "id": "7", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:53:37.732224Z", "iopub.status.busy": "2026-01-06T13:53:37.732110Z", "iopub.status.idle": "2026-01-06T13:53:37.741671Z", "shell.execute_reply": "2026-01-06T13:53:37.741064Z" } }, "outputs": [], "source": [ "project.sample_models['ni'].space_group.name_h_m = 'F m -3 m'\n", "project.sample_models['ni'].space_group.it_coordinate_system_code = '1'\n", "project.sample_models['ni'].cell.length_a = 3.52387\n", "project.sample_models['ni'].atom_sites.add(\n", " label='Ni',\n", " type_symbol='Ni',\n", " fract_x=0.0,\n", " fract_y=0.0,\n", " fract_z=0.0,\n", " wyckoff_letter='a',\n", " b_iso=0.5,\n", ")" ] }, { "cell_type": "markdown", "id": "8", "metadata": {}, "source": [ "## Add Experiment" ] }, { "cell_type": "code", "execution_count": 6, "id": "9", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:53:37.743543Z", "iopub.status.busy": "2026-01-06T13:53:37.743430Z", "iopub.status.idle": "2026-01-06T13:53:37.935315Z", "shell.execute_reply": "2026-01-06T13:53:37.934855Z" } }, "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;36m6\u001b[0m: ni-q27r100-neutron_from-\u001b[1;36m2.\u001b[0mgr\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "✅ Data #\u001b[1;36m6\u001b[0m downloaded to \u001b[32m'data/ed-6.gr'\u001b[0m\n" ] } ], "source": [ "data_path = ed.download_data(id=6, destination='data')" ] }, { "cell_type": "code", "execution_count": 7, "id": "10", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:53:37.937114Z", "iopub.status.busy": "2026-01-06T13:53:37.936966Z", "iopub.status.idle": "2026-01-06T13:53:38.913912Z", "shell.execute_reply": "2026-01-06T13:53:38.912978Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Warning: No uncertainty (sy) column provided. Defaulting to 0.03.\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;34mData loaded successfully\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Experiment 🔬 \u001b[32m'pdf'\u001b[0m. Number of data points: \u001b[1;36m9801\u001b[0m\n" ] } ], "source": [ "project.experiments.add(\n", " name='pdf',\n", " data_path=data_path,\n", " sample_form='powder',\n", " beam_mode='constant wavelength',\n", " radiation_probe='neutron',\n", " scattering_type='total',\n", ")" ] }, { "cell_type": "code", "execution_count": 8, "id": "11", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:53:38.916440Z", "iopub.status.busy": "2026-01-06T13:53:38.916299Z", "iopub.status.idle": "2026-01-06T13:53:38.924047Z", "shell.execute_reply": "2026-01-06T13:53:38.923268Z" } }, "outputs": [], "source": [ "project.experiments['pdf'].linked_phases.add(id='ni', scale=1.0)\n", "project.experiments['pdf'].peak.damp_q = 0\n", "project.experiments['pdf'].peak.broad_q = 0.03\n", "project.experiments['pdf'].peak.cutoff_q = 27.0\n", "project.experiments['pdf'].peak.sharp_delta_1 = 0.0\n", "project.experiments['pdf'].peak.sharp_delta_2 = 2.0\n", "project.experiments['pdf'].peak.damp_particle_diameter = 0" ] }, { "cell_type": "markdown", "id": "12", "metadata": {}, "source": [ "## Select Fitting Parameters" ] }, { "cell_type": "code", "execution_count": 9, "id": "13", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:53:38.949816Z", "iopub.status.busy": "2026-01-06T13:53:38.948219Z", "iopub.status.idle": "2026-01-06T13:53:38.954278Z", "shell.execute_reply": "2026-01-06T13:53:38.953725Z" } }, "outputs": [], "source": [ "project.sample_models['ni'].cell.length_a.free = True\n", "project.sample_models['ni'].atom_sites['Ni'].b_iso.free = True" ] }, { "cell_type": "code", "execution_count": 10, "id": "14", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:53:38.960928Z", "iopub.status.busy": "2026-01-06T13:53:38.960004Z", "iopub.status.idle": "2026-01-06T13:53:38.974676Z", "shell.execute_reply": "2026-01-06T13:53:38.972973Z" } }, "outputs": [], "source": [ "project.experiments['pdf'].linked_phases['ni'].scale.free = True\n", "project.experiments['pdf'].peak.broad_q.free = True\n", "project.experiments['pdf'].peak.sharp_delta_2.free = True" ] }, { "cell_type": "markdown", "id": "15", "metadata": {}, "source": [ "## Run Fitting" ] }, { "cell_type": "code", "execution_count": 11, "id": "16", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:53:38.978808Z", "iopub.status.busy": "2026-01-06T13:53:38.978370Z", "iopub.status.idle": "2026-01-06T13:54:45.247164Z", "shell.execute_reply": "2026-01-06T13:54:45.245371Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;34mCurrent calculator changed to\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "pdffit\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;34mUsing experiment 🔬 \u001b[0m\u001b[32m'pdf'\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", "
 iterationχ²improvement [%]
112324.45
29921.6860.3% ↓
315887.033.8% ↓
456886.39
\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;36m886.39\u001b[0m at iteration \u001b[1;36m55\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;36m64.02\u001b[0m seconds\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "📏 Goodness-of-fit \u001b[1m(\u001b[0mreduced χ²\u001b[1m)\u001b[0m: \u001b[1;36m886.39\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "📏 R-factor \u001b[1m(\u001b[0mRf\u001b[1m)\u001b[0m: \u001b[1;36m20.00\u001b[0m%\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "📏 R-factor squared \u001b[1m(\u001b[0mRf²\u001b[1m)\u001b[0m: \u001b[1;36m19.61\u001b[0m%\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "📏 Weighted R-factor \u001b[1m(\u001b[0mwR\u001b[1m)\u001b[0m: \u001b[1;36m19.61\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", "
 datablockcategoryentryparameterstartfitteduncertaintyunitschange
1nicelllength_a3.52393.5239N/AÅ0.00 % ↓
2niatom_siteNib_iso0.50000.5000N/AŲ0.00 % ↓
3pdflinked_phasesniscale1.00001.0088N/A0.88 % ↑
4pdfpeakbroad_q0.03000.0204N/AÅ⁻²31.99 % ↓
5pdfpeaksharp_delta_22.00003.1153N/AŲ55.76 % ↑
\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.analysis.current_calculator = 'pdffit'\n", "project.analysis.fit()\n", "project.analysis.show_fit_results()" ] }, { "cell_type": "markdown", "id": "17", "metadata": {}, "source": [ "## Plot Measured vs Calculated" ] }, { "cell_type": "code", "execution_count": 12, "id": "18", "metadata": { "execution": { "iopub.execute_input": "2026-01-06T13:54:45.253937Z", "iopub.status.busy": "2026-01-06T13:54:45.252850Z", "iopub.status.idle": "2026-01-06T13:54:46.431662Z", "shell.execute_reply": "2026-01-06T13:54:46.430938Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.plot_meas_vs_calc(expt_name='pdf', show_residual=True)" ] } ], "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 }