{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "0",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-30T22:27:19.217656Z",
"iopub.status.busy": "2026-06-30T22:27:19.217459Z",
"iopub.status.idle": "2026-06-30T22:27:19.221686Z",
"shell.execute_reply": "2026-06-30T22:27:19.220922Z"
},
"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": [
"# Pr₂NiO₄ — single-crystal neutron CW — basic\n",
"\n",
"Verifies calculated F² values for a constant-wavelength neutron\n",
"single-crystal reference with anisotropic ADPs.\n",
"\n",
"**Refinement:** the overall scale only; all other parameters are\n",
"taken from the FullProf reference."
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "2",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-30T22:27:19.223945Z",
"iopub.status.busy": "2026-06-30T22:27:19.223729Z",
"iopub.status.idle": "2026-06-30T22:27:22.150402Z",
"shell.execute_reply": "2026-06-30T22:27:22.149524Z"
}
},
"outputs": [],
"source": [
"import easydiffraction as edi\n",
"from easydiffraction import ExperimentFactory\n",
"from easydiffraction import StructureFactory\n",
"from easydiffraction.analysis import verification as verify"
]
},
{
"cell_type": "markdown",
"id": "3",
"metadata": {},
"source": [
"## Build the project"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "4",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-30T22:27:22.152666Z",
"iopub.status.busy": "2026-06-30T22:27:22.152372Z",
"iopub.status.idle": "2026-06-30T22:27:22.365805Z",
"shell.execute_reply": "2026-06-30T22:27:22.364785Z"
}
},
"outputs": [],
"source": [
"project = edi.Project()"
]
},
{
"cell_type": "markdown",
"id": "5",
"metadata": {},
"source": [
"## Define the structure"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "6",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-30T22:27:22.367622Z",
"iopub.status.busy": "2026-06-30T22:27:22.367452Z",
"iopub.status.idle": "2026-06-30T22:27:22.381669Z",
"shell.execute_reply": "2026-06-30T22:27:22.380742Z"
}
},
"outputs": [],
"source": [
"structure = StructureFactory.from_scratch(name='pr2nio4')\n",
"\n",
"structure.space_group.name_h_m = 'F m m m' # FullProf Space group symbol\n",
"\n",
"structure.cell.length_a = 5.417799 # FullProf a\n",
"structure.cell.length_b = 5.414600 # FullProf b\n",
"structure.cell.length_c = 12.483399 # FullProf c\n",
"\n",
"# Anisotropic sites carry the FullProf β tensor directly: ``adp_type`` is\n",
"# set to ``'beta'`` and the dimensionless β components are assigned\n",
"# verbatim. F m m m is orthorhombic, so β11, β22, β33 are independent —\n",
"# each is set explicitly rather than left to a symmetry constraint.\n",
"# FullProf occupancy folds in the site multiplicity; the chemical\n",
"# occupancy here is the FullProf Occ scaled by the multiplicity (1.0 for\n",
"# a full site).\n",
"structure.atom_sites.create(\n",
" id='Pr', # FullProf Atom\n",
" type_symbol='Pr', # FullProf Typ\n",
" fract_x=0.5, # FullProf X\n",
" fract_y=0.5, # FullProf Y\n",
" fract_z=0.35973, # FullProf Z\n",
" adp_type='beta', # FullProf beta tensor\n",
")\n",
"aniso = structure.atom_site_aniso['Pr']\n",
"aniso.adp_11 = 0.00710 # FullProf beta11\n",
"aniso.adp_22 = 0.00710 # FullProf beta22\n",
"aniso.adp_33 = 0.00084 # FullProf beta33\n",
"\n",
"structure.atom_sites.create(\n",
" id='Ni', # FullProf Atom\n",
" type_symbol='Ni', # FullProf Typ\n",
" fract_x=0, # FullProf X\n",
" fract_y=0, # FullProf Y\n",
" fract_z=0, # FullProf Z\n",
" adp_type='beta', # FullProf beta tensor\n",
")\n",
"aniso = structure.atom_site_aniso['Ni']\n",
"aniso.adp_11 = 0.00280 # FullProf beta11\n",
"aniso.adp_22 = 0.00280 # FullProf beta22\n",
"aniso.adp_33 = 0.00151 # FullProf beta33\n",
"\n",
"structure.atom_sites.create(\n",
" id='O1', # FullProf Atom\n",
" type_symbol='O', # FullProf Typ\n",
" fract_x=0.25, # FullProf X\n",
" fract_y=0.25, # FullProf Y\n",
" fract_z=0, # FullProf Z\n",
" adp_type='beta', # FullProf beta tensor\n",
")\n",
"aniso = structure.atom_site_aniso['O1']\n",
"aniso.adp_11 = 0.00500 # FullProf beta11\n",
"aniso.adp_22 = 0.00500 # FullProf beta22\n",
"aniso.adp_33 = 0.00413 # FullProf beta33\n",
"aniso.adp_12 = -0.00140 # FullProf beta12\n",
"\n",
"structure.atom_sites.create(\n",
" id='O2', # FullProf Atom\n",
" type_symbol='O', # FullProf Typ\n",
" fract_x=0, # FullProf X\n",
" fract_y=0, # FullProf Y\n",
" fract_z=0.17385, # FullProf Z\n",
" occupancy=0.722965, # FullProf Occ 1.44593 / multiplicity\n",
" adp_type='beta', # FullProf beta tensor\n",
")\n",
"aniso = structure.atom_site_aniso['O2']\n",
"aniso.adp_11 = 0.01716 # FullProf beta11\n",
"aniso.adp_22 = 0.01716 # FullProf beta22\n",
"aniso.adp_33 = 0.00045 # FullProf beta33\n",
"\n",
"structure.atom_sites.create(\n",
" id='Oi', # FullProf Atom\n",
" type_symbol='O', # FullProf Typ\n",
" fract_x=0.25, # FullProf X\n",
" fract_y=0.25, # FullProf Y\n",
" fract_z=0.25, # FullProf Z\n",
" occupancy=0.074655, # FullProf Occ 0.14931 / multiplicity\n",
" adp_type='beta', # FullProf beta tensor\n",
")\n",
"aniso = structure.atom_site_aniso['Oi']\n",
"aniso.adp_11 = 0.01033 # FullProf beta11\n",
"aniso.adp_22 = 0.01176 # FullProf beta22\n",
"aniso.adp_33 = 0.00100 # FullProf beta33\n",
"\n",
"# The split interstitial oxygen Od is refined with an isotropic B.\n",
"structure.atom_sites.create(\n",
" id='Od', # FullProf Atom\n",
" type_symbol='O', # FullProf Typ\n",
" fract_x=0.07347, # FullProf X\n",
" fract_y=0.07347, # FullProf Y\n",
" fract_z=0.17349, # FullProf Z\n",
" occupancy=0.074654, # FullProf Occ 0.59723 / multiplicity\n",
" adp_type='Biso', # FullProf Biso\n",
" adp_iso=2.31435, # FullProf Biso\n",
")\n",
"\n",
"project.structures.add(structure)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "7",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-30T22:27:22.383273Z",
"iopub.status.busy": "2026-06-30T22:27:22.383081Z",
"iopub.status.idle": "2026-06-30T22:27:23.037950Z",
"shell.execute_reply": "2026-06-30T22:27:23.037138Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1;36mStructure 🧩 \u001b[0m\u001b[32m'pr2nio4'\u001b[0m\u001b[1;36m as text\u001b[0m\n"
]
},
{
"data": {
"text/html": [
"
| Edi |
|---|
| 1 | data_pr2nio4 |
|---|
| 2 | |
|---|
| 3 | _cell.length_a 5.417799 |
|---|
| 4 | _cell.length_b 5.4146 |
|---|
| 5 | _cell.length_c 12.483399 |
|---|
| 6 | _cell.angle_alpha 90. |
|---|
| 7 | _cell.angle_beta 90. |
|---|
| 8 | _cell.angle_gamma 90. |
|---|
| 9 | |
|---|
| 10 | _space_group.name_h_m "F m m m" |
|---|
| 11 | _space_group.coord_system_code abc |
|---|
| 12 | |
|---|
| 13 | _geom.min_bond_distance_cutoff 0. |
|---|
| 14 | _geom.bond_distance_inc 0.25 |
|---|
| 15 | |
|---|
| 16 | loop_ |
|---|
| 17 | _atom_site.id |
|---|
| 18 | _atom_site.type_symbol |
|---|
| 19 | _atom_site.fract_x |
|---|
| 20 | _atom_site.fract_y |
|---|
| 21 | _atom_site.fract_z |
|---|
| 22 | _atom_site.wyckoff_letter |
|---|
| 23 | _atom_site.multiplicity |
|---|
| 24 | _atom_site.occupancy |
|---|
| 25 | _atom_site.adp_iso |
|---|
| 26 | _atom_site.adp_type |
|---|
| 27 | Pr Pr 0.5 0.5 0.35973 i 8 1. 0.00924491 beta |
|---|
| 28 | Ni Ni 0. 0. 0. a 4 1. 0.0067478 beta |
|---|
| 29 | O1 O 0.25 0.25 0. e 8 1. 0.01582218 beta |
|---|
| 30 | O2 O 0. 0. 0.17385 i 8 0.722965 0.01818564 beta |
|---|
| 31 | Oi O 0.25 0.25 0.25 f 8 0.074655 0.01357409 beta |
|---|
| 32 | Od O 0.07347 0.07347 0.17349 p 32 0.074654 2.31435 Biso |
|---|
| 33 | |
|---|
| 34 | loop_ |
|---|
| 35 | _atom_site_aniso.id |
|---|
| 36 | _atom_site_aniso.adp_11 |
|---|
| 37 | _atom_site_aniso.adp_22 |
|---|
| 38 | _atom_site_aniso.adp_33 |
|---|
| 39 | _atom_site_aniso.adp_12 |
|---|
| 40 | _atom_site_aniso.adp_13 |
|---|
| 41 | _atom_site_aniso.adp_23 |
|---|
| 42 | Pr 0.0071 0.0071 0.00084 0. 0. 0. |
|---|
| 43 | Ni 0.0028 0.0028 0.00151 0. 0. 0. |
|---|
| 44 | O1 0.005 0.005 0.00413 -0.0014 0. 0. |
|---|
| 45 | O2 0.01716 0.01716 0.00045 0. 0. 0. |
|---|
| 46 | Oi 0.01033 0.01176 0.001 0. 0. 0. |
|---|
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"structure.show_as_text()"
]
},
{
"cell_type": "markdown",
"id": "8",
"metadata": {},
"source": [
"## Load the FullProf reference"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "9",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-30T22:27:23.039769Z",
"iopub.status.busy": "2026-06-30T22:27:23.039584Z",
"iopub.status.idle": "2026-06-30T22:27:23.043691Z",
"shell.execute_reply": "2026-06-30T22:27:23.042881Z"
}
},
"outputs": [],
"source": [
"FULLPROF_PROJECT_DIR = 'sc-neut-cwl_pr2nio4_basic'\n",
"FULLPROF_OUT_FILE = 'prnio.out'\n",
"FULLPROF_SCALE = 0.06298 # FullProf Scale\n",
"FULLPROF_WAVELENGTH = 0.8302 # FullProf Lambda\n",
"\n",
"f2calc = verify.load_fullprof_sc_f2calc(FULLPROF_PROJECT_DIR, FULLPROF_OUT_FILE)\n",
"FULLPROF_LABEL = verify.fullprof_label(FULLPROF_PROJECT_DIR, FULLPROF_OUT_FILE)"
]
},
{
"cell_type": "markdown",
"id": "10",
"metadata": {},
"source": [
"## Create the experiment"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "11",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-30T22:27:23.045288Z",
"iopub.status.busy": "2026-06-30T22:27:23.045124Z",
"iopub.status.idle": "2026-06-30T22:27:23.112962Z",
"shell.execute_reply": "2026-06-30T22:27:23.112355Z"
}
},
"outputs": [],
"source": [
"experiment = ExperimentFactory.from_scratch(\n",
" name='pr2nio4',\n",
" sample_form='single crystal',\n",
" beam_mode='constant wavelength',\n",
" radiation_probe='neutron',\n",
" scattering_type='bragg',\n",
")\n",
"\n",
"experiment.linked_structure.structure_id = 'pr2nio4'\n",
"experiment.linked_structure.scale = FULLPROF_SCALE\n",
"experiment.instrument.setup_wavelength = FULLPROF_WAVELENGTH\n",
"\n",
"verify.set_reference_reflections(experiment, f2calc)\n",
"\n",
"project.experiments.add(experiment)"
]
},
{
"cell_type": "markdown",
"id": "12",
"metadata": {},
"source": [
"## edi-cryspy VS FullProf"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "13",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-30T22:27:23.118599Z",
"iopub.status.busy": "2026-06-30T22:27:23.118378Z",
"iopub.status.idle": "2026-06-30T22:27:23.391172Z",
"shell.execute_reply": "2026-06-30T22:27:23.389866Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1;36mCalculator for experiment \u001b[0m\u001b[32m'pr2nio4'\u001b[0m\u001b[1;36m already set to\u001b[0m\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"cryspy\n"
]
},
{
"data": {
"text/html": [
""
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"calc_ed_cryspy = verify.calculate_reflections(project, experiment, 'cryspy')\n",
"LABEL_ED_CRYSPY = verify.engine_label('cryspy')\n",
"reference, candidate = verify.align_reflections(f2calc, calc_ed_cryspy)\n",
"\n",
"project.display.reflection_comparison(\n",
" 'pr2nio4',\n",
" reference=reference,\n",
" candidate=candidate,\n",
" reference_label=FULLPROF_LABEL,\n",
" candidate_label=LABEL_ED_CRYSPY,\n",
")"
]
},
{
"cell_type": "markdown",
"id": "14",
"metadata": {},
"source": [
"## Fit edi-cryspy to FullProf"
]
},
{
"cell_type": "code",
"execution_count": 9,
"id": "15",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-30T22:27:23.393307Z",
"iopub.status.busy": "2026-06-30T22:27:23.392928Z",
"iopub.status.idle": "2026-06-30T22:27:23.911519Z",
"shell.execute_reply": "2026-06-30T22:27:23.910773Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1;36mCalculator for experiment \u001b[0m\u001b[32m'pr2nio4'\u001b[0m\u001b[1;36m already set to\u001b[0m\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"cryspy\n"
]
},
{
"data": {
"text/html": [],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": [
"\n",
"(function() {\n",
" const button = document.getElementById('ed-fit-stop-3b25e9a4448c42989afdd9db763b3fed-button');\n",
" const status = document.getElementById('ed-fit-stop-3b25e9a4448c42989afdd9db763b3fed-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'pr2nio4'\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": [
" | iteration | time (s) | χ² | change / status |
|---|
| 1 | 1 | 0.02 | 34301.03 | |
|---|
| 2 | 5 | 0.08 | 0.01 | 100.0% ↓ |
|---|
| 3 | 8 | 0.13 | 0.01 | |
|---|
"
],
"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;36m0.01\u001b[0m at iteration \u001b[1;36m5\u001b[0m\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"✅ Fitting complete.\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"⚙️ Settings used:\n"
]
},
{
"data": {
"text/html": [
" | Name | Value | Description |
|---|
| 1 | max_iterations | 1000 | Maximum solver iterations. |
|---|
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"📋 Least-squares fit results:\n"
]
},
{
"data": {
"text/html": [
" | Metric | Value |
|---|
| 1 | 🧪 Minimizer | lmfit (leastsq) |
|---|
| 2 | ✅ Overall status | success |
|---|
| 3 | ⏱️ Fitting time (seconds) | 0.13 |
|---|
| 4 | 🔁 Iterations | 5 |
|---|
| 5 | 📏 Goodness-of-fit (reduced χ²) | 0.01 |
|---|
| 6 | 📏 R-factor (Rf, %) | 0.06 |
|---|
| 7 | 📏 R-factor squared (Rf², %) | 0.05 |
|---|
| 8 | 📏 Weighted R-factor (wR, %) | 0.05 |
|---|
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"📈 Refined parameters:\n"
]
},
{
"data": {
"text/html": [
" | datablock | category | entry | parameter | units | start | value | s.u. | change |
|---|
| 1 | pr2nio4 | linked_structure | | scale | | 0.0630 | 2.0176 | 0.0001 | 3103.50 % ↑ |
|---|
"
],
"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"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1;36mCalculator for experiment \u001b[0m\u001b[32m'pr2nio4'\u001b[0m\u001b[1;36m already set to\u001b[0m\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"cryspy\n"
]
},
{
"data": {
"text/html": [
""
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
" | Metric | Before | After |
|---|
| 1 | Profile diff (%) | 96.88 | 0.05 |
|---|
| 2 | Max deviation (%) | 96.88 | 0.08 |
|---|
| 3 | Area ratio | 0.0312 | 1.0004 |
|---|
| 4 | Shape correlation | 1.0000 | 1.0000 |
|---|
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"experiment.calculator.type = 'cryspy'\n",
"\n",
"experiment.linked_structure.scale.free = True\n",
"\n",
"project.analysis.fit()\n",
"project.display.fit.results()\n",
"\n",
"calc_ed_cryspy_refined = verify.calculate_reflections(project, experiment, 'cryspy')\n",
"LABEL_ED_CRYSPY_REFINED = verify.engine_label('cryspy', note='scale only')\n",
"reference_refined, candidate_refined = verify.align_reflections(f2calc, calc_ed_cryspy_refined)\n",
"\n",
"project.display.reflection_comparison(\n",
" 'pr2nio4',\n",
" reference=reference_refined,\n",
" candidate=candidate_refined,\n",
" reference_label=FULLPROF_LABEL,\n",
" candidate_label=LABEL_ED_CRYSPY_REFINED,\n",
")\n",
"\n",
"verify.report_refinement_closeness(\n",
" reference,\n",
" candidate,\n",
" candidate_refined,\n",
")"
]
},
{
"cell_type": "markdown",
"id": "16",
"metadata": {},
"source": [
"## Agreement check"
]
},
{
"cell_type": "code",
"execution_count": 10,
"id": "17",
"metadata": {
"execution": {
"iopub.execute_input": "2026-06-30T22:27:23.913072Z",
"iopub.status.busy": "2026-06-30T22:27:23.912920Z",
"iopub.status.idle": "2026-06-30T22:27:23.920221Z",
"shell.execute_reply": "2026-06-30T22:27:23.919228Z"
}
},
"outputs": [
{
"data": {
"text/html": [
" | Comparison | Metric | Expected | Actual | OK |
|---|
| 1 | edi 0.19.1 (cryspy 0.12.1, scale only) vs FullProf 8.40 | Profile diff (%) | < 2.5 | 0.05 | ✅ |
|---|
| 2 | | Max deviation (%) | < 6 | 0.08 | ✅ |
|---|
| 3 | | Area ratio | 0.99 to 1.01 | 1.0004 | ✅ |
|---|
| 4 | | Shape correlation | > 0.999 | 1.0000 | ✅ |
|---|
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"verify.assert_patterns_agree([\n",
" (f'{LABEL_ED_CRYSPY_REFINED} vs {FULLPROF_LABEL}', reference_refined, candidate_refined),\n",
"])"
]
}
],
"metadata": {
"jupytext": {
"cell_metadata_filter": "-all",
"main_language": "python",
"notebook_metadata_filter": "-all"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.14.5"
}
},
"nbformat": 4,
"nbformat_minor": 5
}