{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "0", "metadata": { "execution": { "iopub.execute_input": "2026-06-04T16:27:23.685313Z", "iopub.status.busy": "2026-06-04T16:27:23.685146Z", "iopub.status.idle": "2026-06-04T16:27:23.688902Z", "shell.execute_reply": "2026-06-04T16:27:23.688208Z" }, "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: Co2SiO4, D20\n", "\n", "This example demonstrates a Rietveld refinement of Co2SiO4 crystal\n", "structure using constant wavelength neutron powder diffraction data\n", "from D20 at ILL.\n", "\n", "It also shows different ways to set free parameters: standard\n", "one-by-one and batch setting." ] }, { "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:27:23.690261Z", "iopub.status.busy": "2026-06-04T16:27:23.690116Z", "iopub.status.idle": "2026-06-04T16:27:26.255273Z", "shell.execute_reply": "2026-06-04T16:27:26.254474Z" } }, "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:27:26.256960Z", "iopub.status.busy": "2026-06-04T16:27:26.256696Z", "iopub.status.idle": "2026-06-04T16:27:26.261160Z", "shell.execute_reply": "2026-06-04T16:27:26.260422Z" } }, "outputs": [], "source": [ "structure = StructureFactory.from_scratch(name='cosio')" ] }, { "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:27:26.262533Z", "iopub.status.busy": "2026-06-04T16:27:26.262363Z", "iopub.status.idle": "2026-06-04T16:27:26.265262Z", "shell.execute_reply": "2026-06-04T16:27:26.264583Z" } }, "outputs": [], "source": [ "structure.space_group.name_h_m = 'P n m a'\n", "structure.space_group.it_coordinate_system_code = 'abc'" ] }, { "cell_type": "markdown", "id": "8", "metadata": {}, "source": [ "### Set Unit Cell" ] }, { "cell_type": "code", "execution_count": 5, "id": "9", "metadata": { "execution": { "iopub.execute_input": "2026-06-04T16:27:26.266600Z", "iopub.status.busy": "2026-06-04T16:27:26.266406Z", "iopub.status.idle": "2026-06-04T16:27:26.269525Z", "shell.execute_reply": "2026-06-04T16:27:26.268684Z" } }, "outputs": [], "source": [ "structure.cell.length_a = 10.3\n", "structure.cell.length_b = 6.0\n", "structure.cell.length_c = 4.8" ] }, { "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:27:26.270839Z", "iopub.status.busy": "2026-06-04T16:27:26.270673Z", "iopub.status.idle": "2026-06-04T16:27:26.278625Z", "shell.execute_reply": "2026-06-04T16:27:26.277893Z" } }, "outputs": [], "source": [ "structure.atom_sites.create(\n", " label='Co1',\n", " type_symbol='Co',\n", " fract_x=0,\n", " fract_y=0,\n", " fract_z=0,\n", " adp_iso=0.5,\n", ")\n", "structure.atom_sites.create(\n", " label='Co2',\n", " type_symbol='Co',\n", " fract_x=0.279,\n", " fract_y=0.25,\n", " fract_z=0.985,\n", " adp_iso=0.5,\n", ")\n", "structure.atom_sites.create(\n", " label='Si',\n", " type_symbol='Si',\n", " fract_x=0.094,\n", " fract_y=0.25,\n", " fract_z=0.429,\n", " adp_iso=0.5,\n", ")\n", "structure.atom_sites.create(\n", " label='O1',\n", " type_symbol='O',\n", " fract_x=0.091,\n", " fract_y=0.25,\n", " fract_z=0.771,\n", " adp_iso=0.5,\n", ")\n", "structure.atom_sites.create(\n", " label='O2',\n", " type_symbol='O',\n", " fract_x=0.448,\n", " fract_y=0.25,\n", " fract_z=0.217,\n", " adp_iso=0.5,\n", ")\n", "structure.atom_sites.create(\n", " label='O3',\n", " type_symbol='O',\n", " fract_x=0.164,\n", " fract_y=0.032,\n", " fract_z=0.28,\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:27:26.280034Z", "iopub.status.busy": "2026-06-04T16:27:26.279869Z", "iopub.status.idle": "2026-06-04T16:27:26.448356Z", "shell.execute_reply": "2026-06-04T16:27:26.447591Z" } }, "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;36m12\u001b[0m: Co2SiO4, D20 \u001b[1m(\u001b[0mILL\u001b[1m)\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "✅ Data #\u001b[1;36m12\u001b[0m downloaded to \u001b[32m'../../../data/ed-12.xye'\u001b[0m\n" ] } ], "source": [ "data_path = download_data(id=12, 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:27:26.449844Z", "iopub.status.busy": "2026-06-04T16:27:26.449663Z", "iopub.status.idle": "2026-06-04T16:27:26.610580Z", "shell.execute_reply": "2026-06-04T16:27:26.609922Z" } }, "outputs": [], "source": [ "expt = ExperimentFactory.from_data_path(name='d20', 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:27:26.612456Z", "iopub.status.busy": "2026-06-04T16:27:26.612292Z", "iopub.status.idle": "2026-06-04T16:27:26.615232Z", "shell.execute_reply": "2026-06-04T16:27:26.614632Z" } }, "outputs": [], "source": [ "expt.instrument.setup_wavelength = 1.87\n", "expt.instrument.calib_twotheta_offset = 0.1" ] }, { "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:27:26.616551Z", "iopub.status.busy": "2026-06-04T16:27:26.616378Z", "iopub.status.idle": "2026-06-04T16:27:26.624447Z", "shell.execute_reply": "2026-06-04T16:27:26.623772Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mPeak types\u001b[0m\n" ] }, { "data": { "text/html": [ "
TypeDescription
1*pseudo-voigtCWL pseudo-Voigt profile
2pseudo-voigt + empirical asymmetryCWL pseudo-Voigt profile with empirical asymmetry correction.
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "expt.peak.show_supported()" ] }, { "cell_type": "code", "execution_count": 11, "id": "20", "metadata": { "execution": { "iopub.execute_input": "2026-06-04T16:27:26.625885Z", "iopub.status.busy": "2026-06-04T16:27:26.625722Z", "iopub.status.idle": "2026-06-04T16:27:26.631981Z", "shell.execute_reply": "2026-06-04T16:27:26.631286Z" } }, "outputs": [ { "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'd20'\u001b[0m\u001b[1;36m changed to\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "pseudo-voigt + empirical asymmetry\n" ] } ], "source": [ "expt.peak.type = 'pseudo-voigt + empirical asymmetry'" ] }, { "cell_type": "code", "execution_count": 12, "id": "21", "metadata": { "execution": { "iopub.execute_input": "2026-06-04T16:27:26.633305Z", "iopub.status.busy": "2026-06-04T16:27:26.633142Z", "iopub.status.idle": "2026-06-04T16:27:26.636124Z", "shell.execute_reply": "2026-06-04T16:27:26.635396Z" } }, "outputs": [], "source": [ "expt.peak.broad_gauss_u = 0.3\n", "expt.peak.broad_gauss_v = -0.5\n", "expt.peak.broad_gauss_w = 0.4" ] }, { "cell_type": "markdown", "id": "22", "metadata": {}, "source": [ "### Set Background" ] }, { "cell_type": "code", "execution_count": 13, "id": "23", "metadata": { "execution": { "iopub.execute_input": "2026-06-04T16:27:26.637804Z", "iopub.status.busy": "2026-06-04T16:27:26.637592Z", "iopub.status.idle": "2026-06-04T16:27:26.643767Z", "shell.execute_reply": "2026-06-04T16:27:26.643033Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mBackground types\u001b[0m\n" ] }, { "data": { "text/html": [ "
TypeDescription
1chebyshevChebyshev polynomial background
2*line-segmentLinear interpolation between points
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "expt.background.show_supported()" ] }, { "cell_type": "code", "execution_count": 14, "id": "24", "metadata": { "execution": { "iopub.execute_input": "2026-06-04T16:27:26.645152Z", "iopub.status.busy": "2026-06-04T16:27:26.645000Z", "iopub.status.idle": "2026-06-04T16:27:26.651982Z", "shell.execute_reply": "2026-06-04T16:27:26.651357Z" } }, "outputs": [], "source": [ "expt.background.create(id='1', x=8, y=500)\n", "expt.background.create(id='2', x=9, y=500)\n", "expt.background.create(id='3', x=10, y=500)\n", "expt.background.create(id='4', x=11, y=500)\n", "expt.background.create(id='5', x=12, y=500)\n", "expt.background.create(id='6', x=15, y=500)\n", "expt.background.create(id='7', x=25, y=500)\n", "expt.background.create(id='8', x=30, y=500)\n", "expt.background.create(id='9', x=50, y=500)\n", "expt.background.create(id='10', x=70, y=500)\n", "expt.background.create(id='11', x=90, y=500)\n", "expt.background.create(id='12', x=110, y=500)\n", "expt.background.create(id='13', x=130, y=500)\n", "expt.background.create(id='14', x=150, y=500)" ] }, { "cell_type": "markdown", "id": "25", "metadata": {}, "source": [ "### Set Linked Phases" ] }, { "cell_type": "code", "execution_count": 15, "id": "26", "metadata": { "execution": { "iopub.execute_input": "2026-06-04T16:27:26.653325Z", "iopub.status.busy": "2026-06-04T16:27:26.653143Z", "iopub.status.idle": "2026-06-04T16:27:26.656011Z", "shell.execute_reply": "2026-06-04T16:27:26.655309Z" } }, "outputs": [], "source": [ "expt.linked_phases.create(id='cosio', scale=1.0)" ] }, { "cell_type": "markdown", "id": "27", "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": 16, "id": "28", "metadata": { "execution": { "iopub.execute_input": "2026-06-04T16:27:26.657322Z", "iopub.status.busy": "2026-06-04T16:27:26.657182Z", "iopub.status.idle": "2026-06-04T16:27:27.140553Z", "shell.execute_reply": "2026-06-04T16:27:27.139870Z" } }, "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='cosio_d20')" ] }, { "cell_type": "code", "execution_count": 17, "id": "29", "metadata": { "execution": { "iopub.execute_input": "2026-06-04T16:27:27.142069Z", "iopub.status.busy": "2026-06-04T16:27:27.141908Z", "iopub.status.idle": "2026-06-04T16:27:27.190503Z", "shell.execute_reply": "2026-06-04T16:27:27.189779Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mSaving project 📦 \u001b[0m\u001b[32m'cosio_d20'\u001b[0m\u001b[1;36m to \u001b[0m\u001b[32m'../../../projects/ed_5_cosio_d20'\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": [ "├── 📁 experiments/\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "├── 📁 analysis/\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "│ └── 📄 analysis.cif\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "└── 📁 reports/\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ " └── 📄 cosio_d20.html\n" ] } ], "source": [ "project.save_as(dir_path='projects/ed_5_cosio_d20')" ] }, { "cell_type": "markdown", "id": "30", "metadata": {}, "source": [ "### Add Structure" ] }, { "cell_type": "code", "execution_count": 18, "id": "31", "metadata": { "execution": { "iopub.execute_input": "2026-06-04T16:27:27.191885Z", "iopub.status.busy": "2026-06-04T16:27:27.191721Z", "iopub.status.idle": "2026-06-04T16:27:27.194271Z", "shell.execute_reply": "2026-06-04T16:27:27.193656Z" } }, "outputs": [], "source": [ "project.structures.add(structure)" ] }, { "cell_type": "markdown", "id": "32", "metadata": {}, "source": [ "### Add Experiment" ] }, { "cell_type": "code", "execution_count": 19, "id": "33", "metadata": { "execution": { "iopub.execute_input": "2026-06-04T16:27:27.195702Z", "iopub.status.busy": "2026-06-04T16:27:27.195529Z", "iopub.status.idle": "2026-06-04T16:27:27.197976Z", "shell.execute_reply": "2026-06-04T16:27:27.197293Z" } }, "outputs": [], "source": [ "project.experiments.add(expt)" ] }, { "cell_type": "markdown", "id": "34", "metadata": {}, "source": [ "## 🚀 Perform Analysis\n", "\n", "This section shows the analysis process, including how to set up\n", "calculation and fitting engines.\n", "\n", "### Display Structure" ] }, { "cell_type": "code", "execution_count": 20, "id": "35", "metadata": { "execution": { "iopub.execute_input": "2026-06-04T16:27:27.199342Z", "iopub.status.busy": "2026-06-04T16:27:27.199175Z", "iopub.status.idle": "2026-06-04T16:27:27.503137Z", "shell.execute_reply": "2026-06-04T16:27:27.502542Z" } }, "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'cosio'\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='cosio')" ] }, { "cell_type": "markdown", "id": "36", "metadata": {}, "source": [ "### Display Pattern" ] }, { "cell_type": "code", "execution_count": 21, "id": "37", "metadata": { "execution": { "iopub.execute_input": "2026-06-04T16:27:27.504895Z", "iopub.status.busy": "2026-06-04T16:27:27.504734Z", "iopub.status.idle": "2026-06-04T16:27:28.710988Z", "shell.execute_reply": "2026-06-04T16:27:28.710295Z" } }, "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": [ "
Loading plot…
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.display.pattern(expt_name='d20')" ] }, { "cell_type": "code", "execution_count": 22, "id": "38", "metadata": { "execution": { "iopub.execute_input": "2026-06-04T16:27:28.713524Z", "iopub.status.busy": "2026-06-04T16:27:28.713355Z", "iopub.status.idle": "2026-06-04T16:27:29.574137Z", "shell.execute_reply": "2026-06-04T16:27:29.573363Z" } }, "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": [ "
Loading plot…
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.display.pattern(expt_name='d20', x_min=41, x_max=54)" ] }, { "cell_type": "markdown", "id": "39", "metadata": {}, "source": [ "### Set Free Parameters" ] }, { "cell_type": "code", "execution_count": 23, "id": "40", "metadata": { "execution": { "iopub.execute_input": "2026-06-04T16:27:29.575631Z", "iopub.status.busy": "2026-06-04T16:27:29.575437Z", "iopub.status.idle": "2026-06-04T16:27:29.585908Z", "shell.execute_reply": "2026-06-04T16:27:29.585151Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "⚠️ Parameter 'cosio.atom_site.Co1.fract_x' is constrained by symmetry. Ignoring free=True. \n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "⚠️ Parameter 'cosio.atom_site.Co1.fract_y' is constrained by symmetry. Ignoring free=True. \n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "⚠️ Parameter 'cosio.atom_site.Co1.fract_z' is constrained by symmetry. Ignoring free=True. \n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "⚠️ Parameter 'cosio.atom_site.Co2.fract_y' is constrained by symmetry. Ignoring free=True. \n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "⚠️ Parameter 'cosio.atom_site.Si.fract_y' is constrained by symmetry. Ignoring free=True. \n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "⚠️ Parameter 'cosio.atom_site.O1.fract_y' is constrained by symmetry. Ignoring free=True. \n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "⚠️ Parameter 'cosio.atom_site.O2.fract_y' is constrained by symmetry. Ignoring free=True. \n" ] } ], "source": [ "structure.cell.length_a.free = True\n", "structure.cell.length_b.free = True\n", "structure.cell.length_c.free = True\n", "\n", "for atom_site in structure.atom_sites:\n", " for parameter in ('fract_x', 'fract_y', 'fract_z'):\n", " getattr(atom_site, parameter).free = True\n", "\n", "for atom_site in structure.atom_sites:\n", " atom_site.adp_iso.free = True\n", "\n", "for label in ('O1', 'O2', 'O3'):\n", " atom_site = structure.atom_sites[label]\n", " atom_site.occupancy.free = True" ] }, { "cell_type": "code", "execution_count": 24, "id": "41", "metadata": { "execution": { "iopub.execute_input": "2026-06-04T16:27:29.587251Z", "iopub.status.busy": "2026-06-04T16:27:29.587099Z", "iopub.status.idle": "2026-06-04T16:27:29.590997Z", "shell.execute_reply": "2026-06-04T16:27:29.590262Z" } }, "outputs": [], "source": [ "expt.linked_phases['cosio'].scale.free = True\n", "\n", "expt.instrument.calib_twotheta_offset.free = True\n", "\n", "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", "expt.peak.asym_empir_2.free = True\n", "\n", "for point in expt.background:\n", " point.y.free = True" ] }, { "cell_type": "markdown", "id": "42", "metadata": {}, "source": [ "Show free parameters after selection." ] }, { "cell_type": "code", "execution_count": 25, "id": "43", "metadata": { "execution": { "iopub.execute_input": "2026-06-04T16:27:29.592301Z", "iopub.status.busy": "2026-06-04T16:27:29.592149Z", "iopub.status.idle": "2026-06-04T16:27:29.626195Z", "shell.execute_reply": "2026-06-04T16:27:29.625483Z" } }, "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": [ "
datablockcategoryentryparametervalueuncertaintyminmaxunits
1cosiocelllength_a10.30000-infinfÅ
2cosiocelllength_b6.00000-infinfÅ
3cosiocelllength_c4.80000-infinfÅ
4cosioatom_siteCo1adp_iso0.50000-infinfŲ
5cosioatom_siteCo2fract_x0.27900-infinf
6cosioatom_siteCo2fract_z0.98500-infinf
7cosioatom_siteCo2adp_iso0.50000-infinfŲ
8cosioatom_siteSifract_x0.09400-infinf
9cosioatom_siteSifract_z0.42900-infinf
10cosioatom_siteSiadp_iso0.50000-infinfŲ
11cosioatom_siteO1fract_x0.09100-infinf
12cosioatom_siteO1fract_z0.77100-infinf
13cosioatom_siteO1occupancy1.00000-infinf
14cosioatom_siteO1adp_iso0.50000-infinfŲ
15cosioatom_siteO2fract_x0.44800-infinf
16cosioatom_siteO2fract_z0.21700-infinf
17cosioatom_siteO2occupancy1.00000-infinf
18cosioatom_siteO2adp_iso0.50000-infinfŲ
19cosioatom_siteO3fract_x0.16400-infinf
20cosioatom_siteO3fract_y0.03200-infinf
21cosioatom_siteO3fract_z0.28000-infinf
22cosioatom_siteO3occupancy1.00000-infinf
23cosioatom_siteO3adp_iso0.50000-infinfŲ
24d20linked_phasescosioscale1.00000-infinf
25d20peakasym_empir_20.00000-infinf
26d20peakbroad_gauss_u0.30000-infinfdeg²
27d20peakbroad_gauss_v-0.50000-infinfdeg²
28d20peakbroad_gauss_w0.40000-infinfdeg²
29d20peakbroad_lorentz_y0.00000-infinfdeg
30d20instrumenttwotheta_offset0.10000-infinfdeg
31d20background1y500.00000-infinf
32d20background2y500.00000-infinf
33d20background3y500.00000-infinf
34d20background4y500.00000-infinf
35d20background5y500.00000-infinf
36d20background6y500.00000-infinf
37d20background7y500.00000-infinf
38d20background8y500.00000-infinf
39d20background9y500.00000-infinf
40d20background10y500.00000-infinf
41d20background11y500.00000-infinf
42d20background12y500.00000-infinf
43d20background13y500.00000-infinf
44d20background14y500.00000-infinf
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.display.parameters.free()" ] }, { "cell_type": "markdown", "id": "44", "metadata": {}, "source": [ "### Set Constraints\n", "\n", "Set aliases for parameters." ] }, { "cell_type": "code", "execution_count": 26, "id": "45", "metadata": { "execution": { "iopub.execute_input": "2026-06-04T16:27:29.627591Z", "iopub.status.busy": "2026-06-04T16:27:29.627413Z", "iopub.status.idle": "2026-06-04T16:27:29.630583Z", "shell.execute_reply": "2026-06-04T16:27:29.629995Z" } }, "outputs": [], "source": [ "project.analysis.aliases.create(\n", " label='biso_Co1',\n", " param=project.structures['cosio'].atom_sites['Co1'].adp_iso,\n", ")\n", "project.analysis.aliases.create(\n", " label='biso_Co2',\n", " param=project.structures['cosio'].atom_sites['Co2'].adp_iso,\n", ")" ] }, { "cell_type": "markdown", "id": "46", "metadata": {}, "source": [ "Set constraints." ] }, { "cell_type": "code", "execution_count": 27, "id": "47", "metadata": { "execution": { "iopub.execute_input": "2026-06-04T16:27:29.631885Z", "iopub.status.busy": "2026-06-04T16:27:29.631735Z", "iopub.status.idle": "2026-06-04T16:27:29.634522Z", "shell.execute_reply": "2026-06-04T16:27:29.633836Z" }, "lines_to_next_cell": 2 }, "outputs": [], "source": [ "project.analysis.constraints.create(expression='biso_Co2 = biso_Co1')" ] }, { "cell_type": "markdown", "id": "48", "metadata": {}, "source": [ "### Run Fitting" ] }, { "cell_type": "code", "execution_count": 28, "id": "49", "metadata": { "execution": { "iopub.execute_input": "2026-06-04T16:27:29.635834Z", "iopub.status.busy": "2026-06-04T16:27:29.635687Z", "iopub.status.idle": "2026-06-04T16:28:53.890069Z", "shell.execute_reply": "2026-06-04T16:28:53.889349Z" } }, "outputs": [ { "data": { "text/html": [], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", "(function() {\n", " const button = document.getElementById('ed-fit-stop-78a68c029ca048758a0e74415c433a98-button');\n", " const status = document.getElementById('ed-fit-stop-78a68c029ca048758a0e74415c433a98-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'd20'\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": [ "
iterationtime (s)χ²change / status
110.28424.43
2355.40424.43
3477.5273.7882.6% ↓
47512.6373.78
59115.3339.4146.6% ↓
611720.3739.41
713623.3019.4750.6% ↓
816528.3719.47
918031.2117.1911.7% ↓
1021136.3417.19
1122438.4411.0335.8% ↓
1226743.5211.03
1326843.637.9428.0% ↓
1430948.717.94
1531249.014.6741.2% ↓
1635454.104.67
1735654.304.386.2% ↓
1839559.364.38
1943564.554.38
2047769.854.38
2151975.024.38
2256280.334.38
2357783.314.38
" ], "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;36m4.38\u001b[0m at iteration \u001b[1;36m560\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "✅ Fitting complete.\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mSaving project 📦 \u001b[0m\u001b[32m'cosio_d20'\u001b[0m\u001b[1;36m to \u001b[0m\u001b[32m'../../../projects/ed_5_cosio_d20'\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": [ "│ └── 📄 cosio.cif\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "├── 📁 experiments/\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "│ └── 📄 d20.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": [ " └── 📄 cosio_d20.html\n" ] } ], "source": [ "project.analysis.fit()" ] }, { "cell_type": "code", "execution_count": 29, "id": "50", "metadata": { "execution": { "iopub.execute_input": "2026-06-04T16:28:53.891838Z", "iopub.status.busy": "2026-06-04T16:28:53.891665Z", "iopub.status.idle": "2026-06-04T16:28:54.287045Z", "shell.execute_reply": "2026-06-04T16:28:54.286375Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "⚙️ Settings used:\n" ] }, { "data": { "text/html": [ "
NameValueDescription
1max_iterations1000Maximum solver iterations.
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "📋 Least-squares fit results:\n" ] }, { "data": { "text/html": [ "
MetricValue
1🧪 Minimizerlmfit (leastsq)
2✅ Overall statussuccess
3⏱️ Fitting time (seconds)83.31
4🔁 Iterations574
5📏 Goodness-of-fit (reduced χ²)4.38
6📏 R-factor (Rf, %)2.99
7📏 R-factor squared (Rf², %)4.32
8📏 Weighted R-factor (wR, %)4.54
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "📈 Refined parameters:\n" ] }, { "data": { "text/html": [ "
datablockcategoryentryparameterunitsstartvalues.u.change
1cosiocelllength_aÅ10.300010.30840.00030.08 % ↑
2cosiocelllength_bÅ6.00006.00360.00020.06 % ↑
3cosiocelllength_cÅ4.80004.78640.00010.28 % ↓
4cosioatom_siteCo1adp_isoŲ0.50000.67160.107934.32 % ↑
5cosioatom_siteCo2fract_x0.27900.27920.00070.06 % ↑
6cosioatom_siteCo2fract_z0.98500.98500.00140.00 % ↓
7cosioatom_siteSifract_x0.09400.09380.00040.25 % ↓
8cosioatom_siteSifract_z0.42900.42930.00080.08 % ↑
9cosioatom_siteSiadp_isoŲ0.50000.68560.088537.11 % ↑
10cosioatom_siteO1fract_x0.09100.09110.00030.14 % ↑
11cosioatom_siteO1fract_z0.77100.77150.00060.07 % ↑
12cosioatom_siteO1occupancy1.00000.91490.01368.51 % ↓
13cosioatom_siteO1adp_isoŲ0.50000.46550.07766.90 % ↓
14cosioatom_siteO2fract_x0.44800.44820.00030.04 % ↑
15cosioatom_siteO2fract_z0.21700.21710.00070.04 % ↑
16cosioatom_siteO2occupancy1.00000.95890.01354.11 % ↓
17cosioatom_siteO2adp_isoŲ0.50000.67010.079534.03 % ↑
18cosioatom_siteO3fract_x0.16400.16360.00020.24 % ↓
19cosioatom_siteO3fract_y0.03200.03150.00031.47 % ↓
20cosioatom_siteO3fract_z0.28000.28020.00050.07 % ↑
21cosioatom_siteO3occupancy1.00000.95490.01184.51 % ↓
22cosioatom_siteO3adp_isoŲ0.50000.84910.061469.83 % ↑
23d20linked_phasescosioscale1.00001.33080.028933.08 % ↑
24d20peakasym_empir_20.0000-0.00870.0019N/A
25d20peakbroad_gauss_udeg²0.30000.24200.006619.32 % ↓
26d20peakbroad_gauss_vdeg²-0.5000-0.53060.01436.11 % ↑
27d20peakbroad_gauss_wdeg²0.40000.38810.00892.98 % ↓
28d20peakbroad_lorentz_ydeg0.00000.01370.0044N/A
29d20instrumenttwotheta_offsetdeg0.10000.27620.0033176.23 % ↑
30d20background1y500.0000608.724714.245521.74 % ↑
31d20background2y500.0000580.69999.529916.14 % ↑
32d20background3y500.0000562.96089.054112.59 % ↑
33d20background4y500.0000540.35728.59118.07 % ↑
34d20background5y500.0000519.84485.92673.97 % ↑
35d20background6y500.0000507.54063.41711.51 % ↑
36d20background7y500.0000462.88423.14477.42 % ↓
37d20background8y500.0000430.79472.426813.84 % ↓
38d20background9y500.0000451.51762.21169.70 % ↓
39d20background10y500.0000429.10401.999214.18 % ↓
40d20background11y500.0000413.59872.220317.28 % ↓
41d20background12y500.0000362.02222.054527.60 % ↓
42d20background13y500.0000292.87111.934941.43 % ↓
43d20background14y500.0000241.14802.920351.77 % ↓
" ], "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": 30, "id": "51", "metadata": { "execution": { "iopub.execute_input": "2026-06-04T16:28:54.288990Z", "iopub.status.busy": "2026-06-04T16:28:54.288681Z", "iopub.status.idle": "2026-06-04T16:28:55.138658Z", "shell.execute_reply": "2026-06-04T16:28:55.137841Z" } }, "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", "
\n", "
Loading plot…
\n", "
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.display.fit.correlations()" ] }, { "cell_type": "markdown", "id": "52", "metadata": {}, "source": [ "### Display Pattern" ] }, { "cell_type": "code", "execution_count": 31, "id": "53", "metadata": { "execution": { "iopub.execute_input": "2026-06-04T16:28:55.140280Z", "iopub.status.busy": "2026-06-04T16:28:55.140108Z", "iopub.status.idle": "2026-06-04T16:28:56.043991Z", "shell.execute_reply": "2026-06-04T16:28:56.043126Z" } }, "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": [ "
Loading plot…
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.display.pattern(expt_name='d20')" ] }, { "cell_type": "code", "execution_count": 32, "id": "54", "metadata": { "execution": { "iopub.execute_input": "2026-06-04T16:28:56.047708Z", "iopub.status.busy": "2026-06-04T16:28:56.047513Z", "iopub.status.idle": "2026-06-04T16:28:56.981288Z", "shell.execute_reply": "2026-06-04T16:28:56.980468Z" } }, "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": [ "
Loading plot…
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.display.pattern(expt_name='d20', x_min=42, x_max=52)" ] }, { "cell_type": "markdown", "id": "55", "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." ] } ], "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 }