{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "0",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:16:30.622419Z",
"iopub.status.busy": "2026-06-04T16:16:30.622235Z",
"iopub.status.idle": "2026-06-04T16:16:30.625844Z",
"shell.execute_reply": "2026-06-04T16:16:30.625171Z"
},
"tags": [
"hide-in-docs"
]
},
"outputs": [],
"source": [
"# Check whether easydiffraction is installed; install it if needed.\n",
"# Required for remote environments such as Google Colab.\n",
"import importlib.util\n",
"\n",
"if importlib.util.find_spec('easydiffraction') is None:\n",
" %pip install easydiffraction==0.18.0"
]
},
{
"cell_type": "markdown",
"id": "1",
"metadata": {},
"source": [
"# Instrument calibration: BEER at ESS\n",
"\n",
"This example demonstrates a Rietveld refinement of a duplex steel\n",
"structure using time-of-flight neutron powder diffraction data\n",
"simulated with McStas.\n",
"\n",
"Two datasets from two symmetrically positioned banks (S2 and N2) of\n",
"the BEER instrument are analyzed in this tutorial."
]
},
{
"cell_type": "markdown",
"id": "2",
"metadata": {},
"source": [
"## 🛠️ Import Library"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "3",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:16:30.627176Z",
"iopub.status.busy": "2026-06-04T16:16:30.627026Z",
"iopub.status.idle": "2026-06-04T16:16:33.338149Z",
"shell.execute_reply": "2026-06-04T16:16:33.337442Z"
}
},
"outputs": [],
"source": [
"from easydiffraction import ExperimentFactory\n",
"from easydiffraction import Project\n",
"from easydiffraction import StructureFactory\n",
"from easydiffraction import download_data\n",
"from easydiffraction import extract_data_paths_from_zip\n",
"from easydiffraction import extract_metadata"
]
},
{
"cell_type": "markdown",
"id": "4",
"metadata": {},
"source": [
"## 🧩 Define Structures\n",
"\n",
"This section covers how to add structures and modify their\n",
"parameters.\n",
"\n",
"### Create Ferrite Structure"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "5",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:16:33.340433Z",
"iopub.status.busy": "2026-06-04T16:16:33.340145Z",
"iopub.status.idle": "2026-06-04T16:16:33.346620Z",
"shell.execute_reply": "2026-06-04T16:16:33.345757Z"
}
},
"outputs": [],
"source": [
"ferrite = StructureFactory.from_scratch(name='ferrite')\n",
"\n",
"ferrite.space_group.name_h_m = 'I m -3 m'\n",
"ferrite.space_group.it_coordinate_system_code = '1'\n",
"\n",
"ferrite.cell.length_a = 2.886\n",
"\n",
"ferrite.atom_sites.create(\n",
" label='Fe',\n",
" type_symbol='Fe',\n",
" fract_x=0.0,\n",
" fract_y=0.0,\n",
" fract_z=0.0,\n",
" adp_type='Biso',\n",
" adp_iso=1.0,\n",
")"
]
},
{
"cell_type": "markdown",
"id": "6",
"metadata": {},
"source": [
"### Create Austenite Structure"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "7",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:16:33.348201Z",
"iopub.status.busy": "2026-06-04T16:16:33.348047Z",
"iopub.status.idle": "2026-06-04T16:16:33.352705Z",
"shell.execute_reply": "2026-06-04T16:16:33.351867Z"
}
},
"outputs": [],
"source": [
"austenite = StructureFactory.from_scratch(name='austenite')\n",
"\n",
"austenite.space_group.name_h_m = 'F m -3 m'\n",
"austenite.space_group.it_coordinate_system_code = '1'\n",
"\n",
"austenite.cell.length_a = 3.6468\n",
"\n",
"austenite.atom_sites.create(\n",
" label='Fe',\n",
" type_symbol='Fe',\n",
" fract_x=0.0,\n",
" fract_y=0.0,\n",
" fract_z=0.0,\n",
" adp_type='Biso',\n",
" adp_iso=1.0,\n",
")"
]
},
{
"cell_type": "markdown",
"id": "8",
"metadata": {},
"source": [
"## 🔬 Define Experiments\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": 5,
"id": "9",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:16:33.354222Z",
"iopub.status.busy": "2026-06-04T16:16:33.354067Z",
"iopub.status.idle": "2026-06-04T16:16:33.495775Z",
"shell.execute_reply": "2026-06-04T16:16:33.495061Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1;36mGetting data\u001b[0m\u001b[1;36m...\u001b[0m\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Data #\u001b[1;36m33\u001b[0m: ferrite + austenite, BEER \u001b[1m(\u001b[0mESS\u001b[1m)\u001b[0m, S2 and N2 detector bank datasets\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"✅ Data #\u001b[1;36m33\u001b[0m downloaded to \u001b[32m'../../../data/ed-33.zip'\u001b[0m\n"
]
}
],
"source": [
"zip_path = download_data(id=33, destination='data')\n",
"data_paths = extract_data_paths_from_zip(zip_path, destination='data/ed-20')\n",
"\n",
"data_path_s2 = data_paths[1] # 'Duplex_in_HR_for_IRF_S2.dat'\n",
"data_path_n2 = data_paths[0] # 'Duplex_in_HR_for_IRF_N2.dat'"
]
},
{
"cell_type": "markdown",
"id": "10",
"metadata": {},
"source": [
"### Create Experiment"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "11",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:16:33.497831Z",
"iopub.status.busy": "2026-06-04T16:16:33.497657Z",
"iopub.status.idle": "2026-06-04T16:16:33.822676Z",
"shell.execute_reply": "2026-06-04T16:16:33.821112Z"
}
},
"outputs": [],
"source": [
"expt_s2 = ExperimentFactory.from_data_path(\n",
" name='expt_s2',\n",
" data_path=data_path_s2,\n",
" beam_mode='time-of-flight',\n",
")"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "12",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:16:33.824322Z",
"iopub.status.busy": "2026-06-04T16:16:33.824157Z",
"iopub.status.idle": "2026-06-04T16:16:34.230971Z",
"shell.execute_reply": "2026-06-04T16:16:34.229523Z"
}
},
"outputs": [],
"source": [
"expt_n2 = ExperimentFactory.from_data_path(\n",
" name='expt_n2',\n",
" data_path=data_path_n2,\n",
" beam_mode='time-of-flight',\n",
")"
]
},
{
"cell_type": "markdown",
"id": "13",
"metadata": {},
"source": [
"### Set Instrument"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "14",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:16:34.232733Z",
"iopub.status.busy": "2026-06-04T16:16:34.232540Z",
"iopub.status.idle": "2026-06-04T16:16:34.236588Z",
"shell.execute_reply": "2026-06-04T16:16:34.235770Z"
}
},
"outputs": [],
"source": [
"expt_s2.instrument.setup_twotheta_bank = extract_metadata(\n",
" data_path_s2, r'two_theta\\s*=\\s*(\\d*\\.?\\d+)'\n",
")\n",
"expt_s2.instrument.calib_d_to_tof_linear = extract_metadata(\n",
" data_path_s2, r'DIFC\\s*=\\s*(\\d*\\.?\\d+)'\n",
")"
]
},
{
"cell_type": "code",
"execution_count": 9,
"id": "15",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:16:34.238037Z",
"iopub.status.busy": "2026-06-04T16:16:34.237865Z",
"iopub.status.idle": "2026-06-04T16:16:34.241311Z",
"shell.execute_reply": "2026-06-04T16:16:34.240516Z"
}
},
"outputs": [],
"source": [
"expt_n2.instrument.setup_twotheta_bank = extract_metadata(\n",
" data_path_n2, r'two_theta\\s*=\\s*(\\d*\\.?\\d+)'\n",
")\n",
"expt_n2.instrument.calib_d_to_tof_linear = extract_metadata(\n",
" data_path_n2, r'DIFC\\s*=\\s*(\\d*\\.?\\d+)'\n",
")"
]
},
{
"cell_type": "markdown",
"id": "16",
"metadata": {},
"source": [
"### Set Peak Profile"
]
},
{
"cell_type": "code",
"execution_count": 10,
"id": "17",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:16:34.242751Z",
"iopub.status.busy": "2026-06-04T16:16:34.242594Z",
"iopub.status.idle": "2026-06-04T16:16:34.252149Z",
"shell.execute_reply": "2026-06-04T16:16:34.251326Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1;36mPeak types\u001b[0m\n"
]
},
{
"data": {
"text/html": [
"
| | Type | Description |
|---|
| 1 | | pseudo-voigt | TOF non-convoluted pseudo-Voigt profile |
|---|
| 2 | * | jorgensen | TOF Jorgensen profile: back-to-back exponentials ⊗ Gaussian |
|---|
| 3 | | jorgensen-von-dreele | TOF Jorgensen-Von Dreele profile: back-to-back exponentials ⊗ pseudo-Voigt |
|---|
| 4 | | double-jorgensen-von-dreele | TOF Double-Jorgensen-Von Dreele profile: double back-to-back exponentials ⊗ pseudo-Voigt (Z-Rietveld type0m) |
|---|
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"expt_s2.peak.show_supported()"
]
},
{
"cell_type": "code",
"execution_count": 11,
"id": "18",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:16:34.253869Z",
"iopub.status.busy": "2026-06-04T16:16:34.253651Z",
"iopub.status.idle": "2026-06-04T16:16:34.264511Z",
"shell.execute_reply": "2026-06-04T16:16:34.263628Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"⚠️ Switching peak profile type removes these settings: \n",
" • decay_beta_0 \n",
" • decay_beta_1 \n",
" • rise_alpha_0 \n",
" • rise_alpha_1 \n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"⚠️ Switching peak profile type adds these settings with defaults: \n",
" • lorentz_gamma_0=0.0 \n",
" • lorentz_gamma_1=0.0 \n",
" • lorentz_gamma_2=0.0 \n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1;36mPeak profile type for experiment \u001b[0m\u001b[32m'expt_s2'\u001b[0m\u001b[1;36m changed to\u001b[0m\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"pseudo-voigt\n"
]
}
],
"source": [
"expt_s2.peak.type = 'pseudo-voigt'"
]
},
{
"cell_type": "code",
"execution_count": 12,
"id": "19",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:16:34.266441Z",
"iopub.status.busy": "2026-06-04T16:16:34.266176Z",
"iopub.status.idle": "2026-06-04T16:16:34.270882Z",
"shell.execute_reply": "2026-06-04T16:16:34.270178Z"
}
},
"outputs": [],
"source": [
"expt_s2.peak.broad_gauss_sigma_0 = 300\n",
"expt_s2.peak.broad_gauss_sigma_1 = 1200\n",
"expt_s2.peak.broad_gauss_sigma_2 = 900"
]
},
{
"cell_type": "code",
"execution_count": 13,
"id": "20",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:16:34.272367Z",
"iopub.status.busy": "2026-06-04T16:16:34.272205Z",
"iopub.status.idle": "2026-06-04T16:16:34.280042Z",
"shell.execute_reply": "2026-06-04T16:16:34.278996Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"⚠️ Switching peak profile type removes these settings: \n",
" • decay_beta_0 \n",
" • decay_beta_1 \n",
" • rise_alpha_0 \n",
" • rise_alpha_1 \n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"⚠️ Switching peak profile type adds these settings with defaults: \n",
" • lorentz_gamma_0=0.0 \n",
" • lorentz_gamma_1=0.0 \n",
" • lorentz_gamma_2=0.0 \n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1;36mPeak profile type for experiment \u001b[0m\u001b[32m'expt_n2'\u001b[0m\u001b[1;36m changed to\u001b[0m\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"pseudo-voigt\n"
]
}
],
"source": [
"expt_n2.peak.type = 'pseudo-voigt'"
]
},
{
"cell_type": "code",
"execution_count": 14,
"id": "21",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:16:34.281591Z",
"iopub.status.busy": "2026-06-04T16:16:34.281407Z",
"iopub.status.idle": "2026-06-04T16:16:34.285121Z",
"shell.execute_reply": "2026-06-04T16:16:34.284351Z"
}
},
"outputs": [],
"source": [
"expt_n2.peak.broad_gauss_sigma_0 = 300\n",
"expt_n2.peak.broad_gauss_sigma_1 = 1200\n",
"expt_n2.peak.broad_gauss_sigma_2 = 900"
]
},
{
"cell_type": "markdown",
"id": "22",
"metadata": {},
"source": [
"### Set Background"
]
},
{
"cell_type": "code",
"execution_count": 15,
"id": "23",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:16:34.286613Z",
"iopub.status.busy": "2026-06-04T16:16:34.286425Z",
"iopub.status.idle": "2026-06-04T16:16:34.292896Z",
"shell.execute_reply": "2026-06-04T16:16:34.292124Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1;36mBackground types\u001b[0m\n"
]
},
{
"data": {
"text/html": [
" | | Type | Description |
|---|
| 1 | | chebyshev | Chebyshev polynomial background |
|---|
| 2 | * | line-segment | Linear interpolation between points |
|---|
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"expt_s2.background.show_supported()"
]
},
{
"cell_type": "code",
"execution_count": 16,
"id": "24",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:16:34.294634Z",
"iopub.status.busy": "2026-06-04T16:16:34.294442Z",
"iopub.status.idle": "2026-06-04T16:16:34.297079Z",
"shell.execute_reply": "2026-06-04T16:16:34.296404Z"
}
},
"outputs": [],
"source": [
"# expt_s2.background.type = 'line-segment'"
]
},
{
"cell_type": "code",
"execution_count": 17,
"id": "25",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:16:34.298813Z",
"iopub.status.busy": "2026-06-04T16:16:34.298654Z",
"iopub.status.idle": "2026-06-04T16:16:34.309661Z",
"shell.execute_reply": "2026-06-04T16:16:34.308958Z"
}
},
"outputs": [],
"source": [
"for idx, (x, y) in enumerate(\n",
" [\n",
" (40111.8789, 0.0170),\n",
" (41193.5664, 0.1484),\n",
" (42041.3750, 0.1848),\n",
" (42713.7734, 0.1975),\n",
" (44409.3945, 0.1891),\n",
" (45198.7344, 0.2147),\n",
" (46251.1875, 0.1887),\n",
" (49350.0742, 0.2194),\n",
" (51289.6836, 0.1991),\n",
" (55245.1992, 0.1981),\n",
" (55679.7070, 0.2276),\n",
" (56383.9102, 0.2439),\n",
" (58956.1797, 0.2907),\n",
" (61536.4570, 0.3067),\n",
" (63768.0469, 0.3242),\n",
" (65581.2109, 0.2973),\n",
" (70183.8516, 0.2575),\n",
" (71787.8203, 0.2321),\n",
" (78343.1094, 0.2158),\n",
" (80016.8047, 0.1694),\n",
" (98141.8516, 0.2400),\n",
" (99262.2344, 0.4335),\n",
" (100985.8516, 0.4375),\n",
" (101933.8516, 0.3427),\n",
" (108656.0312, 0.5339),\n",
" (110896.7500, 0.9537),\n",
" (113137.4844, 1.1668),\n",
" (114430.2031, 1.1164),\n",
" (116929.4844, 0.9161),\n",
" (119428.7422, 0.6885),\n",
" (134506.3438, 0.0692),\n",
" ],\n",
" start=1,\n",
"):\n",
" expt_s2.background.create(id=str(idx), x=x, y=y)"
]
},
{
"cell_type": "code",
"execution_count": 18,
"id": "26",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:16:34.311382Z",
"iopub.status.busy": "2026-06-04T16:16:34.311209Z",
"iopub.status.idle": "2026-06-04T16:16:34.321311Z",
"shell.execute_reply": "2026-06-04T16:16:34.320550Z"
}
},
"outputs": [],
"source": [
"for point in expt_s2.background:\n",
" expt_n2.background.create(id=point.id.value, x=point.x.value, y=point.y.value)"
]
},
{
"cell_type": "markdown",
"id": "27",
"metadata": {},
"source": [
"### Set Linked Phases"
]
},
{
"cell_type": "code",
"execution_count": 19,
"id": "28",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:16:34.322845Z",
"iopub.status.busy": "2026-06-04T16:16:34.322682Z",
"iopub.status.idle": "2026-06-04T16:16:34.325902Z",
"shell.execute_reply": "2026-06-04T16:16:34.325150Z"
}
},
"outputs": [],
"source": [
"expt_s2.linked_phases.create(id='ferrite', scale=10)\n",
"expt_s2.linked_phases.create(id='austenite', scale=10)"
]
},
{
"cell_type": "code",
"execution_count": 20,
"id": "29",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:16:34.327367Z",
"iopub.status.busy": "2026-06-04T16:16:34.327218Z",
"iopub.status.idle": "2026-06-04T16:16:34.330305Z",
"shell.execute_reply": "2026-06-04T16:16:34.329613Z"
}
},
"outputs": [],
"source": [
"expt_n2.linked_phases.create(id='ferrite', scale=10)\n",
"expt_n2.linked_phases.create(id='austenite', scale=10)"
]
},
{
"cell_type": "markdown",
"id": "30",
"metadata": {},
"source": [
"### Set Excluded Regions"
]
},
{
"cell_type": "code",
"execution_count": 21,
"id": "31",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:16:34.332155Z",
"iopub.status.busy": "2026-06-04T16:16:34.332003Z",
"iopub.status.idle": "2026-06-04T16:16:34.335119Z",
"shell.execute_reply": "2026-06-04T16:16:34.334452Z"
}
},
"outputs": [],
"source": [
"expt_s2.excluded_regions.create(id='1', start=0, end=40500)\n",
"expt_s2.excluded_regions.create(id='2', start=130000, end=180000)"
]
},
{
"cell_type": "code",
"execution_count": 22,
"id": "32",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:16:34.337096Z",
"iopub.status.busy": "2026-06-04T16:16:34.336934Z",
"iopub.status.idle": "2026-06-04T16:16:34.340120Z",
"shell.execute_reply": "2026-06-04T16:16:34.339434Z"
}
},
"outputs": [],
"source": [
"expt_n2.excluded_regions.create(id='1', start=0, end=40500)\n",
"expt_n2.excluded_regions.create(id='2', start=130000, end=180000)"
]
},
{
"cell_type": "markdown",
"id": "33",
"metadata": {},
"source": [
"## 📦 Define Project\n",
"\n",
"The project object is used to manage the structure, experiments,\n",
"and analysis\n",
"\n",
"### Create Project"
]
},
{
"cell_type": "code",
"execution_count": 23,
"id": "34",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:16:34.342159Z",
"iopub.status.busy": "2026-06-04T16:16:34.341997Z",
"iopub.status.idle": "2026-06-04T16:16:34.876838Z",
"shell.execute_reply": "2026-06-04T16:16:34.875946Z"
}
},
"outputs": [
{
"data": {
"application/javascript": [
"\n",
" (function() {\n",
" var isDark = false;\n",
"\n",
" // Check JupyterLab theme\n",
" if (document.body.classList.contains('jp-mod-dark') || \n",
" document.body.classList.contains('theme-dark') ||\n",
" document.body.classList.contains('vscode-dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check theme attribute\n",
" var themeAttr = document.body.getAttribute('data-jp-theme-name');\n",
" if (themeAttr && themeAttr.includes('dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check computed background color\n",
" var notebookEl = document.querySelector('.jp-Notebook') || \n",
" document.querySelector('.notebook_app') ||\n",
" document.body;\n",
" if (notebookEl) {\n",
" var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n",
" var rgb = bgColor.match(/\\d+/g);\n",
" if (rgb && rgb.length >= 3) {\n",
" var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n",
" if (brightness < 128) {\n",
" isDark = true;\n",
" }\n",
" }\n",
" }\n",
"\n",
" // Store result\n",
" if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n",
" IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n",
" }\n",
" })();\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" if (typeof IPython !== 'undefined' && IPython.notebook) {\n",
" IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n",
" (document.body.classList.contains('theme-dark') || \n",
" document.body.classList.contains('jp-mod-dark') ||\n",
" (document.body.getAttribute('data-jp-theme-name') && \n",
" document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n",
" }\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1;36mSaving project 📦 \u001b[0m\u001b[32m'beer_mcstas'\u001b[0m\u001b[1;36m to \u001b[0m\u001b[32m'../../../projects/ed_20_beer_mcstas'\u001b[0m\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"├── 📄 project.cif\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"├── 📁 structures/\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"├── 📁 experiments/\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"├── 📁 analysis/\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"│ └── 📄 analysis.cif\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"└── 📁 reports/\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
" └── 📄 beer_mcstas.html\n"
]
}
],
"source": [
"project = Project(name='beer_mcstas')\n",
"project.save_as(dir_path='projects/ed_20_beer_mcstas')"
]
},
{
"cell_type": "markdown",
"id": "35",
"metadata": {},
"source": [
"### Add Structures"
]
},
{
"cell_type": "code",
"execution_count": 24,
"id": "36",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:16:34.878450Z",
"iopub.status.busy": "2026-06-04T16:16:34.878290Z",
"iopub.status.idle": "2026-06-04T16:16:34.881349Z",
"shell.execute_reply": "2026-06-04T16:16:34.880339Z"
}
},
"outputs": [],
"source": [
"project.structures.add(ferrite)\n",
"project.structures.add(austenite)"
]
},
{
"cell_type": "markdown",
"id": "37",
"metadata": {},
"source": [
"### Add Experiments"
]
},
{
"cell_type": "code",
"execution_count": 25,
"id": "38",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:16:34.882973Z",
"iopub.status.busy": "2026-06-04T16:16:34.882808Z",
"iopub.status.idle": "2026-06-04T16:16:34.885526Z",
"shell.execute_reply": "2026-06-04T16:16:34.884708Z"
}
},
"outputs": [],
"source": [
"project.experiments.add(expt_s2)\n",
"project.experiments.add(expt_n2)"
]
},
{
"cell_type": "markdown",
"id": "39",
"metadata": {},
"source": [
"### Display Structure"
]
},
{
"cell_type": "code",
"execution_count": 26,
"id": "40",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:16:34.887118Z",
"iopub.status.busy": "2026-06-04T16:16:34.886916Z",
"iopub.status.idle": "2026-06-04T16:16:35.851816Z",
"shell.execute_reply": "2026-06-04T16:16:35.851162Z"
}
},
"outputs": [
{
"data": {
"application/javascript": [
"\n",
" (function() {\n",
" var isDark = false;\n",
"\n",
" // Check JupyterLab theme\n",
" if (document.body.classList.contains('jp-mod-dark') || \n",
" document.body.classList.contains('theme-dark') ||\n",
" document.body.classList.contains('vscode-dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check theme attribute\n",
" var themeAttr = document.body.getAttribute('data-jp-theme-name');\n",
" if (themeAttr && themeAttr.includes('dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check computed background color\n",
" var notebookEl = document.querySelector('.jp-Notebook') || \n",
" document.querySelector('.notebook_app') ||\n",
" document.body;\n",
" if (notebookEl) {\n",
" var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n",
" var rgb = bgColor.match(/\\d+/g);\n",
" if (rgb && rgb.length >= 3) {\n",
" var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n",
" if (brightness < 128) {\n",
" isDark = true;\n",
" }\n",
" }\n",
" }\n",
"\n",
" // Store result\n",
" if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n",
" IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n",
" }\n",
" })();\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" if (typeof IPython !== 'undefined' && IPython.notebook) {\n",
" IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n",
" (document.body.classList.contains('theme-dark') || \n",
" document.body.classList.contains('jp-mod-dark') ||\n",
" (document.body.getAttribute('data-jp-theme-name') && \n",
" document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n",
" }\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1;36mStructure 🧩 \u001b[0m\u001b[32m'ferrite'\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"
},
{
"data": {
"application/javascript": [
"\n",
" (function() {\n",
" var isDark = false;\n",
"\n",
" // Check JupyterLab theme\n",
" if (document.body.classList.contains('jp-mod-dark') || \n",
" document.body.classList.contains('theme-dark') ||\n",
" document.body.classList.contains('vscode-dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check theme attribute\n",
" var themeAttr = document.body.getAttribute('data-jp-theme-name');\n",
" if (themeAttr && themeAttr.includes('dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check computed background color\n",
" var notebookEl = document.querySelector('.jp-Notebook') || \n",
" document.querySelector('.notebook_app') ||\n",
" document.body;\n",
" if (notebookEl) {\n",
" var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n",
" var rgb = bgColor.match(/\\d+/g);\n",
" if (rgb && rgb.length >= 3) {\n",
" var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n",
" if (brightness < 128) {\n",
" isDark = true;\n",
" }\n",
" }\n",
" }\n",
"\n",
" // Store result\n",
" if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n",
" IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n",
" }\n",
" })();\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" if (typeof IPython !== 'undefined' && IPython.notebook) {\n",
" IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n",
" (document.body.classList.contains('theme-dark') || \n",
" document.body.classList.contains('jp-mod-dark') ||\n",
" (document.body.getAttribute('data-jp-theme-name') && \n",
" document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n",
" }\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1;36mStructure 🧩 \u001b[0m\u001b[32m'austenite'\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='ferrite')\n",
"project.display.structure(struct_name='austenite')"
]
},
{
"cell_type": "markdown",
"id": "41",
"metadata": {},
"source": [
"### Display Pattern"
]
},
{
"cell_type": "code",
"execution_count": 27,
"id": "42",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:16:35.853939Z",
"iopub.status.busy": "2026-06-04T16:16:35.853768Z",
"iopub.status.idle": "2026-06-04T16:16:37.509258Z",
"shell.execute_reply": "2026-06-04T16:16:37.508462Z"
}
},
"outputs": [
{
"data": {
"application/javascript": [
"\n",
" (function() {\n",
" var isDark = false;\n",
"\n",
" // Check JupyterLab theme\n",
" if (document.body.classList.contains('jp-mod-dark') || \n",
" document.body.classList.contains('theme-dark') ||\n",
" document.body.classList.contains('vscode-dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check theme attribute\n",
" var themeAttr = document.body.getAttribute('data-jp-theme-name');\n",
" if (themeAttr && themeAttr.includes('dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check computed background color\n",
" var notebookEl = document.querySelector('.jp-Notebook') || \n",
" document.querySelector('.notebook_app') ||\n",
" document.body;\n",
" if (notebookEl) {\n",
" var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n",
" var rgb = bgColor.match(/\\d+/g);\n",
" if (rgb && rgb.length >= 3) {\n",
" var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n",
" if (brightness < 128) {\n",
" isDark = true;\n",
" }\n",
" }\n",
" }\n",
"\n",
" // Store result\n",
" if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n",
" IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n",
" }\n",
" })();\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" if (typeof IPython !== 'undefined' && IPython.notebook) {\n",
" IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n",
" (document.body.classList.contains('theme-dark') || \n",
" document.body.classList.contains('jp-mod-dark') ||\n",
" (document.body.getAttribute('data-jp-theme-name') && \n",
" document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n",
" }\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" (function() {\n",
" var isDark = false;\n",
"\n",
" // Check JupyterLab theme\n",
" if (document.body.classList.contains('jp-mod-dark') || \n",
" document.body.classList.contains('theme-dark') ||\n",
" document.body.classList.contains('vscode-dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check theme attribute\n",
" var themeAttr = document.body.getAttribute('data-jp-theme-name');\n",
" if (themeAttr && themeAttr.includes('dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check computed background color\n",
" var notebookEl = document.querySelector('.jp-Notebook') || \n",
" document.querySelector('.notebook_app') ||\n",
" document.body;\n",
" if (notebookEl) {\n",
" var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n",
" var rgb = bgColor.match(/\\d+/g);\n",
" if (rgb && rgb.length >= 3) {\n",
" var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n",
" if (brightness < 128) {\n",
" isDark = true;\n",
" }\n",
" }\n",
" }\n",
"\n",
" // Store result\n",
" if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n",
" IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n",
" }\n",
" })();\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" if (typeof IPython !== 'undefined' && IPython.notebook) {\n",
" IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n",
" (document.body.classList.contains('theme-dark') || \n",
" document.body.classList.contains('jp-mod-dark') ||\n",
" (document.body.getAttribute('data-jp-theme-name') && \n",
" document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n",
" }\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" (function() {\n",
" var isDark = false;\n",
"\n",
" // Check JupyterLab theme\n",
" if (document.body.classList.contains('jp-mod-dark') || \n",
" document.body.classList.contains('theme-dark') ||\n",
" document.body.classList.contains('vscode-dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check theme attribute\n",
" var themeAttr = document.body.getAttribute('data-jp-theme-name');\n",
" if (themeAttr && themeAttr.includes('dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check computed background color\n",
" var notebookEl = document.querySelector('.jp-Notebook') || \n",
" document.querySelector('.notebook_app') ||\n",
" document.body;\n",
" if (notebookEl) {\n",
" var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n",
" var rgb = bgColor.match(/\\d+/g);\n",
" if (rgb && rgb.length >= 3) {\n",
" var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n",
" if (brightness < 128) {\n",
" isDark = true;\n",
" }\n",
" }\n",
" }\n",
"\n",
" // Store result\n",
" if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n",
" IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n",
" }\n",
" })();\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" if (typeof IPython !== 'undefined' && IPython.notebook) {\n",
" IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n",
" (document.body.classList.contains('theme-dark') || \n",
" document.body.classList.contains('jp-mod-dark') ||\n",
" (document.body.getAttribute('data-jp-theme-name') && \n",
" document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n",
" }\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" (function() {\n",
" var isDark = false;\n",
"\n",
" // Check JupyterLab theme\n",
" if (document.body.classList.contains('jp-mod-dark') || \n",
" document.body.classList.contains('theme-dark') ||\n",
" document.body.classList.contains('vscode-dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check theme attribute\n",
" var themeAttr = document.body.getAttribute('data-jp-theme-name');\n",
" if (themeAttr && themeAttr.includes('dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check computed background color\n",
" var notebookEl = document.querySelector('.jp-Notebook') || \n",
" document.querySelector('.notebook_app') ||\n",
" document.body;\n",
" if (notebookEl) {\n",
" var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n",
" var rgb = bgColor.match(/\\d+/g);\n",
" if (rgb && rgb.length >= 3) {\n",
" var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n",
" if (brightness < 128) {\n",
" isDark = true;\n",
" }\n",
" }\n",
" }\n",
"\n",
" // Store result\n",
" if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n",
" IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n",
" }\n",
" })();\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" if (typeof IPython !== 'undefined' && IPython.notebook) {\n",
" IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n",
" (document.body.classList.contains('theme-dark') || \n",
" document.body.classList.contains('jp-mod-dark') ||\n",
" (document.body.getAttribute('data-jp-theme-name') && \n",
" document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n",
" }\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
""
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"project.display.pattern(expt_name='expt_s2')"
]
},
{
"cell_type": "code",
"execution_count": 28,
"id": "43",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:16:37.513399Z",
"iopub.status.busy": "2026-06-04T16:16:37.513228Z",
"iopub.status.idle": "2026-06-04T16:16:38.875249Z",
"shell.execute_reply": "2026-06-04T16:16:38.874606Z"
}
},
"outputs": [
{
"data": {
"application/javascript": [
"\n",
" (function() {\n",
" var isDark = false;\n",
"\n",
" // Check JupyterLab theme\n",
" if (document.body.classList.contains('jp-mod-dark') || \n",
" document.body.classList.contains('theme-dark') ||\n",
" document.body.classList.contains('vscode-dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check theme attribute\n",
" var themeAttr = document.body.getAttribute('data-jp-theme-name');\n",
" if (themeAttr && themeAttr.includes('dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check computed background color\n",
" var notebookEl = document.querySelector('.jp-Notebook') || \n",
" document.querySelector('.notebook_app') ||\n",
" document.body;\n",
" if (notebookEl) {\n",
" var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n",
" var rgb = bgColor.match(/\\d+/g);\n",
" if (rgb && rgb.length >= 3) {\n",
" var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n",
" if (brightness < 128) {\n",
" isDark = true;\n",
" }\n",
" }\n",
" }\n",
"\n",
" // Store result\n",
" if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n",
" IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n",
" }\n",
" })();\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" if (typeof IPython !== 'undefined' && IPython.notebook) {\n",
" IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n",
" (document.body.classList.contains('theme-dark') || \n",
" document.body.classList.contains('jp-mod-dark') ||\n",
" (document.body.getAttribute('data-jp-theme-name') && \n",
" document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n",
" }\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" (function() {\n",
" var isDark = false;\n",
"\n",
" // Check JupyterLab theme\n",
" if (document.body.classList.contains('jp-mod-dark') || \n",
" document.body.classList.contains('theme-dark') ||\n",
" document.body.classList.contains('vscode-dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check theme attribute\n",
" var themeAttr = document.body.getAttribute('data-jp-theme-name');\n",
" if (themeAttr && themeAttr.includes('dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check computed background color\n",
" var notebookEl = document.querySelector('.jp-Notebook') || \n",
" document.querySelector('.notebook_app') ||\n",
" document.body;\n",
" if (notebookEl) {\n",
" var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n",
" var rgb = bgColor.match(/\\d+/g);\n",
" if (rgb && rgb.length >= 3) {\n",
" var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n",
" if (brightness < 128) {\n",
" isDark = true;\n",
" }\n",
" }\n",
" }\n",
"\n",
" // Store result\n",
" if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n",
" IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n",
" }\n",
" })();\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" if (typeof IPython !== 'undefined' && IPython.notebook) {\n",
" IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n",
" (document.body.classList.contains('theme-dark') || \n",
" document.body.classList.contains('jp-mod-dark') ||\n",
" (document.body.getAttribute('data-jp-theme-name') && \n",
" document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n",
" }\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" (function() {\n",
" var isDark = false;\n",
"\n",
" // Check JupyterLab theme\n",
" if (document.body.classList.contains('jp-mod-dark') || \n",
" document.body.classList.contains('theme-dark') ||\n",
" document.body.classList.contains('vscode-dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check theme attribute\n",
" var themeAttr = document.body.getAttribute('data-jp-theme-name');\n",
" if (themeAttr && themeAttr.includes('dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check computed background color\n",
" var notebookEl = document.querySelector('.jp-Notebook') || \n",
" document.querySelector('.notebook_app') ||\n",
" document.body;\n",
" if (notebookEl) {\n",
" var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n",
" var rgb = bgColor.match(/\\d+/g);\n",
" if (rgb && rgb.length >= 3) {\n",
" var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n",
" if (brightness < 128) {\n",
" isDark = true;\n",
" }\n",
" }\n",
" }\n",
"\n",
" // Store result\n",
" if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n",
" IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n",
" }\n",
" })();\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" if (typeof IPython !== 'undefined' && IPython.notebook) {\n",
" IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n",
" (document.body.classList.contains('theme-dark') || \n",
" document.body.classList.contains('jp-mod-dark') ||\n",
" (document.body.getAttribute('data-jp-theme-name') && \n",
" document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n",
" }\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" (function() {\n",
" var isDark = false;\n",
"\n",
" // Check JupyterLab theme\n",
" if (document.body.classList.contains('jp-mod-dark') || \n",
" document.body.classList.contains('theme-dark') ||\n",
" document.body.classList.contains('vscode-dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check theme attribute\n",
" var themeAttr = document.body.getAttribute('data-jp-theme-name');\n",
" if (themeAttr && themeAttr.includes('dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check computed background color\n",
" var notebookEl = document.querySelector('.jp-Notebook') || \n",
" document.querySelector('.notebook_app') ||\n",
" document.body;\n",
" if (notebookEl) {\n",
" var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n",
" var rgb = bgColor.match(/\\d+/g);\n",
" if (rgb && rgb.length >= 3) {\n",
" var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n",
" if (brightness < 128) {\n",
" isDark = true;\n",
" }\n",
" }\n",
" }\n",
"\n",
" // Store result\n",
" if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n",
" IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n",
" }\n",
" })();\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" if (typeof IPython !== 'undefined' && IPython.notebook) {\n",
" IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n",
" (document.body.classList.contains('theme-dark') || \n",
" document.body.classList.contains('jp-mod-dark') ||\n",
" (document.body.getAttribute('data-jp-theme-name') && \n",
" document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n",
" }\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
""
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"project.display.pattern(expt_name='expt_n2')"
]
},
{
"cell_type": "markdown",
"id": "44",
"metadata": {},
"source": [
"## 🚀 Perform Analysis\n",
"\n",
"This section shows the analysis process, including how to set up\n",
"calculation and fitting engines.\n",
"\n",
"### Set Fit Mode"
]
},
{
"cell_type": "code",
"execution_count": 29,
"id": "45",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:16:38.879216Z",
"iopub.status.busy": "2026-06-04T16:16:38.879037Z",
"iopub.status.idle": "2026-06-04T16:16:38.885618Z",
"shell.execute_reply": "2026-06-04T16:16:38.885016Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1;36mFitting Mode types\u001b[0m\n"
]
},
{
"data": {
"text/html": [
" | | Type | Description |
|---|
| 1 | * | single | Fit one experiment at a time. |
|---|
| 2 | | joint | Fit several experiments together with shared parameters. |
|---|
| 3 | | sequential | Fit one experiment against a series of data files. |
|---|
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"project.analysis.fitting_mode.show_supported()"
]
},
{
"cell_type": "code",
"execution_count": 30,
"id": "46",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:16:38.887167Z",
"iopub.status.busy": "2026-06-04T16:16:38.886998Z",
"iopub.status.idle": "2026-06-04T16:16:38.891349Z",
"shell.execute_reply": "2026-06-04T16:16:38.890728Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1;36mFitting mode changed to\u001b[0m\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"joint\n"
]
}
],
"source": [
"project.analysis.fitting_mode.type = 'joint'"
]
},
{
"cell_type": "markdown",
"id": "47",
"metadata": {},
"source": [
"### Set Free Parameters"
]
},
{
"cell_type": "code",
"execution_count": 31,
"id": "48",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:16:38.892724Z",
"iopub.status.busy": "2026-06-04T16:16:38.892549Z",
"iopub.status.idle": "2026-06-04T16:16:38.942229Z",
"shell.execute_reply": "2026-06-04T16:16:38.941530Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1;36mFittable parameters for all structures \u001b[0m\u001b[1;36m(\u001b[0m\u001b[1;36m🧩 data blocks\u001b[0m\u001b[1;36m)\u001b[0m\n"
]
},
{
"data": {
"text/html": [
" | datablock | category | entry | parameter | value | uncertainty | units | free |
|---|
| 1 | ferrite | cell | | length_a | 2.88600 | | Å | False |
|---|
| 2 | ferrite | atom_site | Fe | occupancy | 1.00000 | | | False |
|---|
| 3 | ferrite | atom_site | Fe | adp_iso | 1.00000 | | Ų | False |
|---|
| 4 | austenite | cell | | length_a | 3.64680 | | Å | False |
|---|
| 5 | austenite | atom_site | Fe | occupancy | 1.00000 | | | False |
|---|
| 6 | austenite | atom_site | Fe | adp_iso | 1.00000 | | Ų | False |
|---|
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1;36mFittable parameters for all experiments \u001b[0m\u001b[1;36m(\u001b[0m\u001b[1;36m🔬 data blocks\u001b[0m\u001b[1;36m)\u001b[0m\n"
]
},
{
"data": {
"text/html": [
" | datablock | category | entry | parameter | value | uncertainty | units | free |
|---|
| 1 | expt_s2 | linked_phases | ferrite | scale | 10.00000 | | | False |
|---|
| 2 | expt_s2 | linked_phases | austenite | scale | 10.00000 | | | False |
|---|
| 3 | expt_s2 | peak | | lorentz_gamma_0 | 0.00000 | | μs | False |
|---|
| 4 | expt_s2 | peak | | lorentz_gamma_1 | 0.00000 | | μs/Å | False |
|---|
| 5 | expt_s2 | peak | | lorentz_gamma_2 | 0.00000 | | μs²/Ų | False |
|---|
| 6 | expt_s2 | peak | | gauss_sigma_0 | 300.00000 | | μs² | False |
|---|
| 7 | expt_s2 | peak | | gauss_sigma_1 | 1200.00000 | | μs/Å | False |
|---|
| 8 | expt_s2 | peak | | gauss_sigma_2 | 900.00000 | | μs²/Ų | False |
|---|
| 9 | expt_s2 | instrument | | twotheta_bank | 90.00000 | | deg | False |
|---|
| 10 | expt_s2 | instrument | | d_to_tof_offset | 0.00000 | | μs | False |
|---|
| 11 | expt_s2 | instrument | | d_to_tof_linear | 54902.18695 | | μs/Å | False |
|---|
| 12 | expt_s2 | instrument | | d_to_tof_quad | 0.00000 | | μs/Ų | False |
|---|
| 13 | expt_s2 | instrument | | d_to_tof_recip | 0.00000 | | μs·Å | False |
|---|
| 14 | expt_s2 | background | 1 | y | 0.01700 | | | False |
|---|
| 15 | expt_s2 | background | 2 | y | 0.14840 | | | False |
|---|
| 16 | expt_s2 | background | 3 | y | 0.18480 | | | False |
|---|
| 17 | expt_s2 | background | 4 | y | 0.19750 | | | False |
|---|
| 18 | expt_s2 | background | 5 | y | 0.18910 | | | False |
|---|
| 19 | expt_s2 | background | 6 | y | 0.21470 | | | False |
|---|
| 20 | expt_s2 | background | 7 | y | 0.18870 | | | False |
|---|
| 21 | expt_s2 | background | 8 | y | 0.21940 | | | False |
|---|
| 22 | expt_s2 | background | 9 | y | 0.19910 | | | False |
|---|
| 23 | expt_s2 | background | 10 | y | 0.19810 | | | False |
|---|
| 24 | expt_s2 | background | 11 | y | 0.22760 | | | False |
|---|
| 25 | expt_s2 | background | 12 | y | 0.24390 | | | False |
|---|
| 26 | expt_s2 | background | 13 | y | 0.29070 | | | False |
|---|
| 27 | expt_s2 | background | 14 | y | 0.30670 | | | False |
|---|
| 28 | expt_s2 | background | 15 | y | 0.32420 | | | False |
|---|
| 29 | expt_s2 | background | 16 | y | 0.29730 | | | False |
|---|
| 30 | expt_s2 | background | 17 | y | 0.25750 | | | False |
|---|
| 31 | expt_s2 | background | 18 | y | 0.23210 | | | False |
|---|
| 32 | expt_s2 | background | 19 | y | 0.21580 | | | False |
|---|
| 33 | expt_s2 | background | 20 | y | 0.16940 | | | False |
|---|
| 34 | expt_s2 | background | 21 | y | 0.24000 | | | False |
|---|
| 35 | expt_s2 | background | 22 | y | 0.43350 | | | False |
|---|
| 36 | expt_s2 | background | 23 | y | 0.43750 | | | False |
|---|
| 37 | expt_s2 | background | 24 | y | 0.34270 | | | False |
|---|
| 38 | expt_s2 | background | 25 | y | 0.53390 | | | False |
|---|
| 39 | expt_s2 | background | 26 | y | 0.95370 | | | False |
|---|
| 40 | expt_s2 | background | 27 | y | 1.16680 | | | False |
|---|
| 41 | expt_s2 | background | 28 | y | 1.11640 | | | False |
|---|
| 42 | expt_s2 | background | 29 | y | 0.91610 | | | False |
|---|
| 43 | expt_s2 | background | 30 | y | 0.68850 | | | False |
|---|
| 44 | expt_s2 | background | 31 | y | 0.06920 | | | False |
|---|
| 45 | expt_n2 | linked_phases | ferrite | scale | 10.00000 | | | False |
|---|
| 46 | expt_n2 | linked_phases | austenite | scale | 10.00000 | | | False |
|---|
| 47 | expt_n2 | peak | | lorentz_gamma_0 | 0.00000 | | μs | False |
|---|
| 48 | expt_n2 | peak | | lorentz_gamma_1 | 0.00000 | | μs/Å | False |
|---|
| 49 | expt_n2 | peak | | lorentz_gamma_2 | 0.00000 | | μs²/Ų | False |
|---|
| 50 | expt_n2 | peak | | gauss_sigma_0 | 300.00000 | | μs² | False |
|---|
| 51 | expt_n2 | peak | | gauss_sigma_1 | 1200.00000 | | μs/Å | False |
|---|
| 52 | expt_n2 | peak | | gauss_sigma_2 | 900.00000 | | μs²/Ų | False |
|---|
| 53 | expt_n2 | instrument | | twotheta_bank | 90.00000 | | deg | False |
|---|
| 54 | expt_n2 | instrument | | d_to_tof_offset | 0.00000 | | μs | False |
|---|
| 55 | expt_n2 | instrument | | d_to_tof_linear | 54902.18695 | | μs/Å | False |
|---|
| 56 | expt_n2 | instrument | | d_to_tof_quad | 0.00000 | | μs/Ų | False |
|---|
| 57 | expt_n2 | instrument | | d_to_tof_recip | 0.00000 | | μs·Å | False |
|---|
| 58 | expt_n2 | background | 1 | y | 0.01700 | | | False |
|---|
| 59 | expt_n2 | background | 2 | y | 0.14840 | | | False |
|---|
| 60 | expt_n2 | background | 3 | y | 0.18480 | | | False |
|---|
| 61 | expt_n2 | background | 4 | y | 0.19750 | | | False |
|---|
| 62 | expt_n2 | background | 5 | y | 0.18910 | | | False |
|---|
| 63 | expt_n2 | background | 6 | y | 0.21470 | | | False |
|---|
| 64 | expt_n2 | background | 7 | y | 0.18870 | | | False |
|---|
| 65 | expt_n2 | background | 8 | y | 0.21940 | | | False |
|---|
| 66 | expt_n2 | background | 9 | y | 0.19910 | | | False |
|---|
| 67 | expt_n2 | background | 10 | y | 0.19810 | | | False |
|---|
| 68 | expt_n2 | background | 11 | y | 0.22760 | | | False |
|---|
| 69 | expt_n2 | background | 12 | y | 0.24390 | | | False |
|---|
| 70 | expt_n2 | background | 13 | y | 0.29070 | | | False |
|---|
| 71 | expt_n2 | background | 14 | y | 0.30670 | | | False |
|---|
| 72 | expt_n2 | background | 15 | y | 0.32420 | | | False |
|---|
| 73 | expt_n2 | background | 16 | y | 0.29730 | | | False |
|---|
| 74 | expt_n2 | background | 17 | y | 0.25750 | | | False |
|---|
| 75 | expt_n2 | background | 18 | y | 0.23210 | | | False |
|---|
| 76 | expt_n2 | background | 19 | y | 0.21580 | | | False |
|---|
| 77 | expt_n2 | background | 20 | y | 0.16940 | | | False |
|---|
| 78 | expt_n2 | background | 21 | y | 0.24000 | | | False |
|---|
| 79 | expt_n2 | background | 22 | y | 0.43350 | | | False |
|---|
| 80 | expt_n2 | background | 23 | y | 0.43750 | | | False |
|---|
| 81 | expt_n2 | background | 24 | y | 0.34270 | | | False |
|---|
| 82 | expt_n2 | background | 25 | y | 0.53390 | | | False |
|---|
| 83 | expt_n2 | background | 26 | y | 0.95370 | | | False |
|---|
| 84 | expt_n2 | background | 27 | y | 1.16680 | | | False |
|---|
| 85 | expt_n2 | background | 28 | y | 1.11640 | | | False |
|---|
| 86 | expt_n2 | background | 29 | y | 0.91610 | | | False |
|---|
| 87 | expt_n2 | background | 30 | y | 0.68850 | | | False |
|---|
| 88 | expt_n2 | background | 31 | y | 0.06920 | | | False |
|---|
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"project.display.parameters.fittable()"
]
},
{
"cell_type": "code",
"execution_count": 32,
"id": "49",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:16:38.943916Z",
"iopub.status.busy": "2026-06-04T16:16:38.943758Z",
"iopub.status.idle": "2026-06-04T16:16:38.946536Z",
"shell.execute_reply": "2026-06-04T16:16:38.945805Z"
}
},
"outputs": [],
"source": [
"ferrite.atom_sites['Fe'].adp_iso.free = True\n",
"austenite.atom_sites['Fe'].adp_iso.free = True"
]
},
{
"cell_type": "code",
"execution_count": 33,
"id": "50",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:16:38.947876Z",
"iopub.status.busy": "2026-06-04T16:16:38.947714Z",
"iopub.status.idle": "2026-06-04T16:16:38.952115Z",
"shell.execute_reply": "2026-06-04T16:16:38.951433Z"
}
},
"outputs": [],
"source": [
"expt_s2.linked_phases['ferrite'].scale.free = True\n",
"expt_s2.linked_phases['austenite'].scale.free = True\n",
"\n",
"expt_s2.peak.broad_gauss_sigma_0.free = True\n",
"expt_s2.peak.broad_gauss_sigma_1.free = True\n",
"expt_s2.peak.broad_gauss_sigma_2.free = True\n",
"expt_s2.peak.broad_lorentz_gamma_0.free = True\n",
"\n",
"expt_s2.instrument.calib_d_to_tof_offset.free = True\n",
"\n",
"for segment in expt_s2.background:\n",
" segment.y.free = True"
]
},
{
"cell_type": "code",
"execution_count": 34,
"id": "51",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:16:38.953437Z",
"iopub.status.busy": "2026-06-04T16:16:38.953293Z",
"iopub.status.idle": "2026-06-04T16:16:38.957646Z",
"shell.execute_reply": "2026-06-04T16:16:38.956914Z"
}
},
"outputs": [],
"source": [
"expt_n2.linked_phases['ferrite'].scale.free = True\n",
"expt_n2.linked_phases['austenite'].scale.free = True\n",
"\n",
"expt_n2.peak.broad_gauss_sigma_0.free = True\n",
"expt_n2.peak.broad_gauss_sigma_1.free = True\n",
"expt_n2.peak.broad_gauss_sigma_2.free = True\n",
"expt_n2.peak.broad_lorentz_gamma_0.free = True\n",
"\n",
"expt_n2.instrument.calib_d_to_tof_offset.free = True\n",
"\n",
"for segment in expt_n2.background:\n",
" segment.y.free = True"
]
},
{
"cell_type": "markdown",
"id": "52",
"metadata": {},
"source": [
"### Add Constraints"
]
},
{
"cell_type": "code",
"execution_count": 35,
"id": "53",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:16:38.959035Z",
"iopub.status.busy": "2026-06-04T16:16:38.958891Z",
"iopub.status.idle": "2026-06-04T16:16:38.963317Z",
"shell.execute_reply": "2026-06-04T16:16:38.962589Z"
}
},
"outputs": [],
"source": [
"project.analysis.aliases.create(\n",
" label='s2_ferrite_scale', param=expt_s2.linked_phases['ferrite'].scale\n",
")\n",
"project.analysis.aliases.create(\n",
" label='s2_austenite_scale', param=expt_s2.linked_phases['austenite'].scale\n",
")\n",
"\n",
"project.analysis.aliases.create(\n",
" label='n2_ferrite_scale', param=expt_n2.linked_phases['ferrite'].scale\n",
")\n",
"project.analysis.aliases.create(\n",
" label='n2_austenite_scale', param=expt_n2.linked_phases['austenite'].scale\n",
")\n",
"\n",
"project.analysis.constraints.create(expression='n2_ferrite_scale = s2_ferrite_scale')\n",
"project.analysis.constraints.create(expression='n2_austenite_scale = s2_austenite_scale')"
]
},
{
"cell_type": "markdown",
"id": "54",
"metadata": {},
"source": [
"### Run Fitting\n",
"\n",
"Run full fitting with all free parameters."
]
},
{
"cell_type": "code",
"execution_count": 36,
"id": "55",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:16:38.964613Z",
"iopub.status.busy": "2026-06-04T16:16:38.964444Z",
"iopub.status.idle": "2026-06-04T16:17:33.063192Z",
"shell.execute_reply": "2026-06-04T16:17:33.062202Z"
}
},
"outputs": [
{
"data": {
"text/html": [],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
"(function() {\n",
" const button = document.getElementById('ed-fit-stop-2fc78f36a6a845a5baa1bae81d371a98-button');\n",
" const status = document.getElementById('ed-fit-stop-2fc78f36a6a845a5baa1bae81d371a98-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;36mUsing all experiments 🔬 \u001b[0m\u001b[1;36m[\u001b[0m\u001b[32m'expt_s2'\u001b[0m\u001b[1;36m, \u001b[0m\u001b[32m'expt_n2'\u001b[0m\u001b[1;36m]\u001b[0m\u001b[1;36m for \u001b[0m\u001b[32m'joint'\u001b[0m\u001b[1;36m fitting\u001b[0m\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"🚀 Starting fit process with \u001b[32m'lmfit \u001b[0m\u001b[32m(\u001b[0m\u001b[32mleastsq\u001b[0m\u001b[32m)\u001b[0m\u001b[32m'\u001b[0m\u001b[33m...\u001b[0m\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"📈 Goodness-of-fit progress:\n"
]
},
{
"data": {
"text/html": [
" | iteration | time (s) | χ² | change / status |
|---|
| 1 | 1 | 0.08 | 843.64 | |
|---|
| 2 | 71 | 5.09 | 843.64 | |
|---|
| 3 | 80 | 5.79 | 89.69 | 89.4% ↓ |
|---|
| 4 | 147 | 10.86 | 89.69 | |
|---|
| 5 | 157 | 11.68 | 15.07 | 83.2% ↓ |
|---|
| 6 | 220 | 16.76 | 15.07 | |
|---|
| 7 | 234 | 17.85 | 13.82 | 8.3% ↓ |
|---|
| 8 | 302 | 22.93 | 13.82 | |
|---|
| 9 | 369 | 27.93 | 13.81 | |
|---|
| 10 | 432 | 32.98 | 13.81 | |
|---|
| 11 | 499 | 38.00 | 13.81 | |
|---|
| 12 | 543 | 52.20 | 13.81 | |
|---|
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"🏆 Best goodness-of-fit \u001b[1m(\u001b[0mreduced χ²\u001b[1m)\u001b[0m is \u001b[1;36m13.81\u001b[0m at iteration \u001b[1;36m542\u001b[0m\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"✅ Fitting complete.\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1;36mSaving project 📦 \u001b[0m\u001b[32m'beer_mcstas'\u001b[0m\u001b[1;36m to \u001b[0m\u001b[32m'../../../projects/ed_20_beer_mcstas'\u001b[0m\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"├── 📄 project.cif\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"├── 📁 structures/\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"│ └── 📄 ferrite.cif\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"│ └── 📄 austenite.cif\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"├── 📁 experiments/\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"│ └── 📄 expt_s2.cif\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"│ └── 📄 expt_n2.cif\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"├── 📁 analysis/\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"│ └── 📄 analysis.cif\n"
]
},
{
"data": {
"application/javascript": [
"\n",
" (function() {\n",
" var isDark = false;\n",
"\n",
" // Check JupyterLab theme\n",
" if (document.body.classList.contains('jp-mod-dark') || \n",
" document.body.classList.contains('theme-dark') ||\n",
" document.body.classList.contains('vscode-dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check theme attribute\n",
" var themeAttr = document.body.getAttribute('data-jp-theme-name');\n",
" if (themeAttr && themeAttr.includes('dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check computed background color\n",
" var notebookEl = document.querySelector('.jp-Notebook') || \n",
" document.querySelector('.notebook_app') ||\n",
" document.body;\n",
" if (notebookEl) {\n",
" var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n",
" var rgb = bgColor.match(/\\d+/g);\n",
" if (rgb && rgb.length >= 3) {\n",
" var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n",
" if (brightness < 128) {\n",
" isDark = true;\n",
" }\n",
" }\n",
" }\n",
"\n",
" // Store result\n",
" if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n",
" IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n",
" }\n",
" })();\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" if (typeof IPython !== 'undefined' && IPython.notebook) {\n",
" IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n",
" (document.body.classList.contains('theme-dark') || \n",
" document.body.classList.contains('jp-mod-dark') ||\n",
" (document.body.getAttribute('data-jp-theme-name') && \n",
" document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n",
" }\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" (function() {\n",
" var isDark = false;\n",
"\n",
" // Check JupyterLab theme\n",
" if (document.body.classList.contains('jp-mod-dark') || \n",
" document.body.classList.contains('theme-dark') ||\n",
" document.body.classList.contains('vscode-dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check theme attribute\n",
" var themeAttr = document.body.getAttribute('data-jp-theme-name');\n",
" if (themeAttr && themeAttr.includes('dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check computed background color\n",
" var notebookEl = document.querySelector('.jp-Notebook') || \n",
" document.querySelector('.notebook_app') ||\n",
" document.body;\n",
" if (notebookEl) {\n",
" var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n",
" var rgb = bgColor.match(/\\d+/g);\n",
" if (rgb && rgb.length >= 3) {\n",
" var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n",
" if (brightness < 128) {\n",
" isDark = true;\n",
" }\n",
" }\n",
" }\n",
"\n",
" // Store result\n",
" if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n",
" IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n",
" }\n",
" })();\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" if (typeof IPython !== 'undefined' && IPython.notebook) {\n",
" IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n",
" (document.body.classList.contains('theme-dark') || \n",
" document.body.classList.contains('jp-mod-dark') ||\n",
" (document.body.getAttribute('data-jp-theme-name') && \n",
" document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n",
" }\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" (function() {\n",
" var isDark = false;\n",
"\n",
" // Check JupyterLab theme\n",
" if (document.body.classList.contains('jp-mod-dark') || \n",
" document.body.classList.contains('theme-dark') ||\n",
" document.body.classList.contains('vscode-dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check theme attribute\n",
" var themeAttr = document.body.getAttribute('data-jp-theme-name');\n",
" if (themeAttr && themeAttr.includes('dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check computed background color\n",
" var notebookEl = document.querySelector('.jp-Notebook') || \n",
" document.querySelector('.notebook_app') ||\n",
" document.body;\n",
" if (notebookEl) {\n",
" var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n",
" var rgb = bgColor.match(/\\d+/g);\n",
" if (rgb && rgb.length >= 3) {\n",
" var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n",
" if (brightness < 128) {\n",
" isDark = true;\n",
" }\n",
" }\n",
" }\n",
"\n",
" // Store result\n",
" if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n",
" IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n",
" }\n",
" })();\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" if (typeof IPython !== 'undefined' && IPython.notebook) {\n",
" IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n",
" (document.body.classList.contains('theme-dark') || \n",
" document.body.classList.contains('jp-mod-dark') ||\n",
" (document.body.getAttribute('data-jp-theme-name') && \n",
" document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n",
" }\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" (function() {\n",
" var isDark = false;\n",
"\n",
" // Check JupyterLab theme\n",
" if (document.body.classList.contains('jp-mod-dark') || \n",
" document.body.classList.contains('theme-dark') ||\n",
" document.body.classList.contains('vscode-dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check theme attribute\n",
" var themeAttr = document.body.getAttribute('data-jp-theme-name');\n",
" if (themeAttr && themeAttr.includes('dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check computed background color\n",
" var notebookEl = document.querySelector('.jp-Notebook') || \n",
" document.querySelector('.notebook_app') ||\n",
" document.body;\n",
" if (notebookEl) {\n",
" var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n",
" var rgb = bgColor.match(/\\d+/g);\n",
" if (rgb && rgb.length >= 3) {\n",
" var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n",
" if (brightness < 128) {\n",
" isDark = true;\n",
" }\n",
" }\n",
" }\n",
"\n",
" // Store result\n",
" if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n",
" IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n",
" }\n",
" })();\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" if (typeof IPython !== 'undefined' && IPython.notebook) {\n",
" IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n",
" (document.body.classList.contains('theme-dark') || \n",
" document.body.classList.contains('jp-mod-dark') ||\n",
" (document.body.getAttribute('data-jp-theme-name') && \n",
" document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n",
" }\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" (function() {\n",
" var isDark = false;\n",
"\n",
" // Check JupyterLab theme\n",
" if (document.body.classList.contains('jp-mod-dark') || \n",
" document.body.classList.contains('theme-dark') ||\n",
" document.body.classList.contains('vscode-dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check theme attribute\n",
" var themeAttr = document.body.getAttribute('data-jp-theme-name');\n",
" if (themeAttr && themeAttr.includes('dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check computed background color\n",
" var notebookEl = document.querySelector('.jp-Notebook') || \n",
" document.querySelector('.notebook_app') ||\n",
" document.body;\n",
" if (notebookEl) {\n",
" var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n",
" var rgb = bgColor.match(/\\d+/g);\n",
" if (rgb && rgb.length >= 3) {\n",
" var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n",
" if (brightness < 128) {\n",
" isDark = true;\n",
" }\n",
" }\n",
" }\n",
"\n",
" // Store result\n",
" if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n",
" IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n",
" }\n",
" })();\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" if (typeof IPython !== 'undefined' && IPython.notebook) {\n",
" IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n",
" (document.body.classList.contains('theme-dark') || \n",
" document.body.classList.contains('jp-mod-dark') ||\n",
" (document.body.getAttribute('data-jp-theme-name') && \n",
" document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n",
" }\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" (function() {\n",
" var isDark = false;\n",
"\n",
" // Check JupyterLab theme\n",
" if (document.body.classList.contains('jp-mod-dark') || \n",
" document.body.classList.contains('theme-dark') ||\n",
" document.body.classList.contains('vscode-dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check theme attribute\n",
" var themeAttr = document.body.getAttribute('data-jp-theme-name');\n",
" if (themeAttr && themeAttr.includes('dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check computed background color\n",
" var notebookEl = document.querySelector('.jp-Notebook') || \n",
" document.querySelector('.notebook_app') ||\n",
" document.body;\n",
" if (notebookEl) {\n",
" var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n",
" var rgb = bgColor.match(/\\d+/g);\n",
" if (rgb && rgb.length >= 3) {\n",
" var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n",
" if (brightness < 128) {\n",
" isDark = true;\n",
" }\n",
" }\n",
" }\n",
"\n",
" // Store result\n",
" if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n",
" IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n",
" }\n",
" })();\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" if (typeof IPython !== 'undefined' && IPython.notebook) {\n",
" IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n",
" (document.body.classList.contains('theme-dark') || \n",
" document.body.classList.contains('jp-mod-dark') ||\n",
" (document.body.getAttribute('data-jp-theme-name') && \n",
" document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n",
" }\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"└── 📁 reports/\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
" └── 📄 beer_mcstas.html\n"
]
}
],
"source": [
"project.analysis.fit()"
]
},
{
"cell_type": "markdown",
"id": "56",
"metadata": {},
"source": [
"Fix background and run fitting again."
]
},
{
"cell_type": "code",
"execution_count": 37,
"id": "57",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:17:33.064793Z",
"iopub.status.busy": "2026-06-04T16:17:33.064633Z",
"iopub.status.idle": "2026-06-04T16:17:33.069419Z",
"shell.execute_reply": "2026-06-04T16:17:33.068704Z"
}
},
"outputs": [],
"source": [
"for segment in expt_s2.background:\n",
" segment.y.free = False\n",
"for segment in expt_n2.background:\n",
" segment.y.free = False"
]
},
{
"cell_type": "code",
"execution_count": 38,
"id": "58",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:17:33.070838Z",
"iopub.status.busy": "2026-06-04T16:17:33.070676Z",
"iopub.status.idle": "2026-06-04T16:17:36.343602Z",
"shell.execute_reply": "2026-06-04T16:17:36.342789Z"
}
},
"outputs": [
{
"data": {
"text/html": [],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
"(function() {\n",
" const button = document.getElementById('ed-fit-stop-c61775941b53425ba471f28b8ffbe9ec-button');\n",
" const status = document.getElementById('ed-fit-stop-c61775941b53425ba471f28b8ffbe9ec-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;36mUsing all experiments 🔬 \u001b[0m\u001b[1;36m[\u001b[0m\u001b[32m'expt_s2'\u001b[0m\u001b[1;36m, \u001b[0m\u001b[32m'expt_n2'\u001b[0m\u001b[1;36m]\u001b[0m\u001b[1;36m for \u001b[0m\u001b[32m'joint'\u001b[0m\u001b[1;36m fitting\u001b[0m\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"🚀 Starting fit process with \u001b[32m'lmfit \u001b[0m\u001b[32m(\u001b[0m\u001b[32mleastsq\u001b[0m\u001b[32m)\u001b[0m\u001b[32m'\u001b[0m\u001b[33m...\u001b[0m\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"📈 Goodness-of-fit progress:\n"
]
},
{
"data": {
"text/html": [
" | iteration | time (s) | χ² | change / status |
|---|
| 1 | 1 | 0.08 | 13.66 | |
|---|
| 2 | 19 | 1.46 | 13.66 | |
|---|
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"🏆 Best goodness-of-fit \u001b[1m(\u001b[0mreduced χ²\u001b[1m)\u001b[0m is \u001b[1;36m13.66\u001b[0m at iteration \u001b[1;36m18\u001b[0m\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"✅ Fitting complete.\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1;36mSaving project 📦 \u001b[0m\u001b[32m'beer_mcstas'\u001b[0m\u001b[1;36m to \u001b[0m\u001b[32m'../../../projects/ed_20_beer_mcstas'\u001b[0m\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"├── 📄 project.cif\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"├── 📁 structures/\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"│ └── 📄 ferrite.cif\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"│ └── 📄 austenite.cif\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"├── 📁 experiments/\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"│ └── 📄 expt_s2.cif\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"│ └── 📄 expt_n2.cif\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"├── 📁 analysis/\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"│ └── 📄 analysis.cif\n"
]
},
{
"data": {
"application/javascript": [
"\n",
" (function() {\n",
" var isDark = false;\n",
"\n",
" // Check JupyterLab theme\n",
" if (document.body.classList.contains('jp-mod-dark') || \n",
" document.body.classList.contains('theme-dark') ||\n",
" document.body.classList.contains('vscode-dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check theme attribute\n",
" var themeAttr = document.body.getAttribute('data-jp-theme-name');\n",
" if (themeAttr && themeAttr.includes('dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check computed background color\n",
" var notebookEl = document.querySelector('.jp-Notebook') || \n",
" document.querySelector('.notebook_app') ||\n",
" document.body;\n",
" if (notebookEl) {\n",
" var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n",
" var rgb = bgColor.match(/\\d+/g);\n",
" if (rgb && rgb.length >= 3) {\n",
" var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n",
" if (brightness < 128) {\n",
" isDark = true;\n",
" }\n",
" }\n",
" }\n",
"\n",
" // Store result\n",
" if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n",
" IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n",
" }\n",
" })();\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" if (typeof IPython !== 'undefined' && IPython.notebook) {\n",
" IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n",
" (document.body.classList.contains('theme-dark') || \n",
" document.body.classList.contains('jp-mod-dark') ||\n",
" (document.body.getAttribute('data-jp-theme-name') && \n",
" document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n",
" }\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" (function() {\n",
" var isDark = false;\n",
"\n",
" // Check JupyterLab theme\n",
" if (document.body.classList.contains('jp-mod-dark') || \n",
" document.body.classList.contains('theme-dark') ||\n",
" document.body.classList.contains('vscode-dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check theme attribute\n",
" var themeAttr = document.body.getAttribute('data-jp-theme-name');\n",
" if (themeAttr && themeAttr.includes('dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check computed background color\n",
" var notebookEl = document.querySelector('.jp-Notebook') || \n",
" document.querySelector('.notebook_app') ||\n",
" document.body;\n",
" if (notebookEl) {\n",
" var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n",
" var rgb = bgColor.match(/\\d+/g);\n",
" if (rgb && rgb.length >= 3) {\n",
" var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n",
" if (brightness < 128) {\n",
" isDark = true;\n",
" }\n",
" }\n",
" }\n",
"\n",
" // Store result\n",
" if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n",
" IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n",
" }\n",
" })();\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" if (typeof IPython !== 'undefined' && IPython.notebook) {\n",
" IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n",
" (document.body.classList.contains('theme-dark') || \n",
" document.body.classList.contains('jp-mod-dark') ||\n",
" (document.body.getAttribute('data-jp-theme-name') && \n",
" document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n",
" }\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" (function() {\n",
" var isDark = false;\n",
"\n",
" // Check JupyterLab theme\n",
" if (document.body.classList.contains('jp-mod-dark') || \n",
" document.body.classList.contains('theme-dark') ||\n",
" document.body.classList.contains('vscode-dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check theme attribute\n",
" var themeAttr = document.body.getAttribute('data-jp-theme-name');\n",
" if (themeAttr && themeAttr.includes('dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check computed background color\n",
" var notebookEl = document.querySelector('.jp-Notebook') || \n",
" document.querySelector('.notebook_app') ||\n",
" document.body;\n",
" if (notebookEl) {\n",
" var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n",
" var rgb = bgColor.match(/\\d+/g);\n",
" if (rgb && rgb.length >= 3) {\n",
" var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n",
" if (brightness < 128) {\n",
" isDark = true;\n",
" }\n",
" }\n",
" }\n",
"\n",
" // Store result\n",
" if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n",
" IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n",
" }\n",
" })();\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" if (typeof IPython !== 'undefined' && IPython.notebook) {\n",
" IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n",
" (document.body.classList.contains('theme-dark') || \n",
" document.body.classList.contains('jp-mod-dark') ||\n",
" (document.body.getAttribute('data-jp-theme-name') && \n",
" document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n",
" }\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" (function() {\n",
" var isDark = false;\n",
"\n",
" // Check JupyterLab theme\n",
" if (document.body.classList.contains('jp-mod-dark') || \n",
" document.body.classList.contains('theme-dark') ||\n",
" document.body.classList.contains('vscode-dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check theme attribute\n",
" var themeAttr = document.body.getAttribute('data-jp-theme-name');\n",
" if (themeAttr && themeAttr.includes('dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check computed background color\n",
" var notebookEl = document.querySelector('.jp-Notebook') || \n",
" document.querySelector('.notebook_app') ||\n",
" document.body;\n",
" if (notebookEl) {\n",
" var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n",
" var rgb = bgColor.match(/\\d+/g);\n",
" if (rgb && rgb.length >= 3) {\n",
" var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n",
" if (brightness < 128) {\n",
" isDark = true;\n",
" }\n",
" }\n",
" }\n",
"\n",
" // Store result\n",
" if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n",
" IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n",
" }\n",
" })();\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" if (typeof IPython !== 'undefined' && IPython.notebook) {\n",
" IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n",
" (document.body.classList.contains('theme-dark') || \n",
" document.body.classList.contains('jp-mod-dark') ||\n",
" (document.body.getAttribute('data-jp-theme-name') && \n",
" document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n",
" }\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" (function() {\n",
" var isDark = false;\n",
"\n",
" // Check JupyterLab theme\n",
" if (document.body.classList.contains('jp-mod-dark') || \n",
" document.body.classList.contains('theme-dark') ||\n",
" document.body.classList.contains('vscode-dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check theme attribute\n",
" var themeAttr = document.body.getAttribute('data-jp-theme-name');\n",
" if (themeAttr && themeAttr.includes('dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check computed background color\n",
" var notebookEl = document.querySelector('.jp-Notebook') || \n",
" document.querySelector('.notebook_app') ||\n",
" document.body;\n",
" if (notebookEl) {\n",
" var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n",
" var rgb = bgColor.match(/\\d+/g);\n",
" if (rgb && rgb.length >= 3) {\n",
" var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n",
" if (brightness < 128) {\n",
" isDark = true;\n",
" }\n",
" }\n",
" }\n",
"\n",
" // Store result\n",
" if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n",
" IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n",
" }\n",
" })();\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" if (typeof IPython !== 'undefined' && IPython.notebook) {\n",
" IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n",
" (document.body.classList.contains('theme-dark') || \n",
" document.body.classList.contains('jp-mod-dark') ||\n",
" (document.body.getAttribute('data-jp-theme-name') && \n",
" document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n",
" }\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" (function() {\n",
" var isDark = false;\n",
"\n",
" // Check JupyterLab theme\n",
" if (document.body.classList.contains('jp-mod-dark') || \n",
" document.body.classList.contains('theme-dark') ||\n",
" document.body.classList.contains('vscode-dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check theme attribute\n",
" var themeAttr = document.body.getAttribute('data-jp-theme-name');\n",
" if (themeAttr && themeAttr.includes('dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check computed background color\n",
" var notebookEl = document.querySelector('.jp-Notebook') || \n",
" document.querySelector('.notebook_app') ||\n",
" document.body;\n",
" if (notebookEl) {\n",
" var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n",
" var rgb = bgColor.match(/\\d+/g);\n",
" if (rgb && rgb.length >= 3) {\n",
" var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n",
" if (brightness < 128) {\n",
" isDark = true;\n",
" }\n",
" }\n",
" }\n",
"\n",
" // Store result\n",
" if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n",
" IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n",
" }\n",
" })();\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" if (typeof IPython !== 'undefined' && IPython.notebook) {\n",
" IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n",
" (document.body.classList.contains('theme-dark') || \n",
" document.body.classList.contains('jp-mod-dark') ||\n",
" (document.body.getAttribute('data-jp-theme-name') && \n",
" document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n",
" }\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"└── 📁 reports/\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
" └── 📄 beer_mcstas.html\n"
]
}
],
"source": [
"project.analysis.fit()"
]
},
{
"cell_type": "markdown",
"id": "59",
"metadata": {},
"source": [
"Show fit results and parameter correlations."
]
},
{
"cell_type": "code",
"execution_count": 39,
"id": "60",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:17:36.345099Z",
"iopub.status.busy": "2026-06-04T16:17:36.344934Z",
"iopub.status.idle": "2026-06-04T16:17:38.681016Z",
"shell.execute_reply": "2026-06-04T16:17:38.680288Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"⚙️ Settings used:\n"
]
},
{
"data": {
"text/html": [
" | Name | Value | Description |
|---|
| 1 | max_iterations | 1000 | Maximum solver iterations. |
|---|
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"📋 Least-squares fit results:\n"
]
},
{
"data": {
"text/html": [
" | Metric | Value |
|---|
| 1 | 🧪 Minimizer | lmfit (leastsq) |
|---|
| 2 | ✅ Overall status | success |
|---|
| 3 | ⏱️ Fitting time (seconds) | 1.46 |
|---|
| 4 | 🔁 Iterations | 16 |
|---|
| 5 | 📏 Goodness-of-fit (reduced χ²) | 13.66 |
|---|
| 6 | 📏 R-factor (Rf, %) | 4.96 |
|---|
| 7 | 📏 R-factor squared (Rf², %) | 3.86 |
|---|
| 8 | 📏 Weighted R-factor (wR, %) | 3.36 |
|---|
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"📈 Refined parameters:\n"
]
},
{
"data": {
"text/html": [
" | datablock | category | entry | parameter | units | start | value | s.u. | change |
|---|
| 1 | ferrite | atom_site | Fe | adp_iso | Ų | 1.7213 | 1.7213 | 0.0131 | 0.00 % ↑ |
|---|
| 2 | austenite | atom_site | Fe | adp_iso | Ų | 1.7092 | 1.7092 | 0.0122 | 0.00 % ↑ |
|---|
| 3 | expt_s2 | linked_phases | ferrite | scale | | 50.3587 | 50.3587 | 0.1529 | 0.00 % ↑ |
|---|
| 4 | expt_s2 | linked_phases | austenite | scale | | 11.9852 | 11.9852 | 0.0308 | 0.00 % ↑ |
|---|
| 5 | expt_s2 | peak | | lorentz_gamma_0 | μs | 5.0196 | 5.0196 | 0.1521 | 0.00 % ↑ |
|---|
| 6 | expt_s2 | peak | | gauss_sigma_0 | μs² | 881.0993 | 881.1030 | 58.2232 | 0.00 % ↑ |
|---|
| 7 | expt_s2 | peak | | gauss_sigma_1 | μs/Å | 1298.8025 | 1298.7991 | 58.1755 | 0.00 % ↓ |
|---|
| 8 | expt_s2 | peak | | gauss_sigma_2 | μs²/Ų | 308.1175 | 308.1181 | 11.5800 | 0.00 % ↑ |
|---|
| 9 | expt_s2 | instrument | | d_to_tof_offset | μs | -10.4444 | -10.4444 | 0.1217 | 0.00 % ↑ |
|---|
| 10 | expt_n2 | peak | | lorentz_gamma_0 | μs | 5.0134 | 5.0134 | 0.1527 | 0.00 % ↑ |
|---|
| 11 | expt_n2 | peak | | gauss_sigma_0 | μs² | 915.4872 | 915.4909 | 58.7904 | 0.00 % ↑ |
|---|
| 12 | expt_n2 | peak | | gauss_sigma_1 | μs/Å | 1243.9300 | 1243.9265 | 58.7590 | 0.00 % ↓ |
|---|
| 13 | expt_n2 | peak | | gauss_sigma_2 | μs²/Ų | 325.5845 | 325.5851 | 11.6997 | 0.00 % ↑ |
|---|
| 14 | expt_n2 | instrument | | d_to_tof_offset | μs | -2.2502 | -2.2502 | 0.1219 | 0.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"
},
{
"data": {
"application/javascript": [
"\n",
" (function() {\n",
" var isDark = false;\n",
"\n",
" // Check JupyterLab theme\n",
" if (document.body.classList.contains('jp-mod-dark') || \n",
" document.body.classList.contains('theme-dark') ||\n",
" document.body.classList.contains('vscode-dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check theme attribute\n",
" var themeAttr = document.body.getAttribute('data-jp-theme-name');\n",
" if (themeAttr && themeAttr.includes('dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check computed background color\n",
" var notebookEl = document.querySelector('.jp-Notebook') || \n",
" document.querySelector('.notebook_app') ||\n",
" document.body;\n",
" if (notebookEl) {\n",
" var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n",
" var rgb = bgColor.match(/\\d+/g);\n",
" if (rgb && rgb.length >= 3) {\n",
" var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n",
" if (brightness < 128) {\n",
" isDark = true;\n",
" }\n",
" }\n",
" }\n",
"\n",
" // Store result\n",
" if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n",
" IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n",
" }\n",
" })();\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" if (typeof IPython !== 'undefined' && IPython.notebook) {\n",
" IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n",
" (document.body.classList.contains('theme-dark') || \n",
" document.body.classList.contains('jp-mod-dark') ||\n",
" (document.body.getAttribute('data-jp-theme-name') && \n",
" document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n",
" }\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" (function() {\n",
" var isDark = false;\n",
"\n",
" // Check JupyterLab theme\n",
" if (document.body.classList.contains('jp-mod-dark') || \n",
" document.body.classList.contains('theme-dark') ||\n",
" document.body.classList.contains('vscode-dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check theme attribute\n",
" var themeAttr = document.body.getAttribute('data-jp-theme-name');\n",
" if (themeAttr && themeAttr.includes('dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check computed background color\n",
" var notebookEl = document.querySelector('.jp-Notebook') || \n",
" document.querySelector('.notebook_app') ||\n",
" document.body;\n",
" if (notebookEl) {\n",
" var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n",
" var rgb = bgColor.match(/\\d+/g);\n",
" if (rgb && rgb.length >= 3) {\n",
" var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n",
" if (brightness < 128) {\n",
" isDark = true;\n",
" }\n",
" }\n",
" }\n",
"\n",
" // Store result\n",
" if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n",
" IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n",
" }\n",
" })();\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" if (typeof IPython !== 'undefined' && IPython.notebook) {\n",
" IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n",
" (document.body.classList.contains('theme-dark') || \n",
" document.body.classList.contains('jp-mod-dark') ||\n",
" (document.body.getAttribute('data-jp-theme-name') && \n",
" document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n",
" }\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" (function() {\n",
" var isDark = false;\n",
"\n",
" // Check JupyterLab theme\n",
" if (document.body.classList.contains('jp-mod-dark') || \n",
" document.body.classList.contains('theme-dark') ||\n",
" document.body.classList.contains('vscode-dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check theme attribute\n",
" var themeAttr = document.body.getAttribute('data-jp-theme-name');\n",
" if (themeAttr && themeAttr.includes('dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check computed background color\n",
" var notebookEl = document.querySelector('.jp-Notebook') || \n",
" document.querySelector('.notebook_app') ||\n",
" document.body;\n",
" if (notebookEl) {\n",
" var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n",
" var rgb = bgColor.match(/\\d+/g);\n",
" if (rgb && rgb.length >= 3) {\n",
" var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n",
" if (brightness < 128) {\n",
" isDark = true;\n",
" }\n",
" }\n",
" }\n",
"\n",
" // Store result\n",
" if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n",
" IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n",
" }\n",
" })();\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" if (typeof IPython !== 'undefined' && IPython.notebook) {\n",
" IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n",
" (document.body.classList.contains('theme-dark') || \n",
" document.body.classList.contains('jp-mod-dark') ||\n",
" (document.body.getAttribute('data-jp-theme-name') && \n",
" document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n",
" }\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" (function() {\n",
" var isDark = false;\n",
"\n",
" // Check JupyterLab theme\n",
" if (document.body.classList.contains('jp-mod-dark') || \n",
" document.body.classList.contains('theme-dark') ||\n",
" document.body.classList.contains('vscode-dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check theme attribute\n",
" var themeAttr = document.body.getAttribute('data-jp-theme-name');\n",
" if (themeAttr && themeAttr.includes('dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check computed background color\n",
" var notebookEl = document.querySelector('.jp-Notebook') || \n",
" document.querySelector('.notebook_app') ||\n",
" document.body;\n",
" if (notebookEl) {\n",
" var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n",
" var rgb = bgColor.match(/\\d+/g);\n",
" if (rgb && rgb.length >= 3) {\n",
" var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n",
" if (brightness < 128) {\n",
" isDark = true;\n",
" }\n",
" }\n",
" }\n",
"\n",
" // Store result\n",
" if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n",
" IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n",
" }\n",
" })();\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" if (typeof IPython !== 'undefined' && IPython.notebook) {\n",
" IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n",
" (document.body.classList.contains('theme-dark') || \n",
" document.body.classList.contains('jp-mod-dark') ||\n",
" (document.body.getAttribute('data-jp-theme-name') && \n",
" document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n",
" }\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"\n",
"\n",
""
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"project.display.fit.results()\n",
"project.display.fit.correlations()"
]
},
{
"cell_type": "markdown",
"id": "61",
"metadata": {},
"source": [
"### Display Pattern\n",
"\n",
"Show full range in TOF."
]
},
{
"cell_type": "code",
"execution_count": 40,
"id": "62",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:17:38.682487Z",
"iopub.status.busy": "2026-06-04T16:17:38.682333Z",
"iopub.status.idle": "2026-06-04T16:17:39.559866Z",
"shell.execute_reply": "2026-06-04T16:17:39.559044Z"
}
},
"outputs": [
{
"data": {
"application/javascript": [
"\n",
" (function() {\n",
" var isDark = false;\n",
"\n",
" // Check JupyterLab theme\n",
" if (document.body.classList.contains('jp-mod-dark') || \n",
" document.body.classList.contains('theme-dark') ||\n",
" document.body.classList.contains('vscode-dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check theme attribute\n",
" var themeAttr = document.body.getAttribute('data-jp-theme-name');\n",
" if (themeAttr && themeAttr.includes('dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check computed background color\n",
" var notebookEl = document.querySelector('.jp-Notebook') || \n",
" document.querySelector('.notebook_app') ||\n",
" document.body;\n",
" if (notebookEl) {\n",
" var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n",
" var rgb = bgColor.match(/\\d+/g);\n",
" if (rgb && rgb.length >= 3) {\n",
" var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n",
" if (brightness < 128) {\n",
" isDark = true;\n",
" }\n",
" }\n",
" }\n",
"\n",
" // Store result\n",
" if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n",
" IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n",
" }\n",
" })();\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" if (typeof IPython !== 'undefined' && IPython.notebook) {\n",
" IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n",
" (document.body.classList.contains('theme-dark') || \n",
" document.body.classList.contains('jp-mod-dark') ||\n",
" (document.body.getAttribute('data-jp-theme-name') && \n",
" document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n",
" }\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" (function() {\n",
" var isDark = false;\n",
"\n",
" // Check JupyterLab theme\n",
" if (document.body.classList.contains('jp-mod-dark') || \n",
" document.body.classList.contains('theme-dark') ||\n",
" document.body.classList.contains('vscode-dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check theme attribute\n",
" var themeAttr = document.body.getAttribute('data-jp-theme-name');\n",
" if (themeAttr && themeAttr.includes('dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check computed background color\n",
" var notebookEl = document.querySelector('.jp-Notebook') || \n",
" document.querySelector('.notebook_app') ||\n",
" document.body;\n",
" if (notebookEl) {\n",
" var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n",
" var rgb = bgColor.match(/\\d+/g);\n",
" if (rgb && rgb.length >= 3) {\n",
" var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n",
" if (brightness < 128) {\n",
" isDark = true;\n",
" }\n",
" }\n",
" }\n",
"\n",
" // Store result\n",
" if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n",
" IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n",
" }\n",
" })();\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" if (typeof IPython !== 'undefined' && IPython.notebook) {\n",
" IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n",
" (document.body.classList.contains('theme-dark') || \n",
" document.body.classList.contains('jp-mod-dark') ||\n",
" (document.body.getAttribute('data-jp-theme-name') && \n",
" document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n",
" }\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" (function() {\n",
" var isDark = false;\n",
"\n",
" // Check JupyterLab theme\n",
" if (document.body.classList.contains('jp-mod-dark') || \n",
" document.body.classList.contains('theme-dark') ||\n",
" document.body.classList.contains('vscode-dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check theme attribute\n",
" var themeAttr = document.body.getAttribute('data-jp-theme-name');\n",
" if (themeAttr && themeAttr.includes('dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check computed background color\n",
" var notebookEl = document.querySelector('.jp-Notebook') || \n",
" document.querySelector('.notebook_app') ||\n",
" document.body;\n",
" if (notebookEl) {\n",
" var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n",
" var rgb = bgColor.match(/\\d+/g);\n",
" if (rgb && rgb.length >= 3) {\n",
" var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n",
" if (brightness < 128) {\n",
" isDark = true;\n",
" }\n",
" }\n",
" }\n",
"\n",
" // Store result\n",
" if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n",
" IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n",
" }\n",
" })();\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" if (typeof IPython !== 'undefined' && IPython.notebook) {\n",
" IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n",
" (document.body.classList.contains('theme-dark') || \n",
" document.body.classList.contains('jp-mod-dark') ||\n",
" (document.body.getAttribute('data-jp-theme-name') && \n",
" document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n",
" }\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" (function() {\n",
" var isDark = false;\n",
"\n",
" // Check JupyterLab theme\n",
" if (document.body.classList.contains('jp-mod-dark') || \n",
" document.body.classList.contains('theme-dark') ||\n",
" document.body.classList.contains('vscode-dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check theme attribute\n",
" var themeAttr = document.body.getAttribute('data-jp-theme-name');\n",
" if (themeAttr && themeAttr.includes('dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check computed background color\n",
" var notebookEl = document.querySelector('.jp-Notebook') || \n",
" document.querySelector('.notebook_app') ||\n",
" document.body;\n",
" if (notebookEl) {\n",
" var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n",
" var rgb = bgColor.match(/\\d+/g);\n",
" if (rgb && rgb.length >= 3) {\n",
" var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n",
" if (brightness < 128) {\n",
" isDark = true;\n",
" }\n",
" }\n",
" }\n",
"\n",
" // Store result\n",
" if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n",
" IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n",
" }\n",
" })();\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" if (typeof IPython !== 'undefined' && IPython.notebook) {\n",
" IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n",
" (document.body.classList.contains('theme-dark') || \n",
" document.body.classList.contains('jp-mod-dark') ||\n",
" (document.body.getAttribute('data-jp-theme-name') && \n",
" document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n",
" }\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
""
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"project.display.pattern(expt_name='expt_s2')"
]
},
{
"cell_type": "code",
"execution_count": 41,
"id": "63",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:17:39.564050Z",
"iopub.status.busy": "2026-06-04T16:17:39.563816Z",
"iopub.status.idle": "2026-06-04T16:17:41.459633Z",
"shell.execute_reply": "2026-06-04T16:17:41.458727Z"
}
},
"outputs": [
{
"data": {
"application/javascript": [
"\n",
" (function() {\n",
" var isDark = false;\n",
"\n",
" // Check JupyterLab theme\n",
" if (document.body.classList.contains('jp-mod-dark') || \n",
" document.body.classList.contains('theme-dark') ||\n",
" document.body.classList.contains('vscode-dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check theme attribute\n",
" var themeAttr = document.body.getAttribute('data-jp-theme-name');\n",
" if (themeAttr && themeAttr.includes('dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check computed background color\n",
" var notebookEl = document.querySelector('.jp-Notebook') || \n",
" document.querySelector('.notebook_app') ||\n",
" document.body;\n",
" if (notebookEl) {\n",
" var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n",
" var rgb = bgColor.match(/\\d+/g);\n",
" if (rgb && rgb.length >= 3) {\n",
" var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n",
" if (brightness < 128) {\n",
" isDark = true;\n",
" }\n",
" }\n",
" }\n",
"\n",
" // Store result\n",
" if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n",
" IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n",
" }\n",
" })();\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" if (typeof IPython !== 'undefined' && IPython.notebook) {\n",
" IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n",
" (document.body.classList.contains('theme-dark') || \n",
" document.body.classList.contains('jp-mod-dark') ||\n",
" (document.body.getAttribute('data-jp-theme-name') && \n",
" document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n",
" }\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" (function() {\n",
" var isDark = false;\n",
"\n",
" // Check JupyterLab theme\n",
" if (document.body.classList.contains('jp-mod-dark') || \n",
" document.body.classList.contains('theme-dark') ||\n",
" document.body.classList.contains('vscode-dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check theme attribute\n",
" var themeAttr = document.body.getAttribute('data-jp-theme-name');\n",
" if (themeAttr && themeAttr.includes('dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check computed background color\n",
" var notebookEl = document.querySelector('.jp-Notebook') || \n",
" document.querySelector('.notebook_app') ||\n",
" document.body;\n",
" if (notebookEl) {\n",
" var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n",
" var rgb = bgColor.match(/\\d+/g);\n",
" if (rgb && rgb.length >= 3) {\n",
" var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n",
" if (brightness < 128) {\n",
" isDark = true;\n",
" }\n",
" }\n",
" }\n",
"\n",
" // Store result\n",
" if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n",
" IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n",
" }\n",
" })();\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" if (typeof IPython !== 'undefined' && IPython.notebook) {\n",
" IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n",
" (document.body.classList.contains('theme-dark') || \n",
" document.body.classList.contains('jp-mod-dark') ||\n",
" (document.body.getAttribute('data-jp-theme-name') && \n",
" document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n",
" }\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" (function() {\n",
" var isDark = false;\n",
"\n",
" // Check JupyterLab theme\n",
" if (document.body.classList.contains('jp-mod-dark') || \n",
" document.body.classList.contains('theme-dark') ||\n",
" document.body.classList.contains('vscode-dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check theme attribute\n",
" var themeAttr = document.body.getAttribute('data-jp-theme-name');\n",
" if (themeAttr && themeAttr.includes('dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check computed background color\n",
" var notebookEl = document.querySelector('.jp-Notebook') || \n",
" document.querySelector('.notebook_app') ||\n",
" document.body;\n",
" if (notebookEl) {\n",
" var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n",
" var rgb = bgColor.match(/\\d+/g);\n",
" if (rgb && rgb.length >= 3) {\n",
" var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n",
" if (brightness < 128) {\n",
" isDark = true;\n",
" }\n",
" }\n",
" }\n",
"\n",
" // Store result\n",
" if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n",
" IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n",
" }\n",
" })();\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" if (typeof IPython !== 'undefined' && IPython.notebook) {\n",
" IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n",
" (document.body.classList.contains('theme-dark') || \n",
" document.body.classList.contains('jp-mod-dark') ||\n",
" (document.body.getAttribute('data-jp-theme-name') && \n",
" document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n",
" }\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" (function() {\n",
" var isDark = false;\n",
"\n",
" // Check JupyterLab theme\n",
" if (document.body.classList.contains('jp-mod-dark') || \n",
" document.body.classList.contains('theme-dark') ||\n",
" document.body.classList.contains('vscode-dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check theme attribute\n",
" var themeAttr = document.body.getAttribute('data-jp-theme-name');\n",
" if (themeAttr && themeAttr.includes('dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check computed background color\n",
" var notebookEl = document.querySelector('.jp-Notebook') || \n",
" document.querySelector('.notebook_app') ||\n",
" document.body;\n",
" if (notebookEl) {\n",
" var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n",
" var rgb = bgColor.match(/\\d+/g);\n",
" if (rgb && rgb.length >= 3) {\n",
" var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n",
" if (brightness < 128) {\n",
" isDark = true;\n",
" }\n",
" }\n",
" }\n",
"\n",
" // Store result\n",
" if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n",
" IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n",
" }\n",
" })();\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" if (typeof IPython !== 'undefined' && IPython.notebook) {\n",
" IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n",
" (document.body.classList.contains('theme-dark') || \n",
" document.body.classList.contains('jp-mod-dark') ||\n",
" (document.body.getAttribute('data-jp-theme-name') && \n",
" document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n",
" }\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
""
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"project.display.pattern(expt_name='expt_n2')"
]
},
{
"cell_type": "markdown",
"id": "64",
"metadata": {},
"source": [
"Show selected peaks in d-spacing."
]
},
{
"cell_type": "code",
"execution_count": 42,
"id": "65",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:17:41.463677Z",
"iopub.status.busy": "2026-06-04T16:17:41.463430Z",
"iopub.status.idle": "2026-06-04T16:17:42.353975Z",
"shell.execute_reply": "2026-06-04T16:17:42.353211Z"
}
},
"outputs": [
{
"data": {
"application/javascript": [
"\n",
" (function() {\n",
" var isDark = false;\n",
"\n",
" // Check JupyterLab theme\n",
" if (document.body.classList.contains('jp-mod-dark') || \n",
" document.body.classList.contains('theme-dark') ||\n",
" document.body.classList.contains('vscode-dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check theme attribute\n",
" var themeAttr = document.body.getAttribute('data-jp-theme-name');\n",
" if (themeAttr && themeAttr.includes('dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check computed background color\n",
" var notebookEl = document.querySelector('.jp-Notebook') || \n",
" document.querySelector('.notebook_app') ||\n",
" document.body;\n",
" if (notebookEl) {\n",
" var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n",
" var rgb = bgColor.match(/\\d+/g);\n",
" if (rgb && rgb.length >= 3) {\n",
" var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n",
" if (brightness < 128) {\n",
" isDark = true;\n",
" }\n",
" }\n",
" }\n",
"\n",
" // Store result\n",
" if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n",
" IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n",
" }\n",
" })();\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" if (typeof IPython !== 'undefined' && IPython.notebook) {\n",
" IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n",
" (document.body.classList.contains('theme-dark') || \n",
" document.body.classList.contains('jp-mod-dark') ||\n",
" (document.body.getAttribute('data-jp-theme-name') && \n",
" document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n",
" }\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" (function() {\n",
" var isDark = false;\n",
"\n",
" // Check JupyterLab theme\n",
" if (document.body.classList.contains('jp-mod-dark') || \n",
" document.body.classList.contains('theme-dark') ||\n",
" document.body.classList.contains('vscode-dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check theme attribute\n",
" var themeAttr = document.body.getAttribute('data-jp-theme-name');\n",
" if (themeAttr && themeAttr.includes('dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check computed background color\n",
" var notebookEl = document.querySelector('.jp-Notebook') || \n",
" document.querySelector('.notebook_app') ||\n",
" document.body;\n",
" if (notebookEl) {\n",
" var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n",
" var rgb = bgColor.match(/\\d+/g);\n",
" if (rgb && rgb.length >= 3) {\n",
" var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n",
" if (brightness < 128) {\n",
" isDark = true;\n",
" }\n",
" }\n",
" }\n",
"\n",
" // Store result\n",
" if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n",
" IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n",
" }\n",
" })();\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" if (typeof IPython !== 'undefined' && IPython.notebook) {\n",
" IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n",
" (document.body.classList.contains('theme-dark') || \n",
" document.body.classList.contains('jp-mod-dark') ||\n",
" (document.body.getAttribute('data-jp-theme-name') && \n",
" document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n",
" }\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" (function() {\n",
" var isDark = false;\n",
"\n",
" // Check JupyterLab theme\n",
" if (document.body.classList.contains('jp-mod-dark') || \n",
" document.body.classList.contains('theme-dark') ||\n",
" document.body.classList.contains('vscode-dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check theme attribute\n",
" var themeAttr = document.body.getAttribute('data-jp-theme-name');\n",
" if (themeAttr && themeAttr.includes('dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check computed background color\n",
" var notebookEl = document.querySelector('.jp-Notebook') || \n",
" document.querySelector('.notebook_app') ||\n",
" document.body;\n",
" if (notebookEl) {\n",
" var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n",
" var rgb = bgColor.match(/\\d+/g);\n",
" if (rgb && rgb.length >= 3) {\n",
" var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n",
" if (brightness < 128) {\n",
" isDark = true;\n",
" }\n",
" }\n",
" }\n",
"\n",
" // Store result\n",
" if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n",
" IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n",
" }\n",
" })();\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" if (typeof IPython !== 'undefined' && IPython.notebook) {\n",
" IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n",
" (document.body.classList.contains('theme-dark') || \n",
" document.body.classList.contains('jp-mod-dark') ||\n",
" (document.body.getAttribute('data-jp-theme-name') && \n",
" document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n",
" }\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" (function() {\n",
" var isDark = false;\n",
"\n",
" // Check JupyterLab theme\n",
" if (document.body.classList.contains('jp-mod-dark') || \n",
" document.body.classList.contains('theme-dark') ||\n",
" document.body.classList.contains('vscode-dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check theme attribute\n",
" var themeAttr = document.body.getAttribute('data-jp-theme-name');\n",
" if (themeAttr && themeAttr.includes('dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check computed background color\n",
" var notebookEl = document.querySelector('.jp-Notebook') || \n",
" document.querySelector('.notebook_app') ||\n",
" document.body;\n",
" if (notebookEl) {\n",
" var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n",
" var rgb = bgColor.match(/\\d+/g);\n",
" if (rgb && rgb.length >= 3) {\n",
" var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n",
" if (brightness < 128) {\n",
" isDark = true;\n",
" }\n",
" }\n",
" }\n",
"\n",
" // Store result\n",
" if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n",
" IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n",
" }\n",
" })();\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" if (typeof IPython !== 'undefined' && IPython.notebook) {\n",
" IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n",
" (document.body.classList.contains('theme-dark') || \n",
" document.body.classList.contains('jp-mod-dark') ||\n",
" (document.body.getAttribute('data-jp-theme-name') && \n",
" document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n",
" }\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
""
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"project.display.pattern(\n",
" expt_name='expt_s2',\n",
" x='d_spacing',\n",
" x_min=2.08,\n",
" x_max=2.13,\n",
")"
]
},
{
"cell_type": "code",
"execution_count": 43,
"id": "66",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-04T16:17:42.355530Z",
"iopub.status.busy": "2026-06-04T16:17:42.355357Z",
"iopub.status.idle": "2026-06-04T16:17:44.280225Z",
"shell.execute_reply": "2026-06-04T16:17:44.279467Z"
}
},
"outputs": [
{
"data": {
"application/javascript": [
"\n",
" (function() {\n",
" var isDark = false;\n",
"\n",
" // Check JupyterLab theme\n",
" if (document.body.classList.contains('jp-mod-dark') || \n",
" document.body.classList.contains('theme-dark') ||\n",
" document.body.classList.contains('vscode-dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check theme attribute\n",
" var themeAttr = document.body.getAttribute('data-jp-theme-name');\n",
" if (themeAttr && themeAttr.includes('dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check computed background color\n",
" var notebookEl = document.querySelector('.jp-Notebook') || \n",
" document.querySelector('.notebook_app') ||\n",
" document.body;\n",
" if (notebookEl) {\n",
" var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n",
" var rgb = bgColor.match(/\\d+/g);\n",
" if (rgb && rgb.length >= 3) {\n",
" var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n",
" if (brightness < 128) {\n",
" isDark = true;\n",
" }\n",
" }\n",
" }\n",
"\n",
" // Store result\n",
" if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n",
" IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n",
" }\n",
" })();\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" if (typeof IPython !== 'undefined' && IPython.notebook) {\n",
" IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n",
" (document.body.classList.contains('theme-dark') || \n",
" document.body.classList.contains('jp-mod-dark') ||\n",
" (document.body.getAttribute('data-jp-theme-name') && \n",
" document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n",
" }\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" (function() {\n",
" var isDark = false;\n",
"\n",
" // Check JupyterLab theme\n",
" if (document.body.classList.contains('jp-mod-dark') || \n",
" document.body.classList.contains('theme-dark') ||\n",
" document.body.classList.contains('vscode-dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check theme attribute\n",
" var themeAttr = document.body.getAttribute('data-jp-theme-name');\n",
" if (themeAttr && themeAttr.includes('dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check computed background color\n",
" var notebookEl = document.querySelector('.jp-Notebook') || \n",
" document.querySelector('.notebook_app') ||\n",
" document.body;\n",
" if (notebookEl) {\n",
" var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n",
" var rgb = bgColor.match(/\\d+/g);\n",
" if (rgb && rgb.length >= 3) {\n",
" var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n",
" if (brightness < 128) {\n",
" isDark = true;\n",
" }\n",
" }\n",
" }\n",
"\n",
" // Store result\n",
" if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n",
" IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n",
" }\n",
" })();\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" if (typeof IPython !== 'undefined' && IPython.notebook) {\n",
" IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n",
" (document.body.classList.contains('theme-dark') || \n",
" document.body.classList.contains('jp-mod-dark') ||\n",
" (document.body.getAttribute('data-jp-theme-name') && \n",
" document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n",
" }\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" (function() {\n",
" var isDark = false;\n",
"\n",
" // Check JupyterLab theme\n",
" if (document.body.classList.contains('jp-mod-dark') || \n",
" document.body.classList.contains('theme-dark') ||\n",
" document.body.classList.contains('vscode-dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check theme attribute\n",
" var themeAttr = document.body.getAttribute('data-jp-theme-name');\n",
" if (themeAttr && themeAttr.includes('dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check computed background color\n",
" var notebookEl = document.querySelector('.jp-Notebook') || \n",
" document.querySelector('.notebook_app') ||\n",
" document.body;\n",
" if (notebookEl) {\n",
" var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n",
" var rgb = bgColor.match(/\\d+/g);\n",
" if (rgb && rgb.length >= 3) {\n",
" var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n",
" if (brightness < 128) {\n",
" isDark = true;\n",
" }\n",
" }\n",
" }\n",
"\n",
" // Store result\n",
" if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n",
" IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n",
" }\n",
" })();\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" if (typeof IPython !== 'undefined' && IPython.notebook) {\n",
" IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n",
" (document.body.classList.contains('theme-dark') || \n",
" document.body.classList.contains('jp-mod-dark') ||\n",
" (document.body.getAttribute('data-jp-theme-name') && \n",
" document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n",
" }\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" (function() {\n",
" var isDark = false;\n",
"\n",
" // Check JupyterLab theme\n",
" if (document.body.classList.contains('jp-mod-dark') || \n",
" document.body.classList.contains('theme-dark') ||\n",
" document.body.classList.contains('vscode-dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check theme attribute\n",
" var themeAttr = document.body.getAttribute('data-jp-theme-name');\n",
" if (themeAttr && themeAttr.includes('dark')) {\n",
" isDark = true;\n",
" }\n",
"\n",
" // Check computed background color\n",
" var notebookEl = document.querySelector('.jp-Notebook') || \n",
" document.querySelector('.notebook_app') ||\n",
" document.body;\n",
" if (notebookEl) {\n",
" var bgColor = window.getComputedStyle(notebookEl).backgroundColor;\n",
" var rgb = bgColor.match(/\\d+/g);\n",
" if (rgb && rgb.length >= 3) {\n",
" var brightness = (parseInt(rgb[0]) + parseInt(rgb[1]) + parseInt(rgb[2])) / 3;\n",
" if (brightness < 128) {\n",
" isDark = true;\n",
" }\n",
" }\n",
" }\n",
"\n",
" // Store result\n",
" if (typeof IPython !== 'undefined' && IPython.notebook && IPython.notebook.kernel) {\n",
" IPython.notebook.kernel.execute('_jupyter_dark_detect_result = ' + isDark);\n",
" }\n",
" })();\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
" if (typeof IPython !== 'undefined' && IPython.notebook) {\n",
" IPython.notebook.kernel.execute(\"_jupyter_dark_detect_result = \" + \n",
" (document.body.classList.contains('theme-dark') || \n",
" document.body.classList.contains('jp-mod-dark') ||\n",
" (document.body.getAttribute('data-jp-theme-name') && \n",
" document.body.getAttribute('data-jp-theme-name').includes('dark'))));\n",
" }\n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
""
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"project.display.pattern(\n",
" expt_name='expt_n2',\n",
" x='d_spacing',\n",
" x_min=2.08,\n",
" x_max=2.13,\n",
")"
]
}
],
"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
}