{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "0",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:29:25.440429Z",
"iopub.status.busy": "2026-06-04T16:29:25.440249Z",
"iopub.status.idle": "2026-06-04T16:29:25.444288Z",
"shell.execute_reply": "2026-06-04T16:29:25.443600Z"
},
"tags": [
"hide-in-docs"
]
},
"outputs": [],
"source": [
"# Check whether easydiffraction is installed; install it if needed.\n",
"# Required for remote environments such as Google Colab.\n",
"import importlib.util\n",
"\n",
"if importlib.util.find_spec('easydiffraction') is None:\n",
" %pip install easydiffraction==0.18.0"
]
},
{
"cell_type": "markdown",
"id": "1",
"metadata": {},
"source": [
"# Structure Refinement: HS, HRPT\n",
"\n",
"This example demonstrates a Rietveld refinement of HS crystal\n",
"structure using constant wavelength neutron powder diffraction data\n",
"from HRPT at PSI."
]
},
{
"cell_type": "markdown",
"id": "2",
"metadata": {},
"source": [
"## 🛠️ Import Library"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "3",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:29:25.445758Z",
"iopub.status.busy": "2026-06-04T16:29:25.445582Z",
"iopub.status.idle": "2026-06-04T16:29:28.151971Z",
"shell.execute_reply": "2026-06-04T16:29:28.151034Z"
}
},
"outputs": [],
"source": [
"from easydiffraction import ExperimentFactory\n",
"from easydiffraction import Project\n",
"from easydiffraction import StructureFactory\n",
"from easydiffraction import download_data"
]
},
{
"cell_type": "markdown",
"id": "4",
"metadata": {},
"source": [
"## 🧩 Define Structure\n",
"\n",
"This section shows how to add structures and modify their\n",
"parameters.\n",
"\n",
"### Create Structure"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "5",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:29:28.153925Z",
"iopub.status.busy": "2026-06-04T16:29:28.153591Z",
"iopub.status.idle": "2026-06-04T16:29:28.159211Z",
"shell.execute_reply": "2026-06-04T16:29:28.158405Z"
}
},
"outputs": [],
"source": [
"structure = StructureFactory.from_scratch(name='hs')"
]
},
{
"cell_type": "markdown",
"id": "6",
"metadata": {},
"source": [
"### Set Space Group"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "7",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:29:28.160952Z",
"iopub.status.busy": "2026-06-04T16:29:28.160732Z",
"iopub.status.idle": "2026-06-04T16:29:28.164786Z",
"shell.execute_reply": "2026-06-04T16:29:28.164058Z"
}
},
"outputs": [],
"source": [
"structure.space_group.name_h_m = 'R -3 m'\n",
"structure.space_group.it_coordinate_system_code = 'h'"
]
},
{
"cell_type": "markdown",
"id": "8",
"metadata": {
"lines_to_next_cell": 2
},
"source": [
"### Set Unit Cell"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "9",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:29:28.166470Z",
"iopub.status.busy": "2026-06-04T16:29:28.166289Z",
"iopub.status.idle": "2026-06-04T16:29:28.169906Z",
"shell.execute_reply": "2026-06-04T16:29:28.169106Z"
}
},
"outputs": [],
"source": [
"structure.cell.length_a = 6.9\n",
"structure.cell.length_c = 14.1"
]
},
{
"cell_type": "markdown",
"id": "10",
"metadata": {},
"source": [
"### Set Atom Sites"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "11",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:29:28.171610Z",
"iopub.status.busy": "2026-06-04T16:29:28.171349Z",
"iopub.status.idle": "2026-06-04T16:29:28.183374Z",
"shell.execute_reply": "2026-06-04T16:29:28.182344Z"
}
},
"outputs": [],
"source": [
"structure.atom_sites.create(\n",
" label='Zn',\n",
" type_symbol='Zn',\n",
" fract_x=0,\n",
" fract_y=0,\n",
" fract_z=0.5,\n",
" adp_iso=0.5,\n",
")\n",
"structure.atom_sites.create(\n",
" label='Cu',\n",
" type_symbol='Cu',\n",
" fract_x=0.5,\n",
" fract_y=0,\n",
" fract_z=0,\n",
" adp_iso=0.5,\n",
")\n",
"structure.atom_sites.create(\n",
" label='O',\n",
" type_symbol='O',\n",
" fract_x=0.21,\n",
" fract_y=-0.21,\n",
" fract_z=0.06,\n",
" adp_iso=0.5,\n",
")\n",
"structure.atom_sites.create(\n",
" label='Cl',\n",
" type_symbol='Cl',\n",
" fract_x=0,\n",
" fract_y=0,\n",
" fract_z=0.197,\n",
" adp_iso=0.5,\n",
")\n",
"structure.atom_sites.create(\n",
" label='H',\n",
" type_symbol='2H',\n",
" fract_x=0.13,\n",
" fract_y=-0.13,\n",
" fract_z=0.08,\n",
" adp_iso=0.5,\n",
")"
]
},
{
"cell_type": "markdown",
"id": "12",
"metadata": {},
"source": [
"## 🔬 Define Experiment\n",
"\n",
"This section shows how to add experiments, configure their parameters,\n",
"and link the structures defined in the previous step.\n",
"\n",
"### Download Data"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "13",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:29:28.185220Z",
"iopub.status.busy": "2026-06-04T16:29:28.185003Z",
"iopub.status.idle": "2026-06-04T16:29:28.344220Z",
"shell.execute_reply": "2026-06-04T16:29:28.343390Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1;36mGetting data\u001b[0m\u001b[1;36m...\u001b[0m\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Data #\u001b[1;36m11\u001b[0m: HS, HRPT \u001b[1m(\u001b[0mPSI\u001b[1m)\u001b[0m\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"✅ Data #\u001b[1;36m11\u001b[0m downloaded to \u001b[32m'../../../data/ed-11.xye'\u001b[0m\n"
]
}
],
"source": [
"data_path = download_data(id=11, destination='data')"
]
},
{
"cell_type": "markdown",
"id": "14",
"metadata": {},
"source": [
"### Create Experiment"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "15",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:29:28.346388Z",
"iopub.status.busy": "2026-06-04T16:29:28.346148Z",
"iopub.status.idle": "2026-06-04T16:29:28.861540Z",
"shell.execute_reply": "2026-06-04T16:29:28.860525Z"
}
},
"outputs": [],
"source": [
"expt = ExperimentFactory.from_data_path(name='hrpt', data_path=data_path)"
]
},
{
"cell_type": "markdown",
"id": "16",
"metadata": {},
"source": [
"### Set Instrument"
]
},
{
"cell_type": "code",
"execution_count": 9,
"id": "17",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:29:28.863218Z",
"iopub.status.busy": "2026-06-04T16:29:28.863033Z",
"iopub.status.idle": "2026-06-04T16:29:28.865974Z",
"shell.execute_reply": "2026-06-04T16:29:28.865333Z"
}
},
"outputs": [],
"source": [
"expt.instrument.setup_wavelength = 1.89\n",
"expt.instrument.calib_twotheta_offset = 0.0"
]
},
{
"cell_type": "markdown",
"id": "18",
"metadata": {},
"source": [
"### Set Peak Profile"
]
},
{
"cell_type": "code",
"execution_count": 10,
"id": "19",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:29:28.868001Z",
"iopub.status.busy": "2026-06-04T16:29:28.867823Z",
"iopub.status.idle": "2026-06-04T16:29:28.881287Z",
"shell.execute_reply": "2026-06-04T16:29:28.880622Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1;36mPeak types\u001b[0m\n"
]
},
{
"data": {
"text/html": [
"
| | Type | Description |
|---|
| 1 | * | pseudo-voigt | CWL pseudo-Voigt profile |
|---|
| 2 | | pseudo-voigt + empirical asymmetry | CWL pseudo-Voigt profile with empirical asymmetry correction. |
|---|
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"⚠️ Switching peak profile type adds these settings with defaults: \n",
" • asym_empir_1=0.0 \n",
" • asym_empir_2=0.0 \n",
" • asym_empir_3=0.0 \n",
" • asym_empir_4=0.0 \n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1;36mPeak profile type for experiment \u001b[0m\u001b[32m'hrpt'\u001b[0m\u001b[1;36m changed to\u001b[0m\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"pseudo-voigt + empirical asymmetry\n"
]
}
],
"source": [
"expt.peak.show_supported()\n",
"expt.peak.type = 'pseudo-voigt + empirical asymmetry'\n",
"expt.peak.broad_gauss_u = 0.1\n",
"expt.peak.broad_gauss_v = -0.2\n",
"expt.peak.broad_gauss_w = 0.2\n",
"expt.peak.broad_lorentz_x = 0.0\n",
"expt.peak.broad_lorentz_y = 0"
]
},
{
"cell_type": "markdown",
"id": "20",
"metadata": {},
"source": [
"### Set Background"
]
},
{
"cell_type": "code",
"execution_count": 11,
"id": "21",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:29:28.883131Z",
"iopub.status.busy": "2026-06-04T16:29:28.882958Z",
"iopub.status.idle": "2026-06-04T16:29:28.888951Z",
"shell.execute_reply": "2026-06-04T16:29:28.888170Z"
}
},
"outputs": [],
"source": [
"expt.background.create(id='1', x=4.4196, y=500)\n",
"expt.background.create(id='2', x=6.6207, y=500)\n",
"expt.background.create(id='3', x=10.4918, y=500)\n",
"expt.background.create(id='4', x=15.4634, y=500)\n",
"expt.background.create(id='5', x=45.6041, y=500)\n",
"expt.background.create(id='6', x=74.6844, y=500)\n",
"expt.background.create(id='7', x=103.4187, y=500)\n",
"expt.background.create(id='8', x=121.6311, y=500)\n",
"expt.background.create(id='9', x=159.4116, y=500)"
]
},
{
"cell_type": "markdown",
"id": "22",
"metadata": {},
"source": [
"### Set Linked Phases"
]
},
{
"cell_type": "code",
"execution_count": 12,
"id": "23",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:29:28.890642Z",
"iopub.status.busy": "2026-06-04T16:29:28.890406Z",
"iopub.status.idle": "2026-06-04T16:29:28.893899Z",
"shell.execute_reply": "2026-06-04T16:29:28.893052Z"
}
},
"outputs": [],
"source": [
"expt.linked_phases.create(id='hs', scale=0.5)"
]
},
{
"cell_type": "markdown",
"id": "24",
"metadata": {},
"source": [
"## 📦 Define Project\n",
"\n",
"The project object is used to manage the structure, experiment, and\n",
"analysis.\n",
"\n",
"### Create Project"
]
},
{
"cell_type": "code",
"execution_count": 13,
"id": "25",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:29:28.895350Z",
"iopub.status.busy": "2026-06-04T16:29:28.895181Z",
"iopub.status.idle": "2026-06-04T16:29:29.385604Z",
"shell.execute_reply": "2026-06-04T16:29:29.384809Z"
}
},
"outputs": [
{
"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"
}
],
"source": [
"project = Project(name='hs_hrpt')"
]
},
{
"cell_type": "markdown",
"id": "26",
"metadata": {},
"source": [
"### Add Structure"
]
},
{
"cell_type": "code",
"execution_count": 14,
"id": "27",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:29:29.387281Z",
"iopub.status.busy": "2026-06-04T16:29:29.387121Z",
"iopub.status.idle": "2026-06-04T16:29:29.389917Z",
"shell.execute_reply": "2026-06-04T16:29:29.389053Z"
}
},
"outputs": [],
"source": [
"project.structures.add(structure)"
]
},
{
"cell_type": "markdown",
"id": "28",
"metadata": {},
"source": [
"### Add Experiment"
]
},
{
"cell_type": "code",
"execution_count": 15,
"id": "29",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:29:29.391335Z",
"iopub.status.busy": "2026-06-04T16:29:29.391169Z",
"iopub.status.idle": "2026-06-04T16:29:29.394429Z",
"shell.execute_reply": "2026-06-04T16:29:29.393573Z"
}
},
"outputs": [],
"source": [
"project.experiments.add(expt)"
]
},
{
"cell_type": "markdown",
"id": "30",
"metadata": {},
"source": [
"## 🚀 Perform Analysis\n",
"\n",
"This section shows the analysis process, including how to set up\n",
"calculation and fitting engines.\n",
"\n",
"\n",
"### Display Structure"
]
},
{
"cell_type": "code",
"execution_count": 16,
"id": "31",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:29:29.395844Z",
"iopub.status.busy": "2026-06-04T16:29:29.395681Z",
"iopub.status.idle": "2026-06-04T16:29:29.882968Z",
"shell.execute_reply": "2026-06-04T16:29:29.882177Z"
}
},
"outputs": [
{
"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": [
"\u001b[1;36mStructure 🧩 \u001b[0m\u001b[32m'hs'\u001b[0m\u001b[1;36m \u001b[0m\u001b[1;36m(\u001b[0m\u001b[1;36mAtom view type: \u001b[0m\u001b[32m'covalent'\u001b[0m\u001b[1;36m)\u001b[0m\n"
]
},
{
"data": {
"text/html": [
"\n",
"
\n",
"
Loading plot…
\n",
"
\n",
"
\n",
"
\n",
"
drag = rotate
wheel = zoom
right-drag = pan
\n",
"
\n",
"
\n",
"\n",
"\n",
"\n",
""
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"project.display.structure(struct_name='hs')"
]
},
{
"cell_type": "markdown",
"id": "32",
"metadata": {},
"source": [
"### Display Pattern"
]
},
{
"cell_type": "code",
"execution_count": 17,
"id": "33",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:29:29.884659Z",
"iopub.status.busy": "2026-06-04T16:29:29.884440Z",
"iopub.status.idle": "2026-06-04T16:29:31.173318Z",
"shell.execute_reply": "2026-06-04T16:29:31.172537Z"
}
},
"outputs": [
{
"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": {
"text/html": [
""
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"project.display.pattern(expt_name='hrpt')"
]
},
{
"cell_type": "code",
"execution_count": 18,
"id": "34",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:29:31.179968Z",
"iopub.status.busy": "2026-06-04T16:29:31.179796Z",
"iopub.status.idle": "2026-06-04T16:29:32.050606Z",
"shell.execute_reply": "2026-06-04T16:29:32.049883Z"
}
},
"outputs": [
{
"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": {
"text/html": [
""
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"project.display.pattern(expt_name='hrpt', x_min=48, x_max=51)"
]
},
{
"cell_type": "markdown",
"id": "35",
"metadata": {},
"source": [
"### Perform Fit 1/4\n",
"\n",
"Set parameters to be refined."
]
},
{
"cell_type": "code",
"execution_count": 19,
"id": "36",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:29:32.052213Z",
"iopub.status.busy": "2026-06-04T16:29:32.052038Z",
"iopub.status.idle": "2026-06-04T16:29:32.056044Z",
"shell.execute_reply": "2026-06-04T16:29:32.055110Z"
}
},
"outputs": [],
"source": [
"structure.cell.length_a.free = True\n",
"structure.cell.length_c.free = True\n",
"\n",
"expt.linked_phases['hs'].scale.free = True\n",
"expt.instrument.calib_twotheta_offset.free = True"
]
},
{
"cell_type": "markdown",
"id": "37",
"metadata": {},
"source": [
"Show free parameters after selection."
]
},
{
"cell_type": "code",
"execution_count": 20,
"id": "38",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:29:32.057676Z",
"iopub.status.busy": "2026-06-04T16:29:32.057494Z",
"iopub.status.idle": "2026-06-04T16:29:32.117856Z",
"shell.execute_reply": "2026-06-04T16:29:32.117166Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1;36mFree parameters for both structures \u001b[0m\u001b[1;36m(\u001b[0m\u001b[1;36m🧩 data blocks\u001b[0m\u001b[1;36m)\u001b[0m\u001b[1;36m and experiments \u001b[0m\u001b[1;36m(\u001b[0m\u001b[1;36m🔬 data blocks\u001b[0m\u001b[1;36m)\u001b[0m\n"
]
},
{
"data": {
"text/html": [
" | datablock | category | entry | parameter | value | uncertainty | min | max | units |
|---|
| 1 | hs | cell | | length_a | 6.90000 | | -inf | inf | Å |
|---|
| 2 | hs | cell | | length_c | 14.10000 | | -inf | inf | Å |
|---|
| 3 | hrpt | linked_phases | hs | scale | 0.50000 | | -inf | inf | |
|---|
| 4 | hrpt | instrument | | twotheta_offset | 0.00000 | | -inf | inf | deg |
|---|
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"project.display.parameters.free()"
]
},
{
"cell_type": "markdown",
"id": "39",
"metadata": {},
"source": [
"#### Run Fitting"
]
},
{
"cell_type": "code",
"execution_count": 21,
"id": "40",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:29:32.119986Z",
"iopub.status.busy": "2026-06-04T16:29:32.119783Z",
"iopub.status.idle": "2026-06-04T16:30:07.396265Z",
"shell.execute_reply": "2026-06-04T16:30:07.395587Z"
}
},
"outputs": [
{
"data": {
"text/html": [],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
"(function() {\n",
" const button = document.getElementById('ed-fit-stop-dea13165af4d40d0be4a54f9b6524acf-button');\n",
" const status = document.getElementById('ed-fit-stop-dea13165af4d40d0be4a54f9b6524acf-status');\n",
" const kernelId = '';\n",
" if (!button) {\n",
" return;\n",
" }\n",
"\n",
" function setStatus(text) {\n",
" if (status) {\n",
" status.textContent = text;\n",
" }\n",
" }\n",
"\n",
" function pageConfig() {\n",
" const element = document.getElementById('jupyter-config-data');\n",
" if (!element || !element.textContent) {\n",
" return {};\n",
" }\n",
" try {\n",
" return JSON.parse(element.textContent);\n",
" } catch (error) {\n",
" return {};\n",
" }\n",
" }\n",
"\n",
" function baseUrl(config) {\n",
" const configured = config.baseUrl || config.base_url ||\n",
" (window.Jupyter && Jupyter.notebook && Jupyter.notebook.base_url);\n",
" if (configured) {\n",
" return configured.endsWith('/') ? configured : configured + '/';\n",
" }\n",
" const markers = ['/lab/', '/notebooks/', '/tree/'];\n",
" for (const marker of markers) {\n",
" const index = window.location.pathname.indexOf(marker);\n",
" if (index >= 0) {\n",
" return window.location.pathname.slice(0, index + 1);\n",
" }\n",
" }\n",
" return '/';\n",
" }\n",
"\n",
" function token(config) {\n",
" return config.token || new URLSearchParams(window.location.search).get('token') || '';\n",
" }\n",
"\n",
" function cookie(name) {\n",
" const prefix = name + '=';\n",
" for (const part of document.cookie.split(';')) {\n",
" const trimmed = part.trim();\n",
" if (trimmed.startsWith(prefix)) {\n",
" return decodeURIComponent(trimmed.slice(prefix.length));\n",
" }\n",
" }\n",
" return '';\n",
" }\n",
"\n",
" function notebookPath() {\n",
" const decoded = decodeURIComponent(window.location.pathname);\n",
" const markers = ['/lab/tree/', '/notebooks/', '/tree/'];\n",
" for (const marker of markers) {\n",
" const index = decoded.indexOf(marker);\n",
" if (index >= 0) {\n",
" return decoded.slice(index + marker.length);\n",
" }\n",
" }\n",
" return '';\n",
" }\n",
"\n",
" async function kernelFromSessions(config) {\n",
" const url = new URL(baseUrl(config) + 'api/sessions', window.location.origin);\n",
" const authToken = token(config);\n",
" if (authToken) {\n",
" url.searchParams.set('token', authToken);\n",
" }\n",
" const response = await fetch(url, {credentials: 'same-origin'});\n",
" if (!response.ok) {\n",
" return '';\n",
" }\n",
" const sessions = await response.json();\n",
" const path = notebookPath();\n",
" const session = sessions.find((item) => item.path === path) || sessions[0];\n",
" return session && session.kernel ? session.kernel.id : '';\n",
" }\n",
"\n",
" async function interruptKernel(config, resolvedKernelId) {\n",
" const url = new URL(\n",
" baseUrl(config) + 'api/kernels/' + resolvedKernelId + '/interrupt',\n",
" window.location.origin\n",
" );\n",
" const authToken = token(config);\n",
" if (authToken) {\n",
" url.searchParams.set('token', authToken);\n",
" }\n",
" const xsrfToken = cookie('_xsrf');\n",
" const headers = {};\n",
" if (xsrfToken) {\n",
" headers['X-XSRFToken'] = xsrfToken;\n",
" }\n",
" const response = await fetch(url, {\n",
" method: 'POST',\n",
" credentials: 'same-origin',\n",
" headers: headers\n",
" });\n",
" return response.ok;\n",
" }\n",
"\n",
" button.addEventListener('click', async function() {\n",
" button.disabled = true;\n",
" setStatus('Stopping...');\n",
" const config = pageConfig();\n",
" try {\n",
" const resolvedKernelId = kernelId || await kernelFromSessions(config);\n",
" if (!resolvedKernelId) {\n",
" throw new Error('Could not resolve the current kernel id.');\n",
" }\n",
" const interrupted = await interruptKernel(config, resolvedKernelId);\n",
" if (!interrupted) {\n",
" throw new Error('Jupyter Server rejected the interrupt request.');\n",
" }\n",
" setStatus('Interrupt sent...');\n",
" } catch (error) {\n",
" button.disabled = false;\n",
" setStatus('Use Kernel > Interrupt to stop this fit.');\n",
" }\n",
" });\n",
"})();\n"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1;36mStandard fitting\u001b[0m\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"📋 Using experiment 🔬 \u001b[32m'hrpt'\u001b[0m for \u001b[32m'single'\u001b[0m fitting\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 progress:\n"
]
},
{
"data": {
"text/html": [
" | iteration | time (s) | χ² | change / status |
|---|
| 1 | 1 | 0.11 | 576.50 | |
|---|
| 2 | 8 | 0.84 | 122.02 | 78.8% ↓ |
|---|
| 3 | 13 | 1.35 | 115.19 | 5.6% ↓ |
|---|
| 4 | 18 | 2.11 | 109.86 | 4.6% ↓ |
|---|
| 5 | 23 | 2.64 | 106.68 | 2.9% ↓ |
|---|
| 6 | 28 | 3.15 | 104.60 | 2.0% ↓ |
|---|
| 7 | 33 | 3.67 | 102.87 | 1.7% ↓ |
|---|
| 8 | 38 | 4.46 | 101.13 | 1.7% ↓ |
|---|
| 9 | 43 | 4.99 | 99.20 | 1.9% ↓ |
|---|
| 10 | 48 | 5.51 | 96.86 | 2.4% ↓ |
|---|
| 11 | 53 | 6.03 | 93.93 | 3.0% ↓ |
|---|
| 12 | 58 | 6.54 | 90.34 | 3.8% ↓ |
|---|
| 13 | 63 | 7.32 | 86.20 | 4.6% ↓ |
|---|
| 14 | 68 | 7.83 | 81.66 | 5.3% ↓ |
|---|
| 15 | 73 | 8.34 | 76.78 | 6.0% ↓ |
|---|
| 16 | 78 | 8.85 | 71.71 | 6.6% ↓ |
|---|
| 17 | 83 | 9.61 | 66.82 | 6.8% ↓ |
|---|
| 18 | 88 | 10.12 | 62.48 | 6.5% ↓ |
|---|
| 19 | 93 | 10.66 | 58.99 | 5.6% ↓ |
|---|
| 20 | 98 | 11.19 | 56.41 | 4.4% ↓ |
|---|
| 21 | 103 | 11.71 | 54.64 | 3.1% ↓ |
|---|
| 22 | 108 | 12.52 | 53.49 | 2.1% ↓ |
|---|
| 23 | 113 | 13.04 | 52.76 | 1.4% ↓ |
|---|
| 24 | 123 | 14.08 | 52.02 | 1.4% ↓ |
|---|
| 25 | 167 | 19.18 | 51.59 | |
|---|
| 26 | 210 | 24.24 | 51.58 | |
|---|
| 27 | 254 | 29.34 | 51.58 | |
|---|
| 28 | 297 | 34.43 | 51.57 | |
|---|
| 29 | 304 | 35.18 | 51.57 | |
|---|
"
],
"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;36m51.57\u001b[0m at iteration \u001b[1;36m303\u001b[0m\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"✅ Fitting complete.\n"
]
}
],
"source": [
"project.analysis.fit()"
]
},
{
"cell_type": "code",
"execution_count": 22,
"id": "41",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:30:07.398059Z",
"iopub.status.busy": "2026-06-04T16:30:07.397886Z",
"iopub.status.idle": "2026-06-04T16:30:07.861350Z",
"shell.execute_reply": "2026-06-04T16:30:07.860492Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"⚙️ Settings used:\n"
]
},
{
"data": {
"text/html": [
" | Name | Value | Description |
|---|
| 1 | max_iterations | 1000 | Maximum solver iterations. |
|---|
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"📋 Least-squares fit results:\n"
]
},
{
"data": {
"text/html": [
" | Metric | Value |
|---|
| 1 | 🧪 Minimizer | lmfit (leastsq) |
|---|
| 2 | ✅ Overall status | success |
|---|
| 3 | ⏱️ Fitting time (seconds) | 35.18 |
|---|
| 4 | 🔁 Iterations | 301 |
|---|
| 5 | 📏 Goodness-of-fit (reduced χ²) | 51.57 |
|---|
| 6 | 📏 R-factor (Rf, %) | 19.70 |
|---|
| 7 | 📏 R-factor squared (Rf², %) | 30.20 |
|---|
| 8 | 📏 Weighted R-factor (wR, %) | 30.35 |
|---|
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"📈 Refined parameters:\n"
]
},
{
"data": {
"text/html": [
" | datablock | category | entry | parameter | units | start | value | s.u. | change |
|---|
| 1 | hs | cell | | length_a | Å | 6.9000 | 6.8623 | 0.0003 | 0.55 % ↓ |
|---|
| 2 | hs | cell | | length_c | Å | 14.1000 | 14.1365 | 0.0008 | 0.26 % ↑ |
|---|
| 3 | hrpt | linked_phases | hs | scale | | 0.5000 | 0.2548 | 0.0030 | 49.04 % ↓ |
|---|
| 4 | hrpt | instrument | | twotheta_offset | deg | 0.0000 | 0.1271 | 0.0051 | N/A |
|---|
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
" • start = parameter value before refinement
• value = refined value from least-squares minimization
• s.u. = standard uncertainty (one sigma), from the covariance matrix
• change = relative change from start, in %; ↑ = increase, ↓ = decrease
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"project.display.fit.results()"
]
},
{
"cell_type": "markdown",
"id": "42",
"metadata": {},
"source": [
"#### Display Pattern"
]
},
{
"cell_type": "code",
"execution_count": 23,
"id": "43",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:30:07.862973Z",
"iopub.status.busy": "2026-06-04T16:30:07.862782Z",
"iopub.status.idle": "2026-06-04T16:30:08.743498Z",
"shell.execute_reply": "2026-06-04T16:30:08.742869Z"
}
},
"outputs": [
{
"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": {
"text/html": [
""
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"project.display.pattern(expt_name='hrpt')"
]
},
{
"cell_type": "code",
"execution_count": 24,
"id": "44",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:30:08.748723Z",
"iopub.status.busy": "2026-06-04T16:30:08.748536Z",
"iopub.status.idle": "2026-06-04T16:30:09.616476Z",
"shell.execute_reply": "2026-06-04T16:30:09.615526Z"
}
},
"outputs": [
{
"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": {
"text/html": [
""
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"project.display.pattern(expt_name='hrpt', x_min=48, x_max=51)"
]
},
{
"cell_type": "markdown",
"id": "45",
"metadata": {},
"source": [
"### Perform Fit 2/4\n",
"\n",
"Set more parameters to be refined."
]
},
{
"cell_type": "code",
"execution_count": 25,
"id": "46",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:30:09.618148Z",
"iopub.status.busy": "2026-06-04T16:30:09.617956Z",
"iopub.status.idle": "2026-06-04T16:30:09.622546Z",
"shell.execute_reply": "2026-06-04T16:30:09.621832Z"
}
},
"outputs": [],
"source": [
"expt.peak.broad_gauss_u.free = True\n",
"expt.peak.broad_gauss_v.free = True\n",
"expt.peak.broad_gauss_w.free = True\n",
"expt.peak.broad_lorentz_y.free = True\n",
"\n",
"for point in expt.background:\n",
" point.y.free = True"
]
},
{
"cell_type": "markdown",
"id": "47",
"metadata": {},
"source": [
"Show free parameters after selection."
]
},
{
"cell_type": "code",
"execution_count": 26,
"id": "48",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:30:09.623957Z",
"iopub.status.busy": "2026-06-04T16:30:09.623806Z",
"iopub.status.idle": "2026-06-04T16:30:09.676064Z",
"shell.execute_reply": "2026-06-04T16:30:09.675228Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1;36mFree parameters for both structures \u001b[0m\u001b[1;36m(\u001b[0m\u001b[1;36m🧩 data blocks\u001b[0m\u001b[1;36m)\u001b[0m\u001b[1;36m and experiments \u001b[0m\u001b[1;36m(\u001b[0m\u001b[1;36m🔬 data blocks\u001b[0m\u001b[1;36m)\u001b[0m\n"
]
},
{
"data": {
"text/html": [
" | datablock | category | entry | parameter | value | uncertainty | min | max | units |
|---|
| 1 | hs | cell | | length_a | 6.86229 | 0.00029 | -inf | inf | Å |
|---|
| 2 | hs | cell | | length_c | 14.13651 | 0.00084 | -inf | inf | Å |
|---|
| 3 | hrpt | linked_phases | hs | scale | 0.25480 | 0.00305 | -inf | inf | |
|---|
| 4 | hrpt | peak | | broad_gauss_u | 0.10000 | | -inf | inf | deg² |
|---|
| 5 | hrpt | peak | | broad_gauss_v | -0.20000 | | -inf | inf | deg² |
|---|
| 6 | hrpt | peak | | broad_gauss_w | 0.20000 | | -inf | inf | deg² |
|---|
| 7 | hrpt | peak | | broad_lorentz_y | 0.00000 | | -inf | inf | deg |
|---|
| 8 | hrpt | instrument | | twotheta_offset | 0.12712 | 0.00515 | -inf | inf | deg |
|---|
| 9 | hrpt | background | 1 | y | 500.00000 | | -inf | inf | |
|---|
| 10 | hrpt | background | 2 | y | 500.00000 | | -inf | inf | |
|---|
| 11 | hrpt | background | 3 | y | 500.00000 | | -inf | inf | |
|---|
| 12 | hrpt | background | 4 | y | 500.00000 | | -inf | inf | |
|---|
| 13 | hrpt | background | 5 | y | 500.00000 | | -inf | inf | |
|---|
| 14 | hrpt | background | 6 | y | 500.00000 | | -inf | inf | |
|---|
| 15 | hrpt | background | 7 | y | 500.00000 | | -inf | inf | |
|---|
| 16 | hrpt | background | 8 | y | 500.00000 | | -inf | inf | |
|---|
| 17 | hrpt | background | 9 | y | 500.00000 | | -inf | inf | |
|---|
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"project.display.parameters.free()"
]
},
{
"cell_type": "markdown",
"id": "49",
"metadata": {},
"source": [
"#### Run Fitting"
]
},
{
"cell_type": "code",
"execution_count": 27,
"id": "50",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:30:09.677862Z",
"iopub.status.busy": "2026-06-04T16:30:09.677683Z",
"iopub.status.idle": "2026-06-04T16:30:38.961963Z",
"shell.execute_reply": "2026-06-04T16:30:38.961272Z"
}
},
"outputs": [
{
"data": {
"text/html": [],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
"(function() {\n",
" const button = document.getElementById('ed-fit-stop-fd9390db156e41d9a273f5f389054101-button');\n",
" const status = document.getElementById('ed-fit-stop-fd9390db156e41d9a273f5f389054101-status');\n",
" const kernelId = '';\n",
" if (!button) {\n",
" return;\n",
" }\n",
"\n",
" function setStatus(text) {\n",
" if (status) {\n",
" status.textContent = text;\n",
" }\n",
" }\n",
"\n",
" function pageConfig() {\n",
" const element = document.getElementById('jupyter-config-data');\n",
" if (!element || !element.textContent) {\n",
" return {};\n",
" }\n",
" try {\n",
" return JSON.parse(element.textContent);\n",
" } catch (error) {\n",
" return {};\n",
" }\n",
" }\n",
"\n",
" function baseUrl(config) {\n",
" const configured = config.baseUrl || config.base_url ||\n",
" (window.Jupyter && Jupyter.notebook && Jupyter.notebook.base_url);\n",
" if (configured) {\n",
" return configured.endsWith('/') ? configured : configured + '/';\n",
" }\n",
" const markers = ['/lab/', '/notebooks/', '/tree/'];\n",
" for (const marker of markers) {\n",
" const index = window.location.pathname.indexOf(marker);\n",
" if (index >= 0) {\n",
" return window.location.pathname.slice(0, index + 1);\n",
" }\n",
" }\n",
" return '/';\n",
" }\n",
"\n",
" function token(config) {\n",
" return config.token || new URLSearchParams(window.location.search).get('token') || '';\n",
" }\n",
"\n",
" function cookie(name) {\n",
" const prefix = name + '=';\n",
" for (const part of document.cookie.split(';')) {\n",
" const trimmed = part.trim();\n",
" if (trimmed.startsWith(prefix)) {\n",
" return decodeURIComponent(trimmed.slice(prefix.length));\n",
" }\n",
" }\n",
" return '';\n",
" }\n",
"\n",
" function notebookPath() {\n",
" const decoded = decodeURIComponent(window.location.pathname);\n",
" const markers = ['/lab/tree/', '/notebooks/', '/tree/'];\n",
" for (const marker of markers) {\n",
" const index = decoded.indexOf(marker);\n",
" if (index >= 0) {\n",
" return decoded.slice(index + marker.length);\n",
" }\n",
" }\n",
" return '';\n",
" }\n",
"\n",
" async function kernelFromSessions(config) {\n",
" const url = new URL(baseUrl(config) + 'api/sessions', window.location.origin);\n",
" const authToken = token(config);\n",
" if (authToken) {\n",
" url.searchParams.set('token', authToken);\n",
" }\n",
" const response = await fetch(url, {credentials: 'same-origin'});\n",
" if (!response.ok) {\n",
" return '';\n",
" }\n",
" const sessions = await response.json();\n",
" const path = notebookPath();\n",
" const session = sessions.find((item) => item.path === path) || sessions[0];\n",
" return session && session.kernel ? session.kernel.id : '';\n",
" }\n",
"\n",
" async function interruptKernel(config, resolvedKernelId) {\n",
" const url = new URL(\n",
" baseUrl(config) + 'api/kernels/' + resolvedKernelId + '/interrupt',\n",
" window.location.origin\n",
" );\n",
" const authToken = token(config);\n",
" if (authToken) {\n",
" url.searchParams.set('token', authToken);\n",
" }\n",
" const xsrfToken = cookie('_xsrf');\n",
" const headers = {};\n",
" if (xsrfToken) {\n",
" headers['X-XSRFToken'] = xsrfToken;\n",
" }\n",
" const response = await fetch(url, {\n",
" method: 'POST',\n",
" credentials: 'same-origin',\n",
" headers: headers\n",
" });\n",
" return response.ok;\n",
" }\n",
"\n",
" button.addEventListener('click', async function() {\n",
" button.disabled = true;\n",
" setStatus('Stopping...');\n",
" const config = pageConfig();\n",
" try {\n",
" const resolvedKernelId = kernelId || await kernelFromSessions(config);\n",
" if (!resolvedKernelId) {\n",
" throw new Error('Could not resolve the current kernel id.');\n",
" }\n",
" const interrupted = await interruptKernel(config, resolvedKernelId);\n",
" if (!interrupted) {\n",
" throw new Error('Jupyter Server rejected the interrupt request.');\n",
" }\n",
" setStatus('Interrupt sent...');\n",
" } catch (error) {\n",
" button.disabled = false;\n",
" setStatus('Use Kernel > Interrupt to stop this fit.');\n",
" }\n",
" });\n",
"})();\n"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1;36mStandard fitting\u001b[0m\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"📋 Using experiment 🔬 \u001b[32m'hrpt'\u001b[0m for \u001b[32m'single'\u001b[0m fitting\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 progress:\n"
]
},
{
"data": {
"text/html": [
" | iteration | time (s) | χ² | change / status |
|---|
| 1 | 1 | 0.15 | 51.78 | |
|---|
| 2 | 21 | 2.85 | 15.91 | 69.3% ↓ |
|---|
| 3 | 39 | 5.28 | 15.07 | 5.3% ↓ |
|---|
| 4 | 57 | 7.68 | 14.17 | 6.0% ↓ |
|---|
| 5 | 75 | 10.12 | 13.42 | 5.3% ↓ |
|---|
| 6 | 115 | 15.20 | 13.39 | |
|---|
| 7 | 152 | 20.26 | 13.39 | |
|---|
| 8 | 191 | 25.43 | 13.39 | |
|---|
| 9 | 220 | 29.20 | 13.39 | |
|---|
"
],
"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;36m13.39\u001b[0m at iteration \u001b[1;36m219\u001b[0m\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"✅ Fitting complete.\n"
]
}
],
"source": [
"project.analysis.fit()"
]
},
{
"cell_type": "code",
"execution_count": 28,
"id": "51",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:30:38.964005Z",
"iopub.status.busy": "2026-06-04T16:30:38.963826Z",
"iopub.status.idle": "2026-06-04T16:30:39.407449Z",
"shell.execute_reply": "2026-06-04T16:30:39.406667Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"⚙️ Settings used:\n"
]
},
{
"data": {
"text/html": [
" | Name | Value | Description |
|---|
| 1 | max_iterations | 1000 | Maximum solver iterations. |
|---|
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"📋 Least-squares fit results:\n"
]
},
{
"data": {
"text/html": [
" | Metric | Value |
|---|
| 1 | 🧪 Minimizer | lmfit (leastsq) |
|---|
| 2 | ✅ Overall status | success |
|---|
| 3 | ⏱️ Fitting time (seconds) | 29.20 |
|---|
| 4 | 🔁 Iterations | 217 |
|---|
| 5 | 📏 Goodness-of-fit (reduced χ²) | 13.39 |
|---|
| 6 | 📏 R-factor (Rf, %) | 10.13 |
|---|
| 7 | 📏 R-factor squared (Rf², %) | 14.05 |
|---|
| 8 | 📏 Weighted R-factor (wR, %) | 13.91 |
|---|
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"📈 Refined parameters:\n"
]
},
{
"data": {
"text/html": [
" | datablock | category | entry | parameter | units | start | value | s.u. | change |
|---|
| 1 | hs | cell | | length_a | Å | 6.8623 | 6.8631 | 0.0003 | 0.01 % ↑ |
|---|
| 2 | hs | cell | | length_c | Å | 14.1365 | 14.1397 | 0.0009 | 0.02 % ↑ |
|---|
| 3 | hrpt | linked_phases | hs | scale | | 0.2548 | 0.4270 | 0.0039 | 67.58 % ↑ |
|---|
| 4 | hrpt | peak | | broad_gauss_u | deg² | 0.1000 | 0.3338 | 0.0270 | 233.82 % ↑ |
|---|
| 5 | hrpt | peak | | broad_gauss_v | deg² | -0.2000 | -0.2705 | 0.0498 | 35.27 % ↑ |
|---|
| 6 | hrpt | peak | | broad_gauss_w | deg² | 0.2000 | 0.2067 | 0.0214 | 3.37 % ↑ |
|---|
| 7 | hrpt | peak | | broad_lorentz_y | deg | 0.0000 | 0.1859 | 0.0103 | N/A |
|---|
| 8 | hrpt | instrument | | twotheta_offset | deg | 0.1271 | 0.1316 | 0.0040 | 3.49 % ↑ |
|---|
| 9 | hrpt | background | 1 | y | | 500.0000 | 595.4716 | 24.8884 | 19.09 % ↑ |
|---|
| 10 | hrpt | background | 2 | y | | 500.0000 | 500.0658 | 14.1957 | 0.01 % ↑ |
|---|
| 11 | hrpt | background | 3 | y | | 500.0000 | 446.7961 | 10.8562 | 10.64 % ↓ |
|---|
| 12 | hrpt | background | 4 | y | | 500.0000 | 423.0736 | 5.6094 | 15.39 % ↓ |
|---|
| 13 | hrpt | background | 5 | y | | 500.0000 | 469.5233 | 6.1230 | 6.10 % ↓ |
|---|
| 14 | hrpt | background | 6 | y | | 500.0000 | 473.3416 | 5.9675 | 5.33 % ↓ |
|---|
| 15 | hrpt | background | 7 | y | | 500.0000 | 431.9294 | 5.7359 | 13.61 % ↓ |
|---|
| 16 | hrpt | background | 8 | y | | 500.0000 | 388.9936 | 6.0673 | 22.20 % ↓ |
|---|
| 17 | hrpt | background | 9 | y | | 500.0000 | 501.8443 | 5.6961 | 0.37 % ↑ |
|---|
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
" • start = parameter value before refinement
• value = refined value from least-squares minimization
• s.u. = standard uncertainty (one sigma), from the covariance matrix
• change = relative change from start, in %; ↑ = increase, ↓ = decrease
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"project.display.fit.results()"
]
},
{
"cell_type": "markdown",
"id": "52",
"metadata": {},
"source": [
"#### Display Pattern"
]
},
{
"cell_type": "code",
"execution_count": 29,
"id": "53",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:30:39.408901Z",
"iopub.status.busy": "2026-06-04T16:30:39.408724Z",
"iopub.status.idle": "2026-06-04T16:30:40.285837Z",
"shell.execute_reply": "2026-06-04T16:30:40.285033Z"
}
},
"outputs": [
{
"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": {
"text/html": [
""
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"project.display.pattern(expt_name='hrpt')"
]
},
{
"cell_type": "code",
"execution_count": 30,
"id": "54",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:30:40.292789Z",
"iopub.status.busy": "2026-06-04T16:30:40.292548Z",
"iopub.status.idle": "2026-06-04T16:30:41.163420Z",
"shell.execute_reply": "2026-06-04T16:30:41.162584Z"
}
},
"outputs": [
{
"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": {
"text/html": [
""
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"project.display.pattern(expt_name='hrpt', x_min=48, x_max=51)"
]
},
{
"cell_type": "markdown",
"id": "55",
"metadata": {},
"source": [
"### Perform Fit 3/4\n",
"\n",
"Set more parameters to be refined."
]
},
{
"cell_type": "code",
"execution_count": 31,
"id": "56",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:30:41.165587Z",
"iopub.status.busy": "2026-06-04T16:30:41.165391Z",
"iopub.status.idle": "2026-06-04T16:30:41.169696Z",
"shell.execute_reply": "2026-06-04T16:30:41.168763Z"
}
},
"outputs": [],
"source": [
"structure.atom_sites['O'].fract_x.free = True\n",
"structure.atom_sites['O'].fract_z.free = True\n",
"structure.atom_sites['Cl'].fract_z.free = True\n",
"structure.atom_sites['H'].fract_x.free = True\n",
"structure.atom_sites['H'].fract_z.free = True"
]
},
{
"cell_type": "markdown",
"id": "57",
"metadata": {},
"source": [
"Show free parameters after selection."
]
},
{
"cell_type": "code",
"execution_count": 32,
"id": "58",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:30:41.171100Z",
"iopub.status.busy": "2026-06-04T16:30:41.170957Z",
"iopub.status.idle": "2026-06-04T16:30:41.232203Z",
"shell.execute_reply": "2026-06-04T16:30:41.231458Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1;36mFree parameters for both structures \u001b[0m\u001b[1;36m(\u001b[0m\u001b[1;36m🧩 data blocks\u001b[0m\u001b[1;36m)\u001b[0m\u001b[1;36m and experiments \u001b[0m\u001b[1;36m(\u001b[0m\u001b[1;36m🔬 data blocks\u001b[0m\u001b[1;36m)\u001b[0m\n"
]
},
{
"data": {
"text/html": [
" | datablock | category | entry | parameter | value | uncertainty | min | max | units |
|---|
| 1 | hs | cell | | length_a | 6.86308 | 0.00035 | -inf | inf | Å |
|---|
| 2 | hs | cell | | length_c | 14.13974 | 0.00094 | -inf | inf | Å |
|---|
| 3 | hs | atom_site | O | fract_x | 0.21000 | | -inf | inf | |
|---|
| 4 | hs | atom_site | O | fract_z | 0.06000 | | -inf | inf | |
|---|
| 5 | hs | atom_site | Cl | fract_z | 0.19700 | | -inf | inf | |
|---|
| 6 | hs | atom_site | H | fract_x | 0.13000 | | -inf | inf | |
|---|
| 7 | hs | atom_site | H | fract_z | 0.08000 | | -inf | inf | |
|---|
| 8 | hrpt | linked_phases | hs | scale | 0.42699 | 0.00386 | -inf | inf | |
|---|
| 9 | hrpt | peak | | broad_gauss_u | 0.33382 | 0.02703 | -inf | inf | deg² |
|---|
| 10 | hrpt | peak | | broad_gauss_v | -0.27053 | 0.04977 | -inf | inf | deg² |
|---|
| 11 | hrpt | peak | | broad_gauss_w | 0.20675 | 0.02144 | -inf | inf | deg² |
|---|
| 12 | hrpt | peak | | broad_lorentz_y | 0.18589 | 0.01026 | -inf | inf | deg |
|---|
| 13 | hrpt | instrument | | twotheta_offset | 0.13156 | 0.00402 | -inf | inf | deg |
|---|
| 14 | hrpt | background | 1 | y | 595.47160 | 24.88844 | -inf | inf | |
|---|
| 15 | hrpt | background | 2 | y | 500.06584 | 14.19569 | -inf | inf | |
|---|
| 16 | hrpt | background | 3 | y | 446.79606 | 10.85617 | -inf | inf | |
|---|
| 17 | hrpt | background | 4 | y | 423.07355 | 5.60941 | -inf | inf | |
|---|
| 18 | hrpt | background | 5 | y | 469.52331 | 6.12295 | -inf | inf | |
|---|
| 19 | hrpt | background | 6 | y | 473.34159 | 5.96754 | -inf | inf | |
|---|
| 20 | hrpt | background | 7 | y | 431.92940 | 5.73592 | -inf | inf | |
|---|
| 21 | hrpt | background | 8 | y | 388.99361 | 6.06730 | -inf | inf | |
|---|
| 22 | hrpt | background | 9 | y | 501.84432 | 5.69613 | -inf | inf | |
|---|
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"project.display.parameters.free()"
]
},
{
"cell_type": "markdown",
"id": "59",
"metadata": {},
"source": [
"#### Run Fitting"
]
},
{
"cell_type": "code",
"execution_count": 33,
"id": "60",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:30:41.233982Z",
"iopub.status.busy": "2026-06-04T16:30:41.233824Z",
"iopub.status.idle": "2026-06-04T16:31:08.259554Z",
"shell.execute_reply": "2026-06-04T16:31:08.258795Z"
}
},
"outputs": [
{
"data": {
"text/html": [],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
"(function() {\n",
" const button = document.getElementById('ed-fit-stop-8c89bb6fe9894066ad14ce6ce6e3409a-button');\n",
" const status = document.getElementById('ed-fit-stop-8c89bb6fe9894066ad14ce6ce6e3409a-status');\n",
" const kernelId = '';\n",
" if (!button) {\n",
" return;\n",
" }\n",
"\n",
" function setStatus(text) {\n",
" if (status) {\n",
" status.textContent = text;\n",
" }\n",
" }\n",
"\n",
" function pageConfig() {\n",
" const element = document.getElementById('jupyter-config-data');\n",
" if (!element || !element.textContent) {\n",
" return {};\n",
" }\n",
" try {\n",
" return JSON.parse(element.textContent);\n",
" } catch (error) {\n",
" return {};\n",
" }\n",
" }\n",
"\n",
" function baseUrl(config) {\n",
" const configured = config.baseUrl || config.base_url ||\n",
" (window.Jupyter && Jupyter.notebook && Jupyter.notebook.base_url);\n",
" if (configured) {\n",
" return configured.endsWith('/') ? configured : configured + '/';\n",
" }\n",
" const markers = ['/lab/', '/notebooks/', '/tree/'];\n",
" for (const marker of markers) {\n",
" const index = window.location.pathname.indexOf(marker);\n",
" if (index >= 0) {\n",
" return window.location.pathname.slice(0, index + 1);\n",
" }\n",
" }\n",
" return '/';\n",
" }\n",
"\n",
" function token(config) {\n",
" return config.token || new URLSearchParams(window.location.search).get('token') || '';\n",
" }\n",
"\n",
" function cookie(name) {\n",
" const prefix = name + '=';\n",
" for (const part of document.cookie.split(';')) {\n",
" const trimmed = part.trim();\n",
" if (trimmed.startsWith(prefix)) {\n",
" return decodeURIComponent(trimmed.slice(prefix.length));\n",
" }\n",
" }\n",
" return '';\n",
" }\n",
"\n",
" function notebookPath() {\n",
" const decoded = decodeURIComponent(window.location.pathname);\n",
" const markers = ['/lab/tree/', '/notebooks/', '/tree/'];\n",
" for (const marker of markers) {\n",
" const index = decoded.indexOf(marker);\n",
" if (index >= 0) {\n",
" return decoded.slice(index + marker.length);\n",
" }\n",
" }\n",
" return '';\n",
" }\n",
"\n",
" async function kernelFromSessions(config) {\n",
" const url = new URL(baseUrl(config) + 'api/sessions', window.location.origin);\n",
" const authToken = token(config);\n",
" if (authToken) {\n",
" url.searchParams.set('token', authToken);\n",
" }\n",
" const response = await fetch(url, {credentials: 'same-origin'});\n",
" if (!response.ok) {\n",
" return '';\n",
" }\n",
" const sessions = await response.json();\n",
" const path = notebookPath();\n",
" const session = sessions.find((item) => item.path === path) || sessions[0];\n",
" return session && session.kernel ? session.kernel.id : '';\n",
" }\n",
"\n",
" async function interruptKernel(config, resolvedKernelId) {\n",
" const url = new URL(\n",
" baseUrl(config) + 'api/kernels/' + resolvedKernelId + '/interrupt',\n",
" window.location.origin\n",
" );\n",
" const authToken = token(config);\n",
" if (authToken) {\n",
" url.searchParams.set('token', authToken);\n",
" }\n",
" const xsrfToken = cookie('_xsrf');\n",
" const headers = {};\n",
" if (xsrfToken) {\n",
" headers['X-XSRFToken'] = xsrfToken;\n",
" }\n",
" const response = await fetch(url, {\n",
" method: 'POST',\n",
" credentials: 'same-origin',\n",
" headers: headers\n",
" });\n",
" return response.ok;\n",
" }\n",
"\n",
" button.addEventListener('click', async function() {\n",
" button.disabled = true;\n",
" setStatus('Stopping...');\n",
" const config = pageConfig();\n",
" try {\n",
" const resolvedKernelId = kernelId || await kernelFromSessions(config);\n",
" if (!resolvedKernelId) {\n",
" throw new Error('Could not resolve the current kernel id.');\n",
" }\n",
" const interrupted = await interruptKernel(config, resolvedKernelId);\n",
" if (!interrupted) {\n",
" throw new Error('Jupyter Server rejected the interrupt request.');\n",
" }\n",
" setStatus('Interrupt sent...');\n",
" } catch (error) {\n",
" button.disabled = false;\n",
" setStatus('Use Kernel > Interrupt to stop this fit.');\n",
" }\n",
" });\n",
"})();\n"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1;36mStandard fitting\u001b[0m\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"📋 Using experiment 🔬 \u001b[32m'hrpt'\u001b[0m for \u001b[32m'single'\u001b[0m fitting\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 progress:\n"
]
},
{
"data": {
"text/html": [
" | iteration | time (s) | χ² | change / status |
|---|
| 1 | 1 | 0.14 | 13.41 | |
|---|
| 2 | 26 | 3.33 | 5.76 | 57.1% ↓ |
|---|
| 3 | 49 | 6.30 | 5.48 | 4.7% ↓ |
|---|
| 4 | 88 | 11.35 | 5.47 | |
|---|
| 5 | 130 | 16.70 | 5.47 | |
|---|
| 6 | 172 | 21.81 | 5.47 | |
|---|
| 7 | 211 | 26.96 | 5.47 | |
|---|
"
],
"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;36m5.47\u001b[0m at iteration \u001b[1;36m210\u001b[0m\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"✅ Fitting complete.\n"
]
}
],
"source": [
"project.analysis.fit()"
]
},
{
"cell_type": "code",
"execution_count": 34,
"id": "61",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:31:08.261033Z",
"iopub.status.busy": "2026-06-04T16:31:08.260876Z",
"iopub.status.idle": "2026-06-04T16:31:08.699011Z",
"shell.execute_reply": "2026-06-04T16:31:08.698261Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"⚙️ Settings used:\n"
]
},
{
"data": {
"text/html": [
" | Name | Value | Description |
|---|
| 1 | max_iterations | 1000 | Maximum solver iterations. |
|---|
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"📋 Least-squares fit results:\n"
]
},
{
"data": {
"text/html": [
" | Metric | Value |
|---|
| 1 | 🧪 Minimizer | lmfit (leastsq) |
|---|
| 2 | ✅ Overall status | success |
|---|
| 3 | ⏱️ Fitting time (seconds) | 26.96 |
|---|
| 4 | 🔁 Iterations | 208 |
|---|
| 5 | 📏 Goodness-of-fit (reduced χ²) | 5.47 |
|---|
| 6 | 📏 R-factor (Rf, %) | 6.71 |
|---|
| 7 | 📏 R-factor squared (Rf², %) | 9.26 |
|---|
| 8 | 📏 Weighted R-factor (wR, %) | 9.33 |
|---|
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"📈 Refined parameters:\n"
]
},
{
"data": {
"text/html": [
" | datablock | category | entry | parameter | units | start | value | s.u. | change |
|---|
| 1 | hs | cell | | length_a | Å | 6.8631 | 6.8623 | 0.0002 | 0.01 % ↓ |
|---|
| 2 | hs | cell | | length_c | Å | 14.1397 | 14.1357 | 0.0005 | 0.03 % ↓ |
|---|
| 3 | hs | atom_site | O | fract_x | | 0.2100 | 0.2059 | 0.0002 | 1.96 % ↓ |
|---|
| 4 | hs | atom_site | O | fract_z | | 0.0600 | 0.0627 | 0.0002 | 4.53 % ↑ |
|---|
| 5 | hs | atom_site | Cl | fract_z | | 0.1970 | 0.1979 | 0.0002 | 0.46 % ↑ |
|---|
| 6 | hs | atom_site | H | fract_x | | 0.1300 | 0.1336 | 0.0002 | 2.75 % ↑ |
|---|
| 7 | hs | atom_site | H | fract_z | | 0.0800 | 0.0870 | 0.0001 | 8.72 % ↑ |
|---|
| 8 | hrpt | linked_phases | hs | scale | | 0.4270 | 0.3988 | 0.0023 | 6.59 % ↓ |
|---|
| 9 | hrpt | peak | | broad_gauss_u | deg² | 0.3338 | 0.3426 | 0.0146 | 2.64 % ↑ |
|---|
| 10 | hrpt | peak | | broad_gauss_v | deg² | -0.2705 | -0.3774 | 0.0280 | 39.51 % ↑ |
|---|
| 11 | hrpt | peak | | broad_gauss_w | deg² | 0.2067 | 0.2762 | 0.0132 | 33.57 % ↑ |
|---|
| 12 | hrpt | peak | | broad_lorentz_y | deg | 0.1859 | 0.1516 | 0.0062 | 18.46 % ↓ |
|---|
| 13 | hrpt | instrument | | twotheta_offset | deg | 0.1316 | 0.1182 | 0.0025 | 10.15 % ↓ |
|---|
| 14 | hrpt | background | 1 | y | | 595.4716 | 606.8549 | 15.8977 | 1.91 % ↑ |
|---|
| 15 | hrpt | background | 2 | y | | 500.0658 | 506.3937 | 9.0721 | 1.27 % ↑ |
|---|
| 16 | hrpt | background | 3 | y | | 446.7961 | 446.6115 | 6.9412 | 0.04 % ↓ |
|---|
| 17 | hrpt | background | 4 | y | | 423.0736 | 433.4635 | 3.6117 | 2.46 % ↑ |
|---|
| 18 | hrpt | background | 5 | y | | 469.5233 | 480.8266 | 3.8602 | 2.41 % ↑ |
|---|
| 19 | hrpt | background | 6 | y | | 473.3416 | 504.1347 | 3.7880 | 6.51 % ↑ |
|---|
| 20 | hrpt | background | 7 | y | | 431.9294 | 465.0255 | 3.6648 | 7.66 % ↑ |
|---|
| 21 | hrpt | background | 8 | y | | 388.9936 | 446.8489 | 3.9092 | 14.87 % ↑ |
|---|
| 22 | hrpt | background | 9 | y | | 501.8443 | 457.5213 | 3.8978 | 8.83 % ↓ |
|---|
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
" • start = parameter value before refinement
• value = refined value from least-squares minimization
• s.u. = standard uncertainty (one sigma), from the covariance matrix
• change = relative change from start, in %; ↑ = increase, ↓ = decrease
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"project.display.fit.results()"
]
},
{
"cell_type": "markdown",
"id": "62",
"metadata": {},
"source": [
"#### Display Pattern"
]
},
{
"cell_type": "code",
"execution_count": 35,
"id": "63",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:31:08.700485Z",
"iopub.status.busy": "2026-06-04T16:31:08.700317Z",
"iopub.status.idle": "2026-06-04T16:31:09.574975Z",
"shell.execute_reply": "2026-06-04T16:31:09.574287Z"
}
},
"outputs": [
{
"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": {
"text/html": [
""
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"project.display.pattern(expt_name='hrpt')"
]
},
{
"cell_type": "code",
"execution_count": 36,
"id": "64",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:31:09.580955Z",
"iopub.status.busy": "2026-06-04T16:31:09.580780Z",
"iopub.status.idle": "2026-06-04T16:31:10.446246Z",
"shell.execute_reply": "2026-06-04T16:31:10.445482Z"
}
},
"outputs": [
{
"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": {
"text/html": [
""
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"project.display.pattern(expt_name='hrpt', x_min=48, x_max=51)"
]
},
{
"cell_type": "markdown",
"id": "65",
"metadata": {},
"source": [
"### Perform Fit 4/4\n",
"\n",
"Set more parameters to be refined."
]
},
{
"cell_type": "code",
"execution_count": 37,
"id": "66",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:31:10.447792Z",
"iopub.status.busy": "2026-06-04T16:31:10.447623Z",
"iopub.status.idle": "2026-06-04T16:31:10.451487Z",
"shell.execute_reply": "2026-06-04T16:31:10.450741Z"
}
},
"outputs": [],
"source": [
"structure.atom_sites['Zn'].adp_iso.free = True\n",
"structure.atom_sites['Cu'].adp_iso.free = True\n",
"structure.atom_sites['O'].adp_iso.free = True\n",
"structure.atom_sites['Cl'].adp_iso.free = True\n",
"structure.atom_sites['H'].adp_iso.free = True\n",
"\n",
"expt.peak.asym_empir_1.free = True\n",
"expt.peak.asym_empir_2.free = True\n",
"expt.peak.asym_empir_3.free = True\n",
"expt.peak.asym_empir_4.free = True"
]
},
{
"cell_type": "markdown",
"id": "67",
"metadata": {},
"source": [
"Show free parameters after selection."
]
},
{
"cell_type": "code",
"execution_count": 38,
"id": "68",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:31:10.452917Z",
"iopub.status.busy": "2026-06-04T16:31:10.452767Z",
"iopub.status.idle": "2026-06-04T16:31:10.504526Z",
"shell.execute_reply": "2026-06-04T16:31:10.503744Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1;36mFree parameters for both structures \u001b[0m\u001b[1;36m(\u001b[0m\u001b[1;36m🧩 data blocks\u001b[0m\u001b[1;36m)\u001b[0m\u001b[1;36m and experiments \u001b[0m\u001b[1;36m(\u001b[0m\u001b[1;36m🔬 data blocks\u001b[0m\u001b[1;36m)\u001b[0m\n"
]
},
{
"data": {
"text/html": [
" | datablock | category | entry | parameter | value | uncertainty | min | max | units |
|---|
| 1 | hs | cell | | length_a | 6.86227 | 0.00023 | -inf | inf | Å |
|---|
| 2 | hs | cell | | length_c | 14.13575 | 0.00055 | -inf | inf | Å |
|---|
| 3 | hs | atom_site | Zn | adp_iso | 0.50000 | | -inf | inf | Ų |
|---|
| 4 | hs | atom_site | Cu | adp_iso | 0.50000 | | -inf | inf | Ų |
|---|
| 5 | hs | atom_site | O | fract_x | 0.20588 | 0.00024 | -inf | inf | |
|---|
| 6 | hs | atom_site | O | fract_z | 0.06272 | 0.00018 | -inf | inf | |
|---|
| 7 | hs | atom_site | O | adp_iso | 0.50000 | | -inf | inf | Ų |
|---|
| 8 | hs | atom_site | Cl | fract_z | 0.19790 | 0.00018 | -inf | inf | |
|---|
| 9 | hs | atom_site | Cl | adp_iso | 0.50000 | | -inf | inf | Ų |
|---|
| 10 | hs | atom_site | H | fract_x | 0.13357 | 0.00018 | -inf | inf | |
|---|
| 11 | hs | atom_site | H | fract_z | 0.08697 | 0.00013 | -inf | inf | |
|---|
| 12 | hs | atom_site | H | adp_iso | 0.50000 | | -inf | inf | Ų |
|---|
| 13 | hrpt | linked_phases | hs | scale | 0.39885 | 0.00233 | -inf | inf | |
|---|
| 14 | hrpt | peak | | asym_empir_1 | 0.00000 | | -inf | inf | |
|---|
| 15 | hrpt | peak | | asym_empir_2 | 0.00000 | | -inf | inf | |
|---|
| 16 | hrpt | peak | | asym_empir_3 | 0.00000 | | -inf | inf | |
|---|
| 17 | hrpt | peak | | asym_empir_4 | 0.00000 | | -inf | inf | |
|---|
| 18 | hrpt | peak | | broad_gauss_u | 0.34262 | 0.01459 | -inf | inf | deg² |
|---|
| 19 | hrpt | peak | | broad_gauss_v | -0.37742 | 0.02800 | -inf | inf | deg² |
|---|
| 20 | hrpt | peak | | broad_gauss_w | 0.27616 | 0.01316 | -inf | inf | deg² |
|---|
| 21 | hrpt | peak | | broad_lorentz_y | 0.15157 | 0.00624 | -inf | inf | deg |
|---|
| 22 | hrpt | instrument | | twotheta_offset | 0.11821 | 0.00248 | -inf | inf | deg |
|---|
| 23 | hrpt | background | 1 | y | 606.85492 | 15.89775 | -inf | inf | |
|---|
| 24 | hrpt | background | 2 | y | 506.39367 | 9.07212 | -inf | inf | |
|---|
| 25 | hrpt | background | 3 | y | 446.61148 | 6.94119 | -inf | inf | |
|---|
| 26 | hrpt | background | 4 | y | 433.46347 | 3.61166 | -inf | inf | |
|---|
| 27 | hrpt | background | 5 | y | 480.82660 | 3.86016 | -inf | inf | |
|---|
| 28 | hrpt | background | 6 | y | 504.13466 | 3.78801 | -inf | inf | |
|---|
| 29 | hrpt | background | 7 | y | 465.02545 | 3.66479 | -inf | inf | |
|---|
| 30 | hrpt | background | 8 | y | 446.84887 | 3.90918 | -inf | inf | |
|---|
| 31 | hrpt | background | 9 | y | 457.52127 | 3.89777 | -inf | inf | |
|---|
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"project.display.parameters.free()"
]
},
{
"cell_type": "markdown",
"id": "69",
"metadata": {},
"source": [
"#### Run Fitting"
]
},
{
"cell_type": "code",
"execution_count": 39,
"id": "70",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:31:10.506140Z",
"iopub.status.busy": "2026-06-04T16:31:10.505965Z",
"iopub.status.idle": "2026-06-04T16:31:44.606185Z",
"shell.execute_reply": "2026-06-04T16:31:44.605403Z"
}
},
"outputs": [
{
"data": {
"text/html": [],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
"(function() {\n",
" const button = document.getElementById('ed-fit-stop-d0dd36b3ab174bdc871e654b4d5c282f-button');\n",
" const status = document.getElementById('ed-fit-stop-d0dd36b3ab174bdc871e654b4d5c282f-status');\n",
" const kernelId = '';\n",
" if (!button) {\n",
" return;\n",
" }\n",
"\n",
" function setStatus(text) {\n",
" if (status) {\n",
" status.textContent = text;\n",
" }\n",
" }\n",
"\n",
" function pageConfig() {\n",
" const element = document.getElementById('jupyter-config-data');\n",
" if (!element || !element.textContent) {\n",
" return {};\n",
" }\n",
" try {\n",
" return JSON.parse(element.textContent);\n",
" } catch (error) {\n",
" return {};\n",
" }\n",
" }\n",
"\n",
" function baseUrl(config) {\n",
" const configured = config.baseUrl || config.base_url ||\n",
" (window.Jupyter && Jupyter.notebook && Jupyter.notebook.base_url);\n",
" if (configured) {\n",
" return configured.endsWith('/') ? configured : configured + '/';\n",
" }\n",
" const markers = ['/lab/', '/notebooks/', '/tree/'];\n",
" for (const marker of markers) {\n",
" const index = window.location.pathname.indexOf(marker);\n",
" if (index >= 0) {\n",
" return window.location.pathname.slice(0, index + 1);\n",
" }\n",
" }\n",
" return '/';\n",
" }\n",
"\n",
" function token(config) {\n",
" return config.token || new URLSearchParams(window.location.search).get('token') || '';\n",
" }\n",
"\n",
" function cookie(name) {\n",
" const prefix = name + '=';\n",
" for (const part of document.cookie.split(';')) {\n",
" const trimmed = part.trim();\n",
" if (trimmed.startsWith(prefix)) {\n",
" return decodeURIComponent(trimmed.slice(prefix.length));\n",
" }\n",
" }\n",
" return '';\n",
" }\n",
"\n",
" function notebookPath() {\n",
" const decoded = decodeURIComponent(window.location.pathname);\n",
" const markers = ['/lab/tree/', '/notebooks/', '/tree/'];\n",
" for (const marker of markers) {\n",
" const index = decoded.indexOf(marker);\n",
" if (index >= 0) {\n",
" return decoded.slice(index + marker.length);\n",
" }\n",
" }\n",
" return '';\n",
" }\n",
"\n",
" async function kernelFromSessions(config) {\n",
" const url = new URL(baseUrl(config) + 'api/sessions', window.location.origin);\n",
" const authToken = token(config);\n",
" if (authToken) {\n",
" url.searchParams.set('token', authToken);\n",
" }\n",
" const response = await fetch(url, {credentials: 'same-origin'});\n",
" if (!response.ok) {\n",
" return '';\n",
" }\n",
" const sessions = await response.json();\n",
" const path = notebookPath();\n",
" const session = sessions.find((item) => item.path === path) || sessions[0];\n",
" return session && session.kernel ? session.kernel.id : '';\n",
" }\n",
"\n",
" async function interruptKernel(config, resolvedKernelId) {\n",
" const url = new URL(\n",
" baseUrl(config) + 'api/kernels/' + resolvedKernelId + '/interrupt',\n",
" window.location.origin\n",
" );\n",
" const authToken = token(config);\n",
" if (authToken) {\n",
" url.searchParams.set('token', authToken);\n",
" }\n",
" const xsrfToken = cookie('_xsrf');\n",
" const headers = {};\n",
" if (xsrfToken) {\n",
" headers['X-XSRFToken'] = xsrfToken;\n",
" }\n",
" const response = await fetch(url, {\n",
" method: 'POST',\n",
" credentials: 'same-origin',\n",
" headers: headers\n",
" });\n",
" return response.ok;\n",
" }\n",
"\n",
" button.addEventListener('click', async function() {\n",
" button.disabled = true;\n",
" setStatus('Stopping...');\n",
" const config = pageConfig();\n",
" try {\n",
" const resolvedKernelId = kernelId || await kernelFromSessions(config);\n",
" if (!resolvedKernelId) {\n",
" throw new Error('Could not resolve the current kernel id.');\n",
" }\n",
" const interrupted = await interruptKernel(config, resolvedKernelId);\n",
" if (!interrupted) {\n",
" throw new Error('Jupyter Server rejected the interrupt request.');\n",
" }\n",
" setStatus('Interrupt sent...');\n",
" } catch (error) {\n",
" button.disabled = false;\n",
" setStatus('Use Kernel > Interrupt to stop this fit.');\n",
" }\n",
" });\n",
"})();\n"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1;36mStandard fitting\u001b[0m\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"📋 Using experiment 🔬 \u001b[32m'hrpt'\u001b[0m for \u001b[32m'single'\u001b[0m fitting\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 progress:\n"
]
},
{
"data": {
"text/html": [
" | iteration | time (s) | χ² | change / status |
|---|
| 1 | 1 | 0.14 | 5.49 | |
|---|
| 2 | 35 | 4.63 | 2.19 | 60.1% ↓ |
|---|
| 3 | 67 | 8.64 | 1.97 | 9.8% ↓ |
|---|
| 4 | 106 | 13.73 | 1.97 | |
|---|
| 5 | 145 | 18.84 | 1.97 | |
|---|
| 6 | 186 | 23.92 | 1.97 | |
|---|
| 7 | 224 | 28.92 | 1.97 | |
|---|
| 8 | 260 | 34.03 | 1.97 | |
|---|
"
],
"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.97\u001b[0m at iteration \u001b[1;36m259\u001b[0m\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"✅ Fitting complete.\n"
]
}
],
"source": [
"project.analysis.fit()"
]
},
{
"cell_type": "code",
"execution_count": 40,
"id": "71",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:31:44.607705Z",
"iopub.status.busy": "2026-06-04T16:31:44.607519Z",
"iopub.status.idle": "2026-06-04T16:31:45.068303Z",
"shell.execute_reply": "2026-06-04T16:31:45.067592Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"⚙️ Settings used:\n"
]
},
{
"data": {
"text/html": [
" | Name | Value | Description |
|---|
| 1 | max_iterations | 1000 | Maximum solver iterations. |
|---|
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"📋 Least-squares fit results:\n"
]
},
{
"data": {
"text/html": [
" | Metric | Value |
|---|
| 1 | 🧪 Minimizer | lmfit (leastsq) |
|---|
| 2 | ✅ Overall status | success |
|---|
| 3 | ⏱️ Fitting time (seconds) | 34.03 |
|---|
| 4 | 🔁 Iterations | 257 |
|---|
| 5 | 📏 Goodness-of-fit (reduced χ²) | 1.97 |
|---|
| 6 | 📏 R-factor (Rf, %) | 4.03 |
|---|
| 7 | 📏 R-factor squared (Rf², %) | 4.68 |
|---|
| 8 | 📏 Weighted R-factor (wR, %) | 4.19 |
|---|
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"📈 Refined parameters:\n"
]
},
{
"data": {
"text/html": [
" | datablock | category | entry | parameter | units | start | value | s.u. | change |
|---|
| 1 | hs | cell | | length_a | Å | 6.8623 | 6.8643 | 0.0004 | 0.03 % ↑ |
|---|
| 2 | hs | cell | | length_c | Å | 14.1357 | 14.1424 | 0.0010 | 0.05 % ↑ |
|---|
| 3 | hs | atom_site | Zn | adp_iso | Ų | 0.5000 | 0.2297 | 0.0611 | 54.05 % ↓ |
|---|
| 4 | hs | atom_site | Cu | adp_iso | Ų | 0.5000 | 1.4700 | 0.0379 | 193.99 % ↑ |
|---|
| 5 | hs | atom_site | O | fract_x | | 0.2059 | 0.2064 | 0.0002 | 0.24 % ↑ |
|---|
| 6 | hs | atom_site | O | fract_z | | 0.0627 | 0.0610 | 0.0001 | 2.76 % ↓ |
|---|
| 7 | hs | atom_site | O | adp_iso | Ų | 0.5000 | 0.9782 | 0.0347 | 95.65 % ↑ |
|---|
| 8 | hs | atom_site | Cl | fract_z | | 0.1979 | 0.1966 | 0.0001 | 0.63 % ↓ |
|---|
| 9 | hs | atom_site | Cl | adp_iso | Ų | 0.5000 | 1.3926 | 0.0369 | 178.53 % ↑ |
|---|
| 10 | hs | atom_site | H | fract_x | | 0.1336 | 0.1325 | 0.0001 | 0.79 % ↓ |
|---|
| 11 | hs | atom_site | H | fract_z | | 0.0870 | 0.0898 | 0.0001 | 3.27 % ↑ |
|---|
| 12 | hs | atom_site | H | adp_iso | Ų | 0.5000 | 2.5006 | 0.0393 | 400.11 % ↑ |
|---|
| 13 | hrpt | linked_phases | hs | scale | | 0.3988 | 0.5138 | 0.0025 | 28.83 % ↑ |
|---|
| 14 | hrpt | peak | | asym_empir_1 | | 0.0000 | -0.2145 | 0.0248 | N/A |
|---|
| 15 | hrpt | peak | | asym_empir_2 | | 0.0000 | -0.0506 | 0.0040 | N/A |
|---|
| 16 | hrpt | peak | | asym_empir_3 | | 0.0000 | 0.1504 | 0.0553 | N/A |
|---|
| 17 | hrpt | peak | | asym_empir_4 | | 0.0000 | 0.0644 | 0.0089 | N/A |
|---|
| 18 | hrpt | peak | | broad_gauss_u | deg² | 0.3426 | 0.2371 | 0.0095 | 30.81 % ↓ |
|---|
| 19 | hrpt | peak | | broad_gauss_v | deg² | -0.3774 | -0.3015 | 0.0172 | 20.11 % ↓ |
|---|
| 20 | hrpt | peak | | broad_gauss_w | deg² | 0.2762 | 0.2705 | 0.0078 | 2.04 % ↓ |
|---|
| 21 | hrpt | peak | | broad_lorentz_y | deg | 0.1516 | 0.1616 | 0.0036 | 6.61 % ↑ |
|---|
| 22 | hrpt | instrument | | twotheta_offset | deg | 0.1182 | 0.1512 | 0.0071 | 27.93 % ↑ |
|---|
| 23 | hrpt | background | 1 | y | | 606.8549 | 601.1574 | 9.5418 | 0.94 % ↓ |
|---|
| 24 | hrpt | background | 2 | y | | 506.3937 | 503.9188 | 5.4442 | 0.49 % ↓ |
|---|
| 25 | hrpt | background | 3 | y | | 446.6115 | 445.2163 | 4.1651 | 0.31 % ↓ |
|---|
| 26 | hrpt | background | 4 | y | | 433.4635 | 432.9735 | 2.1783 | 0.11 % ↓ |
|---|
| 27 | hrpt | background | 5 | y | | 480.8266 | 455.6484 | 2.3910 | 5.24 % ↓ |
|---|
| 28 | hrpt | background | 6 | y | | 504.1347 | 492.5767 | 2.3061 | 2.29 % ↓ |
|---|
| 29 | hrpt | background | 7 | y | | 465.0255 | 480.8476 | 2.2145 | 3.40 % ↑ |
|---|
| 30 | hrpt | background | 8 | y | | 446.8489 | 510.1369 | 2.4165 | 14.16 % ↑ |
|---|
| 31 | hrpt | background | 9 | y | | 457.5213 | 498.7801 | 2.5676 | 9.02 % ↑ |
|---|
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
" • start = parameter value before refinement
• value = refined value from least-squares minimization
• s.u. = standard uncertainty (one sigma), from the covariance matrix
• change = relative change from start, in %; ↑ = increase, ↓ = decrease
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"project.display.fit.results()"
]
},
{
"cell_type": "code",
"execution_count": 41,
"id": "72",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:31:45.069877Z",
"iopub.status.busy": "2026-06-04T16:31:45.069706Z",
"iopub.status.idle": "2026-06-04T16:31:45.912125Z",
"shell.execute_reply": "2026-06-04T16:31:45.911398Z"
}
},
"outputs": [
{
"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": {
"text/html": [
"\n",
"\n",
""
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"project.display.fit.correlations()"
]
},
{
"cell_type": "markdown",
"id": "73",
"metadata": {},
"source": [
"#### Display Pattern"
]
},
{
"cell_type": "code",
"execution_count": 42,
"id": "74",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:31:45.913954Z",
"iopub.status.busy": "2026-06-04T16:31:45.913772Z",
"iopub.status.idle": "2026-06-04T16:31:46.800286Z",
"shell.execute_reply": "2026-06-04T16:31:46.799735Z"
}
},
"outputs": [
{
"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": {
"text/html": [
""
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"project.display.pattern(expt_name='hrpt')"
]
},
{
"cell_type": "code",
"execution_count": 43,
"id": "75",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:31:46.805113Z",
"iopub.status.busy": "2026-06-04T16:31:46.804929Z",
"iopub.status.idle": "2026-06-04T16:31:47.673193Z",
"shell.execute_reply": "2026-06-04T16:31:47.672407Z"
}
},
"outputs": [
{
"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": {
"text/html": [
""
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"project.display.pattern(expt_name='hrpt', x_min=48, x_max=51)"
]
},
{
"cell_type": "markdown",
"id": "76",
"metadata": {},
"source": [
"## 📊 Report\n",
"\n",
"The HTML report is written automatically when the project is saved;\n",
"enable `project.report.pdf` as well for a PDF version."
]
},
{
"cell_type": "markdown",
"id": "77",
"metadata": {},
"source": [
"## 💾 Save Project"
]
},
{
"cell_type": "code",
"execution_count": 44,
"id": "78",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:31:47.674879Z",
"iopub.status.busy": "2026-06-04T16:31:47.674709Z",
"iopub.status.idle": "2026-06-04T16:31:48.597929Z",
"shell.execute_reply": "2026-06-04T16:31:48.597186Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1;36mSaving project 📦 \u001b[0m\u001b[32m'hs_hrpt'\u001b[0m\u001b[1;36m to \u001b[0m\u001b[32m'../../../projects/ed_6_hs_hrpt'\u001b[0m\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"├── 📄 project.cif\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"├── 📁 structures/\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"│ └── 📄 hs.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/\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"│ └── 📄 analysis.cif\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": {
"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": [
"└── 📁 reports/\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
" └── 📄 hs_hrpt.html\n"
]
}
],
"source": [
"project.save_as(dir_path='projects/ed_6_hs_hrpt')"
]
}
],
"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.14.5"
}
},
"nbformat": 4,
"nbformat_minor": 5
}