{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "0", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:27:42.733208Z", "iopub.status.busy": "2026-06-30T22:27:42.732990Z", "iopub.status.idle": "2026-06-30T22:27:42.737637Z", "shell.execute_reply": "2026-06-30T22:27:42.736873Z" }, "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.19.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-06-30T22:27:42.739202Z", "iopub.status.busy": "2026-06-30T22:27:42.739031Z", "iopub.status.idle": "2026-06-30T22:27:45.722907Z", "shell.execute_reply": "2026-06-30T22:27:45.721876Z" } }, "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-30T22:27:45.724648Z", "iopub.status.busy": "2026-06-30T22:27:45.724375Z", "iopub.status.idle": "2026-06-30T22:27:45.729217Z", "shell.execute_reply": "2026-06-30T22:27:45.728448Z" } }, "outputs": [], "source": [ "structure = StructureFactory.from_scratch(name='hs')" ] }, { "cell_type": "markdown", "id": "6", "metadata": {}, "source": [ "### Set Space Group" ] }, { "cell_type": "code", "execution_count": 4, "id": "7", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:27:45.730955Z", "iopub.status.busy": "2026-06-30T22:27:45.730804Z", "iopub.status.idle": "2026-06-30T22:27:45.733554Z", "shell.execute_reply": "2026-06-30T22:27:45.732857Z" } }, "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-06-30T22:27:45.735281Z", "iopub.status.busy": "2026-06-30T22:27:45.735122Z", "iopub.status.idle": "2026-06-30T22:27:45.738381Z", "shell.execute_reply": "2026-06-30T22:27:45.737730Z" } }, "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-06-30T22:27:45.739990Z", "iopub.status.busy": "2026-06-30T22:27:45.739828Z", "iopub.status.idle": "2026-06-30T22:27:45.747118Z", "shell.execute_reply": "2026-06-30T22:27:45.746398Z" } }, "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-06-30T22:27:45.748485Z", "iopub.status.busy": "2026-06-30T22:27:45.748333Z", "iopub.status.idle": "2026-06-30T22:27:45.907807Z", "shell.execute_reply": "2026-06-30T22:27:45.906875Z" } }, "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-06-30T22:27:45.909508Z", "iopub.status.busy": "2026-06-30T22:27:45.909344Z", "iopub.status.idle": "2026-06-30T22:27:46.418078Z", "shell.execute_reply": "2026-06-30T22:27:46.417198Z" } }, "outputs": [], "source": [ "expt = ExperimentFactory.from_data_path(name='hrpt', data_path=data_path)" ] }, { "cell_type": "markdown", "id": "16", "metadata": {}, "source": [ "### Set Instrument" ] }, { "cell_type": "code", "execution_count": 9, "id": "17", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:27:46.419731Z", "iopub.status.busy": "2026-06-30T22:27:46.419555Z", "iopub.status.idle": "2026-06-30T22:27:46.422659Z", "shell.execute_reply": "2026-06-30T22:27:46.421855Z" } }, "outputs": [], "source": [ "expt.instrument.setup_wavelength = 1.89\n", "expt.instrument.calib_twotheta_offset = 0.0" ] }, { "cell_type": "markdown", "id": "18", "metadata": {}, "source": [ "### Set Peak Profile" ] }, { "cell_type": "code", "execution_count": 10, "id": "19", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:27:46.424309Z", "iopub.status.busy": "2026-06-30T22:27:46.424130Z", "iopub.status.idle": "2026-06-30T22:27:46.434527Z", "shell.execute_reply": "2026-06-30T22:27:46.433662Z" } }, "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-06-30T22:27:46.435992Z", "iopub.status.busy": "2026-06-30T22:27:46.435820Z", "iopub.status.idle": "2026-06-30T22:27:46.442890Z", "shell.execute_reply": "2026-06-30T22:27:46.441876Z" } }, "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-06-30T22:27:46.444466Z", "iopub.status.busy": "2026-06-30T22:27:46.444289Z", "iopub.status.idle": "2026-06-30T22:27:46.447624Z", "shell.execute_reply": "2026-06-30T22:27:46.446861Z" } }, "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-06-30T22:27:46.449484Z", "iopub.status.busy": "2026-06-30T22:27:46.449313Z", "iopub.status.idle": "2026-06-30T22:27:46.452066Z", "shell.execute_reply": "2026-06-30T22:27:46.451473Z" } }, "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-06-30T22:27:46.453887Z", "iopub.status.busy": "2026-06-30T22:27:46.453710Z", "iopub.status.idle": "2026-06-30T22:27:46.475627Z", "shell.execute_reply": "2026-06-30T22:27:46.474872Z" } }, "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-06-30T22:27:46.477730Z", "iopub.status.busy": "2026-06-30T22:27:46.477537Z", "iopub.status.idle": "2026-06-30T22:27:46.481238Z", "shell.execute_reply": "2026-06-30T22:27:46.480516Z" } }, "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-06-30T22:27:46.482855Z", "iopub.status.busy": "2026-06-30T22:27:46.482678Z", "iopub.status.idle": "2026-06-30T22:27:46.734088Z", "shell.execute_reply": "2026-06-30T22:27:46.733217Z" } }, "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-06-30T22:27:46.735943Z", "iopub.status.busy": "2026-06-30T22:27:46.735556Z", "iopub.status.idle": "2026-06-30T22:27:46.738932Z", "shell.execute_reply": "2026-06-30T22:27:46.738103Z" } }, "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-06-30T22:27:46.740437Z", "iopub.status.busy": "2026-06-30T22:27:46.740279Z", "iopub.status.idle": "2026-06-30T22:27:46.742978Z", "shell.execute_reply": "2026-06-30T22:27:46.742224Z" } }, "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-06-30T22:27:46.744488Z", "iopub.status.busy": "2026-06-30T22:27:46.744339Z", "iopub.status.idle": "2026-06-30T22:27:47.071227Z", "shell.execute_reply": "2026-06-30T22:27:47.070319Z" } }, "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-06-30T22:27:47.073192Z", "iopub.status.busy": "2026-06-30T22:27:47.072981Z", "iopub.status.idle": "2026-06-30T22:27:47.558479Z", "shell.execute_reply": "2026-06-30T22:27:47.556353Z" } }, "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-06-30T22:27:47.562896Z", "iopub.status.busy": "2026-06-30T22:27:47.562706Z", "iopub.status.idle": "2026-06-30T22:27:47.615291Z", "shell.execute_reply": "2026-06-30T22:27:47.614388Z" } }, "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-06-30T22:27:47.617124Z", "iopub.status.busy": "2026-06-30T22:27:47.616929Z", "iopub.status.idle": "2026-06-30T22:27:47.620893Z", "shell.execute_reply": "2026-06-30T22:27:47.619891Z" } }, "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-06-30T22:27:47.622456Z", "iopub.status.busy": "2026-06-30T22:27:47.622280Z", "iopub.status.idle": "2026-06-30T22:27:47.733998Z", "shell.execute_reply": "2026-06-30T22:27:47.732185Z" } }, "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-06-30T22:27:47.735607Z", "iopub.status.busy": "2026-06-30T22:27:47.735414Z", "iopub.status.idle": "2026-06-30T22:27:54.497789Z", "shell.execute_reply": "2026-06-30T22:27:54.496749Z" } }, "outputs": [ { "data": { "text/html": [], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", "(function() {\n", " const button = document.getElementById('ed-fit-stop-9ce22983b34142b5835ce63316d9bd51-button');\n", " const status = document.getElementById('ed-fit-stop-9ce22983b34142b5835ce63316d9bd51-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.3860.1271.4% ↓
3130.8555.457.8% ↓
4181.1251.966.3% ↓
5231.3649.784.2% ↓
6281.6048.532.5% ↓
7332.0947.851.4% ↓
8432.6047.311.1% ↓
91106.6847.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-06-30T22:27:54.499799Z", "iopub.status.busy": "2026-06-30T22:27:54.499492Z", "iopub.status.idle": "2026-06-30T22:27:54.966848Z", "shell.execute_reply": "2026-06-30T22:27:54.965987Z" } }, "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.68
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-06-30T22:27:54.968507Z", "iopub.status.busy": "2026-06-30T22:27:54.968323Z", "iopub.status.idle": "2026-06-30T22:27:55.035567Z", "shell.execute_reply": "2026-06-30T22:27:55.034533Z" } }, "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-06-30T22:27:55.040218Z", "iopub.status.busy": "2026-06-30T22:27:55.040022Z", "iopub.status.idle": "2026-06-30T22:27:55.092906Z", "shell.execute_reply": "2026-06-30T22:27:55.092075Z" } }, "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-06-30T22:27:55.094769Z", "iopub.status.busy": "2026-06-30T22:27:55.094596Z", "iopub.status.idle": "2026-06-30T22:27:55.098698Z", "shell.execute_reply": "2026-06-30T22:27:55.097596Z" } }, "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-06-30T22:27:55.100499Z", "iopub.status.busy": "2026-06-30T22:27:55.100282Z", "iopub.status.idle": "2026-06-30T22:27:55.200522Z", "shell.execute_reply": "2026-06-30T22:27:55.199293Z" } }, "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-06-30T22:27:55.202062Z", "iopub.status.busy": "2026-06-30T22:27:55.201896Z", "iopub.status.idle": "2026-06-30T22:28:09.410859Z", "shell.execute_reply": "2026-06-30T22:28:09.409909Z" } }, "outputs": [ { "data": { "text/html": [], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", "(function() {\n", " const button = document.getElementById('ed-fit-stop-4a91be41e8794ff4a8ecbfececd249b2-button');\n", " const status = document.getElementById('ed-fit-stop-4a91be41e8794ff4a8ecbfececd249b2-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.0647.35
2241.4616.0566.1% ↓
3462.8514.946.9% ↓
4674.1813.0112.9% ↓
51489.3612.92
622414.1312.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-06-30T22:28:09.412639Z", "iopub.status.busy": "2026-06-30T22:28:09.412483Z", "iopub.status.idle": "2026-06-30T22:28:09.870600Z", "shell.execute_reply": "2026-06-30T22:28:09.869982Z" } }, "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)14.13
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-06-30T22:28:09.872439Z", "iopub.status.busy": "2026-06-30T22:28:09.872254Z", "iopub.status.idle": "2026-06-30T22:28:09.933624Z", "shell.execute_reply": "2026-06-30T22:28:09.932798Z" } }, "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-06-30T22:28:09.936706Z", "iopub.status.busy": "2026-06-30T22:28:09.936530Z", "iopub.status.idle": "2026-06-30T22:28:09.988879Z", "shell.execute_reply": "2026-06-30T22:28:09.988021Z" } }, "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-06-30T22:28:09.990549Z", "iopub.status.busy": "2026-06-30T22:28:09.990369Z", "iopub.status.idle": "2026-06-30T22:28:09.993567Z", "shell.execute_reply": "2026-06-30T22:28:09.992901Z" } }, "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-06-30T22:28:09.995105Z", "iopub.status.busy": "2026-06-30T22:28:09.994924Z", "iopub.status.idle": "2026-06-30T22:28:10.093478Z", "shell.execute_reply": "2026-06-30T22:28:10.092679Z" } }, "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-06-30T22:28:10.095497Z", "iopub.status.busy": "2026-06-30T22:28:10.095342Z", "iopub.status.idle": "2026-06-30T22:28:25.704682Z", "shell.execute_reply": "2026-06-30T22:28:25.703553Z" } }, "outputs": [ { "data": { "text/html": [], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", "(function() {\n", " const button = document.getElementById('ed-fit-stop-8719f06718dd41b5940d7bfb72cf559b-button');\n", " const status = document.getElementById('ed-fit-stop-8719f06718dd41b5940d7bfb72cf559b-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.0712.94
2291.785.2059.8% ↓
3553.344.954.7% ↓
41338.344.95
521713.374.95
624615.524.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-06-30T22:28:25.706471Z", "iopub.status.busy": "2026-06-30T22:28:25.706238Z", "iopub.status.idle": "2026-06-30T22:28:26.189390Z", "shell.execute_reply": "2026-06-30T22:28:26.188577Z" } }, "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.52
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-06-30T22:28:26.190941Z", "iopub.status.busy": "2026-06-30T22:28:26.190786Z", "iopub.status.idle": "2026-06-30T22:28:26.253639Z", "shell.execute_reply": "2026-06-30T22:28:26.252903Z" } }, "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-06-30T22:28:26.256323Z", "iopub.status.busy": "2026-06-30T22:28:26.256160Z", "iopub.status.idle": "2026-06-30T22:28:26.309262Z", "shell.execute_reply": "2026-06-30T22:28:26.308146Z" } }, "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-06-30T22:28:26.311005Z", "iopub.status.busy": "2026-06-30T22:28:26.310828Z", "iopub.status.idle": "2026-06-30T22:28:26.315977Z", "shell.execute_reply": "2026-06-30T22:28:26.315083Z" } }, "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-06-30T22:28:26.318040Z", "iopub.status.busy": "2026-06-30T22:28:26.317287Z", "iopub.status.idle": "2026-06-30T22:28:26.439420Z", "shell.execute_reply": "2026-06-30T22:28:26.438667Z" } }, "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-06-30T22:28:26.441000Z", "iopub.status.busy": "2026-06-30T22:28:26.440815Z", "iopub.status.idle": "2026-06-30T22:28:51.202303Z", "shell.execute_reply": "2026-06-30T22:28:51.201554Z" } }, "outputs": [ { "data": { "text/html": [], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", "(function() {\n", " const button = document.getElementById('ed-fit-stop-d8c038898c2e4342af075dd26f9e4dae-button');\n", " const status = document.getElementById('ed-fit-stop-d8c038898c2e4342af075dd26f9e4dae-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.442.1556.6% ↓
3734.421.959.1% ↓
41539.441.95
523614.481.95
631719.501.95
739524.661.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-06-30T22:28:51.204123Z", "iopub.status.busy": "2026-06-30T22:28:51.203942Z", "iopub.status.idle": "2026-06-30T22:28:51.652781Z", "shell.execute_reply": "2026-06-30T22:28:51.652021Z" } }, "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)24.66
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-06-30T22:28:51.654831Z", "iopub.status.busy": "2026-06-30T22:28:51.654656Z", "iopub.status.idle": "2026-06-30T22:28:51.683468Z", "shell.execute_reply": "2026-06-30T22:28:51.682225Z" } }, "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-06-30T22:28:51.685927Z", "iopub.status.busy": "2026-06-30T22:28:51.685738Z", "iopub.status.idle": "2026-06-30T22:28:51.746759Z", "shell.execute_reply": "2026-06-30T22:28:51.745924Z" } }, "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-06-30T22:28:51.751530Z", "iopub.status.busy": "2026-06-30T22:28:51.751337Z", "iopub.status.idle": "2026-06-30T22:28:52.060357Z", "shell.execute_reply": "2026-06-30T22:28:52.059426Z" } }, "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-06-30T22:28:52.062357Z", "iopub.status.busy": "2026-06-30T22:28:52.062160Z", "iopub.status.idle": "2026-06-30T22:28:52.423637Z", "shell.execute_reply": "2026-06-30T22:28:52.422403Z" } }, "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" ] }, { "name": "stdout", "output_type": "stream", "text": [ "├── 📁 structures/\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "│ └── 📄 hs.edi\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "├── 📁 experiments/\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "│ └── 📄 hrpt.edi\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "├── 📁 analysis/\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "│ └── 📄 analysis.edi\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "└── 📁 reports/\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ " └── 📄 hs_hrpt.html\n" ] } ], "source": [ "project.save_as(dir_path='projects/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.5" } }, "nbformat": 4, "nbformat_minor": 5 }