{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "0", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:32:42.586894Z", "iopub.status.busy": "2026-06-30T22:32:42.586744Z", "iopub.status.idle": "2026-06-30T22:32:42.591299Z", "shell.execute_reply": "2026-06-30T22:32:42.590398Z" }, "tags": [ "hide-in-docs" ] }, "outputs": [], "source": [ "# Check whether easydiffraction is installed; install it if needed.\n", "# Required for remote environments such as Google Colab.\n", "import importlib.util\n", "\n", "if importlib.util.find_spec('easydiffraction') is None:\n", " %pip install easydiffraction==0.19.1" ] }, { "cell_type": "markdown", "id": "1", "metadata": {}, "source": [ "# Structure Refinement: LBCO, HRPT\n", "\n", "This example demonstrates how to use the EasyDiffraction API in a\n", "simplified, user-friendly manner that closely follows the GUI workflow\n", "for a Rietveld refinement of La0.5Ba0.5CoO3 crystal structure using\n", "constant wavelength neutron powder diffraction data from HRPT at PSI.\n", "\n", "It is intended for users with minimal programming experience who want\n", "to learn how to perform standard crystal structure fitting using\n", "diffraction data. This script covers creating a project, adding\n", "crystal structures and experiments, performing analysis, and refining\n", "parameters.\n", "\n", "Only a single import of `easydiffraction` is required, and all\n", "operations are performed through high-level components of the\n", "`project` object, such as `project.structures`,\n", "`project.experiments`, and `project.analysis`. The `project` object is\n", "the main container for all information." ] }, { "cell_type": "markdown", "id": "2", "metadata": {}, "source": [ "## πŸ› οΈ Import Library" ] }, { "cell_type": "code", "execution_count": 2, "id": "3", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:32:42.593314Z", "iopub.status.busy": "2026-06-30T22:32:42.593151Z", "iopub.status.idle": "2026-06-30T22:32:45.459772Z", "shell.execute_reply": "2026-06-30T22:32:45.458950Z" } }, "outputs": [], "source": [ "import easydiffraction as edi" ] }, { "cell_type": "markdown", "id": "4", "metadata": {}, "source": [ "## πŸ“¦ Define Project\n", "\n", "This section explains how to create a project and define its metadata." ] }, { "cell_type": "markdown", "id": "5", "metadata": {}, "source": [ "### Create Project" ] }, { "cell_type": "code", "execution_count": 3, "id": "6", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:32:45.462000Z", "iopub.status.busy": "2026-06-30T22:32:45.461704Z", "iopub.status.idle": "2026-06-30T22:32:45.674011Z", "shell.execute_reply": "2026-06-30T22:32:45.673314Z" } }, "outputs": [], "source": [ "project = edi.Project(name='lbco_hrpt')" ] }, { "cell_type": "markdown", "id": "7", "metadata": {}, "source": [ "### Set Project Metadata" ] }, { "cell_type": "code", "execution_count": 4, "id": "8", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:32:45.676166Z", "iopub.status.busy": "2026-06-30T22:32:45.675986Z", "iopub.status.idle": "2026-06-30T22:32:45.679216Z", "shell.execute_reply": "2026-06-30T22:32:45.678504Z" } }, "outputs": [], "source": [ "project.metadata.title = 'La0.5Ba0.5CoO3 at HRPT@PSI'\n", "project.metadata.description = \"\"\"This project demonstrates a standard\n", "refinement of La0.5Ba0.5CoO3, which crystallizes in a perovskite-type\n", "structure, using neutron powder diffraction data collected in constant\n", "wavelength mode at the HRPT diffractometer (PSI).\"\"\"" ] }, { "cell_type": "markdown", "id": "9", "metadata": {}, "source": [ "### Show Project Metadata as Text" ] }, { "cell_type": "code", "execution_count": 5, "id": "10", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:32:45.681082Z", "iopub.status.busy": "2026-06-30T22:32:45.680910Z", "iopub.status.idle": "2026-06-30T22:32:45.695743Z", "shell.execute_reply": "2026-06-30T22:32:45.694867Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mProject πŸ“¦ \u001b[0m\u001b[32m'lbco_hrpt'\u001b[0m\u001b[1;36m metadata as text\u001b[0m\n" ] }, { "data": { "text/html": [ "
Edi
1_metadata.name lbco_hrpt
2_metadata.title "La0.5Ba0.5CoO3 at HRPT@PSI"
3_metadata.description
4;
5This project demonstrates a standard refinement of
6La0.5Ba0.5CoO3, which crystallizes in a perovskite-type
7structure, using neutron powder diffraction data collected
8in constant wavelength mode at the HRPT diffractometer
9(PSI).
10;
11_metadata.created "30 Jun 2026 22:32:45"
12_metadata.last_modified "30 Jun 2026 22:32:45"
13_metadata.timestamp ?
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.metadata.show_as_text()" ] }, { "cell_type": "markdown", "id": "11", "metadata": {}, "source": [ "### Save Project\n", "\n", "When saving the project for the first time, you need to specify the\n", "directory path." ] }, { "cell_type": "code", "execution_count": 6, "id": "12", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:32:45.697474Z", "iopub.status.busy": "2026-06-30T22:32:45.697232Z", "iopub.status.idle": "2026-06-30T22:32:45.756290Z", "shell.execute_reply": "2026-06-30T22:32:45.755386Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mSaving project πŸ“¦ \u001b[0m\u001b[32m'lbco_hrpt'\u001b[0m\u001b[1;36m to \u001b[0m\u001b[32m'../../../projects/refine-lbco-hrpt-report'\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "β”œβ”€β”€ πŸ“„ project.edi\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "β”œβ”€β”€ πŸ“ structures/\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "β”œβ”€β”€ πŸ“ experiments/\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "β”œβ”€β”€ πŸ“ analysis/\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "β”‚ └── πŸ“„ analysis.edi\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "└── πŸ“ reports/\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ " └── πŸ“„ lbco_hrpt.html\n" ] } ], "source": [ "project.save_as(dir_path='projects/refine-lbco-hrpt-report')" ] }, { "cell_type": "markdown", "id": "13", "metadata": {}, "source": [ "## 🧩 Define Structure\n", "\n", "This section shows how to add structures and modify their\n", "parameters." ] }, { "cell_type": "markdown", "id": "14", "metadata": {}, "source": [ "### Add Structure" ] }, { "cell_type": "code", "execution_count": 7, "id": "15", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:32:45.757912Z", "iopub.status.busy": "2026-06-30T22:32:45.757735Z", "iopub.status.idle": "2026-06-30T22:32:45.761232Z", "shell.execute_reply": "2026-06-30T22:32:45.760345Z" } }, "outputs": [], "source": [ "project.structures.create(name='lbco')" ] }, { "cell_type": "markdown", "id": "16", "metadata": {}, "source": [ "### Show Defined Structures\n", "\n", "Show the names of the crystal structures added. These names are used\n", "to access the structure using the syntax:\n", "`project.structures[name]`. All structure parameters can be accessed\n", "via the `project` object." ] }, { "cell_type": "code", "execution_count": 8, "id": "17", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:32:45.762877Z", "iopub.status.busy": "2026-06-30T22:32:45.762705Z", "iopub.status.idle": "2026-06-30T22:32:45.767581Z", "shell.execute_reply": "2026-06-30T22:32:45.766935Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mDefined structures 🧩\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1m[\u001b[0m\u001b[32m'lbco'\u001b[0m\u001b[1m]\u001b[0m\n" ] } ], "source": [ "project.structures.show_names()" ] }, { "cell_type": "markdown", "id": "18", "metadata": {}, "source": [ "### Set Space Group\n", "\n", "Modify the default space group parameters." ] }, { "cell_type": "code", "execution_count": 9, "id": "19", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:32:45.769415Z", "iopub.status.busy": "2026-06-30T22:32:45.769249Z", "iopub.status.idle": "2026-06-30T22:32:45.772180Z", "shell.execute_reply": "2026-06-30T22:32:45.771538Z" } }, "outputs": [], "source": [ "project.structures['lbco'].space_group.name_h_m = 'P m -3 m'\n", "project.structures['lbco'].space_group.coord_system_code = '1'" ] }, { "cell_type": "markdown", "id": "20", "metadata": {}, "source": [ "### Set Unit Cell\n", "\n", "Modify the default unit cell parameters." ] }, { "cell_type": "code", "execution_count": 10, "id": "21", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:32:45.773983Z", "iopub.status.busy": "2026-06-30T22:32:45.773813Z", "iopub.status.idle": "2026-06-30T22:32:45.776518Z", "shell.execute_reply": "2026-06-30T22:32:45.775968Z" } }, "outputs": [], "source": [ "project.structures['lbco'].cell.length_a = 3.88" ] }, { "cell_type": "markdown", "id": "22", "metadata": {}, "source": [ "### Set Atom Sites\n", "\n", "Add atom sites to the structure." ] }, { "cell_type": "code", "execution_count": 11, "id": "23", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:32:45.778369Z", "iopub.status.busy": "2026-06-30T22:32:45.778199Z", "iopub.status.idle": "2026-06-30T22:32:45.784638Z", "shell.execute_reply": "2026-06-30T22:32:45.783804Z" } }, "outputs": [], "source": [ "project.structures['lbco'].atom_sites.create(\n", " id='La',\n", " type_symbol='La',\n", " fract_x=0,\n", " fract_y=0,\n", " fract_z=0,\n", " adp_iso=0.5,\n", " occupancy=0.5,\n", ")\n", "project.structures['lbco'].atom_sites.create(\n", " id='Ba',\n", " type_symbol='Ba',\n", " fract_x=0,\n", " fract_y=0,\n", " fract_z=0,\n", " adp_iso=0.5,\n", " occupancy=0.5,\n", ")\n", "project.structures['lbco'].atom_sites.create(\n", " id='Co',\n", " type_symbol='Co',\n", " fract_x=0.5,\n", " fract_y=0.5,\n", " fract_z=0.5,\n", " adp_iso=0.5,\n", ")\n", "project.structures['lbco'].atom_sites.create(\n", " id='O',\n", " type_symbol='O',\n", " fract_x=0,\n", " fract_y=0.5,\n", " fract_z=0.5,\n", " adp_iso=0.5,\n", ")" ] }, { "cell_type": "markdown", "id": "24", "metadata": {}, "source": [ "### Show Structure as Text" ] }, { "cell_type": "code", "execution_count": 12, "id": "25", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:32:45.786184Z", "iopub.status.busy": "2026-06-30T22:32:45.786017Z", "iopub.status.idle": "2026-06-30T22:32:46.240837Z", "shell.execute_reply": "2026-06-30T22:32:46.239993Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mStructure 🧩 \u001b[0m\u001b[32m'lbco'\u001b[0m\u001b[1;36m as text\u001b[0m\n" ] }, { "data": { "text/html": [ "
Edi
1data_lbco
2
3_cell.length_a 3.88
4_cell.length_b 3.88
5_cell.length_c 3.88
6_cell.angle_alpha 90.
7_cell.angle_beta 90.
8_cell.angle_gamma 90.
9
10_space_group.name_h_m "P m -3 m"
11_space_group.coord_system_code 1
12
13_geom.min_bond_distance_cutoff 0.
14_geom.bond_distance_inc 0.25
15
16loop_
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
27La La 0. 0. 0. a 1 0.5 0.5 Biso
28Ba Ba 0. 0. 0. a 1 0.5 0.5 Biso
29Co Co 0.5 0.5 0.5 b 1 1. 0.5 Biso
30O O 0. 0.5 0.5 c 3 1. 0.5 Biso
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.structures['lbco'].show_as_text()" ] }, { "cell_type": "markdown", "id": "26", "metadata": {}, "source": [ "### Display Structure\n", "\n", "EasyDiffraction can draw the structure that has just been defined. The\n", "renderer engine is selected through `project.rendering_structure`. The default `auto`\n", "engine resolves to an interactive `threejs` view inside Jupyter and a\n", "compact `ascii` schematic in a terminal." ] }, { "cell_type": "code", "execution_count": 13, "id": "27", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:32:46.242497Z", "iopub.status.busy": "2026-06-30T22:32:46.242328Z", "iopub.status.idle": "2026-06-30T22:32:46.249994Z", "shell.execute_reply": "2026-06-30T22:32:46.249186Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mRendering Structure types\u001b[0m\n" ] }, { "data": { "text/html": [ "
TypeDescription
1*autoEnvironment default structure-view engine
2asciiConsole ASCII schematic structure view
3threejsInteractive Three.js 3D structure view
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.rendering_structure.show_supported()" ] }, { "cell_type": "markdown", "id": "28", "metadata": {}, "source": [ "Show all public attributes of the structure rendering engine." ] }, { "cell_type": "code", "execution_count": 14, "id": "29", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:32:46.251654Z", "iopub.status.busy": "2026-06-30T22:32:46.251485Z", "iopub.status.idle": "2026-06-30T22:32:46.261435Z", "shell.execute_reply": "2026-06-30T22:32:46.260591Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mProperties\u001b[0m\n" ] }, { "data": { "text/html": [ "
NameWritableDescription
1as_cifReturn the CIF text for this rendering_structure category.
2parametersAll GenericDescriptorBase instances on this item.
3typeβœ“Active factory tag for this category.
4unique_nameFully qualified name: datablock, category, entry.
5viewerLive structure-view facade bound to the active engine.
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mMethods\u001b[0m\n" ] }, { "data": { "text/html": [ "
NameDescription
1from_cif()Populate this category from a CIF block, rebinding engine.
2help()Print parameters, other properties, and methods.
3show_supported()Print supported types and mark the active one.
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.rendering_structure.help()" ] }, { "cell_type": "markdown", "id": "30", "metadata": {}, "source": [ "Visual styling β€” the atom view and colour scheme β€” is configured on\n", "`project.structure_style`." ] }, { "cell_type": "code", "execution_count": 15, "id": "31", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:32:46.263007Z", "iopub.status.busy": "2026-06-30T22:32:46.262838Z", "iopub.status.idle": "2026-06-30T22:32:46.274057Z", "shell.execute_reply": "2026-06-30T22:32:46.273425Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mAtom View types\u001b[0m\n" ] }, { "data": { "text/html": [ "
ValueDescription
1vdwVan der Waals radius balls
2*covalentCovalent radius balls
3ionicIonic (Shannon) radius balls
4adpADP probability surfaces (spheres / ellipsoids)
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mColor Scheme types\u001b[0m\n" ] }, { "data": { "text/html": [ "
ValueDescription
1*jmolJmol / CPK colour scheme
2vestaVESTA colour scheme
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.structure_style.atom_view.show_supported()\n", "project.structure_style.color_scheme.show_supported()" ] }, { "cell_type": "code", "execution_count": 16, "id": "32", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:32:46.276080Z", "iopub.status.busy": "2026-06-30T22:32:46.275916Z", "iopub.status.idle": "2026-06-30T22:32:46.278857Z", "shell.execute_reply": "2026-06-30T22:32:46.278071Z" } }, "outputs": [], "source": [ "project.structure_style.atom_view = 'adp'\n", "project.structure_style.color_scheme = 'jmol'" ] }, { "cell_type": "markdown", "id": "33", "metadata": {}, "source": [ "Bonds are generated automatically between atoms whose separation lies\n", "within the per-structure cutoffs stored on `structure.geom`." ] }, { "cell_type": "code", "execution_count": 17, "id": "34", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:32:46.280257Z", "iopub.status.busy": "2026-06-30T22:32:46.280108Z", "iopub.status.idle": "2026-06-30T22:32:46.283203Z", "shell.execute_reply": "2026-06-30T22:32:46.282395Z" } }, "outputs": [], "source": [ "project.structures['lbco'].geom.min_bond_distance_cutoff = 0.5\n", "project.structures['lbco'].geom.bond_distance_inc = 0.25" ] }, { "cell_type": "markdown", "id": "35", "metadata": {}, "source": [ "List which features the structure data and the active engine can draw." ] }, { "cell_type": "code", "execution_count": 18, "id": "36", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:32:46.284964Z", "iopub.status.busy": "2026-06-30T22:32:46.284825Z", "iopub.status.idle": "2026-06-30T22:32:46.298300Z", "shell.execute_reply": "2026-06-30T22:32:46.297154Z" } }, "outputs": [ { "data": { "text/html": [ "
OptionDescriptionAvailableAuto
1atomsAtoms as spheres, occupancy wedges, or ADP ellipsoids.yesyes
2bondsBonds between atoms within the per-structure cutoffs.yesyes
3cellUnit-cell edges.yesyes
4axesThe a/b/c axis triad.yesyes
5momentsMagnetic-moment arrows (no moment data in version 1).nono
6labelsAtom labels at each site.yesno
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.display.show_structure_options(struct_name='lbco')" ] }, { "cell_type": "markdown", "id": "37", "metadata": {}, "source": [ "Draw the structure. With `include='auto'` (the default) every available\n", "feature is shown; a specific tuple such as `('atoms', 'bonds', 'cell')`\n", "can be requested instead." ] }, { "cell_type": "code", "execution_count": 19, "id": "38", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:32:46.300001Z", "iopub.status.busy": "2026-06-30T22:32:46.299763Z", "iopub.status.idle": "2026-06-30T22:32:46.336290Z", "shell.execute_reply": "2026-06-30T22:32:46.335505Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mStructure 🧩 \u001b[0m\u001b[32m'lbco'\u001b[0m\u001b[1;36m \u001b[0m\u001b[1;36m(\u001b[0m\u001b[1;36mAtom view type: \u001b[0m\u001b[32m'adp'\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='lbco')" ] }, { "cell_type": "markdown", "id": "39", "metadata": {}, "source": [ "For a quick text schematic, switch to the `ascii` engine explicitly,\n", "then restore the automatic default." ] }, { "cell_type": "code", "execution_count": 20, "id": "40", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:32:46.337856Z", "iopub.status.busy": "2026-06-30T22:32:46.337698Z", "iopub.status.idle": "2026-06-30T22:32:46.342661Z", "shell.execute_reply": "2026-06-30T22:32:46.341966Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mCurrent engine changed to\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\u001b[32m'ascii'\u001b[0m\n" ] } ], "source": [ "project.rendering_structure.type = 'ascii'" ] }, { "cell_type": "code", "execution_count": 21, "id": "41", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:32:46.344471Z", "iopub.status.busy": "2026-06-30T22:32:46.344327Z", "iopub.status.idle": "2026-06-30T22:32:46.364535Z", "shell.execute_reply": "2026-06-30T22:32:46.363698Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mStructure 🧩 \u001b[0m\u001b[32m'lbco'\u001b[0m\u001b[1;36m \u001b[0m\u001b[1;36m(\u001b[0m\u001b[1;36mAtom view type: \u001b[0m\u001b[32m'adp'\u001b[0m\u001b[1;36m)\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\n", " b\n", " ↑\n", "\n", " \u001b[38;5;117m●\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;196m●\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;117m●\u001b[0m\n", " \u001b[38;5;145mβ”‚\u001b[0m \u001b[38;5;145mβ”‚\u001b[0m\n", " \u001b[38;5;145mβ”‚\u001b[0m \u001b[38;5;145mβ”‚\u001b[0m\n", " \u001b[38;5;145mβ”‚\u001b[0m \u001b[38;5;145mβ”‚\u001b[0m\n", " \u001b[38;5;145mβ”‚\u001b[0m \u001b[38;5;145mβ”‚\u001b[0m\n", " \u001b[38;5;145mβ”‚\u001b[0m \u001b[38;5;145mβ”‚\u001b[0m\n", " \u001b[38;5;145mβ”‚\u001b[0m \u001b[38;5;145mβ”‚\u001b[0m\n", " \u001b[38;5;145mβ”‚\u001b[0m \u001b[38;5;145mβ”‚\u001b[0m\n", " \u001b[38;5;145mβ”‚\u001b[0m \u001b[38;5;145mβ”‚\u001b[0m\n", " \u001b[38;5;145mβ”‚\u001b[0m \u001b[38;5;145mβ”‚\u001b[0m\n", " \u001b[38;5;196m●\u001b[0m \u001b[38;5;196m●\u001b[0m \u001b[38;5;196m●\u001b[0m\n", " \u001b[38;5;145mβ”‚\u001b[0m \u001b[38;5;145mβ”‚\u001b[0m\n", " \u001b[38;5;145mβ”‚\u001b[0m \u001b[38;5;145mβ”‚\u001b[0m\n", " \u001b[38;5;145mβ”‚\u001b[0m \u001b[38;5;145mβ”‚\u001b[0m\n", " \u001b[38;5;145mβ”‚\u001b[0m \u001b[38;5;145mβ”‚\u001b[0m\n", " \u001b[38;5;145mβ”‚\u001b[0m \u001b[38;5;145mβ”‚\u001b[0m\n", " \u001b[38;5;145mβ”‚\u001b[0m \u001b[38;5;145mβ”‚\u001b[0m\n", " \u001b[38;5;145mβ”‚\u001b[0m \u001b[38;5;145mβ”‚\u001b[0m\n", " \u001b[38;5;145mβ”‚\u001b[0m \u001b[38;5;145mβ”‚\u001b[0m\n", " \u001b[38;5;145mβ”‚\u001b[0m \u001b[38;5;145mβ”‚\u001b[0m\n", " \u001b[38;5;145mβ”‚\u001b[0m \u001b[38;5;145mβ”‚\u001b[0m\n", " \u001b[38;5;117m●\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;196m●\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;145m─\u001b[0m\u001b[38;5;117m●\u001b[0m β†’ a\n", "\n", "\n", "\n", "Legend: \u001b[38;5;217m● Co\u001b[0m \u001b[38;5;196m● O\u001b[0m \u001b[38;5;117m● La/Ba\u001b[0m\n" ] } ], "source": [ "project.display.structure(struct_name='lbco')" ] }, { "cell_type": "code", "execution_count": 22, "id": "42", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:32:46.366441Z", "iopub.status.busy": "2026-06-30T22:32:46.366288Z", "iopub.status.idle": "2026-06-30T22:32:46.371744Z", "shell.execute_reply": "2026-06-30T22:32:46.370936Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mCurrent engine changed to\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\u001b[32m'threejs'\u001b[0m\n" ] } ], "source": [ "project.rendering_structure.type = 'auto'" ] }, { "cell_type": "markdown", "id": "43", "metadata": {}, "source": [ "### Save Project State\n", "\n", "Save the project state after adding the structure. This ensures\n", "that all changes are stored and can be accessed later. The project\n", "state is saved in the directory specified during project creation." ] }, { "cell_type": "code", "execution_count": 23, "id": "44", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:32:46.373186Z", "iopub.status.busy": "2026-06-30T22:32:46.373017Z", "iopub.status.idle": "2026-06-30T22:32:46.434699Z", "shell.execute_reply": "2026-06-30T22:32:46.433871Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mSaving project πŸ“¦ \u001b[0m\u001b[32m'lbco_hrpt'\u001b[0m\u001b[1;36m to \u001b[0m\u001b[32m'../../../projects/refine-lbco-hrpt-report'\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "β”œβ”€β”€ πŸ“„ project.edi\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "β”œβ”€β”€ πŸ“ structures/\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "β”‚ └── πŸ“„ lbco.edi\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "β”œβ”€β”€ πŸ“ experiments/\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "β”œβ”€β”€ πŸ“ analysis/\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "β”‚ └── πŸ“„ analysis.edi\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "└── πŸ“ reports/\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ " └── πŸ“„ lbco_hrpt.html\n" ] } ], "source": [ "project.save()" ] }, { "cell_type": "markdown", "id": "45", "metadata": {}, "source": [ "## πŸ”¬ Define Experiment\n", "\n", "This section shows how to add experiments, configure their parameters,\n", "and link the structures defined in the previous step." ] }, { "cell_type": "markdown", "id": "46", "metadata": {}, "source": [ "### Download Data\n", "\n", "Download the data file from the EasyDiffraction repository on GitHub." ] }, { "cell_type": "code", "execution_count": 24, "id": "47", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:32:46.436583Z", "iopub.status.busy": "2026-06-30T22:32:46.436230Z", "iopub.status.idle": "2026-06-30T22:32:46.442770Z", "shell.execute_reply": "2026-06-30T22:32:46.441869Z" } }, "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-lbco-hrpt'\u001b[0m: La0.5Ba0.5CoO3, HRPT \u001b[1m(\u001b[0mPSI\u001b[1m)\u001b[0m, \u001b[1;36m300\u001b[0m K\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "βœ… Data \u001b[32m'meas-lbco-hrpt'\u001b[0m already present at \u001b[32m'../../../data/meas-lbco-hrpt.xye'\u001b[0m. Keeping existing.\n" ] } ], "source": [ "data_path = edi.download_data('meas-lbco-hrpt', destination='data')" ] }, { "cell_type": "markdown", "id": "48", "metadata": {}, "source": [ "### Create Experiment" ] }, { "cell_type": "code", "execution_count": 25, "id": "49", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:32:46.444255Z", "iopub.status.busy": "2026-06-30T22:32:46.444084Z", "iopub.status.idle": "2026-06-30T22:32:46.942002Z", "shell.execute_reply": "2026-06-30T22:32:46.941182Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mData loaded successfully\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Experiment πŸ”¬ \u001b[32m'hrpt'\u001b[0m. Number of data points: \u001b[1;36m3098\u001b[0m.\n" ] } ], "source": [ "project.experiments.add_from_data_path(\n", " name='hrpt',\n", " data_path=data_path,\n", " sample_form='powder',\n", " beam_mode='constant wavelength',\n", " radiation_probe='neutron',\n", ")" ] }, { "cell_type": "markdown", "id": "50", "metadata": {}, "source": [ "### Show Defined Experiments" ] }, { "cell_type": "code", "execution_count": 26, "id": "51", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:32:46.943539Z", "iopub.status.busy": "2026-06-30T22:32:46.943373Z", "iopub.status.idle": "2026-06-30T22:32:46.948669Z", "shell.execute_reply": "2026-06-30T22:32:46.947731Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mDefined experiments πŸ”¬\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1m[\u001b[0m\u001b[32m'hrpt'\u001b[0m\u001b[1m]\u001b[0m\n" ] } ], "source": [ "project.experiments.show_names()" ] }, { "cell_type": "markdown", "id": "52", "metadata": {}, "source": [ "### Show Measured Data" ] }, { "cell_type": "code", "execution_count": 27, "id": "53", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:32:46.950332Z", "iopub.status.busy": "2026-06-30T22:32:46.950083Z", "iopub.status.idle": "2026-06-30T22:32:47.008931Z", "shell.execute_reply": "2026-06-30T22:32:47.008039Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "⚠️ No linked structures defined. Returning empty pattern. \n" ] }, { "data": { "text/html": [ "
Loading plot…
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.display.pattern(expt_name='hrpt')" ] }, { "cell_type": "markdown", "id": "54", "metadata": {}, "source": [ "### Set Instrument\n", "\n", "Modify the default instrument parameters." ] }, { "cell_type": "code", "execution_count": 28, "id": "55", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:32:47.010640Z", "iopub.status.busy": "2026-06-30T22:32:47.010478Z", "iopub.status.idle": "2026-06-30T22:32:47.014045Z", "shell.execute_reply": "2026-06-30T22:32:47.013027Z" } }, "outputs": [], "source": [ "project.experiments['hrpt'].instrument.setup_wavelength = 1.494\n", "project.experiments['hrpt'].instrument.calib_twotheta_offset = 0.6" ] }, { "cell_type": "markdown", "id": "56", "metadata": {}, "source": [ "### Set Peak Profile\n", "\n", "Show supported peak profile types." ] }, { "cell_type": "code", "execution_count": 29, "id": "57", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:32:47.015564Z", "iopub.status.busy": "2026-06-30T22:32:47.015398Z", "iopub.status.idle": "2026-06-30T22:32:47.022932Z", "shell.execute_reply": "2026-06-30T22:32:47.022102Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mPeak types\u001b[0m\n" ] }, { "data": { "text/html": [ "
TypeDescription
1*pseudo-voigtCWL pseudo-Voigt profile
2pseudo-voigt + berar-baldinozzi asymmetryCWL pseudo-Voigt profile with Berar-Baldinozzi asymmetry correction.
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.experiments['hrpt'].peak.show_supported()" ] }, { "cell_type": "markdown", "id": "58", "metadata": {}, "source": [ "Select the desired peak profile type." ] }, { "cell_type": "code", "execution_count": 30, "id": "59", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:32:47.024824Z", "iopub.status.busy": "2026-06-30T22:32:47.024664Z", "iopub.status.idle": "2026-06-30T22:32:47.030345Z", "shell.execute_reply": "2026-06-30T22:32:47.029350Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mPeak profile type for experiment \u001b[0m\u001b[32m'hrpt'\u001b[0m\u001b[1;36m changed to\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "pseudo-voigt\n" ] } ], "source": [ "project.experiments['hrpt'].peak.type = 'pseudo-voigt'" ] }, { "cell_type": "markdown", "id": "60", "metadata": {}, "source": [ "Modify default peak profile parameters." ] }, { "cell_type": "code", "execution_count": 31, "id": "61", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:32:47.031811Z", "iopub.status.busy": "2026-06-30T22:32:47.031662Z", "iopub.status.idle": "2026-06-30T22:32:47.035443Z", "shell.execute_reply": "2026-06-30T22:32:47.034540Z" } }, "outputs": [], "source": [ "project.experiments['hrpt'].peak.broad_gauss_u = 0.1\n", "project.experiments['hrpt'].peak.broad_gauss_v = -0.1\n", "project.experiments['hrpt'].peak.broad_gauss_w = 0.1\n", "project.experiments['hrpt'].peak.broad_lorentz_x = 0\n", "project.experiments['hrpt'].peak.broad_lorentz_y = 0.1" ] }, { "cell_type": "markdown", "id": "62", "metadata": {}, "source": [ "### Set Background" ] }, { "cell_type": "markdown", "id": "63", "metadata": {}, "source": [ "Show supported background types." ] }, { "cell_type": "code", "execution_count": 32, "id": "64", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:32:47.036872Z", "iopub.status.busy": "2026-06-30T22:32:47.036724Z", "iopub.status.idle": "2026-06-30T22:32:47.043414Z", "shell.execute_reply": "2026-06-30T22:32:47.042706Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mBackground types\u001b[0m\n" ] }, { "data": { "text/html": [ "
TypeDescription
1chebyshevChebyshev polynomial background
2*line-segmentLinear interpolation between points
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.experiments['hrpt'].background.show_supported()" ] }, { "cell_type": "markdown", "id": "65", "metadata": {}, "source": [ "Select the desired background type." ] }, { "cell_type": "code", "execution_count": 33, "id": "66", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:32:47.045562Z", "iopub.status.busy": "2026-06-30T22:32:47.045403Z", "iopub.status.idle": "2026-06-30T22:32:47.049866Z", "shell.execute_reply": "2026-06-30T22:32:47.049152Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mBackground type for experiment \u001b[0m\u001b[32m'hrpt'\u001b[0m\u001b[1;36m already set to\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "line-segment\n" ] } ], "source": [ "project.experiments['hrpt'].background.type = 'line-segment'" ] }, { "cell_type": "markdown", "id": "67", "metadata": {}, "source": [ "Add background points." ] }, { "cell_type": "code", "execution_count": 34, "id": "68", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:32:47.051302Z", "iopub.status.busy": "2026-06-30T22:32:47.051145Z", "iopub.status.idle": "2026-06-30T22:32:47.056616Z", "shell.execute_reply": "2026-06-30T22:32:47.055719Z" } }, "outputs": [], "source": [ "project.experiments['hrpt'].background.create(id='10', position=10, intensity=170)\n", "project.experiments['hrpt'].background.create(id='30', position=30, intensity=170)\n", "project.experiments['hrpt'].background.create(id='50', position=50, intensity=170)\n", "project.experiments['hrpt'].background.create(id='110', position=110, intensity=170)\n", "project.experiments['hrpt'].background.create(id='165', position=165, intensity=170)" ] }, { "cell_type": "markdown", "id": "69", "metadata": {}, "source": [ "Show current background points." ] }, { "cell_type": "code", "execution_count": 35, "id": "70", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:32:47.058254Z", "iopub.status.busy": "2026-06-30T22:32:47.058070Z", "iopub.status.idle": "2026-06-30T22:32:47.065616Z", "shell.execute_reply": "2026-06-30T22:32:47.064688Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mLine-segment background points\u001b[0m\n" ] }, { "data": { "text/html": [ "
PositionIntensity
110170
230170
350170
4110170
5165170
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.experiments['hrpt'].background.show()" ] }, { "cell_type": "markdown", "id": "71", "metadata": {}, "source": [ "### Set Linked Structures\n", "\n", "Link the structure defined in the previous step to the experiment." ] }, { "cell_type": "code", "execution_count": 36, "id": "72", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:32:47.067251Z", "iopub.status.busy": "2026-06-30T22:32:47.067014Z", "iopub.status.idle": "2026-06-30T22:32:47.070858Z", "shell.execute_reply": "2026-06-30T22:32:47.070060Z" } }, "outputs": [], "source": [ "project.experiments['hrpt'].linked_structures.create(structure_id='lbco', scale=10.0)" ] }, { "cell_type": "markdown", "id": "73", "metadata": {}, "source": [ "### Show Experiment as Text" ] }, { "cell_type": "code", "execution_count": 37, "id": "74", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:32:47.072371Z", "iopub.status.busy": "2026-06-30T22:32:47.072208Z", "iopub.status.idle": "2026-06-30T22:32:47.362515Z", "shell.execute_reply": "2026-06-30T22:32:47.361573Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mExperiment πŸ”¬ \u001b[0m\u001b[32m'hrpt'\u001b[0m\u001b[1;36m as text\u001b[0m\n" ] }, { "data": { "text/html": [ "
Edi
1data_hrpt
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.broad_gauss_u 0.1
16_peak.broad_gauss_v -0.1
17_peak.broad_gauss_w 0.1
18_peak.broad_lorentz_x 0.
19_peak.broad_lorentz_y 0.1
20_peak.cutoff_fwhm 0.
21_peak.type cwl-pseudo-voigt
22
23_instrument.setup_wavelength 1.494
24_instrument.setup_wavelength_2 0.
25_instrument.setup_wavelength_2_to_1_ratio 0.
26_instrument.calib_twotheta_offset 0.6
27_instrument.calib_sample_displacement 0.
28_instrument.calib_sample_transparency 0.
29
30_absorption.type none
31
32loop_
33_linked_structure.structure_id
34_linked_structure.scale
35lbco 10.
36
37_background.type line-segment
38
39loop_
40_background.id
41_background.position
42_background.intensity
4310 10 170
4430 30 170
4550 50 170
46110 110 170
47165 165 170
48
49loop_
50_data.two_theta
51_data.id
52_data.d_spacing
53_data.intensity_meas
54_data.intensity_meas_su
55_data.intensity_calc
56_data.intensity_bkg
57_data.calc_status
5810. 1 8.57086379 167. 12.6 172.32780248 170. incl
5910.05 2 8.52833125 157. 12.5 172.30859914 170. incl
6010.1 3 8.48622036 187. 13.3 172.28969336 170. incl
6110.15 4 8.4445249 197. 14. 172.27107915 170. incl
6210.2 5 8.40323875 164. 12.5 172.25275064 170. incl
6310.25 6 8.36235592 171. 13. 172.23470212 170. incl
6410.3 7 8.32187055 190. 13.4 172.21692803 170. incl
6510.35 8 8.28177687 182. 13.5 172.19942295 170. incl
6610.4 9 8.24206922 166. 12.6 172.18218159 170. incl
6710.45 10 8.20274208 203. 14.3 172.1651988 170. incl
68...
69164.4 3089 0.75397591 202. 18.5 172.60037118 170. incl
70164.45 3090 0.75393091 178. 20.4 172.59695823 170. incl
71164.5 3091 0.75388607 153. 18. 172.59381336 170. incl
72164.55 3092 0.75384138 197. 25.3 172.59093099 170. incl
73164.6 3093 0.75379684 153. 20.7 172.58830579 170. incl
74164.65 3094 0.75375244 173. 30.1 172.58593268 170. incl
75164.7 3095 0.75370819 187. 27.9 172.5838068 170. incl
76164.75 3096 0.7536641 175. 38.2 172.58192354 170. incl
77164.8 3097 0.75362015 168. 30.9 172.58027848 170. incl
78164.85 3098 0.75357634 109. 41.2 172.57886743 170. incl
79
80loop_
81_refln.id
82_refln.structure_id
83_refln.d_spacing
84_refln.sin_theta_over_lambda
85_refln.index_h
86_refln.index_k
87_refln.index_l
88_refln.f_calc
89_refln.f_squared_calc
90_refln.two_theta
911 lbco 3.88 0.12886598 1 0 0 0.16244556 0.02638856 22.80044453
922 lbco 2.74357431 0.18224402 1 1 0 0.32869596 0.10804103 32.19908449
933 lbco 2.24011904 0.22320242 1 1 1 2.1043237 4.42817823 39.5583744
944 lbco 1.94 0.25773196 2 0 0 2.56865501 6.59798858 45.89388073
955 lbco 1.73518875 0.28815309 2 1 0 0.15713889 0.02469263 51.5986821
966 lbco 1.58400337 0.31565589 2 1 1 0.31795832 0.10109749 56.8751008
977 lbco 1.37178716 0.36448803 2 2 0 2.48474376 6.17395156 66.58716829
988 lbco 1.29333333 0.38659794 2 2 1 0.15200557 0.02310569 71.16064798
999 lbco 1.29333333 0.38659794 3 0 0 0.15200557 0.02310569 71.16064798
10010 lbco 1.22696373 0.40751001 3 1 0 0.30757145 0.0946002 75.60845321
101...
10219 lbco 0.91452477 0.54673205 4 1 1 0.28780456 0.08283147 110.13497669
10320 lbco 0.89013305 0.56171378 3 3 1 1.84253549 3.39493703 114.71155759
10421 lbco 0.86759438 0.57630618 4 2 0 2.24910171 5.0584585 119.45842061
10522 lbco 0.84668541 0.59053811 4 2 1 0.13759004 0.01893102 124.43335485
10623 lbco 0.82721878 0.60443502 3 3 2 0.27840274 0.07750809 129.7174128
10724 lbco 0.79200168 0.63131179 4 2 2 2.17562943 4.73336341 141.78522183
10825 lbco 0.776 0.6443299 4 3 0 0.13309533 0.01771437 149.17338292
10926 lbco 0.776 0.6443299 5 0 0 0.13309533 0.01771437 149.17338292
11027 lbco 0.7609306 0.65709014 4 3 1 0.26930805 0.07252683 158.63936579
11128 lbco 0.7609306 0.65709014 5 1 0 0.26930805 0.07252683 158.63936579
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.experiments['hrpt'].show_as_text()" ] }, { "cell_type": "markdown", "id": "75", "metadata": {}, "source": [ "### Save Project State" ] }, { "cell_type": "code", "execution_count": 38, "id": "76", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:32:47.364044Z", "iopub.status.busy": "2026-06-30T22:32:47.363870Z", "iopub.status.idle": "2026-06-30T22:32:47.698295Z", "shell.execute_reply": "2026-06-30T22:32:47.697401Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mSaving project πŸ“¦ \u001b[0m\u001b[32m'lbco_hrpt'\u001b[0m\u001b[1;36m to \u001b[0m\u001b[32m'../../../projects/refine-lbco-hrpt-report'\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "β”œβ”€β”€ πŸ“„ project.edi\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "β”œβ”€β”€ πŸ“ structures/\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "β”‚ └── πŸ“„ lbco.edi\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "β”œβ”€β”€ πŸ“ experiments/\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "β”‚ └── πŸ“„ hrpt.edi\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "β”œβ”€β”€ πŸ“ analysis/\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "β”‚ └── πŸ“„ analysis.edi\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "└── πŸ“ reports/\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ " └── πŸ“„ lbco_hrpt.html\n" ] } ], "source": [ "project.save()" ] }, { "cell_type": "markdown", "id": "77", "metadata": {}, "source": [ "## πŸš€ Perform Analysis\n", "\n", "This section explains the analysis process, including how to set up\n", "calculation and fitting engines.\n", "\n", "### Set Calculator\n", "\n", "Show supported calculation engines for this experiment." ] }, { "cell_type": "code", "execution_count": 39, "id": "78", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:32:47.699992Z", "iopub.status.busy": "2026-06-30T22:32:47.699812Z", "iopub.status.idle": "2026-06-30T22:32:47.707189Z", "shell.execute_reply": "2026-06-30T22:32:47.706343Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mCalculator types\u001b[0m\n" ] }, { "data": { "text/html": [ "
TypeDescription
1crysfmlCrysFML library for crystallographic calculations
2*cryspyCrysPy library for crystallographic calculations
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.experiments['hrpt'].calculator.show_supported()" ] }, { "cell_type": "markdown", "id": "79", "metadata": {}, "source": [ "Select the desired calculation engine." ] }, { "cell_type": "code", "execution_count": 40, "id": "80", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:32:47.709123Z", "iopub.status.busy": "2026-06-30T22:32:47.708925Z", "iopub.status.idle": "2026-06-30T22:32:47.714447Z", "shell.execute_reply": "2026-06-30T22:32:47.713660Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mCalculator for experiment \u001b[0m\u001b[32m'hrpt'\u001b[0m\u001b[1;36m already set to\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "cryspy\n" ] } ], "source": [ "project.experiments['hrpt'].calculator.type = 'cryspy'" ] }, { "cell_type": "markdown", "id": "81", "metadata": {}, "source": [ "### Set Plotting Engine\n", "\n", "EasyDiffraction can plot the measured and calculated patterns using different rendering engines.\n", "The default `auto` engine resolves to an interactive `plotly` view inside Jupyter and a\n", "static `asciichartpy` plot for schematic representation in a terminal.\n", "\n", "Show supported data plotting engines." ] }, { "cell_type": "code", "execution_count": 41, "id": "82", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:32:47.716230Z", "iopub.status.busy": "2026-06-30T22:32:47.716038Z", "iopub.status.idle": "2026-06-30T22:32:47.723951Z", "shell.execute_reply": "2026-06-30T22:32:47.722675Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mRendering Plot types\u001b[0m\n" ] }, { "data": { "text/html": [ "
TypeDescription
1*autoEnvironment default rendering_plot engine
2asciichartpyConsole ASCII line charts
3plotlyInteractive browser-based graphing library
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.rendering_plot.show_supported()" ] }, { "cell_type": "markdown", "id": "83", "metadata": {}, "source": [ "Show all public attributes of the data rendering engine." ] }, { "cell_type": "code", "execution_count": 42, "id": "84", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:32:47.725562Z", "iopub.status.busy": "2026-06-30T22:32:47.725384Z", "iopub.status.idle": "2026-06-30T22:32:47.735370Z", "shell.execute_reply": "2026-06-30T22:32:47.734543Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mProperties\u001b[0m\n" ] }, { "data": { "text/html": [ "
NameWritableDescription
1as_cifReturn CIF representation of this object.
2parametersAll GenericDescriptorBase instances on this item.
3plotterLive plotting facade bound to the owning project.
4typeβœ“Active factory tag for this category.
5unique_nameFully qualified name: datablock, category, entry.
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mMethods\u001b[0m\n" ] }, { "data": { "text/html": [ "
NameDescription
1from_cif()Populate this rendering_plot category from a CIF block.
2help()Print parameters, other properties, and methods.
3show_supported()Print supported types and mark the active one.
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.rendering_plot.help()" ] }, { "cell_type": "markdown", "id": "85", "metadata": {}, "source": [ "### Display Pattern" ] }, { "cell_type": "code", "execution_count": 43, "id": "86", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:32:47.736868Z", "iopub.status.busy": "2026-06-30T22:32:47.736706Z", "iopub.status.idle": "2026-06-30T22:32:47.795266Z", "shell.execute_reply": "2026-06-30T22:32:47.794488Z" } }, "outputs": [ { "data": { "text/html": [ "
Loading plot…
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.display.pattern(expt_name='hrpt')" ] }, { "cell_type": "code", "execution_count": 44, "id": "87", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:32:47.799840Z", "iopub.status.busy": "2026-06-30T22:32:47.799591Z", "iopub.status.idle": "2026-06-30T22:32:47.857144Z", "shell.execute_reply": "2026-06-30T22:32:47.856314Z" } }, "outputs": [ { "data": { "text/html": [ "
Loading plot…
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.display.pattern(expt_name='hrpt', x_min=38, x_max=41)" ] }, { "cell_type": "markdown", "id": "88", "metadata": {}, "source": [ "### Display Parameters\n", "\n", "Show all parameters of the project." ] }, { "cell_type": "code", "execution_count": 45, "id": "89", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:32:47.858887Z", "iopub.status.busy": "2026-06-30T22:32:47.858644Z", "iopub.status.idle": "2026-06-30T22:32:48.038563Z", "shell.execute_reply": "2026-06-30T22:32:48.037564Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mAll 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": [ "
datablockcategoryentryparametervaluefittable
1lbcocelllength_a3.88000True
2lbcocelllength_b3.88000False
3lbcocelllength_c3.88000False
4lbcocellangle_alpha90.00000False
5lbcocellangle_beta90.00000False
6lbcocellangle_gamma90.00000False
7lbcospace_groupname_h_mP m -3 mFalse
8lbcospace_groupcoord_system_code1False
9lbcoatom_siteLaidLaFalse
10lbcoatom_siteLatype_symbolLaFalse
11lbcoatom_siteLafract_x0.00000False
12lbcoatom_siteLafract_y0.00000False
13lbcoatom_siteLafract_z0.00000False
14lbcoatom_siteLawyckoff_letteraFalse
15lbcoatom_siteLamultiplicity1False
16lbcoatom_siteLaoccupancy0.50000True
17lbcoatom_siteLaadp_iso0.50000True
18lbcoatom_siteLaadp_typeBisoFalse
19lbcoatom_siteBaidBaFalse
20lbcoatom_siteBatype_symbolBaFalse
21lbcoatom_siteBafract_x0.00000False
22lbcoatom_siteBafract_y0.00000False
23lbcoatom_siteBafract_z0.00000False
24lbcoatom_siteBawyckoff_letteraFalse
25lbcoatom_siteBamultiplicity1False
26lbcoatom_siteBaoccupancy0.50000True
27lbcoatom_siteBaadp_iso0.50000True
28lbcoatom_siteBaadp_typeBisoFalse
29lbcoatom_siteCoidCoFalse
30lbcoatom_siteCotype_symbolCoFalse
31lbcoatom_siteCofract_x0.50000False
32lbcoatom_siteCofract_y0.50000False
33lbcoatom_siteCofract_z0.50000False
34lbcoatom_siteCowyckoff_letterbFalse
35lbcoatom_siteComultiplicity1False
36lbcoatom_siteCooccupancy1.00000True
37lbcoatom_siteCoadp_iso0.50000True
38lbcoatom_siteCoadp_typeBisoFalse
39lbcoatom_siteOidOFalse
40lbcoatom_siteOtype_symbolOFalse
41lbcoatom_siteOfract_x0.00000False
42lbcoatom_siteOfract_y0.50000False
43lbcoatom_siteOfract_z0.50000False
44lbcoatom_siteOwyckoff_lettercFalse
45lbcoatom_siteOmultiplicity3False
46lbcoatom_siteOoccupancy1.00000True
47lbcoatom_siteOadp_iso0.50000True
48lbcoatom_siteOadp_typeBisoFalse
49lbcogeommin_bond_distance_cutoff0.50000False
50lbcogeombond_distance_inc0.25000False
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mAll 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": [ "
datablockcategoryentryparametervaluefittable
1hrptexperiment_typesample_formpowderFalse
2hrptexperiment_typebeam_modeconstant wavelengthFalse
3hrptexperiment_typeradiation_probeneutronFalse
4hrptexperiment_typescattering_typebraggFalse
5hrptdiffrnambient_temperatureFalse
6hrptdiffrnambient_pressureFalse
7hrptdiffrnambient_magnetic_fieldFalse
8hrptdiffrnambient_electric_fieldFalse
9hrptcalculatortypecryspyFalse
10hrptlinked_structurelbcostructure_idlbcoFalse
11hrptlinked_structurelbcoscale10.00000True
12hrptdata_rangetwo_theta_minnanFalse
13hrptdata_rangetwo_theta_maxnanFalse
14hrptdata_rangetwo_theta_incnanFalse
15hrptpeakbroad_gauss_u0.10000True
16hrptpeakbroad_gauss_v-0.10000True
17hrptpeakbroad_gauss_w0.10000True
18hrptpeakbroad_lorentz_x0.00000True
19hrptpeakbroad_lorentz_y0.10000True
20hrptpeakcutoff_fwhm0.00000False
21hrptpeaktypecwl-pseudo-voigtFalse
22hrptinstrumentwavelength1.49400True
23hrptinstrumentwavelength_20.00000False
24hrptinstrumentwavelength_2_to_1_ratio0.00000False
25hrptinstrumenttwotheta_offset0.60000True
26hrptinstrumentsample_displacement0.00000True
27hrptinstrumentsample_transparency0.00000True
28hrptbackground10id10False
29hrptbackground10position10False
30hrptbackground10intensity170True
31hrptbackground30id30False
32hrptbackground30position30False
33hrptbackground30intensity170True
34hrptbackground50id50False
35hrptbackground50position50False
36hrptbackground50intensity170True
37hrptbackground110id110False
38hrptbackground110position110False
39hrptbackground110intensity170True
40hrptbackground165id165False
41hrptbackground165position165False
42hrptbackground165intensity170True
43hrptabsorptiontypenoneFalse
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.display.parameters.all()" ] }, { "cell_type": "markdown", "id": "90", "metadata": {}, "source": [ "Show all fittable parameters." ] }, { "cell_type": "code", "execution_count": 46, "id": "91", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:32:48.040145Z", "iopub.status.busy": "2026-06-30T22:32:48.039971Z", "iopub.status.idle": "2026-06-30T22:32:48.108581Z", "shell.execute_reply": "2026-06-30T22:32:48.107571Z" } }, "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": [ "
datablockcategoryentryparametervalueuncertaintyunitsfree
1lbcocelllength_a3.88000Γ…False
2lbcoatom_siteLaoccupancy0.50000False
3lbcoatom_siteLaadp_iso0.50000Γ…Β²False
4lbcoatom_siteBaoccupancy0.50000False
5lbcoatom_siteBaadp_iso0.50000Γ…Β²False
6lbcoatom_siteCooccupancy1.00000False
7lbcoatom_siteCoadp_iso0.50000Γ…Β²False
8lbcoatom_siteOoccupancy1.00000False
9lbcoatom_siteOadp_iso0.50000Γ…Β²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": [ "
datablockcategoryentryparametervalueuncertaintyunitsfree
1hrptlinked_structurelbcoscale10.00000False
2hrptpeakbroad_gauss_u0.10000degΒ²False
3hrptpeakbroad_gauss_v-0.10000degΒ²False
4hrptpeakbroad_gauss_w0.10000degΒ²False
5hrptpeakbroad_lorentz_x0.00000degFalse
6hrptpeakbroad_lorentz_y0.10000degFalse
7hrptinstrumentwavelength1.49400Γ…False
8hrptinstrumenttwotheta_offset0.60000degFalse
9hrptinstrumentsample_displacement0.00000degFalse
10hrptinstrumentsample_transparency0.00000degFalse
11hrptbackground10intensity170.00000False
12hrptbackground30intensity170.00000False
13hrptbackground50intensity170.00000False
14hrptbackground110intensity170.00000False
15hrptbackground165intensity170.00000False
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.display.parameters.fittable()" ] }, { "cell_type": "markdown", "id": "92", "metadata": {}, "source": [ "Show only free parameters." ] }, { "cell_type": "code", "execution_count": 47, "id": "93", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:32:48.110141Z", "iopub.status.busy": "2026-06-30T22:32:48.109965Z", "iopub.status.idle": "2026-06-30T22:32:48.134014Z", "shell.execute_reply": "2026-06-30T22:32:48.133184Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "⚠️ No free parameters found. \n" ] } ], "source": [ "project.display.parameters.free()" ] }, { "cell_type": "markdown", "id": "94", "metadata": {}, "source": [ "Show how to access parameters in the code." ] }, { "cell_type": "code", "execution_count": 48, "id": "95", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:32:48.135641Z", "iopub.status.busy": "2026-06-30T22:32:48.135489Z", "iopub.status.idle": "2026-06-30T22:32:48.285277Z", "shell.execute_reply": "2026-06-30T22:32:48.284522Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mHow to access parameters\u001b[0m\n" ] }, { "data": { "text/html": [ "
datablockcategoryentryparameterHow to Access in Python Code
1lbcocelllength_aproject.structures['lbco'].cell.length_a
2lbcocelllength_bproject.structures['lbco'].cell.length_b
3lbcocelllength_cproject.structures['lbco'].cell.length_c
4lbcocellangle_alphaproject.structures['lbco'].cell.angle_alpha
5lbcocellangle_betaproject.structures['lbco'].cell.angle_beta
6lbcocellangle_gammaproject.structures['lbco'].cell.angle_gamma
7lbcospace_groupname_h_mproject.structures['lbco'].space_group.name_h_m
8lbcospace_groupcoord_system_codeproject.structures['lbco'].space_group.coord_system_code
9lbcoatom_siteLaidproject.structures['lbco'].atom_site['La'].id
10lbcoatom_siteLatype_symbolproject.structures['lbco'].atom_site['La'].type_symbol
11lbcoatom_siteLafract_xproject.structures['lbco'].atom_site['La'].fract_x
12lbcoatom_siteLafract_yproject.structures['lbco'].atom_site['La'].fract_y
13lbcoatom_siteLafract_zproject.structures['lbco'].atom_site['La'].fract_z
14lbcoatom_siteLawyckoff_letterproject.structures['lbco'].atom_site['La'].wyckoff_letter
15lbcoatom_siteLamultiplicityproject.structures['lbco'].atom_site['La'].multiplicity
16lbcoatom_siteLaoccupancyproject.structures['lbco'].atom_site['La'].occupancy
17lbcoatom_siteLaadp_isoproject.structures['lbco'].atom_site['La'].adp_iso
18lbcoatom_siteLaadp_typeproject.structures['lbco'].atom_site['La'].adp_type
19lbcoatom_siteBaidproject.structures['lbco'].atom_site['Ba'].id
20lbcoatom_siteBatype_symbolproject.structures['lbco'].atom_site['Ba'].type_symbol
21lbcoatom_siteBafract_xproject.structures['lbco'].atom_site['Ba'].fract_x
22lbcoatom_siteBafract_yproject.structures['lbco'].atom_site['Ba'].fract_y
23lbcoatom_siteBafract_zproject.structures['lbco'].atom_site['Ba'].fract_z
24lbcoatom_siteBawyckoff_letterproject.structures['lbco'].atom_site['Ba'].wyckoff_letter
25lbcoatom_siteBamultiplicityproject.structures['lbco'].atom_site['Ba'].multiplicity
26lbcoatom_siteBaoccupancyproject.structures['lbco'].atom_site['Ba'].occupancy
27lbcoatom_siteBaadp_isoproject.structures['lbco'].atom_site['Ba'].adp_iso
28lbcoatom_siteBaadp_typeproject.structures['lbco'].atom_site['Ba'].adp_type
29lbcoatom_siteCoidproject.structures['lbco'].atom_site['Co'].id
30lbcoatom_siteCotype_symbolproject.structures['lbco'].atom_site['Co'].type_symbol
31lbcoatom_siteCofract_xproject.structures['lbco'].atom_site['Co'].fract_x
32lbcoatom_siteCofract_yproject.structures['lbco'].atom_site['Co'].fract_y
33lbcoatom_siteCofract_zproject.structures['lbco'].atom_site['Co'].fract_z
34lbcoatom_siteCowyckoff_letterproject.structures['lbco'].atom_site['Co'].wyckoff_letter
35lbcoatom_siteComultiplicityproject.structures['lbco'].atom_site['Co'].multiplicity
36lbcoatom_siteCooccupancyproject.structures['lbco'].atom_site['Co'].occupancy
37lbcoatom_siteCoadp_isoproject.structures['lbco'].atom_site['Co'].adp_iso
38lbcoatom_siteCoadp_typeproject.structures['lbco'].atom_site['Co'].adp_type
39lbcoatom_siteOidproject.structures['lbco'].atom_site['O'].id
40lbcoatom_siteOtype_symbolproject.structures['lbco'].atom_site['O'].type_symbol
41lbcoatom_siteOfract_xproject.structures['lbco'].atom_site['O'].fract_x
42lbcoatom_siteOfract_yproject.structures['lbco'].atom_site['O'].fract_y
43lbcoatom_siteOfract_zproject.structures['lbco'].atom_site['O'].fract_z
44lbcoatom_siteOwyckoff_letterproject.structures['lbco'].atom_site['O'].wyckoff_letter
45lbcoatom_siteOmultiplicityproject.structures['lbco'].atom_site['O'].multiplicity
46lbcoatom_siteOoccupancyproject.structures['lbco'].atom_site['O'].occupancy
47lbcoatom_siteOadp_isoproject.structures['lbco'].atom_site['O'].adp_iso
48lbcoatom_siteOadp_typeproject.structures['lbco'].atom_site['O'].adp_type
49lbcogeommin_bond_distance_cutoffproject.structures['lbco'].geom.min_bond_distance_cutoff
50lbcogeombond_distance_incproject.structures['lbco'].geom.bond_distance_inc
51hrptexperiment_typesample_formproject.experiments['hrpt'].experiment_type.sample_form
52hrptexperiment_typebeam_modeproject.experiments['hrpt'].experiment_type.beam_mode
53hrptexperiment_typeradiation_probeproject.experiments['hrpt'].experiment_type.radiation_probe
54hrptexperiment_typescattering_typeproject.experiments['hrpt'].experiment_type.scattering_type
55hrptdiffrnambient_temperatureproject.experiments['hrpt'].diffrn.ambient_temperature
56hrptdiffrnambient_pressureproject.experiments['hrpt'].diffrn.ambient_pressure
57hrptdiffrnambient_magnetic_fieldproject.experiments['hrpt'].diffrn.ambient_magnetic_field
58hrptdiffrnambient_electric_fieldproject.experiments['hrpt'].diffrn.ambient_electric_field
59hrptcalculatortypeproject.experiments['hrpt'].calculator.type
60hrptlinked_structurelbcostructure_idproject.experiments['hrpt'].linked_structure['lbco'].structure_id
61hrptlinked_structurelbcoscaleproject.experiments['hrpt'].linked_structure['lbco'].scale
62hrptdata_rangetwo_theta_minproject.experiments['hrpt'].data_range.two_theta_min
63hrptdata_rangetwo_theta_maxproject.experiments['hrpt'].data_range.two_theta_max
64hrptdata_rangetwo_theta_incproject.experiments['hrpt'].data_range.two_theta_inc
65hrptpeakbroad_gauss_uproject.experiments['hrpt'].peak.broad_gauss_u
66hrptpeakbroad_gauss_vproject.experiments['hrpt'].peak.broad_gauss_v
67hrptpeakbroad_gauss_wproject.experiments['hrpt'].peak.broad_gauss_w
68hrptpeakbroad_lorentz_xproject.experiments['hrpt'].peak.broad_lorentz_x
69hrptpeakbroad_lorentz_yproject.experiments['hrpt'].peak.broad_lorentz_y
70hrptpeakcutoff_fwhmproject.experiments['hrpt'].peak.cutoff_fwhm
71hrptpeaktypeproject.experiments['hrpt'].peak.type
72hrptinstrumentwavelengthproject.experiments['hrpt'].instrument.wavelength
73hrptinstrumentwavelength_2project.experiments['hrpt'].instrument.wavelength_2
74hrptinstrumentwavelength_2_to_1_ratioproject.experiments['hrpt'].instrument.wavelength_2_to_1_ratio
75hrptinstrumenttwotheta_offsetproject.experiments['hrpt'].instrument.twotheta_offset
76hrptinstrumentsample_displacementproject.experiments['hrpt'].instrument.sample_displacement
77hrptinstrumentsample_transparencyproject.experiments['hrpt'].instrument.sample_transparency
78hrptbackground10idproject.experiments['hrpt'].background['10'].id
79hrptbackground10positionproject.experiments['hrpt'].background['10'].position
80hrptbackground10intensityproject.experiments['hrpt'].background['10'].intensity
81hrptbackground30idproject.experiments['hrpt'].background['30'].id
82hrptbackground30positionproject.experiments['hrpt'].background['30'].position
83hrptbackground30intensityproject.experiments['hrpt'].background['30'].intensity
84hrptbackground50idproject.experiments['hrpt'].background['50'].id
85hrptbackground50positionproject.experiments['hrpt'].background['50'].position
86hrptbackground50intensityproject.experiments['hrpt'].background['50'].intensity
87hrptbackground110idproject.experiments['hrpt'].background['110'].id
88hrptbackground110positionproject.experiments['hrpt'].background['110'].position
89hrptbackground110intensityproject.experiments['hrpt'].background['110'].intensity
90hrptbackground165idproject.experiments['hrpt'].background['165'].id
91hrptbackground165positionproject.experiments['hrpt'].background['165'].position
92hrptbackground165intensityproject.experiments['hrpt'].background['165'].intensity
93hrptabsorptiontypeproject.experiments['hrpt'].absorption.type
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.display.parameters.access()" ] }, { "cell_type": "markdown", "id": "96", "metadata": {}, "source": [ "### Set Fit Mode\n", "\n", "Show supported fit modes." ] }, { "cell_type": "code", "execution_count": 49, "id": "97", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:32:48.287157Z", "iopub.status.busy": "2026-06-30T22:32:48.286969Z", "iopub.status.idle": "2026-06-30T22:32:48.294542Z", "shell.execute_reply": "2026-06-30T22:32:48.293633Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mFitting Mode types\u001b[0m\n" ] }, { "data": { "text/html": [ "
TypeDescription
1*singleFit one experiment at a time.
2sequentialFit one experiment against a series of data files.
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.analysis.fitting_mode.show_supported()" ] }, { "cell_type": "markdown", "id": "98", "metadata": {}, "source": [ "Select desired fit mode." ] }, { "cell_type": "code", "execution_count": 50, "id": "99", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:32:48.296149Z", "iopub.status.busy": "2026-06-30T22:32:48.295968Z", "iopub.status.idle": "2026-06-30T22:32:48.300835Z", "shell.execute_reply": "2026-06-30T22:32:48.299972Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mFitting mode changed to\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "single\n" ] } ], "source": [ "project.analysis.fitting_mode.type = 'single'" ] }, { "cell_type": "markdown", "id": "100", "metadata": {}, "source": [ "### Set Minimizer\n", "\n", "Show supported fitting engines." ] }, { "cell_type": "code", "execution_count": 51, "id": "101", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:32:48.302347Z", "iopub.status.busy": "2026-06-30T22:32:48.302185Z", "iopub.status.idle": "2026-06-30T22:32:48.308566Z", "shell.execute_reply": "2026-06-30T22:32:48.307911Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mMinimizer types\u001b[0m\n" ] }, { "data": { "text/html": [ "
TypeDescription
1bumpsBUMPS library using the default Levenberg-Marquardt method
2bumps (amoeba)BUMPS library with Nelder-Mead simplex method
3bumps (de)BUMPS library with differential evolution method
4bumps (dream)BUMPS library with DREAM Bayesian sampling
5bumps (lm)BUMPS library with Levenberg-Marquardt method
6dfolsDFO-LS library for derivative-free least-squares optimization
7emceeemcee affine-invariant ensemble Bayesian sampling
8lmfitLMFIT library using the default Levenberg-Marquardt method
9lmfit (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": "markdown", "id": "102", "metadata": {}, "source": [ "Select desired fitting engine." ] }, { "cell_type": "code", "execution_count": 52, "id": "103", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:32:48.310274Z", "iopub.status.busy": "2026-06-30T22:32:48.310021Z", "iopub.status.idle": "2026-06-30T22:32:48.316741Z", "shell.execute_reply": "2026-06-30T22:32:48.315948Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mCurrent minimizer changed to\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "lmfit\n" ] } ], "source": [ "project.analysis.minimizer.type = 'lmfit'" ] }, { "cell_type": "markdown", "id": "104", "metadata": {}, "source": [ "### Perform Fit 1/5\n", "\n", "Set structure parameters to be refined." ] }, { "cell_type": "code", "execution_count": 53, "id": "105", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:32:48.318310Z", "iopub.status.busy": "2026-06-30T22:32:48.318152Z", "iopub.status.idle": "2026-06-30T22:32:48.321346Z", "shell.execute_reply": "2026-06-30T22:32:48.320605Z" } }, "outputs": [], "source": [ "project.structures['lbco'].cell.length_a.free = True" ] }, { "cell_type": "markdown", "id": "106", "metadata": {}, "source": [ "Set experiment parameters to be refined." ] }, { "cell_type": "code", "execution_count": 54, "id": "107", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:32:48.322790Z", "iopub.status.busy": "2026-06-30T22:32:48.322638Z", "iopub.status.idle": "2026-06-30T22:32:48.326407Z", "shell.execute_reply": "2026-06-30T22:32:48.325516Z" } }, "outputs": [], "source": [ "project.experiments['hrpt'].linked_structures['lbco'].scale.free = True\n", "project.experiments['hrpt'].instrument.calib_twotheta_offset.free = True\n", "project.experiments['hrpt'].background['10'].intensity.free = True\n", "project.experiments['hrpt'].background['30'].intensity.free = True\n", "project.experiments['hrpt'].background['50'].intensity.free = True\n", "project.experiments['hrpt'].background['110'].intensity.free = True\n", "project.experiments['hrpt'].background['165'].intensity.free = True" ] }, { "cell_type": "markdown", "id": "108", "metadata": {}, "source": [ "Show free parameters after selection." ] }, { "cell_type": "code", "execution_count": 55, "id": "109", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:32:48.327943Z", "iopub.status.busy": "2026-06-30T22:32:48.327739Z", "iopub.status.idle": "2026-06-30T22:32:48.369167Z", "shell.execute_reply": "2026-06-30T22:32:48.368307Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mFree parameters for both structures \u001b[0m\u001b[1;36m(\u001b[0m\u001b[1;36m🧩 data blocks\u001b[0m\u001b[1;36m)\u001b[0m\u001b[1;36m and experiments \u001b[0m\u001b[1;36m(\u001b[0m\u001b[1;36mπŸ”¬ data blocks\u001b[0m\u001b[1;36m)\u001b[0m\n" ] }, { "data": { "text/html": [ "
datablockcategoryentryparametervalueuncertaintyminmaxunits
1lbcocelllength_a3.88000-infinfΓ…
2hrptlinked_structurelbcoscale10.00000-infinf
3hrptinstrumenttwotheta_offset0.60000-infinfdeg
4hrptbackground10intensity170.00000-infinf
5hrptbackground30intensity170.00000-infinf
6hrptbackground50intensity170.00000-infinf
7hrptbackground110intensity170.00000-infinf
8hrptbackground165intensity170.00000-infinf
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.display.parameters.free()" ] }, { "cell_type": "markdown", "id": "110", "metadata": {}, "source": [ "#### Run Fitting" ] }, { "cell_type": "code", "execution_count": 56, "id": "111", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:32:48.371199Z", "iopub.status.busy": "2026-06-30T22:32:48.371034Z", "iopub.status.idle": "2026-06-30T22:32:51.802088Z", "shell.execute_reply": "2026-06-30T22:32:51.801285Z" } }, "outputs": [ { "data": { "text/html": [], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", "(function() {\n", " const button = document.getElementById('ed-fit-stop-de50e93fbf624b91b03e96d6c98d1632-button');\n", " const status = document.getElementById('ed-fit-stop-de50e93fbf624b91b03e96d6c98d1632-status');\n", " const kernelId = '';\n", " if (!button) {\n", " return;\n", " }\n", "\n", " function setStatus(text) {\n", " if (status) {\n", " status.textContent = text;\n", " }\n", " }\n", "\n", " function pageConfig() {\n", " const element = document.getElementById('jupyter-config-data');\n", " if (!element || !element.textContent) {\n", " return {};\n", " }\n", " try {\n", " return JSON.parse(element.textContent);\n", " } catch (error) {\n", " return {};\n", " }\n", " }\n", "\n", " function baseUrl(config) {\n", " const configured = config.baseUrl || config.base_url ||\n", " (window.Jupyter && Jupyter.notebook && Jupyter.notebook.base_url);\n", " if (configured) {\n", " return configured.endsWith('/') ? configured : configured + '/';\n", " }\n", " const markers = ['/lab/', '/notebooks/', '/tree/'];\n", " for (const marker of markers) {\n", " const index = window.location.pathname.indexOf(marker);\n", " if (index >= 0) {\n", " return window.location.pathname.slice(0, index + 1);\n", " }\n", " }\n", " return '/';\n", " }\n", "\n", " function token(config) {\n", " return config.token || new URLSearchParams(window.location.search).get('token') || '';\n", " }\n", "\n", " function cookie(name) {\n", " const prefix = name + '=';\n", " for (const part of document.cookie.split(';')) {\n", " const trimmed = part.trim();\n", " if (trimmed.startsWith(prefix)) {\n", " return decodeURIComponent(trimmed.slice(prefix.length));\n", " }\n", " }\n", " return '';\n", " }\n", "\n", " function notebookPath() {\n", " const decoded = decodeURIComponent(window.location.pathname);\n", " const markers = ['/lab/tree/', '/notebooks/', '/tree/'];\n", " for (const marker of markers) {\n", " const index = decoded.indexOf(marker);\n", " if (index >= 0) {\n", " return decoded.slice(index + marker.length);\n", " }\n", " }\n", " return '';\n", " }\n", "\n", " async function kernelFromSessions(config) {\n", " const url = new URL(baseUrl(config) + 'api/sessions', window.location.origin);\n", " const authToken = token(config);\n", " if (authToken) {\n", " url.searchParams.set('token', authToken);\n", " }\n", " const response = await fetch(url, {credentials: 'same-origin'});\n", " if (!response.ok) {\n", " return '';\n", " }\n", " const sessions = await response.json();\n", " const path = notebookPath();\n", " const session = sessions.find((item) => item.path === path) || sessions[0];\n", " return session && session.kernel ? session.kernel.id : '';\n", " }\n", "\n", " async function interruptKernel(config, resolvedKernelId) {\n", " const url = new URL(\n", " baseUrl(config) + 'api/kernels/' + resolvedKernelId + '/interrupt',\n", " window.location.origin\n", " );\n", " const authToken = token(config);\n", " if (authToken) {\n", " url.searchParams.set('token', authToken);\n", " }\n", " const xsrfToken = cookie('_xsrf');\n", " const headers = {};\n", " if (xsrfToken) {\n", " headers['X-XSRFToken'] = xsrfToken;\n", " }\n", " const response = await fetch(url, {\n", " method: 'POST',\n", " credentials: 'same-origin',\n", " headers: headers\n", " });\n", " return response.ok;\n", " }\n", "\n", " button.addEventListener('click', async function() {\n", " button.disabled = true;\n", " setStatus('Stopping...');\n", " const config = pageConfig();\n", " try {\n", " const resolvedKernelId = kernelId || await kernelFromSessions(config);\n", " if (!resolvedKernelId) {\n", " throw new Error('Could not resolve the current kernel id.');\n", " }\n", " const interrupted = await interruptKernel(config, resolvedKernelId);\n", " if (!interrupted) {\n", " throw new Error('Jupyter Server rejected the interrupt request.');\n", " }\n", " setStatus('Interrupt sent...');\n", " } catch (error) {\n", " button.disabled = false;\n", " setStatus('Use Kernel > Interrupt to stop this fit.');\n", " }\n", " });\n", "})();\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mStandard fitting\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "πŸ“‹ Using experiment πŸ”¬ \u001b[32m'hrpt'\u001b[0m for \u001b[32m'single'\u001b[0m fitting\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "πŸš€ Starting fit process with \u001b[32m'lmfit \u001b[0m\u001b[32m(\u001b[0m\u001b[32mleastsq\u001b[0m\u001b[32m)\u001b[0m\u001b[32m'\u001b[0m\u001b[33m...\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "πŸ“ˆ Goodness-of-fit progress:\n" ] }, { "data": { "text/html": [ "
iterationtime (s)χ²change / status
110.03164.59
2120.3733.4379.7% ↓
3210.8413.2260.4% ↓
4301.155.7856.3% ↓
5391.433.1545.6% ↓
6772.663.14
" ], "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;36m3.14\u001b[0m at iteration \u001b[1;36m69\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'lbco_hrpt'\u001b[0m\u001b[1;36m to \u001b[0m\u001b[32m'../../../projects/refine-lbco-hrpt-report'\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "β”œβ”€β”€ πŸ“„ project.edi\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "β”œβ”€β”€ πŸ“ structures/\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "β”‚ └── πŸ“„ lbco.edi\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "β”œβ”€β”€ πŸ“ experiments/\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "β”‚ └── πŸ“„ hrpt.edi\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "β”œβ”€β”€ πŸ“ analysis/\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "β”‚ └── πŸ“„ analysis.edi\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "└── πŸ“ reports/\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ " └── πŸ“„ lbco_hrpt.html\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "βš™οΈ Settings used:\n" ] }, { "data": { "text/html": [ "
NameValueDescription
1max_iterations1000Maximum solver iterations.
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "πŸ“‹ Least-squares fit results:\n" ] }, { "data": { "text/html": [ "
MetricValue
1πŸ§ͺ Minimizerlmfit
2βœ… Overall statussuccess
3⏱️ Fitting time (seconds)2.66
4πŸ” Iterations74
5πŸ“ Goodness-of-fit (reduced χ²)3.14
6πŸ“ R-factor (Rf, %)8.42
7πŸ“ R-factor squared (RfΒ², %)11.79
8πŸ“ Weighted R-factor (wR, %)11.62
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "πŸ“ˆ Refined parameters:\n" ] }, { "data": { "text/html": [ "
datablockcategoryentryparameterunitsstartvalues.u.change
1lbcocelllength_aΓ…3.88003.89100.00010.28 % ↑
2hrptlinked_structurelbcoscale10.00007.34090.035026.59 % ↓
3hrptinstrumenttwotheta_offsetdeg0.60000.62430.00184.05 % ↑
4hrptbackground10intensity170.0000167.70662.13001.35 % ↓
5hrptbackground30intensity170.0000166.03381.54042.33 % ↓
6hrptbackground50intensity170.0000169.94951.10250.03 % ↓
7hrptbackground110intensity170.0000170.08020.97880.05 % ↑
8hrptbackground165intensity170.0000179.66561.32895.69 % ↑
" ], "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.analysis.fit()\n", "project.display.fit.results()" ] }, { "cell_type": "markdown", "id": "112", "metadata": {}, "source": [ "#### Display Pattern" ] }, { "cell_type": "code", "execution_count": 57, "id": "113", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:32:51.803583Z", "iopub.status.busy": "2026-06-30T22:32:51.803419Z", "iopub.status.idle": "2026-06-30T22:32:51.860797Z", "shell.execute_reply": "2026-06-30T22:32:51.859912Z" } }, "outputs": [ { "data": { "text/html": [ "
Loading plot…
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.display.pattern(expt_name='hrpt')" ] }, { "cell_type": "code", "execution_count": 58, "id": "114", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:32:51.864997Z", "iopub.status.busy": "2026-06-30T22:32:51.864825Z", "iopub.status.idle": "2026-06-30T22:32:51.915031Z", "shell.execute_reply": "2026-06-30T22:32:51.914330Z" } }, "outputs": [ { "data": { "text/html": [ "
Loading plot…
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.display.pattern(expt_name='hrpt', x_min=38, x_max=41)" ] }, { "cell_type": "markdown", "id": "115", "metadata": {}, "source": [ "### Perform Fit 2/5\n", "\n", "Set more parameters to be refined." ] }, { "cell_type": "code", "execution_count": 59, "id": "116", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:32:51.916902Z", "iopub.status.busy": "2026-06-30T22:32:51.916741Z", "iopub.status.idle": "2026-06-30T22:32:51.920129Z", "shell.execute_reply": "2026-06-30T22:32:51.919256Z" } }, "outputs": [], "source": [ "project.experiments['hrpt'].peak.broad_gauss_u.free = True\n", "project.experiments['hrpt'].peak.broad_gauss_v.free = True\n", "project.experiments['hrpt'].peak.broad_gauss_w.free = True\n", "project.experiments['hrpt'].peak.broad_lorentz_y.free = True" ] }, { "cell_type": "markdown", "id": "117", "metadata": {}, "source": [ "Show free parameters after selection." ] }, { "cell_type": "code", "execution_count": 60, "id": "118", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:32:51.921866Z", "iopub.status.busy": "2026-06-30T22:32:51.921648Z", "iopub.status.idle": "2026-06-30T22:32:51.972159Z", "shell.execute_reply": "2026-06-30T22:32:51.971270Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mFree parameters for both structures \u001b[0m\u001b[1;36m(\u001b[0m\u001b[1;36m🧩 data blocks\u001b[0m\u001b[1;36m)\u001b[0m\u001b[1;36m and experiments \u001b[0m\u001b[1;36m(\u001b[0m\u001b[1;36mπŸ”¬ data blocks\u001b[0m\u001b[1;36m)\u001b[0m\n" ] }, { "data": { "text/html": [ "
datablockcategoryentryparametervalueuncertaintyminmaxunits
1lbcocelllength_a3.890990.00006-infinfΓ…
2hrptlinked_structurelbcoscale7.340880.03496-infinf
3hrptpeakbroad_gauss_u0.10000-infinfdegΒ²
4hrptpeakbroad_gauss_v-0.10000-infinfdegΒ²
5hrptpeakbroad_gauss_w0.10000-infinfdegΒ²
6hrptpeakbroad_lorentz_y0.10000-infinfdeg
7hrptinstrumenttwotheta_offset0.624320.00181-infinfdeg
8hrptbackground10intensity167.706622.13004-infinf
9hrptbackground30intensity166.033831.54041-infinf
10hrptbackground50intensity169.949491.10249-infinf
11hrptbackground110intensity170.080230.97879-infinf
12hrptbackground165intensity179.665571.32895-infinf
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.display.parameters.free()" ] }, { "cell_type": "markdown", "id": "119", "metadata": {}, "source": [ "#### Run Fitting" ] }, { "cell_type": "code", "execution_count": 61, "id": "120", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:32:51.974106Z", "iopub.status.busy": "2026-06-30T22:32:51.973947Z", "iopub.status.idle": "2026-06-30T22:32:55.410578Z", "shell.execute_reply": "2026-06-30T22:32:55.409744Z" } }, "outputs": [ { "data": { "text/html": [], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", "(function() {\n", " const button = document.getElementById('ed-fit-stop-d619fbaf6aba4924892cdf0b2669e578-button');\n", " const status = document.getElementById('ed-fit-stop-d619fbaf6aba4924892cdf0b2669e578-status');\n", " const kernelId = '';\n", " if (!button) {\n", " return;\n", " }\n", "\n", " function setStatus(text) {\n", " if (status) {\n", " status.textContent = text;\n", " }\n", " }\n", "\n", " function pageConfig() {\n", " const element = document.getElementById('jupyter-config-data');\n", " if (!element || !element.textContent) {\n", " return {};\n", " }\n", " try {\n", " return JSON.parse(element.textContent);\n", " } catch (error) {\n", " return {};\n", " }\n", " }\n", "\n", " function baseUrl(config) {\n", " const configured = config.baseUrl || config.base_url ||\n", " (window.Jupyter && Jupyter.notebook && Jupyter.notebook.base_url);\n", " if (configured) {\n", " return configured.endsWith('/') ? configured : configured + '/';\n", " }\n", " const markers = ['/lab/', '/notebooks/', '/tree/'];\n", " for (const marker of markers) {\n", " const index = window.location.pathname.indexOf(marker);\n", " if (index >= 0) {\n", " return window.location.pathname.slice(0, index + 1);\n", " }\n", " }\n", " return '/';\n", " }\n", "\n", " function token(config) {\n", " return config.token || new URLSearchParams(window.location.search).get('token') || '';\n", " }\n", "\n", " function cookie(name) {\n", " const prefix = name + '=';\n", " for (const part of document.cookie.split(';')) {\n", " const trimmed = part.trim();\n", " if (trimmed.startsWith(prefix)) {\n", " return decodeURIComponent(trimmed.slice(prefix.length));\n", " }\n", " }\n", " return '';\n", " }\n", "\n", " function notebookPath() {\n", " const decoded = decodeURIComponent(window.location.pathname);\n", " const markers = ['/lab/tree/', '/notebooks/', '/tree/'];\n", " for (const marker of markers) {\n", " const index = decoded.indexOf(marker);\n", " if (index >= 0) {\n", " return decoded.slice(index + marker.length);\n", " }\n", " }\n", " return '';\n", " }\n", "\n", " async function kernelFromSessions(config) {\n", " const url = new URL(baseUrl(config) + 'api/sessions', window.location.origin);\n", " const authToken = token(config);\n", " if (authToken) {\n", " url.searchParams.set('token', authToken);\n", " }\n", " const response = await fetch(url, {credentials: 'same-origin'});\n", " if (!response.ok) {\n", " return '';\n", " }\n", " const sessions = await response.json();\n", " const path = notebookPath();\n", " const session = sessions.find((item) => item.path === path) || sessions[0];\n", " return session && session.kernel ? session.kernel.id : '';\n", " }\n", "\n", " async function interruptKernel(config, resolvedKernelId) {\n", " const url = new URL(\n", " baseUrl(config) + 'api/kernels/' + resolvedKernelId + '/interrupt',\n", " window.location.origin\n", " );\n", " const authToken = token(config);\n", " if (authToken) {\n", " url.searchParams.set('token', authToken);\n", " }\n", " const xsrfToken = cookie('_xsrf');\n", " const headers = {};\n", " if (xsrfToken) {\n", " headers['X-XSRFToken'] = xsrfToken;\n", " }\n", " const response = await fetch(url, {\n", " method: 'POST',\n", " credentials: 'same-origin',\n", " headers: headers\n", " });\n", " return response.ok;\n", " }\n", "\n", " button.addEventListener('click', async function() {\n", " button.disabled = true;\n", " setStatus('Stopping...');\n", " const config = pageConfig();\n", " try {\n", " const resolvedKernelId = kernelId || await kernelFromSessions(config);\n", " if (!resolvedKernelId) {\n", " throw new Error('Could not resolve the current kernel id.');\n", " }\n", " const interrupted = await interruptKernel(config, resolvedKernelId);\n", " if (!interrupted) {\n", " throw new Error('Jupyter Server rejected the interrupt request.');\n", " }\n", " setStatus('Interrupt sent...');\n", " } catch (error) {\n", " button.disabled = false;\n", " setStatus('Use Kernel > Interrupt to stop this fit.');\n", " }\n", " });\n", "})();\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mStandard fitting\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "πŸ“‹ Using experiment πŸ”¬ \u001b[32m'hrpt'\u001b[0m for \u001b[32m'single'\u001b[0m fitting\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "πŸš€ Starting fit process with \u001b[32m'lmfit \u001b[0m\u001b[32m(\u001b[0m\u001b[32mleastsq\u001b[0m\u001b[32m)\u001b[0m\u001b[32m'\u001b[0m\u001b[33m...\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "πŸ“ˆ Goodness-of-fit progress:\n" ] }, { "data": { "text/html": [ "
iterationtime (s)χ²change / status
110.043.14
2160.572.859.1% ↓
3692.482.85
" ], "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;36m2.85\u001b[0m at iteration \u001b[1;36m68\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'lbco_hrpt'\u001b[0m\u001b[1;36m to \u001b[0m\u001b[32m'../../../projects/refine-lbco-hrpt-report'\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "β”œβ”€β”€ πŸ“„ project.edi\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "β”œβ”€β”€ πŸ“ structures/\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "β”‚ └── πŸ“„ lbco.edi\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "β”œβ”€β”€ πŸ“ experiments/\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "β”‚ └── πŸ“„ hrpt.edi\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "β”œβ”€β”€ πŸ“ analysis/\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "β”‚ └── πŸ“„ analysis.edi\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "└── πŸ“ reports/\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ " └── πŸ“„ lbco_hrpt.html\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "βš™οΈ Settings used:\n" ] }, { "data": { "text/html": [ "
NameValueDescription
1max_iterations1000Maximum solver iterations.
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "πŸ“‹ Least-squares fit results:\n" ] }, { "data": { "text/html": [ "
MetricValue
1πŸ§ͺ Minimizerlmfit
2βœ… Overall statussuccess
3⏱️ Fitting time (seconds)2.48
4πŸ” Iterations66
5πŸ“ Goodness-of-fit (reduced χ²)2.85
6πŸ“ R-factor (Rf, %)8.30
7πŸ“ R-factor squared (RfΒ², %)11.85
8πŸ“ Weighted R-factor (wR, %)11.91
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "πŸ“ˆ Refined parameters:\n" ] }, { "data": { "text/html": [ "
datablockcategoryentryparameterunitsstartvalues.u.change
1lbcocelllength_aΓ…3.89103.89090.00010.00 % ↓
2hrptlinked_structurelbcoscale7.34097.21200.04061.76 % ↓
3hrptpeakbroad_gauss_udegΒ²0.10000.08030.004719.74 % ↓
4hrptpeakbroad_gauss_vdegΒ²-0.1000-0.10290.01042.93 % ↑
5hrptpeakbroad_gauss_wdegΒ²0.10000.10770.00517.66 % ↑
6hrptpeakbroad_lorentz_ydeg0.10000.08930.003210.67 % ↓
7hrptinstrumenttwotheta_offsetdeg0.62430.62310.00170.19 % ↓
8hrptbackground10intensity167.7066167.51672.03110.11 % ↓
9hrptbackground30intensity166.0338166.76271.47940.44 % ↑
10hrptbackground50intensity169.9495170.83301.08080.52 % ↑
11hrptbackground110intensity170.0802172.25460.96601.28 % ↑
12hrptbackground165intensity179.6656180.64051.27370.54 % ↑
" ], "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.analysis.fit()\n", "project.display.fit.results()" ] }, { "cell_type": "markdown", "id": "121", "metadata": {}, "source": [ "#### Display Pattern" ] }, { "cell_type": "code", "execution_count": 62, "id": "122", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:32:55.412260Z", "iopub.status.busy": "2026-06-30T22:32:55.412057Z", "iopub.status.idle": "2026-06-30T22:32:55.470707Z", "shell.execute_reply": "2026-06-30T22:32:55.470040Z" } }, "outputs": [ { "data": { "text/html": [ "
Loading plot…
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.display.pattern(expt_name='hrpt')" ] }, { "cell_type": "code", "execution_count": 63, "id": "123", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:32:55.477382Z", "iopub.status.busy": "2026-06-30T22:32:55.477199Z", "iopub.status.idle": "2026-06-30T22:32:55.527815Z", "shell.execute_reply": "2026-06-30T22:32:55.526966Z" } }, "outputs": [ { "data": { "text/html": [ "
Loading plot…
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.display.pattern(expt_name='hrpt', x_min=38, x_max=41)" ] }, { "cell_type": "markdown", "id": "124", "metadata": {}, "source": [ "#### Save Project State" ] }, { "cell_type": "code", "execution_count": 64, "id": "125", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:32:55.529791Z", "iopub.status.busy": "2026-06-30T22:32:55.529628Z", "iopub.status.idle": "2026-06-30T22:32:55.882023Z", "shell.execute_reply": "2026-06-30T22:32:55.881194Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mSaving project πŸ“¦ \u001b[0m\u001b[32m'lbco_hrpt'\u001b[0m\u001b[1;36m to \u001b[0m\u001b[32m'../../../projects/refine-lbco-hrpt-report'\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "β”œβ”€β”€ πŸ“„ project.edi\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "β”œβ”€β”€ πŸ“ structures/\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "β”‚ └── πŸ“„ lbco.edi\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "β”œβ”€β”€ πŸ“ experiments/\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "β”‚ └── πŸ“„ hrpt.edi\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "β”œβ”€β”€ πŸ“ analysis/\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "β”‚ └── πŸ“„ analysis.edi\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "└── πŸ“ reports/\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ " └── πŸ“„ lbco_hrpt.html\n" ] } ], "source": [ "project.save()" ] }, { "cell_type": "markdown", "id": "126", "metadata": {}, "source": [ "### Perform Fit 3/5\n", "\n", "Set more parameters to be refined." ] }, { "cell_type": "code", "execution_count": 65, "id": "127", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:32:55.884027Z", "iopub.status.busy": "2026-06-30T22:32:55.883804Z", "iopub.status.idle": "2026-06-30T22:32:55.888287Z", "shell.execute_reply": "2026-06-30T22:32:55.887122Z" } }, "outputs": [], "source": [ "project.structures['lbco'].atom_sites['La'].adp_iso.free = True\n", "project.structures['lbco'].atom_sites['Ba'].adp_iso.free = True\n", "project.structures['lbco'].atom_sites['Co'].adp_iso.free = True\n", "project.structures['lbco'].atom_sites['O'].adp_iso.free = True" ] }, { "cell_type": "markdown", "id": "128", "metadata": {}, "source": [ "Show free parameters after selection." ] }, { "cell_type": "code", "execution_count": 66, "id": "129", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:32:55.889796Z", "iopub.status.busy": "2026-06-30T22:32:55.889628Z", "iopub.status.idle": "2026-06-30T22:32:55.938774Z", "shell.execute_reply": "2026-06-30T22:32:55.937896Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mFree parameters for both structures \u001b[0m\u001b[1;36m(\u001b[0m\u001b[1;36m🧩 data blocks\u001b[0m\u001b[1;36m)\u001b[0m\u001b[1;36m and experiments \u001b[0m\u001b[1;36m(\u001b[0m\u001b[1;36mπŸ”¬ data blocks\u001b[0m\u001b[1;36m)\u001b[0m\n" ] }, { "data": { "text/html": [ "
datablockcategoryentryparametervalueuncertaintyminmaxunits
1lbcocelllength_a3.890910.00005-infinfΓ…
2lbcoatom_siteLaadp_iso0.50000-infinfΓ…Β²
3lbcoatom_siteBaadp_iso0.50000-infinfΓ…Β²
4lbcoatom_siteCoadp_iso0.50000-infinfΓ…Β²
5lbcoatom_siteOadp_iso0.50000-infinfΓ…Β²
6hrptlinked_structurelbcoscale7.211990.04057-infinf
7hrptpeakbroad_gauss_u0.080260.00472-infinfdegΒ²
8hrptpeakbroad_gauss_v-0.102930.01036-infinfdegΒ²
9hrptpeakbroad_gauss_w0.107660.00515-infinfdegΒ²
10hrptpeakbroad_lorentz_y0.089330.00320-infinfdeg
11hrptinstrumenttwotheta_offset0.623140.00167-infinfdeg
12hrptbackground10intensity167.516692.03112-infinf
13hrptbackground30intensity166.762681.47937-infinf
14hrptbackground50intensity170.833051.08080-infinf
15hrptbackground110intensity172.254580.96599-infinf
16hrptbackground165intensity180.640541.27368-infinf
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.display.parameters.free()" ] }, { "cell_type": "markdown", "id": "130", "metadata": {}, "source": [ "#### Run Fitting" ] }, { "cell_type": "code", "execution_count": 67, "id": "131", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:32:55.940453Z", "iopub.status.busy": "2026-06-30T22:32:55.940288Z", "iopub.status.idle": "2026-06-30T22:33:04.451566Z", "shell.execute_reply": "2026-06-30T22:33:04.450879Z" } }, "outputs": [ { "data": { "text/html": [], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", "(function() {\n", " const button = document.getElementById('ed-fit-stop-fa78f3c7747e4be5a9064f2e245676f7-button');\n", " const status = document.getElementById('ed-fit-stop-fa78f3c7747e4be5a9064f2e245676f7-status');\n", " const kernelId = '';\n", " if (!button) {\n", " return;\n", " }\n", "\n", " function setStatus(text) {\n", " if (status) {\n", " status.textContent = text;\n", " }\n", " }\n", "\n", " function pageConfig() {\n", " const element = document.getElementById('jupyter-config-data');\n", " if (!element || !element.textContent) {\n", " return {};\n", " }\n", " try {\n", " return JSON.parse(element.textContent);\n", " } catch (error) {\n", " return {};\n", " }\n", " }\n", "\n", " function baseUrl(config) {\n", " const configured = config.baseUrl || config.base_url ||\n", " (window.Jupyter && Jupyter.notebook && Jupyter.notebook.base_url);\n", " if (configured) {\n", " return configured.endsWith('/') ? configured : configured + '/';\n", " }\n", " const markers = ['/lab/', '/notebooks/', '/tree/'];\n", " for (const marker of markers) {\n", " const index = window.location.pathname.indexOf(marker);\n", " if (index >= 0) {\n", " return window.location.pathname.slice(0, index + 1);\n", " }\n", " }\n", " return '/';\n", " }\n", "\n", " function token(config) {\n", " return config.token || new URLSearchParams(window.location.search).get('token') || '';\n", " }\n", "\n", " function cookie(name) {\n", " const prefix = name + '=';\n", " for (const part of document.cookie.split(';')) {\n", " const trimmed = part.trim();\n", " if (trimmed.startsWith(prefix)) {\n", " return decodeURIComponent(trimmed.slice(prefix.length));\n", " }\n", " }\n", " return '';\n", " }\n", "\n", " function notebookPath() {\n", " const decoded = decodeURIComponent(window.location.pathname);\n", " const markers = ['/lab/tree/', '/notebooks/', '/tree/'];\n", " for (const marker of markers) {\n", " const index = decoded.indexOf(marker);\n", " if (index >= 0) {\n", " return decoded.slice(index + marker.length);\n", " }\n", " }\n", " return '';\n", " }\n", "\n", " async function kernelFromSessions(config) {\n", " const url = new URL(baseUrl(config) + 'api/sessions', window.location.origin);\n", " const authToken = token(config);\n", " if (authToken) {\n", " url.searchParams.set('token', authToken);\n", " }\n", " const response = await fetch(url, {credentials: 'same-origin'});\n", " if (!response.ok) {\n", " return '';\n", " }\n", " const sessions = await response.json();\n", " const path = notebookPath();\n", " const session = sessions.find((item) => item.path === path) || sessions[0];\n", " return session && session.kernel ? session.kernel.id : '';\n", " }\n", "\n", " async function interruptKernel(config, resolvedKernelId) {\n", " const url = new URL(\n", " baseUrl(config) + 'api/kernels/' + resolvedKernelId + '/interrupt',\n", " window.location.origin\n", " );\n", " const authToken = token(config);\n", " if (authToken) {\n", " url.searchParams.set('token', authToken);\n", " }\n", " const xsrfToken = cookie('_xsrf');\n", " const headers = {};\n", " if (xsrfToken) {\n", " headers['X-XSRFToken'] = xsrfToken;\n", " }\n", " const response = await fetch(url, {\n", " method: 'POST',\n", " credentials: 'same-origin',\n", " headers: headers\n", " });\n", " return response.ok;\n", " }\n", "\n", " button.addEventListener('click', async function() {\n", " button.disabled = true;\n", " setStatus('Stopping...');\n", " const config = pageConfig();\n", " try {\n", " const resolvedKernelId = kernelId || await kernelFromSessions(config);\n", " if (!resolvedKernelId) {\n", " throw new Error('Could not resolve the current kernel id.');\n", " }\n", " const interrupted = await interruptKernel(config, resolvedKernelId);\n", " if (!interrupted) {\n", " throw new Error('Jupyter Server rejected the interrupt request.');\n", " }\n", " setStatus('Interrupt sent...');\n", " } catch (error) {\n", " button.disabled = false;\n", " setStatus('Use Kernel > Interrupt to stop this fit.');\n", " }\n", " });\n", "})();\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mStandard fitting\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "πŸ“‹ Using experiment πŸ”¬ \u001b[32m'hrpt'\u001b[0m for \u001b[32m'single'\u001b[0m fitting\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "πŸš€ Starting fit process with \u001b[32m'lmfit \u001b[0m\u001b[32m(\u001b[0m\u001b[32mleastsq\u001b[0m\u001b[32m)\u001b[0m\u001b[32m'\u001b[0m\u001b[33m...\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "πŸ“ˆ Goodness-of-fit progress:\n" ] }, { "data": { "text/html": [ "
iterationtime (s)χ²change / status
110.042.85
2281.012.2819.9% ↓
3451.621.6228.9% ↓
4622.301.479.6% ↓
5792.911.367.0% ↓
6973.561.295.4% ↓
72047.821.29
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "πŸ† Best goodness-of-fit \u001b[1m(\u001b[0mreduced χ²\u001b[1m)\u001b[0m is \u001b[1;36m1.29\u001b[0m at iteration \u001b[1;36m187\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'lbco_hrpt'\u001b[0m\u001b[1;36m to \u001b[0m\u001b[32m'../../../projects/refine-lbco-hrpt-report'\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "β”œβ”€β”€ πŸ“„ project.edi\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "β”œβ”€β”€ πŸ“ structures/\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "β”‚ └── πŸ“„ lbco.edi\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "β”œβ”€β”€ πŸ“ experiments/\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "β”‚ └── πŸ“„ hrpt.edi\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "β”œβ”€β”€ πŸ“ analysis/\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "β”‚ └── πŸ“„ analysis.edi\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "└── πŸ“ reports/\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ " └── πŸ“„ lbco_hrpt.html\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "βš™οΈ Settings used:\n" ] }, { "data": { "text/html": [ "
NameValueDescription
1max_iterations1000Maximum solver iterations.
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "πŸ“‹ Least-squares fit results:\n" ] }, { "data": { "text/html": [ "
MetricValue
1πŸ§ͺ Minimizerlmfit
2βœ… Overall statussuccess
3⏱️ Fitting time (seconds)7.82
4πŸ” Iterations201
5πŸ“ Goodness-of-fit (reduced χ²)1.29
6πŸ“ R-factor (Rf, %)5.63
7πŸ“ R-factor squared (RfΒ², %)5.27
8πŸ“ Weighted R-factor (wR, %)4.41
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "πŸ“ˆ Refined parameters:\n" ] }, { "data": { "text/html": [ "
datablockcategoryentryparameterunitsstartvalues.u.change
1lbcocelllength_aΓ…3.89093.89090.00000.00 % ↓
2lbcoatom_siteLaadp_isoΓ…Β²0.50000.50511212.94781.02 % ↑
3lbcoatom_siteBaadp_isoΓ…Β²0.50000.50481971.13820.96 % ↑
4lbcoatom_siteCoadp_isoΓ…Β²0.50000.23710.061252.59 % ↓
5lbcoatom_siteOadp_isoΓ…Β²0.50001.39350.0167178.71 % ↑
6hrptlinked_structurelbcoscale7.21209.13500.064126.66 % ↑
7hrptpeakbroad_gauss_udegΒ²0.08030.08160.00311.63 % ↑
8hrptpeakbroad_gauss_vdegΒ²-0.1029-0.11590.006712.62 % ↑
9hrptpeakbroad_gauss_wdegΒ²0.10770.12040.003311.88 % ↑
10hrptpeakbroad_lorentz_ydeg0.08930.08440.00215.47 % ↓
11hrptinstrumenttwotheta_offsetdeg0.62310.62260.00100.09 % ↓
12hrptbackground10intensity167.5167168.55851.36710.62 % ↑
13hrptbackground30intensity166.7627164.33570.99921.46 % ↓
14hrptbackground50intensity170.8330166.88810.73882.31 % ↓
15hrptbackground110intensity172.2546175.40040.65711.83 % ↑
16hrptbackground165intensity180.6405174.28110.91133.52 % ↓
" ], "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.analysis.fit()\n", "project.display.fit.results()" ] }, { "cell_type": "markdown", "id": "132", "metadata": {}, "source": [ "#### Display Pattern" ] }, { "cell_type": "code", "execution_count": 68, "id": "133", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:33:04.453450Z", "iopub.status.busy": "2026-06-30T22:33:04.453298Z", "iopub.status.idle": "2026-06-30T22:33:04.510153Z", "shell.execute_reply": "2026-06-30T22:33:04.509257Z" } }, "outputs": [ { "data": { "text/html": [ "
Loading plot…
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.display.pattern(expt_name='hrpt')" ] }, { "cell_type": "code", "execution_count": 69, "id": "134", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:33:04.514353Z", "iopub.status.busy": "2026-06-30T22:33:04.514115Z", "iopub.status.idle": "2026-06-30T22:33:04.569397Z", "shell.execute_reply": "2026-06-30T22:33:04.568267Z" } }, "outputs": [ { "data": { "text/html": [ "
Loading plot…
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.display.pattern(expt_name='hrpt', x_min=38, x_max=41)" ] }, { "cell_type": "markdown", "id": "135", "metadata": {}, "source": [ "### Perform Fit 4/5\n", "\n", "#### Set Constraints\n", "\n", "Set aliases for parameters." ] }, { "cell_type": "code", "execution_count": 70, "id": "136", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:33:04.570902Z", "iopub.status.busy": "2026-06-30T22:33:04.570748Z", "iopub.status.idle": "2026-06-30T22:33:04.574718Z", "shell.execute_reply": "2026-06-30T22:33:04.573794Z" } }, "outputs": [], "source": [ "project.analysis.aliases.create(\n", " id='biso_La',\n", " param=project.structures['lbco'].atom_sites['La'].adp_iso,\n", ")\n", "project.analysis.aliases.create(\n", " id='biso_Ba',\n", " param=project.structures['lbco'].atom_sites['Ba'].adp_iso,\n", ")" ] }, { "cell_type": "markdown", "id": "137", "metadata": {}, "source": [ "Set constraints." ] }, { "cell_type": "code", "execution_count": 71, "id": "138", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:33:04.576210Z", "iopub.status.busy": "2026-06-30T22:33:04.576046Z", "iopub.status.idle": "2026-06-30T22:33:04.578973Z", "shell.execute_reply": "2026-06-30T22:33:04.578367Z" } }, "outputs": [], "source": [ "project.analysis.constraints.create(expression='biso_Ba = biso_La')" ] }, { "cell_type": "markdown", "id": "139", "metadata": {}, "source": [ "Show defined constraints." ] }, { "cell_type": "code", "execution_count": 72, "id": "140", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:33:04.580488Z", "iopub.status.busy": "2026-06-30T22:33:04.580345Z", "iopub.status.idle": "2026-06-30T22:33:04.587309Z", "shell.execute_reply": "2026-06-30T22:33:04.586507Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mUser defined constraints\u001b[0m\n" ] }, { "data": { "text/html": [ "
idexpression
1biso_Babiso_Ba = biso_La
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "Constraints enabled: \u001b[3;92mTrue\u001b[0m\n" ] } ], "source": [ "project.analysis.constraints.show()" ] }, { "cell_type": "markdown", "id": "141", "metadata": {}, "source": [ "Show free parameters." ] }, { "cell_type": "code", "execution_count": 73, "id": "142", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:33:04.588810Z", "iopub.status.busy": "2026-06-30T22:33:04.588622Z", "iopub.status.idle": "2026-06-30T22:33:04.645802Z", "shell.execute_reply": "2026-06-30T22:33:04.644866Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mFree parameters for both structures \u001b[0m\u001b[1;36m(\u001b[0m\u001b[1;36m🧩 data blocks\u001b[0m\u001b[1;36m)\u001b[0m\u001b[1;36m and experiments \u001b[0m\u001b[1;36m(\u001b[0m\u001b[1;36mπŸ”¬ data blocks\u001b[0m\u001b[1;36m)\u001b[0m\n" ] }, { "data": { "text/html": [ "
datablockcategoryentryparametervalueuncertaintyminmaxunits
1lbcocelllength_a3.890870.00004-infinfΓ…
2lbcoatom_siteLaadp_iso0.505091212.94783-infinfΓ…Β²
3lbcoatom_siteBaadp_iso0.504811971.13815-infinfΓ…Β²
4lbcoatom_siteCoadp_iso0.237070.06119-infinfΓ…Β²
5lbcoatom_siteOadp_iso1.393540.01668-infinfΓ…Β²
6hrptlinked_structurelbcoscale9.135030.06407-infinf
7hrptpeakbroad_gauss_u0.081570.00314-infinfdegΒ²
8hrptpeakbroad_gauss_v-0.115920.00672-infinfdegΒ²
9hrptpeakbroad_gauss_w0.120450.00328-infinfdegΒ²
10hrptpeakbroad_lorentz_y0.084450.00215-infinfdeg
11hrptinstrumenttwotheta_offset0.622580.00104-infinfdeg
12hrptbackground10intensity168.558491.36709-infinf
13hrptbackground30intensity164.335710.99917-infinf
14hrptbackground50intensity166.888140.73884-infinf
15hrptbackground110intensity175.400400.65707-infinf
16hrptbackground165intensity174.281130.91128-infinf
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.display.parameters.free()" ] }, { "cell_type": "markdown", "id": "143", "metadata": {}, "source": [ "#### Run Fitting" ] }, { "cell_type": "code", "execution_count": 74, "id": "144", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:33:04.647350Z", "iopub.status.busy": "2026-06-30T22:33:04.647182Z", "iopub.status.idle": "2026-06-30T22:33:06.187693Z", "shell.execute_reply": "2026-06-30T22:33:06.186884Z" } }, "outputs": [ { "data": { "text/html": [], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", "(function() {\n", " const button = document.getElementById('ed-fit-stop-1a98d9ccca8c4385bf9235e00d879051-button');\n", " const status = document.getElementById('ed-fit-stop-1a98d9ccca8c4385bf9235e00d879051-status');\n", " const kernelId = '';\n", " if (!button) {\n", " return;\n", " }\n", "\n", " function setStatus(text) {\n", " if (status) {\n", " status.textContent = text;\n", " }\n", " }\n", "\n", " function pageConfig() {\n", " const element = document.getElementById('jupyter-config-data');\n", " if (!element || !element.textContent) {\n", " return {};\n", " }\n", " try {\n", " return JSON.parse(element.textContent);\n", " } catch (error) {\n", " return {};\n", " }\n", " }\n", "\n", " function baseUrl(config) {\n", " const configured = config.baseUrl || config.base_url ||\n", " (window.Jupyter && Jupyter.notebook && Jupyter.notebook.base_url);\n", " if (configured) {\n", " return configured.endsWith('/') ? configured : configured + '/';\n", " }\n", " const markers = ['/lab/', '/notebooks/', '/tree/'];\n", " for (const marker of markers) {\n", " const index = window.location.pathname.indexOf(marker);\n", " if (index >= 0) {\n", " return window.location.pathname.slice(0, index + 1);\n", " }\n", " }\n", " return '/';\n", " }\n", "\n", " function token(config) {\n", " return config.token || new URLSearchParams(window.location.search).get('token') || '';\n", " }\n", "\n", " function cookie(name) {\n", " const prefix = name + '=';\n", " for (const part of document.cookie.split(';')) {\n", " const trimmed = part.trim();\n", " if (trimmed.startsWith(prefix)) {\n", " return decodeURIComponent(trimmed.slice(prefix.length));\n", " }\n", " }\n", " return '';\n", " }\n", "\n", " function notebookPath() {\n", " const decoded = decodeURIComponent(window.location.pathname);\n", " const markers = ['/lab/tree/', '/notebooks/', '/tree/'];\n", " for (const marker of markers) {\n", " const index = decoded.indexOf(marker);\n", " if (index >= 0) {\n", " return decoded.slice(index + marker.length);\n", " }\n", " }\n", " return '';\n", " }\n", "\n", " async function kernelFromSessions(config) {\n", " const url = new URL(baseUrl(config) + 'api/sessions', window.location.origin);\n", " const authToken = token(config);\n", " if (authToken) {\n", " url.searchParams.set('token', authToken);\n", " }\n", " const response = await fetch(url, {credentials: 'same-origin'});\n", " if (!response.ok) {\n", " return '';\n", " }\n", " const sessions = await response.json();\n", " const path = notebookPath();\n", " const session = sessions.find((item) => item.path === path) || sessions[0];\n", " return session && session.kernel ? session.kernel.id : '';\n", " }\n", "\n", " async function interruptKernel(config, resolvedKernelId) {\n", " const url = new URL(\n", " baseUrl(config) + 'api/kernels/' + resolvedKernelId + '/interrupt',\n", " window.location.origin\n", " );\n", " const authToken = token(config);\n", " if (authToken) {\n", " url.searchParams.set('token', authToken);\n", " }\n", " const xsrfToken = cookie('_xsrf');\n", " const headers = {};\n", " if (xsrfToken) {\n", " headers['X-XSRFToken'] = xsrfToken;\n", " }\n", " const response = await fetch(url, {\n", " method: 'POST',\n", " credentials: 'same-origin',\n", " headers: headers\n", " });\n", " return response.ok;\n", " }\n", "\n", " button.addEventListener('click', async function() {\n", " button.disabled = true;\n", " setStatus('Stopping...');\n", " const config = pageConfig();\n", " try {\n", " const resolvedKernelId = kernelId || await kernelFromSessions(config);\n", " if (!resolvedKernelId) {\n", " throw new Error('Could not resolve the current kernel id.');\n", " }\n", " const interrupted = await interruptKernel(config, resolvedKernelId);\n", " if (!interrupted) {\n", " throw new Error('Jupyter Server rejected the interrupt request.');\n", " }\n", " setStatus('Interrupt sent...');\n", " } catch (error) {\n", " button.disabled = false;\n", " setStatus('Use Kernel > Interrupt to stop this fit.');\n", " }\n", " });\n", "})();\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mStandard fitting\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "πŸ“‹ Using experiment πŸ”¬ \u001b[32m'hrpt'\u001b[0m for \u001b[32m'single'\u001b[0m fitting\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "πŸš€ Starting fit process with \u001b[32m'lmfit \u001b[0m\u001b[32m(\u001b[0m\u001b[32mleastsq\u001b[0m\u001b[32m)\u001b[0m\u001b[32m'\u001b[0m\u001b[33m...\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "πŸ“ˆ Goodness-of-fit progress:\n" ] }, { "data": { "text/html": [ "
iterationtime (s)χ²change / status
110.041.29
2200.781.29
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "πŸ† Best goodness-of-fit \u001b[1m(\u001b[0mreduced χ²\u001b[1m)\u001b[0m is \u001b[1;36m1.29\u001b[0m at iteration \u001b[1;36m19\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'lbco_hrpt'\u001b[0m\u001b[1;36m to \u001b[0m\u001b[32m'../../../projects/refine-lbco-hrpt-report'\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "β”œβ”€β”€ πŸ“„ project.edi\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "β”œβ”€β”€ πŸ“ structures/\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "β”‚ └── πŸ“„ lbco.edi\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "β”œβ”€β”€ πŸ“ experiments/\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "β”‚ └── πŸ“„ hrpt.edi\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "β”œβ”€β”€ πŸ“ analysis/\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "β”‚ └── πŸ“„ analysis.edi\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "└── πŸ“ reports/\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ " └── πŸ“„ lbco_hrpt.html\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "βš™οΈ Settings used:\n" ] }, { "data": { "text/html": [ "
NameValueDescription
1max_iterations1000Maximum solver iterations.
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "πŸ“‹ Least-squares fit results:\n" ] }, { "data": { "text/html": [ "
MetricValue
1πŸ§ͺ Minimizerlmfit
2βœ… Overall statussuccess
3⏱️ Fitting time (seconds)0.78
4πŸ” Iterations17
5πŸ“ Goodness-of-fit (reduced χ²)1.29
6πŸ“ R-factor (Rf, %)5.63
7πŸ“ R-factor squared (RfΒ², %)5.27
8πŸ“ Weighted R-factor (wR, %)4.41
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "πŸ“ˆ Refined parameters:\n" ] }, { "data": { "text/html": [ "
datablockcategoryentryparameterunitsstartvalues.u.change
1lbcocelllength_aΓ…3.89093.89090.00000.00 % ↑
2lbcoatom_siteLaadp_isoΓ…Β²0.50510.50510.02780.00 % ↓
3lbcoatom_siteCoadp_isoΓ…Β²0.23710.23700.05640.03 % ↓
4lbcoatom_siteOadp_isoΓ…Β²1.39351.39350.01600.00 % ↑
5hrptlinked_structurelbcoscale9.13509.13510.05380.00 % ↑
6hrptpeakbroad_gauss_udegΒ²0.08160.08160.00310.00 % ↑
7hrptpeakbroad_gauss_vdegΒ²-0.1159-0.11590.00660.00 % ↑
8hrptpeakbroad_gauss_wdegΒ²0.12040.12040.00320.00 % ↑
9hrptpeakbroad_lorentz_ydeg0.08440.08440.00210.00 % ↓
10hrptinstrumenttwotheta_offsetdeg0.62260.62260.00100.00 % ↑
11hrptbackground10intensity168.5585168.55851.36690.00 % ↓
12hrptbackground30intensity164.3357164.33570.99900.00 % ↓
13hrptbackground50intensity166.8881166.88810.73860.00 % ↓
14hrptbackground110intensity175.4004175.40060.64880.00 % ↑
15hrptbackground165intensity174.2811174.28120.89440.00 % ↑
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
β€’ start = parameter value before refinement
β€’ value = refined value from least-squares minimization
β€’ s.u. = standard uncertainty (one sigma), from the covariance matrix
β€’ change = relative change from start, in %; ↑ = increase, ↓ = decrease
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.analysis.fit()\n", "project.display.fit.results()" ] }, { "cell_type": "markdown", "id": "145", "metadata": {}, "source": [ "#### Display Pattern" ] }, { "cell_type": "code", "execution_count": 75, "id": "146", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:33:06.189305Z", "iopub.status.busy": "2026-06-30T22:33:06.189139Z", "iopub.status.idle": "2026-06-30T22:33:06.258460Z", "shell.execute_reply": "2026-06-30T22:33:06.257732Z" } }, "outputs": [ { "data": { "text/html": [ "
Loading plot…
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.display.pattern(expt_name='hrpt')" ] }, { "cell_type": "code", "execution_count": 76, "id": "147", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:33:06.262584Z", "iopub.status.busy": "2026-06-30T22:33:06.262421Z", "iopub.status.idle": "2026-06-30T22:33:06.328068Z", "shell.execute_reply": "2026-06-30T22:33:06.327410Z" } }, "outputs": [ { "data": { "text/html": [ "
Loading plot…
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.display.pattern(expt_name='hrpt', x_min=38, x_max=41)" ] }, { "cell_type": "markdown", "id": "148", "metadata": {}, "source": [ "### Perform Fit 5/5\n", "\n", "#### Set Constraints\n", "\n", "Set more aliases for parameters." ] }, { "cell_type": "code", "execution_count": 77, "id": "149", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:33:06.329816Z", "iopub.status.busy": "2026-06-30T22:33:06.329654Z", "iopub.status.idle": "2026-06-30T22:33:06.333256Z", "shell.execute_reply": "2026-06-30T22:33:06.332439Z" } }, "outputs": [], "source": [ "project.analysis.aliases.create(\n", " id='occ_La',\n", " param=project.structures['lbco'].atom_sites['La'].occupancy,\n", ")\n", "project.analysis.aliases.create(\n", " id='occ_Ba',\n", " param=project.structures['lbco'].atom_sites['Ba'].occupancy,\n", ")" ] }, { "cell_type": "markdown", "id": "150", "metadata": {}, "source": [ "Set more constraints." ] }, { "cell_type": "code", "execution_count": 78, "id": "151", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:33:06.334890Z", "iopub.status.busy": "2026-06-30T22:33:06.334734Z", "iopub.status.idle": "2026-06-30T22:33:06.337585Z", "shell.execute_reply": "2026-06-30T22:33:06.336827Z" } }, "outputs": [], "source": [ "project.analysis.constraints.create(\n", " expression='occ_Ba = 1 - occ_La',\n", ")" ] }, { "cell_type": "markdown", "id": "152", "metadata": {}, "source": [ "Show defined constraints." ] }, { "cell_type": "code", "execution_count": 79, "id": "153", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:33:06.339106Z", "iopub.status.busy": "2026-06-30T22:33:06.338933Z", "iopub.status.idle": "2026-06-30T22:33:06.346296Z", "shell.execute_reply": "2026-06-30T22:33:06.345641Z" }, "lines_to_next_cell": 2 }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mUser defined constraints\u001b[0m\n" ] }, { "data": { "text/html": [ "
idexpression
1biso_Babiso_Ba = biso_La
2occ_Baocc_Ba = 1 - occ_La
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "Constraints enabled: \u001b[3;92mTrue\u001b[0m\n" ] } ], "source": [ "project.analysis.constraints.show()" ] }, { "cell_type": "markdown", "id": "154", "metadata": {}, "source": [ "Set structure parameters to be refined." ] }, { "cell_type": "code", "execution_count": 80, "id": "155", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:33:06.348021Z", "iopub.status.busy": "2026-06-30T22:33:06.347819Z", "iopub.status.idle": "2026-06-30T22:33:06.350923Z", "shell.execute_reply": "2026-06-30T22:33:06.350234Z" } }, "outputs": [], "source": [ "project.structures['lbco'].atom_sites['La'].occupancy.free = True" ] }, { "cell_type": "markdown", "id": "156", "metadata": {}, "source": [ "Show free parameters after selection." ] }, { "cell_type": "code", "execution_count": 81, "id": "157", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:33:06.352862Z", "iopub.status.busy": "2026-06-30T22:33:06.352712Z", "iopub.status.idle": "2026-06-30T22:33:06.407115Z", "shell.execute_reply": "2026-06-30T22:33:06.405923Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mFree parameters for both structures \u001b[0m\u001b[1;36m(\u001b[0m\u001b[1;36m🧩 data blocks\u001b[0m\u001b[1;36m)\u001b[0m\u001b[1;36m and experiments \u001b[0m\u001b[1;36m(\u001b[0m\u001b[1;36mπŸ”¬ data blocks\u001b[0m\u001b[1;36m)\u001b[0m\n" ] }, { "data": { "text/html": [ "
datablockcategoryentryparametervalueuncertaintyminmaxunits
1lbcocelllength_a3.890870.00004-infinfΓ…
2lbcoatom_siteLaoccupancy0.50000-infinf
3lbcoatom_siteLaadp_iso0.505080.02777-infinfΓ…Β²
4lbcoatom_siteCoadp_iso0.236990.05643-infinfΓ…Β²
5lbcoatom_siteOadp_iso1.393550.01599-infinfΓ…Β²
6hrptlinked_structurelbcoscale9.135090.05380-infinf
7hrptpeakbroad_gauss_u0.081570.00310-infinfdegΒ²
8hrptpeakbroad_gauss_v-0.115930.00664-infinfdegΒ²
9hrptpeakbroad_gauss_w0.120450.00325-infinfdegΒ²
10hrptpeakbroad_lorentz_y0.084450.00214-infinfdeg
11hrptinstrumenttwotheta_offset0.622580.00103-infinfdeg
12hrptbackground10intensity168.558491.36685-infinf
13hrptbackground30intensity164.335690.99900-infinf
14hrptbackground50intensity166.888080.73857-infinf
15hrptbackground110intensity175.400560.64879-infinf
16hrptbackground165intensity174.281240.89439-infinf
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.display.parameters.free()" ] }, { "cell_type": "markdown", "id": "158", "metadata": {}, "source": [ "#### Run Fitting" ] }, { "cell_type": "code", "execution_count": 82, "id": "159", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:33:06.408886Z", "iopub.status.busy": "2026-06-30T22:33:06.408668Z", "iopub.status.idle": "2026-06-30T22:33:09.464146Z", "shell.execute_reply": "2026-06-30T22:33:09.463355Z" } }, "outputs": [ { "data": { "text/html": [], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", "(function() {\n", " const button = document.getElementById('ed-fit-stop-584abe3c0ef94c129f277aa03fe844a4-button');\n", " const status = document.getElementById('ed-fit-stop-584abe3c0ef94c129f277aa03fe844a4-status');\n", " const kernelId = '';\n", " if (!button) {\n", " return;\n", " }\n", "\n", " function setStatus(text) {\n", " if (status) {\n", " status.textContent = text;\n", " }\n", " }\n", "\n", " function pageConfig() {\n", " const element = document.getElementById('jupyter-config-data');\n", " if (!element || !element.textContent) {\n", " return {};\n", " }\n", " try {\n", " return JSON.parse(element.textContent);\n", " } catch (error) {\n", " return {};\n", " }\n", " }\n", "\n", " function baseUrl(config) {\n", " const configured = config.baseUrl || config.base_url ||\n", " (window.Jupyter && Jupyter.notebook && Jupyter.notebook.base_url);\n", " if (configured) {\n", " return configured.endsWith('/') ? configured : configured + '/';\n", " }\n", " const markers = ['/lab/', '/notebooks/', '/tree/'];\n", " for (const marker of markers) {\n", " const index = window.location.pathname.indexOf(marker);\n", " if (index >= 0) {\n", " return window.location.pathname.slice(0, index + 1);\n", " }\n", " }\n", " return '/';\n", " }\n", "\n", " function token(config) {\n", " return config.token || new URLSearchParams(window.location.search).get('token') || '';\n", " }\n", "\n", " function cookie(name) {\n", " const prefix = name + '=';\n", " for (const part of document.cookie.split(';')) {\n", " const trimmed = part.trim();\n", " if (trimmed.startsWith(prefix)) {\n", " return decodeURIComponent(trimmed.slice(prefix.length));\n", " }\n", " }\n", " return '';\n", " }\n", "\n", " function notebookPath() {\n", " const decoded = decodeURIComponent(window.location.pathname);\n", " const markers = ['/lab/tree/', '/notebooks/', '/tree/'];\n", " for (const marker of markers) {\n", " const index = decoded.indexOf(marker);\n", " if (index >= 0) {\n", " return decoded.slice(index + marker.length);\n", " }\n", " }\n", " return '';\n", " }\n", "\n", " async function kernelFromSessions(config) {\n", " const url = new URL(baseUrl(config) + 'api/sessions', window.location.origin);\n", " const authToken = token(config);\n", " if (authToken) {\n", " url.searchParams.set('token', authToken);\n", " }\n", " const response = await fetch(url, {credentials: 'same-origin'});\n", " if (!response.ok) {\n", " return '';\n", " }\n", " const sessions = await response.json();\n", " const path = notebookPath();\n", " const session = sessions.find((item) => item.path === path) || sessions[0];\n", " return session && session.kernel ? session.kernel.id : '';\n", " }\n", "\n", " async function interruptKernel(config, resolvedKernelId) {\n", " const url = new URL(\n", " baseUrl(config) + 'api/kernels/' + resolvedKernelId + '/interrupt',\n", " window.location.origin\n", " );\n", " const authToken = token(config);\n", " if (authToken) {\n", " url.searchParams.set('token', authToken);\n", " }\n", " const xsrfToken = cookie('_xsrf');\n", " const headers = {};\n", " if (xsrfToken) {\n", " headers['X-XSRFToken'] = xsrfToken;\n", " }\n", " const response = await fetch(url, {\n", " method: 'POST',\n", " credentials: 'same-origin',\n", " headers: headers\n", " });\n", " return response.ok;\n", " }\n", "\n", " button.addEventListener('click', async function() {\n", " button.disabled = true;\n", " setStatus('Stopping...');\n", " const config = pageConfig();\n", " try {\n", " const resolvedKernelId = kernelId || await kernelFromSessions(config);\n", " if (!resolvedKernelId) {\n", " throw new Error('Could not resolve the current kernel id.');\n", " }\n", " const interrupted = await interruptKernel(config, resolvedKernelId);\n", " if (!interrupted) {\n", " throw new Error('Jupyter Server rejected the interrupt request.');\n", " }\n", " setStatus('Interrupt sent...');\n", " } catch (error) {\n", " button.disabled = false;\n", " setStatus('Use Kernel > Interrupt to stop this fit.');\n", " }\n", " });\n", "})();\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mStandard fitting\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "πŸ“‹ Using experiment πŸ”¬ \u001b[32m'hrpt'\u001b[0m for \u001b[32m'single'\u001b[0m fitting\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "πŸš€ Starting fit process with \u001b[32m'lmfit \u001b[0m\u001b[32m(\u001b[0m\u001b[32mleastsq\u001b[0m\u001b[32m)\u001b[0m\u001b[32m'\u001b[0m\u001b[33m...\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "πŸ“ˆ Goodness-of-fit progress:\n" ] }, { "data": { "text/html": [ "
iterationtime (s)χ²change / status
110.041.29
2552.011.28
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "πŸ† Best goodness-of-fit \u001b[1m(\u001b[0mreduced χ²\u001b[1m)\u001b[0m is \u001b[1;36m1.28\u001b[0m at iteration \u001b[1;36m54\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'lbco_hrpt'\u001b[0m\u001b[1;36m to \u001b[0m\u001b[32m'../../../projects/refine-lbco-hrpt-report'\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "β”œβ”€β”€ πŸ“„ project.edi\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "β”œβ”€β”€ πŸ“ structures/\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "β”‚ └── πŸ“„ lbco.edi\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "β”œβ”€β”€ πŸ“ experiments/\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "β”‚ └── πŸ“„ hrpt.edi\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "β”œβ”€β”€ πŸ“ analysis/\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "β”‚ └── πŸ“„ analysis.edi\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "└── πŸ“ reports/\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ " └── πŸ“„ lbco_hrpt.html\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "βš™οΈ Settings used:\n" ] }, { "data": { "text/html": [ "
NameValueDescription
1max_iterations1000Maximum solver iterations.
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "πŸ“‹ Least-squares fit results:\n" ] }, { "data": { "text/html": [ "
MetricValue
1πŸ§ͺ Minimizerlmfit
2βœ… Overall statussuccess
3⏱️ Fitting time (seconds)2.01
4πŸ” Iterations52
5πŸ“ Goodness-of-fit (reduced χ²)1.28
6πŸ“ R-factor (Rf, %)5.61
7πŸ“ R-factor squared (RfΒ², %)5.25
8πŸ“ Weighted R-factor (wR, %)4.39
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "πŸ“ˆ Refined parameters:\n" ] }, { "data": { "text/html": [ "
datablockcategoryentryparameterunitsstartvalues.u.change
1lbcocelllength_aΓ…3.89093.89090.00000.00 % ↑
2lbcoatom_siteLaoccupancy0.50000.58400.020316.81 % ↑
3lbcoatom_siteLaadp_isoΓ…Β²0.50510.59830.035518.46 % ↑
4lbcoatom_siteCoadp_isoΓ…Β²0.23700.16650.058029.74 % ↓
5lbcoatom_siteOadp_isoΓ…Β²1.39351.34910.01923.19 % ↓
6hrptlinked_structurelbcoscale9.13518.90570.07612.51 % ↓
7hrptpeakbroad_gauss_udegΒ²0.08160.08120.00310.43 % ↓
8hrptpeakbroad_gauss_vdegΒ²-0.1159-0.11540.00660.48 % ↓
9hrptpeakbroad_gauss_wdegΒ²0.12040.12030.00320.14 % ↓
10hrptpeakbroad_lorentz_ydeg0.08440.08460.00210.18 % ↑
11hrptinstrumenttwotheta_offsetdeg0.62260.62260.00100.00 % ↑
12hrptbackground10intensity168.5585168.97801.36660.25 % ↑
13hrptbackground30intensity164.3357164.05350.99920.17 % ↓
14hrptbackground50intensity166.8881166.91250.73640.01 % ↑
15hrptbackground110intensity175.4006175.26990.64790.07 % ↓
16hrptbackground165intensity174.2812174.55800.89350.16 % ↑
" ], "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": [ "\n", "\n", "
\n", "
Loading plot…
\n", "
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.analysis.fit()\n", "project.display.fit.results()\n", "project.display.fit.correlations()" ] }, { "cell_type": "markdown", "id": "160", "metadata": {}, "source": [ "#### Display Pattern" ] }, { "cell_type": "code", "execution_count": 83, "id": "161", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:33:09.465942Z", "iopub.status.busy": "2026-06-30T22:33:09.465711Z", "iopub.status.idle": "2026-06-30T22:33:09.536566Z", "shell.execute_reply": "2026-06-30T22:33:09.535628Z" } }, "outputs": [ { "data": { "text/html": [ "
Loading plot…
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.display.pattern(expt_name='hrpt')" ] }, { "cell_type": "code", "execution_count": 84, "id": "162", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:33:09.540647Z", "iopub.status.busy": "2026-06-30T22:33:09.540470Z", "iopub.status.idle": "2026-06-30T22:33:09.618408Z", "shell.execute_reply": "2026-06-30T22:33:09.617577Z" } }, "outputs": [ { "data": { "text/html": [ "
Loading plot…
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "project.display.pattern(expt_name='hrpt', x_min=38, x_max=41)" ] }, { "cell_type": "markdown", "id": "163", "metadata": {}, "source": [ "#### Display Structure" ] }, { "cell_type": "code", "execution_count": 85, "id": "164", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:33:09.620268Z", "iopub.status.busy": "2026-06-30T22:33:09.620077Z", "iopub.status.idle": "2026-06-30T22:33:09.658308Z", "shell.execute_reply": "2026-06-30T22:33:09.657462Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mStructure 🧩 \u001b[0m\u001b[32m'lbco'\u001b[0m\u001b[1;36m \u001b[0m\u001b[1;36m(\u001b[0m\u001b[1;36mAtom view type: \u001b[0m\u001b[32m'adp'\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='lbco')" ] }, { "cell_type": "markdown", "id": "165", "metadata": {}, "source": [ "## πŸ“Š Report\n", "\n", "This final section shows how to review the results of the analysis.\n", "\n", "By default, HTML report is generated after fitting. Here we also\n", "show how to activate generation of CIF, TEX and PDF reports with\n", "regular project saves.\n", "Keep in mind, that PDF report generation requires additional\n", "dependencies and is not that fast to be generated after each fit, so\n", "use it with caution.\n", "The generated report files will be saved in the `reports` folder of\n", "the project directory." ] }, { "cell_type": "code", "execution_count": 86, "id": "166", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T22:33:09.660252Z", "iopub.status.busy": "2026-06-30T22:33:09.660080Z", "iopub.status.idle": "2026-06-30T22:33:36.825474Z", "shell.execute_reply": "2026-06-30T22:33:36.824664Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1;36mSaving project πŸ“¦ \u001b[0m\u001b[32m'lbco_hrpt'\u001b[0m\u001b[1;36m to \u001b[0m\u001b[32m'../../../projects/refine-lbco-hrpt-report'\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "β”œβ”€β”€ πŸ“„ project.edi\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "β”œβ”€β”€ πŸ“ structures/\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "β”‚ └── πŸ“„ lbco.edi\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "β”œβ”€β”€ πŸ“ experiments/\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "β”‚ └── πŸ“„ hrpt.edi\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "β”œβ”€β”€ πŸ“ analysis/\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "β”‚ └── πŸ“„ analysis.edi\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "└── πŸ“ reports/\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ " β”œβ”€β”€ πŸ“„ lbco_hrpt.cif\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ " β”œβ”€β”€ πŸ“„ lbco_hrpt.html\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ " β”œβ”€β”€ πŸ“„ tex/lbco_hrpt.tex\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ " └── πŸ“„ lbco_hrpt.pdf\n" ] } ], "source": [ "project.report.cif = True\n", "project.report.tex = True\n", "project.report.pdf = True\n", "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.5" } }, "nbformat": 4, "nbformat_minor": 5 }