{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "0",
"metadata": {
"execution": {
"iopub.execute_input": "2026-09-22T21:04:18.540563Z",
"iopub.status.busy": "2026-09-22T21:04:18.540394Z",
"iopub.status.idle": "2026-09-22T21:04:18.545437Z",
"shell.execute_reply": "2026-09-22T21:04:18.544364Z"
},
"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.21.1"
]
},
{
"cell_type": "markdown",
"id": "1",
"metadata": {},
"source": [
"# Structure Refinement: YAlO3+Al2O3, SPODI\n",
"\n",
"This example demonstrates a staged two-phase Rietveld refinement of\n",
"yttrium aluminium perovskite YAlO3 (or YAP) with a small Al2O3\n",
"impurity using constant wavelength neutron powder diffraction data\n",
"measured at 3 K on SPODI at MLZ.\n",
"\n",
"The workflow defines both structures, configures the experiment, and\n",
"refines the cell, scale, profile, background, and atom parameters of\n",
"both phases in stages."
]
},
{
"cell_type": "markdown",
"id": "2",
"metadata": {},
"source": [
"## π οΈ Import Library"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "3",
"metadata": {
"execution": {
"iopub.execute_input": "2026-09-22T21:04:18.546933Z",
"iopub.status.busy": "2026-09-22T21:04:18.546760Z",
"iopub.status.idle": "2026-09-22T21:04:21.437703Z",
"shell.execute_reply": "2026-09-22T21:04:21.436331Z"
}
},
"outputs": [],
"source": [
"import easydiffraction as edi"
]
},
{
"cell_type": "markdown",
"id": "4",
"metadata": {},
"source": [
"## π¦ Define Project\n",
"\n",
"### Create Project"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "5",
"metadata": {
"execution": {
"iopub.execute_input": "2026-09-22T21:04:21.439655Z",
"iopub.status.busy": "2026-09-22T21:04:21.439330Z",
"iopub.status.idle": "2026-09-22T21:04:21.644409Z",
"shell.execute_reply": "2026-09-22T21:04:21.643377Z"
}
},
"outputs": [],
"source": [
"project = edi.Project(\n",
" name='yap_3k',\n",
" description='Two-phase YAlO3 and Al2O3 refinement using 3 K data from SPODI at MLZ.',\n",
")"
]
},
{
"cell_type": "markdown",
"id": "6",
"metadata": {},
"source": [
"### Save Initial Project"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "7",
"metadata": {
"execution": {
"iopub.execute_input": "2026-09-22T21:04:21.646295Z",
"iopub.status.busy": "2026-09-22T21:04:21.646066Z",
"iopub.status.idle": "2026-09-22T21:04:21.703505Z",
"shell.execute_reply": "2026-09-22T21:04:21.702758Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1;36mSaving project π¦ \u001b[0m\u001b[32m'yap_3k'\u001b[0m\u001b[1;36m to \u001b[0m\u001b[32m'../../../projects/refine-yap-3k'\u001b[0m\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"βββ π project.edi\n",
"βββ π structures/\n",
"βββ π experiments/\n",
"βββ π analysis/\n",
"β βββ π analysis.edi\n",
"βββ π reports/\n",
" βββ π yap_3k.html\n"
]
}
],
"source": [
"project.save_as(dir_path='projects/refine-yap-3k')"
]
},
{
"cell_type": "markdown",
"id": "8",
"metadata": {},
"source": [
"## π§© Define Structures\n",
"\n",
"### Create Structure 1: YAlO3\n",
"\n",
"Preserve the orthorhombic Pbnm setting used in FullProf. In\n",
"EasyDiffraction this is represented by the standard space-group\n",
"symbol `P n m a` with coordinate-system code `cab`. The cell axes and\n",
"atom coordinates below therefore stay in the original Pbnm setting.\n",
"\n",
"FullProf's PCR occupancies include the site multiplicity divided by\n",
"the general-position multiplicity. Here each atom site is fully\n",
"occupied: the PCR values 0.5 for Y, Al, and O1, and 1.0 for O2, all\n",
"become an occupancy of 1.0. Displacement parameters are entered as\n",
"Biso, matching the PCR file."
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "9",
"metadata": {
"execution": {
"iopub.execute_input": "2026-09-22T21:04:21.705681Z",
"iopub.status.busy": "2026-09-22T21:04:21.705482Z",
"iopub.status.idle": "2026-09-22T21:04:21.708687Z",
"shell.execute_reply": "2026-09-22T21:04:21.707775Z"
}
},
"outputs": [],
"source": [
"yap_cif = \"\"\"\n",
"data_yap\n",
"\n",
"_cell.length_a 5.18\n",
"_cell.length_b 5.33\n",
"_cell.length_c 7.37\n",
"_cell.angle_alpha 90.\n",
"_cell.angle_beta 90.\n",
"_cell.angle_gamma 90.\n",
"\n",
"_space_group.name_h_m \"P n m a\"\n",
"_space_group.coord_system_code cab\n",
"\n",
"loop_\n",
"_atom_site.id\n",
"_atom_site.type_symbol\n",
"_atom_site.fract_x\n",
"_atom_site.fract_y\n",
"_atom_site.fract_z\n",
"_atom_site.occupancy\n",
"_atom_site.adp_iso\n",
"_atom_site.adp_type\n",
"Y Y 0.0100 0.5500 0.2500 1.0 0.12 Biso\n",
"Al Al 0.0000 0.0000 0.0000 1.0 0.13 Biso\n",
"O1 O -0.0800 -0.0200 0.2500 1.0 0.06 Biso\n",
"O2 O 0.2000 0.2900 0.0400 1.0 0.14 Biso\n",
"\"\"\""
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "10",
"metadata": {
"execution": {
"iopub.execute_input": "2026-09-22T21:04:21.710141Z",
"iopub.status.busy": "2026-09-22T21:04:21.709974Z",
"iopub.status.idle": "2026-09-22T21:04:21.726654Z",
"shell.execute_reply": "2026-09-22T21:04:21.725787Z"
}
},
"outputs": [],
"source": [
"project.structures.add_from_cif_str(yap_cif)"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "11",
"metadata": {
"execution": {
"iopub.execute_input": "2026-09-22T21:04:21.728211Z",
"iopub.status.busy": "2026-09-22T21:04:21.728020Z",
"iopub.status.idle": "2026-09-22T21:04:21.730903Z",
"shell.execute_reply": "2026-09-22T21:04:21.730085Z"
}
},
"outputs": [],
"source": [
"yap = project.structures['yap']"
]
},
{
"cell_type": "markdown",
"id": "12",
"metadata": {},
"source": [
"### Display Structure 1: YAlO3"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "13",
"metadata": {
"execution": {
"iopub.execute_input": "2026-09-22T21:04:21.732781Z",
"iopub.status.busy": "2026-09-22T21:04:21.732624Z",
"iopub.status.idle": "2026-09-22T21:04:21.780394Z",
"shell.execute_reply": "2026-09-22T21:04:21.779448Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1;36mStructure π§© \u001b[0m\u001b[32m'yap'\u001b[0m\u001b[1;36m as text\u001b[0m\n"
]
},
{
"data": {
"text/html": [
"
| Edi |
|---|
| 1 | data_yap |
|---|
| 2 | |
|---|
| 3 | _cell.length_a 5.18 |
|---|
| 4 | _cell.length_b 5.33 |
|---|
| 5 | _cell.length_c 7.37 |
|---|
| 6 | _cell.angle_alpha 90. |
|---|
| 7 | _cell.angle_beta 90. |
|---|
| 8 | _cell.angle_gamma 90. |
|---|
| 9 | |
|---|
| 10 | _space_group.name_h_m "P n m a" |
|---|
| 11 | _space_group.coord_system_code cab |
|---|
| 12 | |
|---|
| 13 | _geom.min_bond_distance_cutoff 0. |
|---|
| 14 | _geom.bond_distance_inc 0.25 |
|---|
| 15 | |
|---|
| 16 | loop_ |
|---|
| 17 | _atom_site.id |
|---|
| 18 | _atom_site.type_symbol |
|---|
| 19 | _atom_site.fract_x |
|---|
| 20 | _atom_site.fract_y |
|---|
| 21 | _atom_site.fract_z |
|---|
| 22 | _atom_site.wyckoff_letter |
|---|
| 23 | _atom_site.multiplicity |
|---|
| 24 | _atom_site.occupancy |
|---|
| 25 | _atom_site.adp_iso |
|---|
| 26 | _atom_site.adp_type |
|---|
| 27 | Y Y 0.01 0.55 0.25 c 4 1. 0.12 Biso |
|---|
| 28 | Al Al 0. 0. 0. a 4 1. 0.13 Biso |
|---|
| 29 | O1 O -0.08 -0.02 0.25 c 4 1. 0.06 Biso |
|---|
| 30 | O2 O 0.2 0.29 0.04 d 8 1. 0.14 Biso |
|---|
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"yap.show_as_text()"
]
},
{
"cell_type": "code",
"execution_count": 9,
"id": "14",
"metadata": {
"execution": {
"iopub.execute_input": "2026-09-22T21:04:21.781984Z",
"iopub.status.busy": "2026-09-22T21:04:21.781784Z",
"iopub.status.idle": "2026-09-22T21:04:21.800919Z",
"shell.execute_reply": "2026-09-22T21:04:21.800208Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1;36mStructure π§© \u001b[0m\u001b[32m'yap'\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='yap')"
]
},
{
"cell_type": "markdown",
"id": "15",
"metadata": {},
"source": [
"### Create Structure 2: Al2O3\n",
"\n",
"Define the corundum impurity in the hexagonal setting of R-3c. The\n",
"FullProf PCR occupancies of 2/3 for Al and 1 for O also describe fully\n",
"occupied sites. Refine its two independent cell lengths, Al z and O x\n",
"coordinates, and both Biso values, as specified by the PCR codewords.\n",
"The PCR contains a negative Al Biso. EasyDiffraction requires a\n",
"nonnegative input value, so start this parameter at 0.1 Γ
Β² and refine\n",
"it alongside O Biso."
]
},
{
"cell_type": "code",
"execution_count": 10,
"id": "16",
"metadata": {
"execution": {
"iopub.execute_input": "2026-09-22T21:04:21.802499Z",
"iopub.status.busy": "2026-09-22T21:04:21.802317Z",
"iopub.status.idle": "2026-09-22T21:04:21.805520Z",
"shell.execute_reply": "2026-09-22T21:04:21.804766Z"
}
},
"outputs": [],
"source": [
"alumina = edi.StructureFactory.from_scratch(name='alumina')"
]
},
{
"cell_type": "markdown",
"id": "17",
"metadata": {},
"source": [
"#### Set Space Group"
]
},
{
"cell_type": "code",
"execution_count": 11,
"id": "18",
"metadata": {
"execution": {
"iopub.execute_input": "2026-09-22T21:04:21.807392Z",
"iopub.status.busy": "2026-09-22T21:04:21.807188Z",
"iopub.status.idle": "2026-09-22T21:04:21.810352Z",
"shell.execute_reply": "2026-09-22T21:04:21.809523Z"
}
},
"outputs": [],
"source": [
"alumina.space_group.name_h_m = 'R -3 c'\n",
"alumina.space_group.coord_system_code = 'h'"
]
},
{
"cell_type": "markdown",
"id": "19",
"metadata": {},
"source": [
"#### Set Unit Cell"
]
},
{
"cell_type": "code",
"execution_count": 12,
"id": "20",
"metadata": {
"execution": {
"iopub.execute_input": "2026-09-22T21:04:21.811965Z",
"iopub.status.busy": "2026-09-22T21:04:21.811771Z",
"iopub.status.idle": "2026-09-22T21:04:21.814934Z",
"shell.execute_reply": "2026-09-22T21:04:21.814277Z"
}
},
"outputs": [],
"source": [
"alumina.cell.length_a = 4.75\n",
"alumina.cell.length_c = 12.95"
]
},
{
"cell_type": "markdown",
"id": "21",
"metadata": {},
"source": [
"#### Set Atom Sites"
]
},
{
"cell_type": "code",
"execution_count": 13,
"id": "22",
"metadata": {
"execution": {
"iopub.execute_input": "2026-09-22T21:04:21.816681Z",
"iopub.status.busy": "2026-09-22T21:04:21.816510Z",
"iopub.status.idle": "2026-09-22T21:04:21.860382Z",
"shell.execute_reply": "2026-09-22T21:04:21.857275Z"
}
},
"outputs": [],
"source": [
"alumina.atom_sites.create(\n",
" id='Al1',\n",
" type_symbol='Al',\n",
" fract_x=0.0,\n",
" fract_y=0.0,\n",
" fract_z=0.33351,\n",
" occupancy=1.0,\n",
" adp_type='Biso',\n",
" adp_iso=0.1,\n",
")\n",
"alumina.atom_sites.create(\n",
" id='O1',\n",
" type_symbol='O',\n",
" fract_x=0.3503,\n",
" fract_y=0.0,\n",
" fract_z=0.25,\n",
" occupancy=1.0,\n",
" adp_type='Biso',\n",
" adp_iso=1.22884,\n",
")"
]
},
{
"cell_type": "code",
"execution_count": 14,
"id": "23",
"metadata": {
"execution": {
"iopub.execute_input": "2026-09-22T21:04:21.863998Z",
"iopub.status.busy": "2026-09-22T21:04:21.863751Z",
"iopub.status.idle": "2026-09-22T21:04:21.866575Z",
"shell.execute_reply": "2026-09-22T21:04:21.866136Z"
}
},
"outputs": [],
"source": [
"project.structures.add(alumina)"
]
},
{
"cell_type": "markdown",
"id": "24",
"metadata": {},
"source": [
"### Display Structure 2: Al2O3"
]
},
{
"cell_type": "code",
"execution_count": 15,
"id": "25",
"metadata": {
"execution": {
"iopub.execute_input": "2026-09-22T21:04:21.872332Z",
"iopub.status.busy": "2026-09-22T21:04:21.869844Z",
"iopub.status.idle": "2026-09-22T21:04:22.012825Z",
"shell.execute_reply": "2026-09-22T21:04:22.011915Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1;36mStructure π§© \u001b[0m\u001b[32m'alumina'\u001b[0m\u001b[1;36m as text\u001b[0m\n"
]
},
{
"data": {
"text/html": [
" | Edi |
|---|
| 1 | data_alumina |
|---|
| 2 | |
|---|
| 3 | _cell.length_a 4.75 |
|---|
| 4 | _cell.length_b 4.75 |
|---|
| 5 | _cell.length_c 12.95 |
|---|
| 6 | _cell.angle_alpha 90. |
|---|
| 7 | _cell.angle_beta 90. |
|---|
| 8 | _cell.angle_gamma 120. |
|---|
| 9 | |
|---|
| 10 | _space_group.name_h_m "R -3 c" |
|---|
| 11 | _space_group.coord_system_code h |
|---|
| 12 | |
|---|
| 13 | _geom.min_bond_distance_cutoff 0. |
|---|
| 14 | _geom.bond_distance_inc 0.25 |
|---|
| 15 | |
|---|
| 16 | loop_ |
|---|
| 17 | _atom_site.id |
|---|
| 18 | _atom_site.type_symbol |
|---|
| 19 | _atom_site.fract_x |
|---|
| 20 | _atom_site.fract_y |
|---|
| 21 | _atom_site.fract_z |
|---|
| 22 | _atom_site.wyckoff_letter |
|---|
| 23 | _atom_site.multiplicity |
|---|
| 24 | _atom_site.occupancy |
|---|
| 25 | _atom_site.adp_iso |
|---|
| 26 | _atom_site.adp_type |
|---|
| 27 | Al1 Al 0. 0. 0.33351 c 12 1. 0.1 Biso |
|---|
| 28 | O1 O 0.3503 0. 0.25 e 18 1. 1.22884 Biso |
|---|
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"alumina.show_as_text()"
]
},
{
"cell_type": "code",
"execution_count": 16,
"id": "26",
"metadata": {
"execution": {
"iopub.execute_input": "2026-09-22T21:04:22.014368Z",
"iopub.status.busy": "2026-09-22T21:04:22.014147Z",
"iopub.status.idle": "2026-09-22T21:04:22.039416Z",
"shell.execute_reply": "2026-09-22T21:04:22.038555Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1;36mStructure π§© \u001b[0m\u001b[32m'alumina'\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='alumina')"
]
},
{
"cell_type": "markdown",
"id": "27",
"metadata": {},
"source": [
"## π¬ Define Experiment\n",
"\n",
"### Download Measured Data\n",
"\n",
"Download the YAlO3 + Al2O3 pattern from the EasyDiffraction online\n",
"data repository. The three columns contain 2-theta in degrees,\n",
"intensity, and its standard uncertainty. They are copied from the\n",
"original SPODI dataset without changing the measured values."
]
},
{
"cell_type": "code",
"execution_count": 17,
"id": "28",
"metadata": {
"execution": {
"iopub.execute_input": "2026-09-22T21:04:22.041189Z",
"iopub.status.busy": "2026-09-22T21:04:22.040968Z",
"iopub.status.idle": "2026-09-22T21:04:22.238616Z",
"shell.execute_reply": "2026-09-22T21:04:22.237628Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1;36mGetting data\u001b[0m\u001b[1;36m...\u001b[0m\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Data \u001b[32m'meas-yap-spodi'\u001b[0m: YAlO3 + Al2O3, SPODI \u001b[1m(\u001b[0mMLZ\u001b[1m)\u001b[0m, \u001b[1;36m3\u001b[0m K\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"β
Data \u001b[32m'meas-yap-spodi'\u001b[0m downloaded to \u001b[32m'../../../data/meas-yap-spodi.xye'\u001b[0m\n"
]
}
],
"source": [
"data_path = edi.download_data('meas-yap-spodi', destination='data')"
]
},
{
"cell_type": "code",
"execution_count": 18,
"id": "29",
"metadata": {
"execution": {
"iopub.execute_input": "2026-09-22T21:04:22.240940Z",
"iopub.status.busy": "2026-09-22T21:04:22.240208Z",
"iopub.status.idle": "2026-09-22T21:04:22.662842Z",
"shell.execute_reply": "2026-09-22T21:04:22.661919Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1;36mData loaded successfully\u001b[0m\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Experiment π¬ \u001b[32m'yap_3k'\u001b[0m. Number of data points: \u001b[1;36m3000\u001b[0m.\n"
]
}
],
"source": [
"project.experiments.add_from_data_path(\n",
" name='yap_3k',\n",
" data_path=data_path,\n",
" sample_form='powder',\n",
" beam_mode='constant wavelength',\n",
" radiation_probe='neutron',\n",
")"
]
},
{
"cell_type": "code",
"execution_count": 19,
"id": "30",
"metadata": {
"execution": {
"iopub.execute_input": "2026-09-22T21:04:22.664426Z",
"iopub.status.busy": "2026-09-22T21:04:22.664260Z",
"iopub.status.idle": "2026-09-22T21:04:22.667318Z",
"shell.execute_reply": "2026-09-22T21:04:22.666675Z"
}
},
"outputs": [],
"source": [
"expt = project.experiments['yap_3k']"
]
},
{
"cell_type": "markdown",
"id": "31",
"metadata": {},
"source": [
"### Set Instrument\n",
"\n",
"Use the neutron wavelength reported for the SPODI dataset and start\n",
"with zero 2-theta offset."
]
},
{
"cell_type": "code",
"execution_count": 20,
"id": "32",
"metadata": {
"execution": {
"iopub.execute_input": "2026-09-22T21:04:22.668886Z",
"iopub.status.busy": "2026-09-22T21:04:22.668717Z",
"iopub.status.idle": "2026-09-22T21:04:22.671703Z",
"shell.execute_reply": "2026-09-22T21:04:22.670883Z"
}
},
"outputs": [],
"source": [
"expt.instrument.setup_wavelength = 1.54816\n",
"expt.instrument.calib_twotheta_offset = 0.0"
]
},
{
"cell_type": "markdown",
"id": "33",
"metadata": {},
"source": [
"### Set Peak Profile\n",
"\n",
"Use a pseudo-Voigt profile with BΓ©rar-Baldinozzi asymmetry."
]
},
{
"cell_type": "code",
"execution_count": 21,
"id": "34",
"metadata": {
"execution": {
"iopub.execute_input": "2026-09-22T21:04:22.673022Z",
"iopub.status.busy": "2026-09-22T21:04:22.672861Z",
"iopub.status.idle": "2026-09-22T21:04:22.679511Z",
"shell.execute_reply": "2026-09-22T21:04:22.678817Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1;36mPeak types\u001b[0m\n"
]
},
{
"data": {
"text/html": [
" | | Type | Description |
|---|
| 1 | * | pseudo-voigt | CWL pseudo-Voigt profile |
|---|
| 2 | | pseudo-voigt + berar-baldinozzi asymmetry | CWL pseudo-Voigt profile with Berar-Baldinozzi asymmetry correction. |
|---|
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"expt.peak.show_supported()"
]
},
{
"cell_type": "code",
"execution_count": 22,
"id": "35",
"metadata": {
"execution": {
"iopub.execute_input": "2026-09-22T21:04:22.680971Z",
"iopub.status.busy": "2026-09-22T21:04:22.680814Z",
"iopub.status.idle": "2026-09-22T21:04:22.687004Z",
"shell.execute_reply": "2026-09-22T21:04:22.686322Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"β οΈ Switching peak profile type adds these settings with defaults:\n",
"β’ asym_beba_a0=0.0\n",
"β’ asym_beba_a1=0.0\n",
"β’ asym_beba_b0=0.0\n",
"β’ asym_beba_b1=0.0\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1;36mPeak profile type for experiment \u001b[0m\u001b[32m'yap_3k'\u001b[0m\u001b[1;36m changed to\u001b[0m\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"pseudo-voigt + berar-baldinozzi asymmetry\n"
]
}
],
"source": [
"expt.peak.type = 'pseudo-voigt + berar-baldinozzi asymmetry'"
]
},
{
"cell_type": "code",
"execution_count": 23,
"id": "36",
"metadata": {
"execution": {
"iopub.execute_input": "2026-09-22T21:04:22.688419Z",
"iopub.status.busy": "2026-09-22T21:04:22.688262Z",
"iopub.status.idle": "2026-09-22T21:04:22.691552Z",
"shell.execute_reply": "2026-09-22T21:04:22.690854Z"
}
},
"outputs": [],
"source": [
"expt.peak.broad_gauss_u = 0.04\n",
"expt.peak.broad_gauss_v = -0.05\n",
"expt.peak.broad_gauss_w = 0.10\n",
"expt.peak.broad_lorentz_x = 0.0\n",
"expt.peak.broad_lorentz_y = 0.01"
]
},
{
"cell_type": "code",
"execution_count": 24,
"id": "37",
"metadata": {
"execution": {
"iopub.execute_input": "2026-09-22T21:04:22.692971Z",
"iopub.status.busy": "2026-09-22T21:04:22.692802Z",
"iopub.status.idle": "2026-09-22T21:04:22.695669Z",
"shell.execute_reply": "2026-09-22T21:04:22.694958Z"
}
},
"outputs": [],
"source": [
"expt.peak.asym_beba_a0 = 0.0\n",
"expt.peak.asym_beba_b0 = 0.0\n",
"expt.peak.asym_beba_a1 = 0.0\n",
"expt.peak.asym_beba_b1 = 0.0"
]
},
{
"cell_type": "code",
"execution_count": 25,
"id": "38",
"metadata": {
"execution": {
"iopub.execute_input": "2026-09-22T21:04:22.697233Z",
"iopub.status.busy": "2026-09-22T21:04:22.697048Z",
"iopub.status.idle": "2026-09-22T21:04:22.699737Z",
"shell.execute_reply": "2026-09-22T21:04:22.699061Z"
}
},
"outputs": [],
"source": [
"expt.peak.cutoff_fwhm = 8.0"
]
},
{
"cell_type": "markdown",
"id": "39",
"metadata": {},
"source": [
"### Set Absorption\n",
"\n",
"Apply the cylindrical-sample Hewat correction with the absorption\n",
"radius product from FullProf."
]
},
{
"cell_type": "code",
"execution_count": 26,
"id": "40",
"metadata": {
"execution": {
"iopub.execute_input": "2026-09-22T21:04:22.701304Z",
"iopub.status.busy": "2026-09-22T21:04:22.701134Z",
"iopub.status.idle": "2026-09-22T21:04:22.706084Z",
"shell.execute_reply": "2026-09-22T21:04:22.705393Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1;36mAbsorption type changed to\u001b[0m\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"cylinder-hewat\n"
]
}
],
"source": [
"expt.absorption.type = 'cylinder-hewat'\n",
"expt.absorption.mu_r = 0.0221"
]
},
{
"cell_type": "markdown",
"id": "41",
"metadata": {},
"source": [
"### Set Excluded Regions"
]
},
{
"cell_type": "code",
"execution_count": 27,
"id": "42",
"metadata": {
"execution": {
"iopub.execute_input": "2026-09-22T21:04:22.707593Z",
"iopub.status.busy": "2026-09-22T21:04:22.707422Z",
"iopub.status.idle": "2026-09-22T21:04:22.710721Z",
"shell.execute_reply": "2026-09-22T21:04:22.710062Z"
}
},
"outputs": [],
"source": [
"expt.excluded_regions.create(id='1', start=0.0, end=4.0)\n",
"expt.excluded_regions.create(id='2', start=153.95, end=180.0)"
]
},
{
"cell_type": "markdown",
"id": "43",
"metadata": {},
"source": [
"### Set Background\n",
"\n",
"Estimate the initial line-segment background from the measured pattern.\n",
"This first estimate does not use a calculated structural model."
]
},
{
"cell_type": "code",
"execution_count": 28,
"id": "44",
"metadata": {
"execution": {
"iopub.execute_input": "2026-09-22T21:04:22.712210Z",
"iopub.status.busy": "2026-09-22T21:04:22.712048Z",
"iopub.status.idle": "2026-09-22T21:04:22.736578Z",
"shell.execute_reply": "2026-09-22T21:04:22.735612Z"
}
},
"outputs": [],
"source": [
"expt.background.auto_estimate(use_model=False)"
]
},
{
"cell_type": "code",
"execution_count": 29,
"id": "45",
"metadata": {
"execution": {
"iopub.execute_input": "2026-09-22T21:04:22.738074Z",
"iopub.status.busy": "2026-09-22T21:04:22.737877Z",
"iopub.status.idle": "2026-09-22T21:04:22.744311Z",
"shell.execute_reply": "2026-09-22T21:04:22.743761Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1;36mLine-segment background points\u001b[0m\n"
]
},
{
"data": {
"text/html": [
" | Position | Intensity |
|---|
| 1 | 4.05000 | 1303.00000 |
|---|
| 2 | 5.95000 | 2193.97204 |
|---|
| 3 | 18.20000 | 1997.00000 |
|---|
| 4 | 37.35000 | 2147.12282 |
|---|
| 5 | 47.70000 | 2092.00000 |
|---|
| 6 | 59.25000 | 1977.00000 |
|---|
| 7 | 151.95000 | 3468.48635 |
|---|
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"expt.background.show()"
]
},
{
"cell_type": "markdown",
"id": "46",
"metadata": {},
"source": [
"### Set Linked Structures\n",
"\n",
"Give each phase an independent scale factor. Scale factors are fitted\n",
"intensity multipliers, rather than phase weight fractions."
]
},
{
"cell_type": "code",
"execution_count": 30,
"id": "47",
"metadata": {
"execution": {
"iopub.execute_input": "2026-09-22T21:04:22.746177Z",
"iopub.status.busy": "2026-09-22T21:04:22.746011Z",
"iopub.status.idle": "2026-09-22T21:04:22.750075Z",
"shell.execute_reply": "2026-09-22T21:04:22.749137Z"
}
},
"outputs": [],
"source": [
"expt.linked_structures.create(structure_id='yap', scale=30)\n",
"expt.linked_structures.create(structure_id='alumina', scale=0.1)"
]
},
{
"cell_type": "code",
"execution_count": 31,
"id": "48",
"metadata": {
"execution": {
"iopub.execute_input": "2026-09-22T21:04:22.751413Z",
"iopub.status.busy": "2026-09-22T21:04:22.751258Z",
"iopub.status.idle": "2026-09-22T21:04:23.305590Z",
"shell.execute_reply": "2026-09-22T21:04:23.304612Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1;36mExperiment π¬ \u001b[0m\u001b[32m'yap_3k'\u001b[0m\u001b[1;36m as text\u001b[0m\n"
]
},
{
"data": {
"text/html": [
" | Edi |
|---|
| 1 | data_yap_3k |
|---|
| 2 | |
|---|
| 3 | _experiment_type.sample_form powder |
|---|
| 4 | _experiment_type.beam_mode "constant wavelength" |
|---|
| 5 | _experiment_type.radiation_probe neutron |
|---|
| 6 | _experiment_type.scattering_type bragg |
|---|
| 7 | |
|---|
| 8 | _diffrn.ambient_temperature ? |
|---|
| 9 | _diffrn.ambient_pressure ? |
|---|
| 10 | _diffrn.ambient_magnetic_field ? |
|---|
| 11 | _diffrn.ambient_electric_field ? |
|---|
| 12 | |
|---|
| 13 | _calculator.type cryspy |
|---|
| 14 | |
|---|
| 15 | _peak.asym_beba_a0 0. |
|---|
| 16 | _peak.asym_beba_b0 0. |
|---|
| 17 | _peak.asym_beba_a1 0. |
|---|
| 18 | _peak.asym_beba_b1 0. |
|---|
| 19 | _peak.broad_gauss_u 0.04 |
|---|
| 20 | _peak.broad_gauss_v -0.05 |
|---|
| 21 | _peak.broad_gauss_w 0.1 |
|---|
| 22 | _peak.broad_lorentz_x 0. |
|---|
| 23 | _peak.broad_lorentz_y 0.01 |
|---|
| 24 | _peak.cutoff_fwhm 8. |
|---|
| 25 | _peak.type cwl-pseudo-voigt-berar-baldinozzi-asymmetry |
|---|
| 26 | |
|---|
| 27 | _instrument.setup_wavelength 1.54816 |
|---|
| 28 | _instrument.setup_wavelength_2 0. |
|---|
| 29 | _instrument.setup_wavelength_2_to_1_ratio 0. |
|---|
| 30 | _instrument.calib_twotheta_offset 0. |
|---|
| 31 | _instrument.calib_sample_displacement 0. |
|---|
| 32 | _instrument.calib_sample_transparency 0. |
|---|
| 33 | |
|---|
| 34 | _absorption.type cylinder-hewat |
|---|
| 35 | _absorption.mu_r 0.0221 |
|---|
| 36 | |
|---|
| 37 | loop_ |
|---|
| 38 | _linked_structure.structure_id |
|---|
| 39 | _linked_structure.scale |
|---|
| 40 | yap 30 |
|---|
| 41 | alumina 0.1 |
|---|
| 42 | |
|---|
| 43 | loop_ |
|---|
| 44 | _excluded_region.id |
|---|
| 45 | _excluded_region.start |
|---|
| 46 | _excluded_region.end |
|---|
| 47 | 1 0. 4. |
|---|
| 48 | 2 153.95 180. |
|---|
| 49 | |
|---|
| 50 | _background.type line-segment |
|---|
| 51 | |
|---|
| 52 | loop_ |
|---|
| 53 | _background.id |
|---|
| 54 | _background.position |
|---|
| 55 | _background.intensity |
|---|
| 56 | 1 4.05 1303. |
|---|
| 57 | 2 5.95 2193.97203967 |
|---|
| 58 | 3 18.2 1997. |
|---|
| 59 | 4 37.35 2147.12281802 |
|---|
| 60 | 5 47.7 2092. |
|---|
| 61 | 6 59.25 1977. |
|---|
| 62 | 7 151.95 3468.48635134 |
|---|
| 63 | |
|---|
| 64 | loop_ |
|---|
| 65 | _data.two_theta |
|---|
| 66 | _data.id |
|---|
| 67 | _data.d_spacing |
|---|
| 68 | _data.intensity_meas |
|---|
| 69 | _data.intensity_meas_su |
|---|
| 70 | _data.intensity_calc |
|---|
| 71 | _data.intensity_bkg |
|---|
| 72 | _data.calc_status |
|---|
| 73 | 2. 1 0. 0. 1. 0. 0. excl |
|---|
| 74 | 2.05 2 0. 0. 1. 0. 0. excl |
|---|
| 75 | 2.1 3 0. 0. 1. 0. 0. excl |
|---|
| 76 | 2.15 4 0. 0. 1. 0. 0. excl |
|---|
| 77 | 2.2 5 0. 0. 1. 0. 0. excl |
|---|
| 78 | 2.25 6 0. 0. 1. 0. 0. excl |
|---|
| 79 | 2.3 7 0. 0. 1. 0. 0. excl |
|---|
| 80 | 2.35 8 0. 0. 1. 0. 0. excl |
|---|
| 81 | 2.4 9 0. 0. 1. 0. 0. excl |
|---|
| 82 | 2.45 10 0. 0. 1. 0. 0. excl |
|---|
| 83 | ... |
|---|
| 84 | 151.5 2991 0.79865385 3354. 57. 4902.79239884 3461.24612633 incl |
|---|
| 85 | 151.55 2992 0.79856544 3438. 58. 4938.57755495 3462.05059578 incl |
|---|
| 86 | 151.6 2993 0.79847719 3441. 58. 4948.05195479 3462.85506522 incl |
|---|
| 87 | 151.65 2994 0.79838912 3396. 58. 4927.349773 3463.65953467 incl |
|---|
| 88 | 151.7 2995 0.79830122 3429. 58. 4876.02736329 3464.46400411 incl |
|---|
| 89 | 151.75 2996 0.79821349 3448. 58. 4796.74526503 3465.26847356 incl |
|---|
| 90 | 151.8 2997 0.79812593 3532. 59. 4694.51730196 3466.072943 incl |
|---|
| 91 | 151.85 2998 0.79803854 3693. 60. 4575.78062248 3466.87741245 incl |
|---|
| 92 | 151.9 2999 0.79795132 3780. 61. 4447.50441615 3467.68188189 incl |
|---|
| 93 | 151.95 3000 0.79786427 3784. 61. 4316.44341414 3468.48635134 incl |
|---|
| 94 | |
|---|
| 95 | loop_ |
|---|
| 96 | _refln.id |
|---|
| 97 | _refln.structure_id |
|---|
| 98 | _refln.d_spacing |
|---|
| 99 | _refln.sin_theta_over_lambda |
|---|
| 100 | _refln.index_h |
|---|
| 101 | _refln.index_k |
|---|
| 102 | _refln.index_l |
|---|
| 103 | _refln.f_calc |
|---|
| 104 | _refln.f_squared_calc |
|---|
| 105 | _refln.two_theta |
|---|
| 106 | 1 yap 7.37 0.06784261 0 0 1 0. 0. 12.05792913 |
|---|
| 107 | 2 yap 5.33 0.09380863 0 1 0 0. 0. 16.7012855 |
|---|
| 108 | 3 yap 5.18 0.0965251 1 0 0 0. 0. 17.18852072 |
|---|
| 109 | 4 yap 4.31891055 0.11576994 0 1 1 0. 0. 20.64987025 |
|---|
| 110 | 5 yap 4.23794054 0.11798183 1 0 1 0.17288679 0.02988984 21.0488605 |
|---|
| 111 | 6 yap 3.71471093 0.13459998 1 1 0 0.10027655 0.01005539 24.05513521 |
|---|
| 112 | 7 yap 3.685 0.13568521 0 0 2 0.02219992 0.00049284 24.25201992 |
|---|
| 113 | 8 yap 3.31717219 0.15073079 1 1 1 0.86359044 0.74578846 26.98939657 |
|---|
| 114 | 9 yap 3.03110835 0.16495616 0 1 2 0. 0. 29.5920322 |
|---|
| 115 | 10 yap 3.00271487 0.16651598 1 0 2 0. 0. 29.878338 |
|---|
| 116 | ... |
|---|
| 117 | 365 alumina 0.81930006 0.61027702 4 -1 11 1.19108015 1.41867193 141.75014806 |
|---|
| 118 | 366 alumina 0.81616218 0.61262334 5 0 2 4.22226892 17.82755481 143.04165903 |
|---|
| 119 | 367 alumina 0.81529214 0.6132771 5 -2 -8 0.52947251 0.28034113 143.40934214 |
|---|
| 120 | 368 alumina 0.81138823 0.61622782 2 -1 15 5.6072072 31.44077264 145.11538603 |
|---|
| 121 | 369 alumina 0.80534833 0.62084936 4 0 10 0.67018386 0.44914641 147.96362502 |
|---|
| 122 | 370 alumina 0.79864545 0.62606004 4 -2 12 0.91581608 0.8387191 151.50474768 |
|---|
| 123 | 371 alumina 0.79738004 0.62705357 5 0 -4 0.18323927 0.03357663 152.22995668 |
|---|
| 124 | 372 alumina 0.79495324 0.62896781 3 -1 -14 2.05217352 4.21141616 153.68237943 |
|---|
| 125 | 373 alumina 0.79414921 0.6296046 1 0 16 2.43194259 5.91434477 154.18330783 |
|---|
| 126 | 374 alumina 0.79166667 0.63157895 6 -3 0 9.73709759 94.8110695 155.80110779 |
|---|
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"expt.show_as_text()"
]
},
{
"cell_type": "markdown",
"id": "49",
"metadata": {},
"source": [
"## π Perform Analysis\n",
"\n",
"### Display Initial Pattern"
]
},
{
"cell_type": "code",
"execution_count": 32,
"id": "50",
"metadata": {
"execution": {
"iopub.execute_input": "2026-09-22T21:04:23.307308Z",
"iopub.status.busy": "2026-09-22T21:04:23.307095Z",
"iopub.status.idle": "2026-09-22T21:04:23.397651Z",
"shell.execute_reply": "2026-09-22T21:04:23.396708Z"
},
"lines_to_next_cell": 2
},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"project.display.pattern(expt_name='yap_3k')"
]
},
{
"cell_type": "code",
"execution_count": 33,
"id": "51",
"metadata": {
"execution": {
"iopub.execute_input": "2026-09-22T21:04:23.404332Z",
"iopub.status.busy": "2026-09-22T21:04:23.404121Z",
"iopub.status.idle": "2026-09-22T21:04:23.458457Z",
"shell.execute_reply": "2026-09-22T21:04:23.457425Z"
}
},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"project.display.pattern(expt_name='yap_3k', x_min=134, x_max=146)"
]
},
{
"cell_type": "markdown",
"id": "52",
"metadata": {},
"source": [
"### Select Calculator"
]
},
{
"cell_type": "code",
"execution_count": 34,
"id": "53",
"metadata": {
"execution": {
"iopub.execute_input": "2026-09-22T21:04:23.460328Z",
"iopub.status.busy": "2026-09-22T21:04:23.460085Z",
"iopub.status.idle": "2026-09-22T21:04:23.467984Z",
"shell.execute_reply": "2026-09-22T21:04:23.467056Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1;36mCalculator types\u001b[0m\n"
]
},
{
"data": {
"text/html": [
" | | Type | Description |
|---|
| 1 | | crysfml | CrysFML library for crystallographic calculations |
|---|
| 2 | * | cryspy | CrysPy library for crystallographic calculations |
|---|
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"expt.calculator.show_supported()"
]
},
{
"cell_type": "code",
"execution_count": 35,
"id": "54",
"metadata": {
"execution": {
"iopub.execute_input": "2026-09-22T21:04:23.469943Z",
"iopub.status.busy": "2026-09-22T21:04:23.469702Z",
"iopub.status.idle": "2026-09-22T21:04:23.475332Z",
"shell.execute_reply": "2026-09-22T21:04:23.474456Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1;36mCalculator for experiment \u001b[0m\u001b[32m'yap_3k'\u001b[0m\u001b[1;36m already set to\u001b[0m\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"cryspy\n"
]
}
],
"source": [
"expt.calculator.type = 'cryspy'"
]
},
{
"cell_type": "markdown",
"id": "55",
"metadata": {},
"source": [
"### Select Minimizer"
]
},
{
"cell_type": "code",
"execution_count": 36,
"id": "56",
"metadata": {
"execution": {
"iopub.execute_input": "2026-09-22T21:04:23.477098Z",
"iopub.status.busy": "2026-09-22T21:04:23.476860Z",
"iopub.status.idle": "2026-09-22T21:04:23.484056Z",
"shell.execute_reply": "2026-09-22T21:04:23.483262Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1;36mMinimizer types\u001b[0m\n"
]
},
{
"data": {
"text/html": [
" | | Type | Description |
|---|
| 1 | | bumps | BUMPS library using the default Levenberg-Marquardt method |
|---|
| 2 | | bumps (amoeba) | BUMPS library with Nelder-Mead simplex method |
|---|
| 3 | | bumps (de) | BUMPS library with differential evolution method |
|---|
| 4 | | bumps (dream) | BUMPS library with DREAM Bayesian sampling |
|---|
| 5 | | bumps (lm) | BUMPS library with Levenberg-Marquardt method |
|---|
| 6 | | dfols | DFO-LS library for derivative-free least-squares optimization |
|---|
| 7 | | emcee | emcee affine-invariant ensemble Bayesian sampling |
|---|
| 8 | | lmfit | LMFIT library using the default Levenberg-Marquardt method |
|---|
| 9 | | lmfit (least_squares) | LMFIT library with SciPy's trust region reflective algorithm |
|---|
| 10 | * | lmfit (leastsq) | LMFIT library with Levenberg-Marquardt least squares method |
|---|
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"project.analysis.minimizer.show_supported()"
]
},
{
"cell_type": "code",
"execution_count": 37,
"id": "57",
"metadata": {
"execution": {
"iopub.execute_input": "2026-09-22T21:04:23.485688Z",
"iopub.status.busy": "2026-09-22T21:04:23.485515Z",
"iopub.status.idle": "2026-09-22T21:04:23.493099Z",
"shell.execute_reply": "2026-09-22T21:04:23.492323Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"β οΈ Switching minimizer type removes these settings:\n",
"β’ gradient_tolerance\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1;36mCurrent minimizer changed to\u001b[0m\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"bumps \u001b[1m(\u001b[0mlm\u001b[1m)\u001b[0m\n"
]
}
],
"source": [
"project.analysis.minimizer.type = 'bumps (lm)'"
]
},
{
"cell_type": "code",
"execution_count": 38,
"id": "58",
"metadata": {
"execution": {
"iopub.execute_input": "2026-09-22T21:04:23.495115Z",
"iopub.status.busy": "2026-09-22T21:04:23.494883Z",
"iopub.status.idle": "2026-09-22T21:04:23.498827Z",
"shell.execute_reply": "2026-09-22T21:04:23.498079Z"
}
},
"outputs": [],
"source": [
"project.analysis.minimizer.max_iterations = 500\n",
"project.analysis.minimizer.chi_square_change_tolerance = 1e-2"
]
},
{
"cell_type": "markdown",
"id": "59",
"metadata": {},
"source": [
"### Perform Fit 1/3: Cell, Scale, and Background\n",
"\n",
"First refine the independent cell lengths of both phases, both phase\n",
"scales, the instrument zero offset, and the automatically estimated\n",
"background intensities. Hexagonal symmetry couples the Al2O3 b length\n",
"to a, leaving only a and c independent."
]
},
{
"cell_type": "code",
"execution_count": 39,
"id": "60",
"metadata": {
"execution": {
"iopub.execute_input": "2026-09-22T21:04:23.500386Z",
"iopub.status.busy": "2026-09-22T21:04:23.500224Z",
"iopub.status.idle": "2026-09-22T21:04:23.505020Z",
"shell.execute_reply": "2026-09-22T21:04:23.503997Z"
}
},
"outputs": [],
"source": [
"yap.cell.length_a.free = True\n",
"yap.cell.length_b.free = True\n",
"yap.cell.length_c.free = True\n",
"\n",
"alumina.cell.length_a.free = True\n",
"alumina.cell.length_c.free = True\n",
"\n",
"expt.linked_structures['yap'].scale.free = True\n",
"expt.linked_structures['alumina'].scale.free = True\n",
"\n",
"expt.instrument.calib_twotheta_offset.free = True\n",
"\n",
"for point in expt.background:\n",
" point.intensity.free = True"
]
},
{
"cell_type": "code",
"execution_count": 40,
"id": "61",
"metadata": {
"execution": {
"iopub.execute_input": "2026-09-22T21:04:23.506641Z",
"iopub.status.busy": "2026-09-22T21:04:23.506478Z",
"iopub.status.idle": "2026-09-22T21:04:23.587450Z",
"shell.execute_reply": "2026-09-22T21:04:23.586444Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1;36mFree parameters for both structures \u001b[0m\u001b[1;36m(\u001b[0m\u001b[1;36mπ§© data blocks\u001b[0m\u001b[1;36m)\u001b[0m\u001b[1;36m and experiments \u001b[0m\u001b[1;36m(\u001b[0m\u001b[1;36mπ¬ data blocks\u001b[0m\u001b[1;36m)\u001b[0m\n"
]
},
{
"data": {
"text/html": [
" | datablock | category | entry | parameter | value | uncertainty | min | max | units |
|---|
| 1 | yap | cell | | length_a | 5.18000 | | -inf | inf | Γ
|
|---|
| 2 | yap | cell | | length_b | 5.33000 | | -inf | inf | Γ
|
|---|
| 3 | yap | cell | | length_c | 7.37000 | | -inf | inf | Γ
|
|---|
| 4 | alumina | cell | | length_a | 4.75000 | | -inf | inf | Γ
|
|---|
| 5 | alumina | cell | | length_c | 12.95000 | | -inf | inf | Γ
|
|---|
| 6 | yap_3k | linked_structure | yap | scale | 30.00000 | | -inf | inf | |
|---|
| 7 | yap_3k | linked_structure | alumina | scale | 0.10000 | | -inf | inf | |
|---|
| 8 | yap_3k | instrument | | twotheta_offset | 0.00000 | | -inf | inf | deg |
|---|
| 9 | yap_3k | background | 1 | intensity | 1303.00000 | | -inf | inf | |
|---|
| 10 | yap_3k | background | 2 | intensity | 2193.97204 | | -inf | inf | |
|---|
| 11 | yap_3k | background | 3 | intensity | 1997.00000 | | -inf | inf | |
|---|
| 12 | yap_3k | background | 4 | intensity | 2147.12282 | | -inf | inf | |
|---|
| 13 | yap_3k | background | 5 | intensity | 2092.00000 | | -inf | inf | |
|---|
| 14 | yap_3k | background | 6 | intensity | 1977.00000 | | -inf | inf | |
|---|
| 15 | yap_3k | background | 7 | intensity | 3468.48635 | | -inf | inf | |
|---|
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"project.display.parameters.free()"
]
},
{
"cell_type": "code",
"execution_count": 41,
"id": "62",
"metadata": {
"execution": {
"iopub.execute_input": "2026-09-22T21:04:23.589030Z",
"iopub.status.busy": "2026-09-22T21:04:23.588858Z",
"iopub.status.idle": "2026-09-22T21:04:41.548157Z",
"shell.execute_reply": "2026-09-22T21:04:41.547693Z"
}
},
"outputs": [
{
"data": {
"text/html": [],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
"(function() {\n",
" const button = document.getElementById('ed-fit-stop-51a658c36eb246788d85164950a1aa95-button');\n",
" const status = document.getElementById('ed-fit-stop-51a658c36eb246788d85164950a1aa95-status');\n",
" const kernelId = '';\n",
" if (!button) {\n",
" return;\n",
" }\n",
"\n",
" function setStatus(text) {\n",
" if (status) {\n",
" status.textContent = text;\n",
" }\n",
" }\n",
"\n",
" function pageConfig() {\n",
" const element = document.getElementById('jupyter-config-data');\n",
" if (!element || !element.textContent) {\n",
" return {};\n",
" }\n",
" try {\n",
" return JSON.parse(element.textContent);\n",
" } catch (error) {\n",
" return {};\n",
" }\n",
" }\n",
"\n",
" function baseUrl(config) {\n",
" const configured = config.baseUrl || config.base_url ||\n",
" (window.Jupyter && Jupyter.notebook && Jupyter.notebook.base_url);\n",
" if (configured) {\n",
" return configured.endsWith('/') ? configured : configured + '/';\n",
" }\n",
" const markers = ['/lab/', '/notebooks/', '/tree/'];\n",
" for (const marker of markers) {\n",
" const index = window.location.pathname.indexOf(marker);\n",
" if (index >= 0) {\n",
" return window.location.pathname.slice(0, index + 1);\n",
" }\n",
" }\n",
" return '/';\n",
" }\n",
"\n",
" function token(config) {\n",
" return config.token || new URLSearchParams(window.location.search).get('token') || '';\n",
" }\n",
"\n",
" function cookie(name) {\n",
" const prefix = name + '=';\n",
" for (const part of document.cookie.split(';')) {\n",
" const trimmed = part.trim();\n",
" if (trimmed.startsWith(prefix)) {\n",
" return decodeURIComponent(trimmed.slice(prefix.length));\n",
" }\n",
" }\n",
" return '';\n",
" }\n",
"\n",
" function notebookPath() {\n",
" const decoded = decodeURIComponent(window.location.pathname);\n",
" const markers = ['/lab/tree/', '/notebooks/', '/tree/'];\n",
" for (const marker of markers) {\n",
" const index = decoded.indexOf(marker);\n",
" if (index >= 0) {\n",
" return decoded.slice(index + marker.length);\n",
" }\n",
" }\n",
" return '';\n",
" }\n",
"\n",
" async function kernelFromSessions(config) {\n",
" const url = new URL(baseUrl(config) + 'api/sessions', window.location.origin);\n",
" const authToken = token(config);\n",
" if (authToken) {\n",
" url.searchParams.set('token', authToken);\n",
" }\n",
" const response = await fetch(url, {credentials: 'same-origin'});\n",
" if (!response.ok) {\n",
" return '';\n",
" }\n",
" const sessions = await response.json();\n",
" const path = notebookPath();\n",
" const session = sessions.find((item) => item.path === path) || sessions[0];\n",
" return session && session.kernel ? session.kernel.id : '';\n",
" }\n",
"\n",
" async function interruptKernel(config, resolvedKernelId) {\n",
" const url = new URL(\n",
" baseUrl(config) + 'api/kernels/' + resolvedKernelId + '/interrupt',\n",
" window.location.origin\n",
" );\n",
" const authToken = token(config);\n",
" if (authToken) {\n",
" url.searchParams.set('token', authToken);\n",
" }\n",
" const xsrfToken = cookie('_xsrf');\n",
" const headers = {};\n",
" if (xsrfToken) {\n",
" headers['X-XSRFToken'] = xsrfToken;\n",
" }\n",
" const response = await fetch(url, {\n",
" method: 'POST',\n",
" credentials: 'same-origin',\n",
" headers: headers\n",
" });\n",
" return response.ok;\n",
" }\n",
"\n",
" button.addEventListener('click', async function() {\n",
" button.disabled = true;\n",
" setStatus('Stopping...');\n",
" const config = pageConfig();\n",
" try {\n",
" const resolvedKernelId = kernelId || await kernelFromSessions(config);\n",
" if (!resolvedKernelId) {\n",
" throw new Error('Could not resolve the current kernel id.');\n",
" }\n",
" const interrupted = await interruptKernel(config, resolvedKernelId);\n",
" if (!interrupted) {\n",
" throw new Error('Jupyter Server rejected the interrupt request.');\n",
" }\n",
" setStatus('Interrupt sent...');\n",
" } catch (error) {\n",
" button.disabled = false;\n",
" setStatus('Use Kernel > Interrupt to stop this fit.');\n",
" }\n",
" });\n",
"})();\n"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1;36mStandard fitting\u001b[0m\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"π Using experiment π¬ \u001b[32m'yap_3k'\u001b[0m for \u001b[32m'single'\u001b[0m fitting\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"π Starting fit process with \u001b[32m'bumps \u001b[0m\u001b[32m(\u001b[0m\u001b[32mlm\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.37 | 1170.67 | |
|---|
| 2 | 17 | 2.61 | 266.00 | 77.3% β |
|---|
| 3 | 33 | 4.80 | 74.80 | 71.9% β |
|---|
| 4 | 49 | 7.37 | 66.39 | 11.3% β |
|---|
| 5 | 67 | 17.89 | 66.03 | |
|---|
"
],
"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;36m66.03\u001b[0m at iteration \u001b[1;36m67\u001b[0m\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"β
Fitting complete.\n"
]
}
],
"source": [
"project.analysis.fit()"
]
},
{
"cell_type": "code",
"execution_count": 42,
"id": "63",
"metadata": {
"execution": {
"iopub.execute_input": "2026-09-22T21:04:41.551119Z",
"iopub.status.busy": "2026-09-22T21:04:41.550882Z",
"iopub.status.idle": "2026-09-22T21:04:42.512545Z",
"shell.execute_reply": "2026-09-22T21:04:42.511373Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"βοΈ Settings used:\n"
]
},
{
"data": {
"text/html": [
" | Name | Value | Description |
|---|
| 1 | max_iterations | 500 | Maximum solver iterations. |
|---|
| 2 | chi_square_change_tolerance | 0.01 | Relative change in the objective (chi-square) used to stop fitting. |
|---|
| 3 | parameter_change_tolerance | 1e-08 | Relative change in fitted parameters used to stop fitting. |
|---|
"
],
"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 | bumps (lm) |
|---|
| 2 | β
Overall status | success |
|---|
| 3 | β±οΈ Fitting time (seconds) | 17.89 |
|---|
| 4 | π Goodness-of-fit (reduced ΟΒ²) | 66.03 |
|---|
| 5 | π R-factor (Rf, %) | 8.19 |
|---|
| 6 | π R-factor squared (RfΒ², %) | 10.54 |
|---|
| 7 | π Weighted R-factor (wR, %) | 10.63 |
|---|
"
],
"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 | yap | cell | | length_a | Γ
| 5.1800 | 5.1736 | 0.0001 | 0.12 % β |
|---|
| 2 | yap | cell | | length_b | Γ
| 5.3300 | 5.3278 | 0.0001 | 0.04 % β |
|---|
| 3 | yap | cell | | length_c | Γ
| 7.3700 | 7.3624 | 0.0001 | 0.10 % β |
|---|
| 4 | alumina | cell | | length_a | Γ
| 4.7500 | 4.7556 | 0.0012 | 0.12 % β |
|---|
| 5 | alumina | cell | | length_c | Γ
| 12.9500 | 12.9893 | 0.0063 | 0.30 % β |
|---|
| 6 | yap_3k | linked_structure | yap | scale | | 30.0000 | 27.0708 | 0.0851 | 9.76 % β |
|---|
| 7 | yap_3k | linked_structure | alumina | scale | | 0.1000 | 0.1940 | 0.0166 | 93.98 % β |
|---|
| 8 | yap_3k | instrument | | twotheta_offset | deg | 0.0000 | 0.0044 | 0.0010 | N/A |
|---|
| 9 | yap_3k | background | 1 | intensity | | 1303.0000 | 1364.5791 | 89.8261 | 4.73 % β |
|---|
| 10 | yap_3k | background | 2 | intensity | | 2193.9720 | 2366.3256 | 42.1391 | 7.86 % β |
|---|
| 11 | yap_3k | background | 3 | intensity | | 1997.0000 | 2014.4755 | 28.6320 | 0.88 % β |
|---|
| 12 | yap_3k | background | 4 | intensity | | 2147.1228 | 2231.3583 | 33.2468 | 3.92 % β |
|---|
| 13 | yap_3k | background | 5 | intensity | | 2092.0000 | 2238.6534 | 39.8940 | 7.01 % β |
|---|
| 14 | yap_3k | background | 6 | intensity | | 1977.0000 | 2069.8340 | 21.0995 | 4.70 % β |
|---|
| 15 | yap_3k | background | 7 | intensity | | 3468.4864 | 2414.2626 | 24.4757 | 30.39 % β |
|---|
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
" β’ start = parameter value before refinement
β’ value = refined value from least-squares minimization
β’ s.u. = standard uncertainty (one sigma), from the covariance matrix
β’ change = relative change from start, in %; β = increase, β = decrease
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"project.display.fit.results()"
]
},
{
"cell_type": "markdown",
"id": "64",
"metadata": {},
"source": [
"### Perform Fit 2/3: Peak Profile\n",
"\n",
"Add the Gaussian and Lorentzian broadening and asymmetry parameters\n",
"to the refinement. The background intensities remain free."
]
},
{
"cell_type": "code",
"execution_count": 43,
"id": "65",
"metadata": {
"execution": {
"iopub.execute_input": "2026-09-22T21:04:42.514430Z",
"iopub.status.busy": "2026-09-22T21:04:42.514249Z",
"iopub.status.idle": "2026-09-22T21:04:42.517978Z",
"shell.execute_reply": "2026-09-22T21:04:42.517023Z"
}
},
"outputs": [],
"source": [
"expt.peak.broad_gauss_u.free = True\n",
"expt.peak.broad_gauss_v.free = True\n",
"expt.peak.broad_gauss_w.free = True\n",
"expt.peak.broad_lorentz_y.free = True\n",
"\n",
"expt.peak.asym_beba_a0.free = True\n",
"# expt.peak.asym_beba_b0.free = True\n",
"# expt.peak.asym_beba_a1.free = True\n",
"expt.peak.asym_beba_b1.free = True"
]
},
{
"cell_type": "code",
"execution_count": 44,
"id": "66",
"metadata": {
"execution": {
"iopub.execute_input": "2026-09-22T21:04:42.519649Z",
"iopub.status.busy": "2026-09-22T21:04:42.519479Z",
"iopub.status.idle": "2026-09-22T21:04:42.718762Z",
"shell.execute_reply": "2026-09-22T21:04:42.717080Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1;36mFree parameters for both structures \u001b[0m\u001b[1;36m(\u001b[0m\u001b[1;36mπ§© data blocks\u001b[0m\u001b[1;36m)\u001b[0m\u001b[1;36m and experiments \u001b[0m\u001b[1;36m(\u001b[0m\u001b[1;36mπ¬ data blocks\u001b[0m\u001b[1;36m)\u001b[0m\n"
]
},
{
"data": {
"text/html": [
" | datablock | category | entry | parameter | value | uncertainty | min | max | units |
|---|
| 1 | yap | cell | | length_a | 5.17364 | 0.00007 | -inf | inf | Γ
|
|---|
| 2 | yap | cell | | length_b | 5.32778 | 0.00007 | -inf | inf | Γ
|
|---|
| 3 | yap | cell | | length_c | 7.36239 | 0.00010 | -inf | inf | Γ
|
|---|
| 4 | alumina | cell | | length_a | 4.75560 | 0.00119 | -inf | inf | Γ
|
|---|
| 5 | alumina | cell | | length_c | 12.98925 | 0.00626 | -inf | inf | Γ
|
|---|
| 6 | yap_3k | linked_structure | yap | scale | 27.07084 | 0.08509 | -inf | inf | |
|---|
| 7 | yap_3k | linked_structure | alumina | scale | 0.19398 | 0.01660 | -inf | inf | |
|---|
| 8 | yap_3k | peak | | asym_beba_a0 | 0.00000 | | -inf | inf | |
|---|
| 9 | yap_3k | peak | | asym_beba_b1 | 0.00000 | | -inf | inf | |
|---|
| 10 | yap_3k | peak | | broad_gauss_u | 0.04000 | | -inf | inf | degΒ² |
|---|
| 11 | yap_3k | peak | | broad_gauss_v | -0.05000 | | -inf | inf | degΒ² |
|---|
| 12 | yap_3k | peak | | broad_gauss_w | 0.10000 | | -inf | inf | degΒ² |
|---|
| 13 | yap_3k | peak | | broad_lorentz_y | 0.01000 | | -inf | inf | deg |
|---|
| 14 | yap_3k | instrument | | twotheta_offset | 0.00445 | 0.00096 | -inf | inf | deg |
|---|
| 15 | yap_3k | background | 1 | intensity | 1364.57909 | 89.82607 | -inf | inf | |
|---|
| 16 | yap_3k | background | 2 | intensity | 2366.32560 | 42.13908 | -inf | inf | |
|---|
| 17 | yap_3k | background | 3 | intensity | 2014.47546 | 28.63205 | -inf | inf | |
|---|
| 18 | yap_3k | background | 4 | intensity | 2231.35827 | 33.24678 | -inf | inf | |
|---|
| 19 | yap_3k | background | 5 | intensity | 2238.65341 | 39.89401 | -inf | inf | |
|---|
| 20 | yap_3k | background | 6 | intensity | 2069.83400 | 21.09954 | -inf | inf | |
|---|
| 21 | yap_3k | background | 7 | intensity | 2414.26259 | 24.47574 | -inf | inf | |
|---|
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"project.display.parameters.free()"
]
},
{
"cell_type": "code",
"execution_count": 45,
"id": "67",
"metadata": {
"execution": {
"iopub.execute_input": "2026-09-22T21:04:42.721939Z",
"iopub.status.busy": "2026-09-22T21:04:42.721660Z",
"iopub.status.idle": "2026-09-22T21:05:05.110761Z",
"shell.execute_reply": "2026-09-22T21:05:05.109854Z"
}
},
"outputs": [
{
"data": {
"text/html": [],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
"(function() {\n",
" const button = document.getElementById('ed-fit-stop-d1cec5444a684e82a74a360d28a74b0d-button');\n",
" const status = document.getElementById('ed-fit-stop-d1cec5444a684e82a74a360d28a74b0d-status');\n",
" const kernelId = '';\n",
" if (!button) {\n",
" return;\n",
" }\n",
"\n",
" function setStatus(text) {\n",
" if (status) {\n",
" status.textContent = text;\n",
" }\n",
" }\n",
"\n",
" function pageConfig() {\n",
" const element = document.getElementById('jupyter-config-data');\n",
" if (!element || !element.textContent) {\n",
" return {};\n",
" }\n",
" try {\n",
" return JSON.parse(element.textContent);\n",
" } catch (error) {\n",
" return {};\n",
" }\n",
" }\n",
"\n",
" function baseUrl(config) {\n",
" const configured = config.baseUrl || config.base_url ||\n",
" (window.Jupyter && Jupyter.notebook && Jupyter.notebook.base_url);\n",
" if (configured) {\n",
" return configured.endsWith('/') ? configured : configured + '/';\n",
" }\n",
" const markers = ['/lab/', '/notebooks/', '/tree/'];\n",
" for (const marker of markers) {\n",
" const index = window.location.pathname.indexOf(marker);\n",
" if (index >= 0) {\n",
" return window.location.pathname.slice(0, index + 1);\n",
" }\n",
" }\n",
" return '/';\n",
" }\n",
"\n",
" function token(config) {\n",
" return config.token || new URLSearchParams(window.location.search).get('token') || '';\n",
" }\n",
"\n",
" function cookie(name) {\n",
" const prefix = name + '=';\n",
" for (const part of document.cookie.split(';')) {\n",
" const trimmed = part.trim();\n",
" if (trimmed.startsWith(prefix)) {\n",
" return decodeURIComponent(trimmed.slice(prefix.length));\n",
" }\n",
" }\n",
" return '';\n",
" }\n",
"\n",
" function notebookPath() {\n",
" const decoded = decodeURIComponent(window.location.pathname);\n",
" const markers = ['/lab/tree/', '/notebooks/', '/tree/'];\n",
" for (const marker of markers) {\n",
" const index = decoded.indexOf(marker);\n",
" if (index >= 0) {\n",
" return decoded.slice(index + marker.length);\n",
" }\n",
" }\n",
" return '';\n",
" }\n",
"\n",
" async function kernelFromSessions(config) {\n",
" const url = new URL(baseUrl(config) + 'api/sessions', window.location.origin);\n",
" const authToken = token(config);\n",
" if (authToken) {\n",
" url.searchParams.set('token', authToken);\n",
" }\n",
" const response = await fetch(url, {credentials: 'same-origin'});\n",
" if (!response.ok) {\n",
" return '';\n",
" }\n",
" const sessions = await response.json();\n",
" const path = notebookPath();\n",
" const session = sessions.find((item) => item.path === path) || sessions[0];\n",
" return session && session.kernel ? session.kernel.id : '';\n",
" }\n",
"\n",
" async function interruptKernel(config, resolvedKernelId) {\n",
" const url = new URL(\n",
" baseUrl(config) + 'api/kernels/' + resolvedKernelId + '/interrupt',\n",
" window.location.origin\n",
" );\n",
" const authToken = token(config);\n",
" if (authToken) {\n",
" url.searchParams.set('token', authToken);\n",
" }\n",
" const xsrfToken = cookie('_xsrf');\n",
" const headers = {};\n",
" if (xsrfToken) {\n",
" headers['X-XSRFToken'] = xsrfToken;\n",
" }\n",
" const response = await fetch(url, {\n",
" method: 'POST',\n",
" credentials: 'same-origin',\n",
" headers: headers\n",
" });\n",
" return response.ok;\n",
" }\n",
"\n",
" button.addEventListener('click', async function() {\n",
" button.disabled = true;\n",
" setStatus('Stopping...');\n",
" const config = pageConfig();\n",
" try {\n",
" const resolvedKernelId = kernelId || await kernelFromSessions(config);\n",
" if (!resolvedKernelId) {\n",
" throw new Error('Could not resolve the current kernel id.');\n",
" }\n",
" const interrupted = await interruptKernel(config, resolvedKernelId);\n",
" if (!interrupted) {\n",
" throw new Error('Jupyter Server rejected the interrupt request.');\n",
" }\n",
" setStatus('Interrupt sent...');\n",
" } catch (error) {\n",
" button.disabled = false;\n",
" setStatus('Use Kernel > Interrupt to stop this fit.');\n",
" }\n",
" });\n",
"})();\n"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1;36mStandard fitting\u001b[0m\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"π Using experiment π¬ \u001b[32m'yap_3k'\u001b[0m for \u001b[32m'single'\u001b[0m fitting\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"π Starting fit process with \u001b[32m'bumps \u001b[0m\u001b[32m(\u001b[0m\u001b[32mlm\u001b[0m\u001b[32m)\u001b[0m\u001b[32m'\u001b[0m\u001b[33m...\u001b[0m\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"π Goodness-of-fit progress:\n"
]
},
{
"data": {
"text/html": [
" | iteration | time (s) | ΟΒ² | change / status |
|---|
| 1 | 1 | 0.15 | 66.17 | |
|---|
| 2 | 23 | 4.77 | 59.24 | 10.5% β |
|---|
| 3 | 45 | 9.89 | 58.60 | 1.1% β |
|---|
| 4 | 69 | 22.28 | 58.50 | |
|---|
"
],
"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;36m58.50\u001b[0m at iteration \u001b[1;36m69\u001b[0m\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"β
Fitting complete.\n"
]
}
],
"source": [
"project.analysis.fit()"
]
},
{
"cell_type": "code",
"execution_count": 46,
"id": "68",
"metadata": {
"execution": {
"iopub.execute_input": "2026-09-22T21:05:05.112359Z",
"iopub.status.busy": "2026-09-22T21:05:05.112151Z",
"iopub.status.idle": "2026-09-22T21:05:06.162011Z",
"shell.execute_reply": "2026-09-22T21:05:06.161153Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"βοΈ Settings used:\n"
]
},
{
"data": {
"text/html": [
" | Name | Value | Description |
|---|
| 1 | max_iterations | 500 | Maximum solver iterations. |
|---|
| 2 | chi_square_change_tolerance | 0.01 | Relative change in the objective (chi-square) used to stop fitting. |
|---|
| 3 | parameter_change_tolerance | 1e-08 | Relative change in fitted parameters used to stop fitting. |
|---|
"
],
"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 | bumps (lm) |
|---|
| 2 | β
Overall status | success |
|---|
| 3 | β±οΈ Fitting time (seconds) | 22.28 |
|---|
| 4 | π Goodness-of-fit (reduced ΟΒ²) | 58.50 |
|---|
| 5 | π R-factor (Rf, %) | 7.66 |
|---|
| 6 | π R-factor squared (RfΒ², %) | 10.03 |
|---|
| 7 | π Weighted R-factor (wR, %) | 9.99 |
|---|
"
],
"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 | yap | cell | | length_a | Γ
| 5.1736 | 5.1728 | 0.0001 | 0.02 % β |
|---|
| 2 | yap | cell | | length_b | Γ
| 5.3278 | 5.3270 | 0.0001 | 0.01 % β |
|---|
| 3 | yap | cell | | length_c | Γ
| 7.3624 | 7.3610 | 0.0002 | 0.02 % β |
|---|
| 4 | alumina | cell | | length_a | Γ
| 4.7556 | 4.7577 | 0.0011 | 0.04 % β |
|---|
| 5 | alumina | cell | | length_c | Γ
| 12.9893 | 12.9761 | 0.0059 | 0.10 % β |
|---|
| 6 | yap_3k | linked_structure | yap | scale | | 27.0708 | 28.0693 | 0.1137 | 3.69 % β |
|---|
| 7 | yap_3k | linked_structure | alumina | scale | | 0.1940 | 0.1941 | 0.0161 | 0.07 % β |
|---|
| 8 | yap_3k | peak | | asym_beba_a0 | | 0.0000 | -0.1818 | 0.0152 | N/A |
|---|
| 9 | yap_3k | peak | | asym_beba_b1 | | 0.0000 | -0.0612 | 0.0050 | N/A |
|---|
| 10 | yap_3k | peak | | broad_gauss_u | degΒ² | 0.0400 | 0.0364 | 0.0020 | 8.95 % β |
|---|
| 11 | yap_3k | peak | | broad_gauss_v | degΒ² | -0.0500 | -0.0510 | 0.0041 | 2.07 % β |
|---|
| 12 | yap_3k | peak | | broad_gauss_w | degΒ² | 0.1000 | 0.0985 | 0.0022 | 1.55 % β |
|---|
| 13 | yap_3k | peak | | broad_lorentz_y | deg | 0.0100 | 0.0298 | 0.0019 | 198.09 % β |
|---|
| 14 | yap_3k | instrument | | twotheta_offset | deg | 0.0044 | 0.0059 | 0.0027 | 33.39 % β |
|---|
| 15 | yap_3k | background | 1 | intensity | | 1364.5791 | 1368.9347 | 84.5448 | 0.32 % β |
|---|
| 16 | yap_3k | background | 2 | intensity | | 2366.3256 | 2355.8542 | 39.6696 | 0.44 % β |
|---|
| 17 | yap_3k | background | 3 | intensity | | 2014.4755 | 2037.0481 | 27.0053 | 1.12 % β |
|---|
| 18 | yap_3k | background | 4 | intensity | | 2231.3583 | 2140.9844 | 32.0606 | 4.05 % β |
|---|
| 19 | yap_3k | background | 5 | intensity | | 2238.6534 | 2025.1406 | 41.3151 | 9.54 % β |
|---|
| 20 | yap_3k | background | 6 | intensity | | 2069.8340 | 1954.5600 | 21.6874 | 5.57 % β |
|---|
| 21 | yap_3k | background | 7 | intensity | | 2414.2626 | 2293.7219 | 26.6836 | 4.99 % β |
|---|
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
" β’ start = parameter value before refinement
β’ value = refined value from least-squares minimization
β’ s.u. = standard uncertainty (one sigma), from the covariance matrix
β’ change = relative change from start, in %; β = increase, β = decrease
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"project.display.fit.results()"
]
},
{
"cell_type": "markdown",
"id": "69",
"metadata": {},
"source": [
"### Perform Fit 3/3: Model-Guided Background and Atom Parameters\n",
"\n",
"Replace the initial background with a new estimate based on the fitted\n",
"peak model. Automatically generated points are fixed by default, so\n",
"mark their intensities free before fitting them with the atom parameters."
]
},
{
"cell_type": "code",
"execution_count": 47,
"id": "70",
"metadata": {
"execution": {
"iopub.execute_input": "2026-09-22T21:05:06.163936Z",
"iopub.status.busy": "2026-09-22T21:05:06.163763Z",
"iopub.status.idle": "2026-09-22T21:05:06.190064Z",
"shell.execute_reply": "2026-09-22T21:05:06.189228Z"
}
},
"outputs": [],
"source": [
"expt.background.auto_estimate(use_model=True)"
]
},
{
"cell_type": "code",
"execution_count": 48,
"id": "71",
"metadata": {
"execution": {
"iopub.execute_input": "2026-09-22T21:05:06.191970Z",
"iopub.status.busy": "2026-09-22T21:05:06.191771Z",
"iopub.status.idle": "2026-09-22T21:05:06.199167Z",
"shell.execute_reply": "2026-09-22T21:05:06.198356Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1;36mLine-segment background points\u001b[0m\n"
]
},
{
"data": {
"text/html": [
" | Position | Intensity |
|---|
| 1 | 4.05000 | 1303.00000 |
|---|
| 2 | 5.85000 | 2173.00000 |
|---|
| 3 | 7.30000 | 2414.80830 |
|---|
| 4 | 17.85000 | 2010.28100 |
|---|
| 5 | 24.75000 | 2041.00000 |
|---|
| 6 | 35.00000 | 1968.46433 |
|---|
| 7 | 39.35000 | 1606.73948 |
|---|
| 8 | 41.45000 | 0.00000 |
|---|
| 9 | 43.95000 | 1695.97793 |
|---|
| 10 | 44.95000 | 2367.00000 |
|---|
| 11 | 47.65000 | 1691.86967 |
|---|
| 12 | 48.15000 | 1321.52032 |
|---|
| 13 | 51.60000 | 1934.23588 |
|---|
| 14 | 74.60000 | 1881.37866 |
|---|
| 15 | 101.10000 | 1996.38773 |
|---|
| 16 | 122.20000 | 1525.63663 |
|---|
| 17 | 129.65000 | 3108.73377 |
|---|
| 18 | 142.50000 | 2493.86153 |
|---|
| 19 | 144.75000 | 2295.53422 |
|---|
| 20 | 151.95000 | 2451.55313 |
|---|
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"expt.background.show()"
]
},
{
"cell_type": "code",
"execution_count": 49,
"id": "72",
"metadata": {
"execution": {
"iopub.execute_input": "2026-09-22T21:05:06.201089Z",
"iopub.status.busy": "2026-09-22T21:05:06.200903Z",
"iopub.status.idle": "2026-09-22T21:05:06.204490Z",
"shell.execute_reply": "2026-09-22T21:05:06.203657Z"
}
},
"outputs": [],
"source": [
"for point in expt.background:\n",
" point.intensity.free = True"
]
},
{
"cell_type": "markdown",
"id": "73",
"metadata": {},
"source": [
"Refine the independent Y and O coordinates in Pbnm and the\n",
"isotropic displacement parameters of both phases. Symmetry keeps Y\n",
"and O1 in YAlO3 at z = 1/4 and Al at the origin. For Al2O3, refine\n",
"Al1 z and O1 x. Occupancies remain fixed\n",
"at 1.0, and all coordinates fixed by symmetry remain fixed."
]
},
{
"cell_type": "code",
"execution_count": 50,
"id": "74",
"metadata": {
"execution": {
"iopub.execute_input": "2026-09-22T21:05:06.206144Z",
"iopub.status.busy": "2026-09-22T21:05:06.205947Z",
"iopub.status.idle": "2026-09-22T21:05:06.211425Z",
"shell.execute_reply": "2026-09-22T21:05:06.210440Z"
}
},
"outputs": [],
"source": [
"yap.atom_sites['Y'].fract_x.free = True\n",
"yap.atom_sites['Y'].fract_y.free = True\n",
"yap.atom_sites['O1'].fract_x.free = True\n",
"yap.atom_sites['O1'].fract_y.free = True\n",
"yap.atom_sites['O2'].fract_x.free = True\n",
"yap.atom_sites['O2'].fract_y.free = True\n",
"yap.atom_sites['O2'].fract_z.free = True\n",
"\n",
"alumina.atom_sites['Al1'].fract_z.free = True\n",
"alumina.atom_sites['O1'].fract_x.free = True\n",
"\n",
"for structure in (yap, alumina):\n",
" for atom in structure.atom_sites:\n",
" atom.adp_iso.free = True"
]
},
{
"cell_type": "code",
"execution_count": 51,
"id": "75",
"metadata": {
"execution": {
"iopub.execute_input": "2026-09-22T21:05:06.213064Z",
"iopub.status.busy": "2026-09-22T21:05:06.212860Z",
"iopub.status.idle": "2026-09-22T21:05:06.330795Z",
"shell.execute_reply": "2026-09-22T21:05:06.329928Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1;36mFree parameters for both structures \u001b[0m\u001b[1;36m(\u001b[0m\u001b[1;36mπ§© data blocks\u001b[0m\u001b[1;36m)\u001b[0m\u001b[1;36m and experiments \u001b[0m\u001b[1;36m(\u001b[0m\u001b[1;36mπ¬ data blocks\u001b[0m\u001b[1;36m)\u001b[0m\n"
]
},
{
"data": {
"text/html": [
" | datablock | category | entry | parameter | value | uncertainty | min | max | units |
|---|
| 1 | yap | cell | | length_a | 5.17278 | 0.00012 | -inf | inf | Γ
|
|---|
| 2 | yap | cell | | length_b | 5.32698 | 0.00012 | -inf | inf | Γ
|
|---|
| 3 | yap | cell | | length_c | 7.36105 | 0.00017 | -inf | inf | Γ
|
|---|
| 4 | yap | atom_site | Y | fract_x | 0.01000 | | -inf | inf | |
|---|
| 5 | yap | atom_site | Y | fract_y | 0.55000 | | -inf | inf | |
|---|
| 6 | yap | atom_site | Y | adp_iso | 0.12000 | | -inf | inf | Γ
Β² |
|---|
| 7 | yap | atom_site | Al | adp_iso | 0.13000 | | -inf | inf | Γ
Β² |
|---|
| 8 | yap | atom_site | O1 | fract_x | -0.08000 | | -inf | inf | |
|---|
| 9 | yap | atom_site | O1 | fract_y | -0.02000 | | -inf | inf | |
|---|
| 10 | yap | atom_site | O1 | adp_iso | 0.06000 | | -inf | inf | Γ
Β² |
|---|
| 11 | yap | atom_site | O2 | fract_x | 0.20000 | | -inf | inf | |
|---|
| 12 | yap | atom_site | O2 | fract_y | 0.29000 | | -inf | inf | |
|---|
| 13 | yap | atom_site | O2 | fract_z | 0.04000 | | -inf | inf | |
|---|
| 14 | yap | atom_site | O2 | adp_iso | 0.14000 | | -inf | inf | Γ
Β² |
|---|
| 15 | alumina | cell | | length_a | 4.75771 | 0.00112 | -inf | inf | Γ
|
|---|
| 16 | alumina | cell | | length_c | 12.97614 | 0.00589 | -inf | inf | Γ
|
|---|
| 17 | alumina | atom_site | Al1 | fract_z | 0.33351 | | -inf | inf | |
|---|
| 18 | alumina | atom_site | Al1 | adp_iso | 0.10000 | | -inf | inf | Γ
Β² |
|---|
| 19 | alumina | atom_site | O1 | fract_x | 0.35030 | | -inf | inf | |
|---|
| 20 | alumina | atom_site | O1 | adp_iso | 1.22884 | | -inf | inf | Γ
Β² |
|---|
| 21 | yap_3k | linked_structure | yap | scale | 28.06935 | 0.11372 | -inf | inf | |
|---|
| 22 | yap_3k | linked_structure | alumina | scale | 0.19413 | 0.01609 | -inf | inf | |
|---|
| 23 | yap_3k | peak | | asym_beba_a0 | -0.18183 | 0.01524 | -inf | inf | |
|---|
| 24 | yap_3k | peak | | asym_beba_b1 | -0.06117 | 0.00501 | -inf | inf | |
|---|
| 25 | yap_3k | peak | | broad_gauss_u | 0.03642 | 0.00197 | -inf | inf | degΒ² |
|---|
| 26 | yap_3k | peak | | broad_gauss_v | -0.05103 | 0.00409 | -inf | inf | degΒ² |
|---|
| 27 | yap_3k | peak | | broad_gauss_w | 0.09845 | 0.00218 | -inf | inf | degΒ² |
|---|
| 28 | yap_3k | peak | | broad_lorentz_y | 0.02981 | 0.00192 | -inf | inf | deg |
|---|
| 29 | yap_3k | instrument | | twotheta_offset | 0.00593 | 0.00268 | -inf | inf | deg |
|---|
| 30 | yap_3k | background | 1 | intensity | 1303.00000 | | -inf | inf | |
|---|
| 31 | yap_3k | background | 2 | intensity | 2173.00000 | | -inf | inf | |
|---|
| 32 | yap_3k | background | 3 | intensity | 2414.80830 | | -inf | inf | |
|---|
| 33 | yap_3k | background | 4 | intensity | 2010.28100 | | -inf | inf | |
|---|
| 34 | yap_3k | background | 5 | intensity | 2041.00000 | | -inf | inf | |
|---|
| 35 | yap_3k | background | 6 | intensity | 1968.46433 | | -inf | inf | |
|---|
| 36 | yap_3k | background | 7 | intensity | 1606.73948 | | -inf | inf | |
|---|
| 37 | yap_3k | background | 8 | intensity | 0.00000 | | -inf | inf | |
|---|
| 38 | yap_3k | background | 9 | intensity | 1695.97793 | | -inf | inf | |
|---|
| 39 | yap_3k | background | 10 | intensity | 2367.00000 | | -inf | inf | |
|---|
| 40 | yap_3k | background | 11 | intensity | 1691.86967 | | -inf | inf | |
|---|
| 41 | yap_3k | background | 12 | intensity | 1321.52032 | | -inf | inf | |
|---|
| 42 | yap_3k | background | 13 | intensity | 1934.23588 | | -inf | inf | |
|---|
| 43 | yap_3k | background | 14 | intensity | 1881.37866 | | -inf | inf | |
|---|
| 44 | yap_3k | background | 15 | intensity | 1996.38773 | | -inf | inf | |
|---|
| 45 | yap_3k | background | 16 | intensity | 1525.63663 | | -inf | inf | |
|---|
| 46 | yap_3k | background | 17 | intensity | 3108.73377 | | -inf | inf | |
|---|
| 47 | yap_3k | background | 18 | intensity | 2493.86153 | | -inf | inf | |
|---|
| 48 | yap_3k | background | 19 | intensity | 2295.53422 | | -inf | inf | |
|---|
| 49 | yap_3k | background | 20 | intensity | 2451.55313 | | -inf | inf | |
|---|
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"project.display.parameters.free()"
]
},
{
"cell_type": "code",
"execution_count": 52,
"id": "76",
"metadata": {
"execution": {
"iopub.execute_input": "2026-09-22T21:05:06.332520Z",
"iopub.status.busy": "2026-09-22T21:05:06.332319Z",
"iopub.status.idle": "2026-09-22T21:05:50.132959Z",
"shell.execute_reply": "2026-09-22T21:05:50.132144Z"
}
},
"outputs": [
{
"data": {
"text/html": [],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
"(function() {\n",
" const button = document.getElementById('ed-fit-stop-9ca8bdf908c14bd6bec8b8a6241728df-button');\n",
" const status = document.getElementById('ed-fit-stop-9ca8bdf908c14bd6bec8b8a6241728df-status');\n",
" const kernelId = '';\n",
" if (!button) {\n",
" return;\n",
" }\n",
"\n",
" function setStatus(text) {\n",
" if (status) {\n",
" status.textContent = text;\n",
" }\n",
" }\n",
"\n",
" function pageConfig() {\n",
" const element = document.getElementById('jupyter-config-data');\n",
" if (!element || !element.textContent) {\n",
" return {};\n",
" }\n",
" try {\n",
" return JSON.parse(element.textContent);\n",
" } catch (error) {\n",
" return {};\n",
" }\n",
" }\n",
"\n",
" function baseUrl(config) {\n",
" const configured = config.baseUrl || config.base_url ||\n",
" (window.Jupyter && Jupyter.notebook && Jupyter.notebook.base_url);\n",
" if (configured) {\n",
" return configured.endsWith('/') ? configured : configured + '/';\n",
" }\n",
" const markers = ['/lab/', '/notebooks/', '/tree/'];\n",
" for (const marker of markers) {\n",
" const index = window.location.pathname.indexOf(marker);\n",
" if (index >= 0) {\n",
" return window.location.pathname.slice(0, index + 1);\n",
" }\n",
" }\n",
" return '/';\n",
" }\n",
"\n",
" function token(config) {\n",
" return config.token || new URLSearchParams(window.location.search).get('token') || '';\n",
" }\n",
"\n",
" function cookie(name) {\n",
" const prefix = name + '=';\n",
" for (const part of document.cookie.split(';')) {\n",
" const trimmed = part.trim();\n",
" if (trimmed.startsWith(prefix)) {\n",
" return decodeURIComponent(trimmed.slice(prefix.length));\n",
" }\n",
" }\n",
" return '';\n",
" }\n",
"\n",
" function notebookPath() {\n",
" const decoded = decodeURIComponent(window.location.pathname);\n",
" const markers = ['/lab/tree/', '/notebooks/', '/tree/'];\n",
" for (const marker of markers) {\n",
" const index = decoded.indexOf(marker);\n",
" if (index >= 0) {\n",
" return decoded.slice(index + marker.length);\n",
" }\n",
" }\n",
" return '';\n",
" }\n",
"\n",
" async function kernelFromSessions(config) {\n",
" const url = new URL(baseUrl(config) + 'api/sessions', window.location.origin);\n",
" const authToken = token(config);\n",
" if (authToken) {\n",
" url.searchParams.set('token', authToken);\n",
" }\n",
" const response = await fetch(url, {credentials: 'same-origin'});\n",
" if (!response.ok) {\n",
" return '';\n",
" }\n",
" const sessions = await response.json();\n",
" const path = notebookPath();\n",
" const session = sessions.find((item) => item.path === path) || sessions[0];\n",
" return session && session.kernel ? session.kernel.id : '';\n",
" }\n",
"\n",
" async function interruptKernel(config, resolvedKernelId) {\n",
" const url = new URL(\n",
" baseUrl(config) + 'api/kernels/' + resolvedKernelId + '/interrupt',\n",
" window.location.origin\n",
" );\n",
" const authToken = token(config);\n",
" if (authToken) {\n",
" url.searchParams.set('token', authToken);\n",
" }\n",
" const xsrfToken = cookie('_xsrf');\n",
" const headers = {};\n",
" if (xsrfToken) {\n",
" headers['X-XSRFToken'] = xsrfToken;\n",
" }\n",
" const response = await fetch(url, {\n",
" method: 'POST',\n",
" credentials: 'same-origin',\n",
" headers: headers\n",
" });\n",
" return response.ok;\n",
" }\n",
"\n",
" button.addEventListener('click', async function() {\n",
" button.disabled = true;\n",
" setStatus('Stopping...');\n",
" const config = pageConfig();\n",
" try {\n",
" const resolvedKernelId = kernelId || await kernelFromSessions(config);\n",
" if (!resolvedKernelId) {\n",
" throw new Error('Could not resolve the current kernel id.');\n",
" }\n",
" const interrupted = await interruptKernel(config, resolvedKernelId);\n",
" if (!interrupted) {\n",
" throw new Error('Jupyter Server rejected the interrupt request.');\n",
" }\n",
" setStatus('Interrupt sent...');\n",
" } catch (error) {\n",
" button.disabled = false;\n",
" setStatus('Use Kernel > Interrupt to stop this fit.');\n",
" }\n",
" });\n",
"})();\n"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1;36mStandard fitting\u001b[0m\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"π Using experiment π¬ \u001b[32m'yap_3k'\u001b[0m for \u001b[32m'single'\u001b[0m fitting\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"π Starting fit process with \u001b[32m'bumps \u001b[0m\u001b[32m(\u001b[0m\u001b[32mlm\u001b[0m\u001b[32m)\u001b[0m\u001b[32m'\u001b[0m\u001b[33m...\u001b[0m\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"π Goodness-of-fit progress:\n"
]
},
{
"data": {
"text/html": [
" | iteration | time (s) | ΟΒ² | change / status |
|---|
| 1 | 1 | 0.14 | 78.60 | |
|---|
| 2 | 51 | 9.00 | 9.93 | 87.4% β |
|---|
| 3 | 101 | 17.52 | 9.28 | 6.6% β |
|---|
| 4 | 153 | 43.73 | 9.25 | |
|---|
"
],
"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;36m9.25\u001b[0m at iteration \u001b[1;36m153\u001b[0m\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"β
Fitting complete.\n"
]
}
],
"source": [
"project.analysis.fit()"
]
},
{
"cell_type": "markdown",
"id": "77",
"metadata": {},
"source": [
"### Inspect Results\n",
"\n",
"Review the fit statistics, refined parameters, and correlations.\n",
"Inspect the full pattern and a closer view with impurity reflections."
]
},
{
"cell_type": "code",
"execution_count": 53,
"id": "78",
"metadata": {
"execution": {
"iopub.execute_input": "2026-09-22T21:05:50.134878Z",
"iopub.status.busy": "2026-09-22T21:05:50.134670Z",
"iopub.status.idle": "2026-09-22T21:05:50.799003Z",
"shell.execute_reply": "2026-09-22T21:05:50.798357Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"βοΈ Settings used:\n"
]
},
{
"data": {
"text/html": [
" | Name | Value | Description |
|---|
| 1 | max_iterations | 500 | Maximum solver iterations. |
|---|
| 2 | chi_square_change_tolerance | 0.01 | Relative change in the objective (chi-square) used to stop fitting. |
|---|
| 3 | parameter_change_tolerance | 1e-08 | Relative change in fitted parameters used to stop fitting. |
|---|
"
],
"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 | bumps (lm) |
|---|
| 2 | β
Overall status | success |
|---|
| 3 | β±οΈ Fitting time (seconds) | 43.73 |
|---|
| 4 | π Goodness-of-fit (reduced ΟΒ²) | 9.25 |
|---|
| 5 | π R-factor (Rf, %) | 3.13 |
|---|
| 6 | π R-factor squared (RfΒ², %) | 3.71 |
|---|
| 7 | π Weighted R-factor (wR, %) | 3.96 |
|---|
"
],
"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 | yap | cell | | length_a | Γ
| 5.1728 | 5.1728 | 0.0000 | 0.00 % β |
|---|
| 2 | yap | cell | | length_b | Γ
| 5.3270 | 5.3271 | 0.0000 | 0.00 % β |
|---|
| 3 | yap | cell | | length_c | Γ
| 7.3610 | 7.3613 | 0.0001 | 0.00 % β |
|---|
| 4 | yap | atom_site | Y | fract_x | | 0.0100 | 0.0123 | 0.0001 | 22.93 % β |
|---|
| 5 | yap | atom_site | Y | fract_y | | 0.5500 | 0.5541 | 0.0001 | 0.74 % β |
|---|
| 6 | yap | atom_site | Y | adp_iso | Γ
Β² | 0.1200 | 0.0711 | 0.0086 | 40.77 % β |
|---|
| 7 | yap | atom_site | Al | adp_iso | Γ
Β² | 0.1300 | 0.0938 | 0.0149 | 27.81 % β |
|---|
| 8 | yap | atom_site | O1 | fract_x | | -0.0800 | -0.0839 | 0.0001 | 4.91 % β |
|---|
| 9 | yap | atom_site | O1 | fract_y | | -0.0200 | -0.0219 | 0.0001 | 9.38 % β |
|---|
| 10 | yap | atom_site | O1 | adp_iso | Γ
Β² | 0.0600 | 0.0280 | 0.0096 | 53.41 % β |
|---|
| 11 | yap | atom_site | O2 | fract_x | | 0.2000 | 0.2047 | 0.0001 | 2.33 % β |
|---|
| 12 | yap | atom_site | O2 | fract_y | | 0.2900 | 0.2948 | 0.0001 | 1.64 % β |
|---|
| 13 | yap | atom_site | O2 | fract_z | | 0.0400 | 0.0442 | 0.0001 | 10.53 % β |
|---|
| 14 | yap | atom_site | O2 | adp_iso | Γ
Β² | 0.1400 | 0.0894 | 0.0075 | 36.17 % β |
|---|
| 15 | alumina | cell | | length_a | Γ
| 4.7577 | 4.7580 | 0.0004 | 0.01 % β |
|---|
| 16 | alumina | cell | | length_c | Γ
| 12.9761 | 12.9748 | 0.0024 | 0.01 % β |
|---|
| 17 | alumina | atom_site | Al1 | fract_z | | 0.3335 | 0.3409 | 0.0036 | 2.22 % β |
|---|
| 18 | alumina | atom_site | Al1 | adp_iso | Γ
Β² | 0.1000 | 0.0789 | 0.3262 | 21.13 % β |
|---|
| 19 | alumina | atom_site | O1 | fract_x | | 0.3503 | 0.3402 | 0.0077 | 2.88 % β |
|---|
| 20 | alumina | atom_site | O1 | adp_iso | Γ
Β² | 1.2288 | 1.0775 | 0.2565 | 12.32 % β |
|---|
| 21 | yap_3k | linked_structure | yap | scale | | 28.0693 | 28.0057 | 0.0755 | 0.23 % β |
|---|
| 22 | yap_3k | linked_structure | alumina | scale | | 0.1941 | 0.1847 | 0.0123 | 4.87 % β |
|---|
| 23 | yap_3k | peak | | asym_beba_a0 | | -0.1818 | -0.1825 | 0.0064 | 0.35 % β |
|---|
| 24 | yap_3k | peak | | asym_beba_b1 | | -0.0612 | -0.0596 | 0.0021 | 2.51 % β |
|---|
| 25 | yap_3k | peak | | broad_gauss_u | degΒ² | 0.0364 | 0.0303 | 0.0007 | 16.83 % β |
|---|
| 26 | yap_3k | peak | | broad_gauss_v | degΒ² | -0.0510 | -0.0458 | 0.0015 | 10.26 % β |
|---|
| 27 | yap_3k | peak | | broad_gauss_w | degΒ² | 0.0985 | 0.0964 | 0.0009 | 2.03 % β |
|---|
| 28 | yap_3k | peak | | broad_lorentz_y | deg | 0.0298 | 0.0326 | 0.0009 | 9.53 % β |
|---|
| 29 | yap_3k | instrument | | twotheta_offset | deg | 0.0059 | 0.0084 | 0.0011 | 42.18 % β |
|---|
| 30 | yap_3k | background | 1 | intensity | | 1303.0000 | 1389.3685 | 36.3054 | 6.63 % β |
|---|
| 31 | yap_3k | background | 2 | intensity | | 2173.0000 | 2260.6485 | 32.2917 | 4.03 % β |
|---|
| 32 | yap_3k | background | 3 | intensity | | 2414.8083 | 2363.8752 | 17.4837 | 2.11 % β |
|---|
| 33 | yap_3k | background | 4 | intensity | | 2010.2810 | 2000.3479 | 14.0653 | 0.49 % β |
|---|
| 34 | yap_3k | background | 5 | intensity | | 2041.0000 | 2093.0766 | 14.7535 | 2.55 % β |
|---|
| 35 | yap_3k | background | 6 | intensity | | 1968.4643 | 2089.9668 | 18.0042 | 6.17 % β |
|---|
| 36 | yap_3k | background | 7 | intensity | | 1606.7395 | 2267.8070 | 28.6865 | 41.14 % β |
|---|
| 37 | yap_3k | background | 8 | intensity | | 0.0000 | 1651.2100 | 51.4432 | N/A |
|---|
| 38 | yap_3k | background | 9 | intensity | | 1695.9779 | 2069.5408 | 49.6652 | 22.03 % β |
|---|
| 39 | yap_3k | background | 10 | intensity | | 2367.0000 | 2093.7316 | 38.8953 | 11.54 % β |
|---|
| 40 | yap_3k | background | 11 | intensity | | 1691.8697 | 2062.8503 | 34.5231 | 21.93 % β |
|---|
| 41 | yap_3k | background | 12 | intensity | | 1321.5203 | 1738.0206 | 37.4917 | 31.52 % β |
|---|
| 42 | yap_3k | background | 13 | intensity | | 1934.2359 | 2008.8316 | 14.0618 | 3.86 % β |
|---|
| 43 | yap_3k | background | 14 | intensity | | 1881.3787 | 2028.2740 | 12.7842 | 7.81 % β |
|---|
| 44 | yap_3k | background | 15 | intensity | | 1996.3877 | 2072.5901 | 13.5330 | 3.82 % β |
|---|
| 45 | yap_3k | background | 16 | intensity | | 1525.6366 | 1925.4302 | 15.7703 | 26.21 % β |
|---|
| 46 | yap_3k | background | 17 | intensity | | 3108.7338 | 2266.1180 | 24.4631 | 27.10 % β |
|---|
| 47 | yap_3k | background | 18 | intensity | | 2493.8615 | 2561.2009 | 23.8398 | 2.70 % β |
|---|
| 48 | yap_3k | background | 19 | intensity | | 2295.5342 | 2546.2284 | 28.5615 | 10.92 % β |
|---|
| 49 | yap_3k | background | 20 | intensity | | 2451.5531 | 2754.9245 | 37.8898 | 12.37 % β |
|---|
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
" β’ start = parameter value before refinement
β’ value = refined value from least-squares minimization
β’ s.u. = standard uncertainty (one sigma), from the covariance matrix
β’ change = relative change from start, in %; β = increase, β = decrease
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"β οΈ Red s.u.: exceeds the refined value (consider adding constraints)
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"project.display.fit.results()"
]
},
{
"cell_type": "code",
"execution_count": 54,
"id": "79",
"metadata": {
"execution": {
"iopub.execute_input": "2026-09-22T21:05:50.800718Z",
"iopub.status.busy": "2026-09-22T21:05:50.800548Z",
"iopub.status.idle": "2026-09-22T21:05:50.830659Z",
"shell.execute_reply": "2026-09-22T21:05:50.829894Z"
}
},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
""
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"project.display.fit.correlations()"
]
},
{
"cell_type": "code",
"execution_count": 55,
"id": "80",
"metadata": {
"execution": {
"iopub.execute_input": "2026-09-22T21:05:50.832717Z",
"iopub.status.busy": "2026-09-22T21:05:50.832472Z",
"iopub.status.idle": "2026-09-22T21:05:50.908963Z",
"shell.execute_reply": "2026-09-22T21:05:50.908086Z"
}
},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"project.display.pattern(expt_name='yap_3k')"
]
},
{
"cell_type": "code",
"execution_count": 56,
"id": "81",
"metadata": {
"execution": {
"iopub.execute_input": "2026-09-22T21:05:50.915454Z",
"iopub.status.busy": "2026-09-22T21:05:50.915253Z",
"iopub.status.idle": "2026-09-22T21:05:51.278178Z",
"shell.execute_reply": "2026-09-22T21:05:51.277052Z"
}
},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"project.display.pattern(expt_name='yap_3k', x_min=134, x_max=146)"
]
},
{
"cell_type": "markdown",
"id": "82",
"metadata": {},
"source": [
"## πΎ Save Project\n",
"\n",
"Save the refined model and analysis results in the project directory."
]
},
{
"cell_type": "code",
"execution_count": 57,
"id": "83",
"metadata": {
"execution": {
"iopub.execute_input": "2026-09-22T21:05:51.279854Z",
"iopub.status.busy": "2026-09-22T21:05:51.279667Z",
"iopub.status.idle": "2026-09-22T21:05:51.668554Z",
"shell.execute_reply": "2026-09-22T21:05:51.667625Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1;36mSaving project π¦ \u001b[0m\u001b[32m'yap_3k'\u001b[0m\u001b[1;36m to \u001b[0m\u001b[32m'../../../projects/refine-yap-3k'\u001b[0m\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"βββ π project.edi\n",
"βββ π structures/\n",
"β βββ π yap.edi\n",
"β βββ π alumina.edi\n",
"βββ π experiments/\n",
"β βββ π yap_3k.edi\n",
"βββ π analysis/\n",
"β βββ π analysis.edi\n",
"βββ π reports/\n",
" βββ π yap_3k.html\n"
]
}
],
"source": [
"project.save()"
]
}
],
"metadata": {
"jupytext": {
"cell_metadata_filter": "-all",
"main_language": "python",
"notebook_metadata_filter": "-all"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.14.6"
}
},
"nbformat": 4,
"nbformat_minor": 5
}