{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "0", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:28:24.625829Z", "iopub.status.busy": "2026-08-18T18:28:24.625632Z", "iopub.status.idle": "2026-08-18T18:28:24.629711Z", "shell.execute_reply": "2026-08-18T18:28:24.629002Z" }, "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.20.1" ] }, { "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-08-18T18:28:24.631187Z", "iopub.status.busy": "2026-08-18T18:28:24.631025Z", "iopub.status.idle": "2026-08-18T18:28:27.622985Z", "shell.execute_reply": "2026-08-18T18:28:27.622113Z" } }, "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-08-18T18:28:27.625509Z", "iopub.status.busy": "2026-08-18T18:28:27.625159Z", "iopub.status.idle": "2026-08-18T18:28:27.630778Z", "shell.execute_reply": "2026-08-18T18:28:27.630085Z" } }, "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-08-18T18:28:27.632445Z", "iopub.status.busy": "2026-08-18T18:28:27.632298Z", "iopub.status.idle": "2026-08-18T18:28:27.635402Z", "shell.execute_reply": "2026-08-18T18:28:27.634874Z" } }, "outputs": [], "source": [ "structure.space_group.name_h_m = 'R -3 m'\n", "structure.space_group.coord_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-08-18T18:28:27.637091Z", "iopub.status.busy": "2026-08-18T18:28:27.636936Z", "iopub.status.idle": "2026-08-18T18:28:27.639574Z", "shell.execute_reply": "2026-08-18T18:28:27.638929Z" } }, "outputs": [], "source": [ "structure.cell.length_a = 6.85\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-08-18T18:28:27.641214Z", "iopub.status.busy": "2026-08-18T18:28:27.641045Z", "iopub.status.idle": "2026-08-18T18:28:27.648147Z", "shell.execute_reply": "2026-08-18T18:28:27.647479Z" } }, "outputs": [], "source": [ "structure.atom_sites.create(\n", " id='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", " id='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", " id='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", " id='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", " id='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-08-18T18:28:27.649780Z", "iopub.status.busy": "2026-08-18T18:28:27.649618Z", "iopub.status.idle": "2026-08-18T18:28:27.851770Z", "shell.execute_reply": "2026-08-18T18:28:27.848252Z" } }, "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[32m'meas-hs-hrpt'\u001b[0m: HS, HRPT \u001b[1m(\u001b[0mPSI\u001b[1m)\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "✅ Data \u001b[32m'meas-hs-hrpt'\u001b[0m downloaded to \u001b[32m'../../../data/meas-hs-hrpt.xye'\u001b[0m\n" ] } ], "source": [ "data_path = download_data('meas-hs-hrpt', 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-08-18T18:28:27.853827Z", "iopub.status.busy": "2026-08-18T18:28:27.853532Z", "iopub.status.idle": "2026-08-18T18:28:28.381330Z", "shell.execute_reply": "2026-08-18T18:28:28.380372Z" } }, "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-08-18T18:28:28.383381Z", "iopub.status.busy": "2026-08-18T18:28:28.383214Z", "iopub.status.idle": "2026-08-18T18:28:28.386166Z", "shell.execute_reply": "2026-08-18T18:28:28.385493Z" } }, "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-08-18T18:28:28.387794Z", "iopub.status.busy": "2026-08-18T18:28:28.387641Z", "iopub.status.idle": "2026-08-18T18:28:28.396577Z", "shell.execute_reply": "2026-08-18T18:28:28.395885Z" } }, "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 + berar-baldinozzi asymmetryCWL pseudo-Voigt profile with Berar-Baldinozzi 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-08-18T18:28:28.398209Z", "iopub.status.busy": "2026-08-18T18:28:28.398052Z", "iopub.status.idle": "2026-08-18T18:28:28.404279Z", "shell.execute_reply": "2026-08-18T18:28:28.403602Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "⚠️ Switching peak profile type adds these settings with defaults: \n", " • asym_beba_a0=0.0 \n", " • asym_beba_a1=0.0 \n", " • asym_beba_b0=0.0 \n", " • asym_beba_b1=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 + berar-baldinozzi asymmetry\n" ] } ], "source": [ "expt.peak.type = 'pseudo-voigt + berar-baldinozzi asymmetry'" ] }, { "cell_type": "code", "execution_count": 12, "id": "21", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:28:28.405988Z", "iopub.status.busy": "2026-08-18T18:28:28.405828Z", "iopub.status.idle": "2026-08-18T18:28:28.409053Z", "shell.execute_reply": "2026-08-18T18:28:28.408433Z" } }, "outputs": [], "source": [ "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_y = 0" ] }, { "cell_type": "code", "execution_count": 13, "id": "22", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:28:28.410757Z", "iopub.status.busy": "2026-08-18T18:28:28.410601Z", "iopub.status.idle": "2026-08-18T18:28:28.413092Z", "shell.execute_reply": "2026-08-18T18:28:28.412441Z" } }, "outputs": [], "source": [ "expt.peak.cutoff_fwhm = 8" ] }, { "cell_type": "markdown", "id": "23", "metadata": {}, "source": [ "### Set Background" ] }, { "cell_type": "code", "execution_count": 14, "id": "24", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:28:28.414751Z", "iopub.status.busy": "2026-08-18T18:28:28.414596Z", "iopub.status.idle": "2026-08-18T18:28:28.442553Z", "shell.execute_reply": "2026-08-18T18:28:28.441826Z" } }, "outputs": [], "source": [ "expt.background.auto_estimate()" ] }, { "cell_type": "markdown", "id": "25", "metadata": {}, "source": [ "### Set Linked Structures" ] }, { "cell_type": "code", "execution_count": 15, "id": "26", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:28:28.444326Z", "iopub.status.busy": "2026-08-18T18:28:28.444167Z", "iopub.status.idle": "2026-08-18T18:28:28.446754Z", "shell.execute_reply": "2026-08-18T18:28:28.446158Z" } }, "outputs": [], "source": [ "expt.linked_structures.create(structure_id='hs', scale=0.5)" ] }, { "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-08-18T18:28:28.448403Z", "iopub.status.busy": "2026-08-18T18:28:28.448248Z", "iopub.status.idle": "2026-08-18T18:28:28.742763Z", "shell.execute_reply": "2026-08-18T18:28:28.742291Z" } }, "outputs": [], "source": [ "project = Project(name='hs_hrpt')" ] }, { "cell_type": "markdown", "id": "29", "metadata": {}, "source": [ "### Add Structure" ] }, { "cell_type": "code", "execution_count": 17, "id": "30", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:28:28.747914Z", "iopub.status.busy": "2026-08-18T18:28:28.747737Z", "iopub.status.idle": "2026-08-18T18:28:28.752382Z", "shell.execute_reply": "2026-08-18T18:28:28.751586Z" } }, "outputs": [], "source": [ "project.structures.add(structure)" ] }, { "cell_type": "markdown", "id": "31", "metadata": {}, "source": [ "### Add Experiment" ] }, { "cell_type": "code", "execution_count": 18, "id": "32", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:28:28.753959Z", "iopub.status.busy": "2026-08-18T18:28:28.753787Z", "iopub.status.idle": "2026-08-18T18:28:28.757677Z", "shell.execute_reply": "2026-08-18T18:28:28.757217Z" } }, "outputs": [], "source": [ "project.experiments.add(expt)" ] }, { "cell_type": "markdown", "id": "33", "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": 19, "id": "34", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:28:28.759653Z", "iopub.status.busy": "2026-08-18T18:28:28.759483Z", "iopub.status.idle": "2026-08-18T18:28:29.158374Z", "shell.execute_reply": "2026-08-18T18:28:29.157825Z" } }, "outputs": [ { "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": "35", "metadata": {}, "source": [ "### Display Pattern" ] }, { "cell_type": "code", "execution_count": 20, "id": "36", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:28:29.160032Z", "iopub.status.busy": "2026-08-18T18:28:29.159863Z", "iopub.status.idle": "2026-08-18T18:28:29.620863Z", "shell.execute_reply": "2026-08-18T18:28:29.617857Z" } }, "outputs": [ { "data": { "text/html": [ "
Loading plot…
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.display.pattern(expt_name='hrpt')" ] }, { "cell_type": "code", "execution_count": 21, "id": "37", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:28:29.625013Z", "iopub.status.busy": "2026-08-18T18:28:29.624847Z", "iopub.status.idle": "2026-08-18T18:28:29.673725Z", "shell.execute_reply": "2026-08-18T18:28:29.672845Z" } }, "outputs": [ { "data": { "text/html": [ "
Loading plot…
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.display.pattern(expt_name='hrpt', x_min=48, x_max=51)" ] }, { "cell_type": "markdown", "id": "38", "metadata": {}, "source": [ "### Perform Fit 1/4\n", "\n", "Set parameters to be refined." ] }, { "cell_type": "code", "execution_count": 22, "id": "39", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:28:29.675322Z", "iopub.status.busy": "2026-08-18T18:28:29.675136Z", "iopub.status.idle": "2026-08-18T18:28:29.678655Z", "shell.execute_reply": "2026-08-18T18:28:29.677997Z" } }, "outputs": [], "source": [ "structure.cell.length_a.free = True\n", "structure.cell.length_c.free = True\n", "\n", "expt.linked_structures['hs'].scale.free = True\n", "expt.instrument.calib_twotheta_offset.free = True" ] }, { "cell_type": "markdown", "id": "40", "metadata": {}, "source": [ "Show free parameters after selection." ] }, { "cell_type": "code", "execution_count": 23, "id": "41", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:28:29.680291Z", "iopub.status.busy": "2026-08-18T18:28:29.680122Z", "iopub.status.idle": "2026-08-18T18:28:29.779681Z", "shell.execute_reply": "2026-08-18T18:28:29.779209Z" } }, "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
1hscelllength_a6.85000-infinfÅ
2hscelllength_c14.10000-infinfÅ
3hrptlinked_structurehsscale0.50000-infinf
4hrptinstrumenttwotheta_offset0.00000-infinfdeg
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.display.parameters.free()" ] }, { "cell_type": "markdown", "id": "42", "metadata": {}, "source": [ "#### Run Fitting" ] }, { "cell_type": "code", "execution_count": 24, "id": "43", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:28:29.782883Z", "iopub.status.busy": "2026-08-18T18:28:29.782704Z", "iopub.status.idle": "2026-08-18T18:28:36.471528Z", "shell.execute_reply": "2026-08-18T18:28:36.470947Z" } }, "outputs": [ { "data": { "text/html": [], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", "(function() {\n", " const button = document.getElementById('ed-fit-stop-e2b5aaefd3f145208381e07ab453d8c0-button');\n", " const status = document.getElementById('ed-fit-stop-e2b5aaefd3f145208381e07ab453d8c0-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": [ "
iterationtime (s)χ²change / status
110.05210.23
280.4460.1271.4% ↓
3130.9655.457.8% ↓
4181.2151.966.3% ↓
5231.4849.784.2% ↓
6281.7348.532.5% ↓
7331.9747.851.4% ↓
8432.6947.311.1% ↓
91106.6147.11
" ], "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;36m47.11\u001b[0m at iteration \u001b[1;36m80\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "✅ Fitting complete.\n" ] } ], "source": [ "project.analysis.fit()" ] }, { "cell_type": "code", "execution_count": 25, "id": "44", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:28:36.474693Z", "iopub.status.busy": "2026-08-18T18:28:36.474346Z", "iopub.status.idle": "2026-08-18T18:28:36.893874Z", "shell.execute_reply": "2026-08-18T18:28:36.893305Z" } }, "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)6.61
4🔁 Iterations107
5📏 Goodness-of-fit (reduced χ²)47.11
6📏 R-factor (Rf, %)17.69
7📏 R-factor squared (Rf², %)30.23
8📏 Weighted R-factor (wR, %)31.10
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "📈 Refined parameters:\n" ] }, { "data": { "text/html": [ "
datablockcategoryentryparameterunitsstartvalues.u.change
1hscelllength_aÅ6.85006.86220.00030.18 % ↑
2hscelllength_cÅ14.100014.13630.00080.26 % ↑
3hrptlinked_structurehsscale0.50000.24420.002951.16 % ↓
4hrptinstrumenttwotheta_offsetdeg0.00000.12580.0051N/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": "45", "metadata": {}, "source": [ "#### Display Pattern" ] }, { "cell_type": "code", "execution_count": 26, "id": "46", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:28:36.897840Z", "iopub.status.busy": "2026-08-18T18:28:36.897676Z", "iopub.status.idle": "2026-08-18T18:28:36.963501Z", "shell.execute_reply": "2026-08-18T18:28:36.962865Z" } }, "outputs": [ { "data": { "text/html": [ "
Loading plot…
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.display.pattern(expt_name='hrpt')" ] }, { "cell_type": "code", "execution_count": 27, "id": "47", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:28:36.968031Z", "iopub.status.busy": "2026-08-18T18:28:36.967855Z", "iopub.status.idle": "2026-08-18T18:28:37.019009Z", "shell.execute_reply": "2026-08-18T18:28:37.018171Z" } }, "outputs": [ { "data": { "text/html": [ "
Loading plot…
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.display.pattern(expt_name='hrpt', x_min=48, x_max=51)" ] }, { "cell_type": "markdown", "id": "48", "metadata": {}, "source": [ "### Perform Fit 2/4\n", "\n", "Set more parameters to be refined." ] }, { "cell_type": "code", "execution_count": 28, "id": "49", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:28:37.020514Z", "iopub.status.busy": "2026-08-18T18:28:37.020341Z", "iopub.status.idle": "2026-08-18T18:28:37.023969Z", "shell.execute_reply": "2026-08-18T18:28:37.023243Z" } }, "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.intensity.free = True" ] }, { "cell_type": "markdown", "id": "50", "metadata": {}, "source": [ "Show free parameters after selection." ] }, { "cell_type": "code", "execution_count": 29, "id": "51", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:28:37.025571Z", "iopub.status.busy": "2026-08-18T18:28:37.025389Z", "iopub.status.idle": "2026-08-18T18:28:37.108437Z", "shell.execute_reply": "2026-08-18T18:28:37.107711Z" } }, "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
1hscelllength_a6.862160.00029-infinfÅ
2hscelllength_c14.136340.00084-infinfÅ
3hrptlinked_structurehsscale0.244220.00291-infinf
4hrptpeakbroad_gauss_u0.10000-infinfdeg²
5hrptpeakbroad_gauss_v-0.20000-infinfdeg²
6hrptpeakbroad_gauss_w0.20000-infinfdeg²
7hrptpeakbroad_lorentz_y0.00000-infinfdeg
8hrptinstrumenttwotheta_offset0.125750.00513-infinfdeg
9hrptbackground1intensity645.00000-infinf
10hrptbackground2intensity460.00000-infinf
11hrptbackground3intensity451.00000-infinf
12hrptbackground4intensity616.75182-infinf
13hrptbackground5intensity451.00000-infinf
14hrptbackground6intensity522.48916-infinf
15hrptbackground7intensity497.01720-infinf
16hrptbackground8intensity613.15327-infinf
17hrptbackground9intensity657.13723-infinf
18hrptbackground10intensity573.00000-infinf
19hrptbackground11intensity514.00000-infinf
20hrptbackground12intensity538.17307-infinf
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.display.parameters.free()" ] }, { "cell_type": "markdown", "id": "52", "metadata": {}, "source": [ "#### Run Fitting" ] }, { "cell_type": "code", "execution_count": 30, "id": "53", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:28:37.110219Z", "iopub.status.busy": "2026-08-18T18:28:37.110063Z", "iopub.status.idle": "2026-08-18T18:28:51.164753Z", "shell.execute_reply": "2026-08-18T18:28:51.164081Z" } }, "outputs": [ { "data": { "text/html": [], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", "(function() {\n", " const button = document.getElementById('ed-fit-stop-62836cdaf8444d54931306ce7dfae104-button');\n", " const status = document.getElementById('ed-fit-stop-62836cdaf8444d54931306ce7dfae104-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": [ "
iterationtime (s)χ²change / status
110.0547.35
2241.4316.0566.1% ↓
3462.7914.946.9% ↓
4674.2713.0112.9% ↓
51489.4312.92
622413.9712.92
" ], "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;36m12.92\u001b[0m at iteration \u001b[1;36m202\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "✅ Fitting complete.\n" ] } ], "source": [ "project.analysis.fit()" ] }, { "cell_type": "code", "execution_count": 31, "id": "54", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:28:51.166932Z", "iopub.status.busy": "2026-08-18T18:28:51.166770Z", "iopub.status.idle": "2026-08-18T18:28:51.585631Z", "shell.execute_reply": "2026-08-18T18:28:51.584956Z" } }, "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)13.97
4🔁 Iterations221
5📏 Goodness-of-fit (reduced χ²)12.92
6📏 R-factor (Rf, %)9.89
7📏 R-factor squared (Rf², %)13.86
8📏 Weighted R-factor (wR, %)13.80
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "📈 Refined parameters:\n" ] }, { "data": { "text/html": [ "
datablockcategoryentryparameterunitsstartvalues.u.change
1hscelllength_aÅ6.86226.86260.00030.01 % ↑
2hscelllength_cÅ14.136314.13920.00090.02 % ↑
3hrptlinked_structurehsscale0.24420.41620.004070.42 % ↑
4hrptpeakbroad_gauss_udeg²0.10000.34580.0267245.76 % ↑
5hrptpeakbroad_gauss_vdeg²-0.2000-0.24790.049323.94 % ↑
6hrptpeakbroad_gauss_wdeg²0.20000.21270.02116.34 % ↑
7hrptpeakbroad_lorentz_ydeg0.00000.15740.0106N/A
8hrptinstrumenttwotheta_offsetdeg0.12580.12720.00401.14 % ↑
9hrptbackground1intensity645.0000673.107520.03344.36 % ↑
10hrptbackground2intensity460.0000454.92516.26941.10 % ↓
11hrptbackground3intensity451.0000436.54236.12753.21 % ↓
12hrptbackground4intensity616.7518562.072213.65108.87 % ↓
13hrptbackground5intensity451.0000472.80347.68534.83 % ↑
14hrptbackground6intensity522.4892495.69345.48985.13 % ↓
15hrptbackground7intensity497.0172404.57085.287518.60 % ↓
16hrptbackground8intensity613.1533440.454210.475528.17 % ↓
17hrptbackground9intensity657.1372394.857511.479039.91 % ↓
18hrptbackground10intensity573.0000538.77338.97745.97 % ↓
19hrptbackground11intensity514.0000456.03608.410511.28 % ↓
20hrptbackground12intensity538.1731552.231114.70532.61 % ↑
" ], "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": "55", "metadata": {}, "source": [ "#### Display Pattern" ] }, { "cell_type": "code", "execution_count": 32, "id": "56", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:28:51.587552Z", "iopub.status.busy": "2026-08-18T18:28:51.587369Z", "iopub.status.idle": "2026-08-18T18:28:51.642921Z", "shell.execute_reply": "2026-08-18T18:28:51.642250Z" } }, "outputs": [ { "data": { "text/html": [ "
Loading plot…
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.display.pattern(expt_name='hrpt')" ] }, { "cell_type": "code", "execution_count": 33, "id": "57", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:28:51.647367Z", "iopub.status.busy": "2026-08-18T18:28:51.647192Z", "iopub.status.idle": "2026-08-18T18:28:51.697182Z", "shell.execute_reply": "2026-08-18T18:28:51.696329Z" } }, "outputs": [ { "data": { "text/html": [ "
Loading plot…
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.display.pattern(expt_name='hrpt', x_min=48, x_max=51)" ] }, { "cell_type": "markdown", "id": "58", "metadata": {}, "source": [ "### Perform Fit 3/4\n", "\n", "Set more parameters to be refined." ] }, { "cell_type": "code", "execution_count": 34, "id": "59", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:28:51.699138Z", "iopub.status.busy": "2026-08-18T18:28:51.698905Z", "iopub.status.idle": "2026-08-18T18:28:51.702903Z", "shell.execute_reply": "2026-08-18T18:28:51.702173Z" } }, "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": "60", "metadata": {}, "source": [ "Show free parameters after selection." ] }, { "cell_type": "code", "execution_count": 35, "id": "61", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:28:51.704436Z", "iopub.status.busy": "2026-08-18T18:28:51.704267Z", "iopub.status.idle": "2026-08-18T18:28:51.791039Z", "shell.execute_reply": "2026-08-18T18:28:51.790250Z" } }, "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
1hscelllength_a6.862600.00035-infinfÅ
2hscelllength_c14.139200.00093-infinfÅ
3hsatom_siteOfract_x0.21000-infinf
4hsatom_siteOfract_z0.06000-infinf
5hsatom_siteClfract_z0.19700-infinf
6hsatom_siteHfract_x0.13000-infinf
7hsatom_siteHfract_z0.08000-infinf
8hrptlinked_structurehsscale0.416190.00400-infinf
9hrptpeakbroad_gauss_u0.345760.02672-infinfdeg²
10hrptpeakbroad_gauss_v-0.247880.04934-infinfdeg²
11hrptpeakbroad_gauss_w0.212670.02110-infinfdeg²
12hrptpeakbroad_lorentz_y0.157400.01058-infinfdeg
13hrptinstrumenttwotheta_offset0.127180.00396-infinfdeg
14hrptbackground1intensity673.1075320.03337-infinf
15hrptbackground2intensity454.925086.26943-infinf
16hrptbackground3intensity436.542326.12751-infinf
17hrptbackground4intensity562.0722013.65100-infinf
18hrptbackground5intensity472.803377.68533-infinf
19hrptbackground6intensity495.693385.48976-infinf
20hrptbackground7intensity404.570815.28747-infinf
21hrptbackground8intensity440.4542110.47549-infinf
22hrptbackground9intensity394.8575111.47903-infinf
23hrptbackground10intensity538.773358.97740-infinf
24hrptbackground11intensity456.035998.41055-infinf
25hrptbackground12intensity552.2310914.70527-infinf
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.display.parameters.free()" ] }, { "cell_type": "markdown", "id": "62", "metadata": {}, "source": [ "#### Run Fitting" ] }, { "cell_type": "code", "execution_count": 36, "id": "63", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:28:51.792864Z", "iopub.status.busy": "2026-08-18T18:28:51.792705Z", "iopub.status.idle": "2026-08-18T18:29:07.022958Z", "shell.execute_reply": "2026-08-18T18:29:07.021971Z" } }, "outputs": [ { "data": { "text/html": [], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", "(function() {\n", " const button = document.getElementById('ed-fit-stop-c47b4a3a3b3b4a77b5656036a6fed0dd-button');\n", " const status = document.getElementById('ed-fit-stop-c47b4a3a3b3b4a77b5656036a6fed0dd-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": [ "
iterationtime (s)χ²change / status
110.0612.94
2291.665.2059.8% ↓
3553.154.954.7% ↓
41378.164.95
521713.234.95
624615.154.95
" ], "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.95\u001b[0m at iteration \u001b[1;36m178\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "✅ Fitting complete.\n" ] } ], "source": [ "project.analysis.fit()" ] }, { "cell_type": "code", "execution_count": 37, "id": "64", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:29:07.024578Z", "iopub.status.busy": "2026-08-18T18:29:07.024387Z", "iopub.status.idle": "2026-08-18T18:29:07.504919Z", "shell.execute_reply": "2026-08-18T18:29:07.504308Z" } }, "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)15.15
4🔁 Iterations243
5📏 Goodness-of-fit (reduced χ²)4.95
6📏 R-factor (Rf, %)6.43
7📏 R-factor squared (Rf², %)8.76
8📏 Weighted R-factor (wR, %)8.89
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "📈 Refined parameters:\n" ] }, { "data": { "text/html": [ "
datablockcategoryentryparameterunitsstartvalues.u.change
1hscelllength_aÅ6.86266.86200.00020.01 % ↓
2hscelllength_cÅ14.139214.13480.00050.03 % ↓
3hsatom_siteOfract_x0.21000.20590.00021.94 % ↓
4hsatom_siteOfract_z0.06000.06290.00024.75 % ↑
5hsatom_siteClfract_z0.19700.19740.00020.20 % ↑
6hsatom_siteHfract_x0.13000.13390.00023.01 % ↑
7hsatom_siteHfract_z0.08000.08710.00018.89 % ↑
8hrptlinked_structurehsscale0.41620.39500.00235.09 % ↓
9hrptpeakbroad_gauss_udeg²0.34580.35720.01403.30 % ↑
10hrptpeakbroad_gauss_vdeg²-0.2479-0.38180.026854.01 % ↑
11hrptpeakbroad_gauss_wdeg²0.21270.28250.012532.86 % ↑
12hrptpeakbroad_lorentz_ydeg0.15740.13900.006211.68 % ↓
13hrptinstrumenttwotheta_offsetdeg0.12720.11480.00249.71 % ↓
14hrptbackground1intensity673.1075672.131312.39740.15 % ↓
15hrptbackground2intensity454.9251456.28193.88360.30 % ↑
16hrptbackground3intensity436.5423448.07803.79642.64 % ↑
17hrptbackground4intensity562.0722564.31338.42950.40 % ↑
18hrptbackground5intensity472.8034464.74434.79381.70 % ↓
19hrptbackground6intensity495.6934517.89743.36794.48 % ↑
20hrptbackground7intensity404.5708449.90133.231611.20 % ↑
21hrptbackground8intensity440.4542473.37426.76617.47 % ↑
22hrptbackground9intensity394.8575477.23438.057820.86 % ↑
23hrptbackground10intensity538.7733454.93766.096515.56 % ↓
24hrptbackground11intensity456.0360405.12245.602811.16 % ↓
25hrptbackground12intensity552.2311589.73989.20596.79 % ↑
" ], "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": "65", "metadata": {}, "source": [ "#### Display Pattern" ] }, { "cell_type": "code", "execution_count": 38, "id": "66", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:29:07.506714Z", "iopub.status.busy": "2026-08-18T18:29:07.506551Z", "iopub.status.idle": "2026-08-18T18:29:07.571292Z", "shell.execute_reply": "2026-08-18T18:29:07.570882Z" } }, "outputs": [ { "data": { "text/html": [ "
Loading plot…
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.display.pattern(expt_name='hrpt')" ] }, { "cell_type": "code", "execution_count": 39, "id": "67", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:29:07.581902Z", "iopub.status.busy": "2026-08-18T18:29:07.581718Z", "iopub.status.idle": "2026-08-18T18:29:07.643275Z", "shell.execute_reply": "2026-08-18T18:29:07.642604Z" } }, "outputs": [ { "data": { "text/html": [ "
Loading plot…
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.display.pattern(expt_name='hrpt', x_min=48, x_max=51)" ] }, { "cell_type": "markdown", "id": "68", "metadata": {}, "source": [ "### Perform Fit 4/4\n", "\n", "Set more parameters to be refined." ] }, { "cell_type": "code", "execution_count": 40, "id": "69", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:29:07.644738Z", "iopub.status.busy": "2026-08-18T18:29:07.644567Z", "iopub.status.idle": "2026-08-18T18:29:07.648294Z", "shell.execute_reply": "2026-08-18T18:29:07.647654Z" } }, "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_beba_a0.free = True\n", "expt.peak.asym_beba_b0.free = True\n", "expt.peak.asym_beba_a1.free = True\n", "expt.peak.asym_beba_b1.free = True" ] }, { "cell_type": "markdown", "id": "70", "metadata": {}, "source": [ "Show free parameters after selection." ] }, { "cell_type": "code", "execution_count": 41, "id": "71", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:29:07.650041Z", "iopub.status.busy": "2026-08-18T18:29:07.649862Z", "iopub.status.idle": "2026-08-18T18:29:07.769508Z", "shell.execute_reply": "2026-08-18T18:29:07.765200Z" } }, "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
1hscelllength_a6.862030.00022-infinfÅ
2hscelllength_c14.134840.00053-infinfÅ
3hsatom_siteZnadp_iso0.50000-infinfŲ
4hsatom_siteCuadp_iso0.50000-infinfŲ
5hsatom_siteOfract_x0.205920.00024-infinf
6hsatom_siteOfract_z0.062850.00018-infinf
7hsatom_siteOadp_iso0.50000-infinfŲ
8hsatom_siteClfract_z0.197390.00018-infinf
9hsatom_siteCladp_iso0.50000-infinfŲ
10hsatom_siteHfract_x0.133910.00018-infinf
11hsatom_siteHfract_z0.087110.00013-infinf
12hsatom_siteHadp_iso0.50000-infinfŲ
13hrptlinked_structurehsscale0.395010.00234-infinf
14hrptpeakasym_beba_a00.00000-infinf
15hrptpeakasym_beba_b00.00000-infinf
16hrptpeakasym_beba_a10.00000-infinf
17hrptpeakasym_beba_b10.00000-infinf
18hrptpeakbroad_gauss_u0.357170.01404-infinfdeg²
19hrptpeakbroad_gauss_v-0.381760.02676-infinfdeg²
20hrptpeakbroad_gauss_w0.282550.01248-infinfdeg²
21hrptpeakbroad_lorentz_y0.139010.00615-infinfdeg
22hrptinstrumenttwotheta_offset0.114830.00237-infinfdeg
23hrptbackground1intensity672.1312812.39736-infinf
24hrptbackground2intensity456.281943.88358-infinf
25hrptbackground3intensity448.078053.79639-infinf
26hrptbackground4intensity564.313278.42947-infinf
27hrptbackground5intensity464.744324.79375-infinf
28hrptbackground6intensity517.897373.36789-infinf
29hrptbackground7intensity449.901253.23156-infinf
30hrptbackground8intensity473.374256.76608-infinf
31hrptbackground9intensity477.234318.05784-infinf
32hrptbackground10intensity454.937626.09645-infinf
33hrptbackground11intensity405.122395.60281-infinf
34hrptbackground12intensity589.739819.20593-infinf
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.display.parameters.free()" ] }, { "cell_type": "markdown", "id": "72", "metadata": {}, "source": [ "#### Run Fitting" ] }, { "cell_type": "code", "execution_count": 42, "id": "73", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:29:07.771196Z", "iopub.status.busy": "2026-08-18T18:29:07.771012Z", "iopub.status.idle": "2026-08-18T18:29:33.582305Z", "shell.execute_reply": "2026-08-18T18:29:33.581217Z" } }, "outputs": [ { "data": { "text/html": [], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", "(function() {\n", " const button = document.getElementById('ed-fit-stop-585777c990724acbb4a62206435da996-button');\n", " const status = document.getElementById('ed-fit-stop-585777c990724acbb4a62206435da996-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": [ "
iterationtime (s)χ²change / status
110.064.96
2382.672.1556.6% ↓
3734.901.959.1% ↓
414910.251.95
523215.271.95
631220.291.95
739525.711.95
" ], "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.95\u001b[0m at iteration \u001b[1;36m373\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "✅ Fitting complete.\n" ] } ], "source": [ "project.analysis.fit()" ] }, { "cell_type": "code", "execution_count": 43, "id": "74", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:29:33.584036Z", "iopub.status.busy": "2026-08-18T18:29:33.583846Z", "iopub.status.idle": "2026-08-18T18:29:34.041562Z", "shell.execute_reply": "2026-08-18T18:29:34.040396Z" } }, "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)25.71
4🔁 Iterations392
5📏 Goodness-of-fit (reduced χ²)1.95
6📏 R-factor (Rf, %)3.99
7📏 R-factor squared (Rf², %)4.64
8📏 Weighted R-factor (wR, %)4.14
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "📈 Refined parameters:\n" ] }, { "data": { "text/html": [ "
datablockcategoryentryparameterunitsstartvalues.u.change
1hscelllength_aÅ6.86206.86400.00040.03 % ↑
2hscelllength_cÅ14.134814.14180.00100.05 % ↑
3hsatom_siteZnadp_isoŲ0.50000.16180.060967.65 % ↓
4hsatom_siteCuadp_isoŲ0.50001.48730.0380197.46 % ↑
5hsatom_siteOfract_x0.20590.20630.00020.16 % ↑
6hsatom_siteOfract_z0.06290.06110.00012.85 % ↓
7hsatom_siteOadp_isoŲ0.50001.07820.0377115.64 % ↑
8hsatom_siteClfract_z0.19740.19670.00010.34 % ↓
9hsatom_siteCladp_isoŲ0.50001.43290.0380186.58 % ↑
10hsatom_siteHfract_x0.13390.13240.00021.15 % ↓
11hsatom_siteHfract_z0.08710.08980.00013.12 % ↑
12hsatom_siteHadp_isoŲ0.50002.44450.0430388.90 % ↑
13hrptlinked_structurehsscale0.39500.51100.002629.37 % ↑
14hrptpeakasym_beba_a00.0000-0.19690.0258N/A
15hrptpeakasym_beba_b00.0000-0.04740.0041N/A
16hrptpeakasym_beba_a10.00000.11790.0591N/A
17hrptpeakasym_beba_b10.00000.05530.0093N/A
18hrptpeakbroad_gauss_udeg²0.35720.23040.007535.50 % ↓
19hrptpeakbroad_gauss_vdeg²-0.3818-0.28840.011324.45 % ↓
20hrptpeakbroad_gauss_wdeg²0.28250.27220.00323.65 % ↓
21hrptpeakbroad_lorentz_ydeg0.13900.15280.00319.90 % ↑
22hrptinstrumenttwotheta_offsetdeg0.11480.14610.007127.24 % ↑
23hrptbackground1intensity672.1313672.19707.78860.01 % ↑
24hrptbackground2intensity456.2819456.19042.44270.02 % ↓
25hrptbackground3intensity448.0780444.73832.38980.75 % ↓
26hrptbackground4intensity564.3133472.71385.621916.23 % ↓
27hrptbackground5intensity464.7443460.85423.01710.84 % ↓
28hrptbackground6intensity517.8974494.47042.09044.52 % ↓
29hrptbackground7intensity449.9013492.33972.07189.43 % ↑
30hrptbackground8intensity473.3742533.20864.415212.64 % ↑
31hrptbackground9intensity477.2343525.16185.233810.04 % ↑
32hrptbackground10intensity454.9376526.73873.928215.78 % ↑
33hrptbackground11intensity405.1224492.44873.651221.56 % ↑
34hrptbackground12intensity589.7398507.19616.671114.00 % ↓
" ], "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": 44, "id": "75", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:29:34.043076Z", "iopub.status.busy": "2026-08-18T18:29:34.042907Z", "iopub.status.idle": "2026-08-18T18:29:34.349304Z", "shell.execute_reply": "2026-08-18T18:29:34.348310Z" } }, "outputs": [ { "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": "76", "metadata": {}, "source": [ "#### Display Pattern" ] }, { "cell_type": "code", "execution_count": 45, "id": "77", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:29:34.350896Z", "iopub.status.busy": "2026-08-18T18:29:34.350719Z", "iopub.status.idle": "2026-08-18T18:29:34.409990Z", "shell.execute_reply": "2026-08-18T18:29:34.409103Z" } }, "outputs": [ { "data": { "text/html": [ "
Loading plot…
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.display.pattern(expt_name='hrpt')" ] }, { "cell_type": "code", "execution_count": 46, "id": "78", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:29:34.413572Z", "iopub.status.busy": "2026-08-18T18:29:34.413332Z", "iopub.status.idle": "2026-08-18T18:29:34.466866Z", "shell.execute_reply": "2026-08-18T18:29:34.466207Z" } }, "outputs": [ { "data": { "text/html": [ "
Loading plot…
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.display.pattern(expt_name='hrpt', x_min=48, x_max=51)" ] }, { "cell_type": "markdown", "id": "79", "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": "80", "metadata": {}, "source": [ "## 💾 Save Project" ] }, { "cell_type": "code", "execution_count": 47, "id": "81", "metadata": { "execution": { "iopub.execute_input": "2026-08-18T18:29:34.468445Z", "iopub.status.busy": "2026-08-18T18:29:34.468287Z", "iopub.status.idle": "2026-08-18T18:29:34.805685Z", "shell.execute_reply": "2026-08-18T18:29:34.804852Z" } }, "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/refine-hs-hrpt'\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "├── 📄 project.edi\n", "├── 📁 structures/\n", "│ └── 📄 hs.edi\n", "├── 📁 experiments/\n", "│ └── 📄 hrpt.edi\n", "├── 📁 analysis/\n", "│ └── 📄 analysis.edi\n", "└── 📁 reports/\n", " └── 📄 hs_hrpt.html\n" ] } ], "source": [ "project.save_as(dir_path='projects/refine-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.6" } }, "nbformat": 4, "nbformat_minor": 5 }