{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "f6d394da",
"metadata": {
"execution": {
"iopub.execute_input": "2026-01-06T13:53:07.720906Z",
"iopub.status.busy": "2026-01-06T13:53:07.720731Z",
"iopub.status.idle": "2026-01-06T13:53:07.725244Z",
"shell.execute_reply": "2026-01-06T13:53:07.724186Z"
},
"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: Si, NPD\n",
"\n",
"This example demonstrates a pair distribution function (PDF) analysis\n",
"of Si, based on data collected from a time-of-flight neutron powder\n",
"diffraction experiment at NOMAD at SNS."
]
},
{
"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:07.727438Z",
"iopub.status.busy": "2026-01-06T13:53:07.727316Z",
"iopub.status.idle": "2026-01-06T13:53:11.661374Z",
"shell.execute_reply": "2026-01-06T13:53:11.660506Z"
}
},
"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:11.669573Z",
"iopub.status.busy": "2026-01-06T13:53:11.669108Z",
"iopub.status.idle": "2026-01-06T13:53:11.980490Z",
"shell.execute_reply": "2026-01-06T13:53:11.979611Z"
}
},
"outputs": [],
"source": [
"project = ed.Project()"
]
},
{
"cell_type": "markdown",
"id": "5",
"metadata": {},
"source": [
"## Set Plotting Engine"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "6",
"metadata": {
"execution": {
"iopub.execute_input": "2026-01-06T13:53:11.985133Z",
"iopub.status.busy": "2026-01-06T13:53:11.983674Z",
"iopub.status.idle": "2026-01-06T13:53:11.996461Z",
"shell.execute_reply": "2026-01-06T13:53:11.993607Z"
}
},
"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": "code",
"execution_count": 5,
"id": "7",
"metadata": {
"execution": {
"iopub.execute_input": "2026-01-06T13:53:12.001620Z",
"iopub.status.busy": "2026-01-06T13:53:12.000836Z",
"iopub.status.idle": "2026-01-06T13:53:12.013090Z",
"shell.execute_reply": "2026-01-06T13:53:12.010960Z"
}
},
"outputs": [],
"source": [
"# Set global plot range for plots\n",
"project.plotter.x_max = 40"
]
},
{
"cell_type": "markdown",
"id": "8",
"metadata": {},
"source": [
"## Add Sample Model"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "9",
"metadata": {
"execution": {
"iopub.execute_input": "2026-01-06T13:53:12.015397Z",
"iopub.status.busy": "2026-01-06T13:53:12.015223Z",
"iopub.status.idle": "2026-01-06T13:53:12.041103Z",
"shell.execute_reply": "2026-01-06T13:53:12.036892Z"
}
},
"outputs": [],
"source": [
"project.sample_models.add(name='si')"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "10",
"metadata": {
"execution": {
"iopub.execute_input": "2026-01-06T13:53:12.050835Z",
"iopub.status.busy": "2026-01-06T13:53:12.050358Z",
"iopub.status.idle": "2026-01-06T13:53:12.062163Z",
"shell.execute_reply": "2026-01-06T13:53:12.059132Z"
}
},
"outputs": [],
"source": [
"sample_model = project.sample_models['si']\n",
"sample_model.space_group.name_h_m.value = 'F d -3 m'\n",
"sample_model.space_group.it_coordinate_system_code = '1'\n",
"sample_model.cell.length_a = 5.43146\n",
"sample_model.atom_sites.add(\n",
" label='Si',\n",
" type_symbol='Si',\n",
" fract_x=0,\n",
" fract_y=0,\n",
" fract_z=0,\n",
" wyckoff_letter='a',\n",
" b_iso=0.5,\n",
")"
]
},
{
"cell_type": "markdown",
"id": "11",
"metadata": {},
"source": [
"## Add Experiment"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "12",
"metadata": {
"execution": {
"iopub.execute_input": "2026-01-06T13:53:12.064073Z",
"iopub.status.busy": "2026-01-06T13:53:12.063894Z",
"iopub.status.idle": "2026-01-06T13:53:12.295150Z",
"shell.execute_reply": "2026-01-06T13:53:12.294377Z"
}
},
"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;36m5\u001b[0m: NOM_9999_Si_640g_PAC_50_ff_ftfrgr_up-to-\u001b[1;36m50.\u001b[0mgr\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"โ
Data #\u001b[1;36m5\u001b[0m downloaded to \u001b[32m'data/ed-5.gr'\u001b[0m\n"
]
}
],
"source": [
"data_path = ed.download_data(id=5, destination='data')"
]
},
{
"cell_type": "code",
"execution_count": 9,
"id": "13",
"metadata": {
"execution": {
"iopub.execute_input": "2026-01-06T13:53:12.298238Z",
"iopub.status.busy": "2026-01-06T13:53:12.298097Z",
"iopub.status.idle": "2026-01-06T13:53:13.218202Z",
"shell.execute_reply": "2026-01-06T13:53:13.216954Z"
}
},
"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'nomad'\u001b[0m. Number of data points: \u001b[1;36m5033\u001b[0m\n"
]
}
],
"source": [
"project.experiments.add(\n",
" name='nomad',\n",
" data_path=data_path,\n",
" sample_form='powder',\n",
" beam_mode='time-of-flight',\n",
" radiation_probe='neutron',\n",
" scattering_type='total',\n",
")"
]
},
{
"cell_type": "code",
"execution_count": 10,
"id": "14",
"metadata": {
"execution": {
"iopub.execute_input": "2026-01-06T13:53:13.222578Z",
"iopub.status.busy": "2026-01-06T13:53:13.221796Z",
"iopub.status.idle": "2026-01-06T13:53:13.231799Z",
"shell.execute_reply": "2026-01-06T13:53:13.229544Z"
}
},
"outputs": [],
"source": [
"experiment = project.experiments['nomad']\n",
"experiment.linked_phases.add(id='si', scale=1.0)\n",
"experiment.peak.damp_q = 0.02\n",
"experiment.peak.broad_q = 0.03\n",
"experiment.peak.cutoff_q = 35.0\n",
"experiment.peak.sharp_delta_1 = 0.0\n",
"experiment.peak.sharp_delta_2 = 4.0\n",
"experiment.peak.damp_particle_diameter = 0"
]
},
{
"cell_type": "markdown",
"id": "15",
"metadata": {},
"source": [
"## Select Fitting Parameters"
]
},
{
"cell_type": "code",
"execution_count": 11,
"id": "16",
"metadata": {
"execution": {
"iopub.execute_input": "2026-01-06T13:53:13.234560Z",
"iopub.status.busy": "2026-01-06T13:53:13.234379Z",
"iopub.status.idle": "2026-01-06T13:53:13.237488Z",
"shell.execute_reply": "2026-01-06T13:53:13.236700Z"
}
},
"outputs": [],
"source": [
"project.sample_models['si'].cell.length_a.free = True\n",
"project.sample_models['si'].atom_sites['Si'].b_iso.free = True\n",
"experiment.linked_phases['si'].scale.free = True"
]
},
{
"cell_type": "code",
"execution_count": 12,
"id": "17",
"metadata": {
"execution": {
"iopub.execute_input": "2026-01-06T13:53:13.239572Z",
"iopub.status.busy": "2026-01-06T13:53:13.239449Z",
"iopub.status.idle": "2026-01-06T13:53:13.241744Z",
"shell.execute_reply": "2026-01-06T13:53:13.241379Z"
}
},
"outputs": [],
"source": [
"experiment.peak.damp_q.free = True\n",
"experiment.peak.broad_q.free = True\n",
"experiment.peak.sharp_delta_1.free = True\n",
"experiment.peak.sharp_delta_2.free = True"
]
},
{
"cell_type": "markdown",
"id": "18",
"metadata": {},
"source": [
"## Run Fitting"
]
},
{
"cell_type": "code",
"execution_count": 13,
"id": "19",
"metadata": {
"execution": {
"iopub.execute_input": "2026-01-06T13:53:13.246067Z",
"iopub.status.busy": "2026-01-06T13:53:13.245905Z",
"iopub.status.idle": "2026-01-06T13:53:22.558768Z",
"shell.execute_reply": "2026-01-06T13:53:22.558350Z"
}
},
"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'nomad'\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",
" iteration | \n",
" ฯยฒ | \n",
" improvement [%] | \n",
"
\n",
" \n",
" \n",
" \n",
" | 1 | \n",
" 1 | \n",
" 3103.72 | \n",
" | \n",
"
\n",
" \n",
" | 2 | \n",
" 11 | \n",
" 270.15 | \n",
" 91.3% โ | \n",
"
\n",
" \n",
" | 3 | \n",
" 19 | \n",
" 239.11 | \n",
" 11.5% โ | \n",
"
\n",
" \n",
" | 4 | \n",
" 52 | \n",
" 239.01 | \n",
" | \n",
"
\n",
" \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;36m239.01\u001b[0m at iteration \u001b[1;36m51\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;36m7.99\u001b[0m seconds\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"๐ Goodness-of-fit \u001b[1m(\u001b[0mreduced ฯยฒ\u001b[1m)\u001b[0m: \u001b[1;36m239.01\u001b[0m\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"๐ R-factor \u001b[1m(\u001b[0mRf\u001b[1m)\u001b[0m: \u001b[1;36m9.88\u001b[0m%\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"๐ R-factor squared \u001b[1m(\u001b[0mRfยฒ\u001b[1m)\u001b[0m: \u001b[1;36m9.82\u001b[0m%\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"๐ Weighted R-factor \u001b[1m(\u001b[0mwR\u001b[1m)\u001b[0m: \u001b[1;36m9.82\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",
" datablock | \n",
" category | \n",
" entry | \n",
" parameter | \n",
" start | \n",
" fitted | \n",
" uncertainty | \n",
" units | \n",
" change | \n",
"
\n",
" \n",
" \n",
" \n",
" | 1 | \n",
" si | \n",
" cell | \n",
" | \n",
" length_a | \n",
" 5.4315 | \n",
" 5.4315 | \n",
" N/A | \n",
" ร
| \n",
" 0.00 % โ | \n",
"
\n",
" \n",
" | 2 | \n",
" si | \n",
" atom_site | \n",
" Si | \n",
" b_iso | \n",
" 0.5000 | \n",
" 0.5000 | \n",
" N/A | \n",
" ร
ยฒ | \n",
" 0.00 % โ | \n",
"
\n",
" \n",
" | 3 | \n",
" nomad | \n",
" linked_phases | \n",
" si | \n",
" scale | \n",
" 1.0000 | \n",
" 1.2501 | \n",
" N/A | \n",
" | \n",
" 25.01 % โ | \n",
"
\n",
" \n",
" | 4 | \n",
" nomad | \n",
" peak | \n",
" | \n",
" damp_q | \n",
" 0.0200 | \n",
" 0.0233 | \n",
" N/A | \n",
" ร
โปยน | \n",
" 16.62 % โ | \n",
"
\n",
" \n",
" | 5 | \n",
" nomad | \n",
" peak | \n",
" | \n",
" broad_q | \n",
" 0.0300 | \n",
" 0.0290 | \n",
" N/A | \n",
" ร
โปยฒ | \n",
" 3.46 % โ | \n",
"
\n",
" \n",
" | 6 | \n",
" nomad | \n",
" peak | \n",
" | \n",
" sharp_delta_1 | \n",
" 0.0000 | \n",
" 0.0078 | \n",
" N/A | \n",
" ร
| \n",
" N/A | \n",
"
\n",
" \n",
" | 7 | \n",
" nomad | \n",
" peak | \n",
" | \n",
" sharp_delta_2 | \n",
" 4.0000 | \n",
" 3.8877 | \n",
" N/A | \n",
" ร
ยฒ | \n",
" 2.81 % โ | \n",
"
\n",
" \n",
"
\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": "20",
"metadata": {},
"source": [
"## Plot Measured vs Calculated"
]
},
{
"cell_type": "code",
"execution_count": 14,
"id": "21",
"metadata": {
"execution": {
"iopub.execute_input": "2026-01-06T13:53:22.560874Z",
"iopub.status.busy": "2026-01-06T13:53:22.560463Z",
"iopub.status.idle": "2026-01-06T13:53:22.733892Z",
"shell.execute_reply": "2026-01-06T13:53:22.733464Z"
}
},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"project.plot_meas_vs_calc(expt_name='nomad', show_residual=False)"
]
}
],
"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
}