Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion 01_Introduction.md → 01_introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ The approach also implements an efficient pre-processing strategy that highly be
This study demonstrates and benchmarks the PM methodology on the SPED dataset from the model Al-Cu-Li alloy that has previously been released open-source together with a corresponding ground truth phase map [@Thronsen2024].
The workflow is further validated by applying it to the more challenging precipitate structures in an Al-Mg-Si-Cu alloy that contains both partly disordered and structurally similar precipitates [@Sunde2020; @sorhaug2026].
Overall, this study aims to establish a user-friendly and robust framework for SPED phase mapping that handles both known and unknown crystal structures.
The workflow is released open-source, and it can be further modified and readily applied to other material systems, for instance it has already been applied to Al-Zn-Mg-Cu alloys [@Ryggetangen2025] and Al-Mg-Si-Cu alloys in a related publication [@sorhaug2026].
The workflow is released open-source, and it can be further modified and readily applied to other material systems, for instance it has already been applied to Al-Zn-Mg-Cu alloys [@Ryggetangen2025] and Al-Mg-Si-Cu alloys in a related publication [@sorhaug2026].
4 changes: 2 additions & 2 deletions myst.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ project:
- Al-Cu-Li
- Al-Mg-Si-Cu
- precipitates
github: https://github.com/tinabe/pattern-matching-paper
github: https://github.com/msa-em/pattern-matching-paper
jupyter: true
# jupyter:
# server:
Expand All @@ -25,7 +25,7 @@ project:
license: CC-BY-4.0
#banner: banner.png
#thumbnail: thumbnail.webp
date: 2026-06-24
date: 2026-06-26
requirements:
- 'Dockerfile'
- requirements.txt
Expand Down
33 changes: 14 additions & 19 deletions notebooks/advanced_phase_map.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
"import hyperspy.api as hs\n",
"from matplotlib.colors import to_rgba, LinearSegmentedColormap, ListedColormap\n",
"from IPython.display import display\n",
"from ipywidgets import Dropdown, interactive, Layout"
"from ipywidgets import Dropdown, interactive, Layout\n",
"from pathlib import Path"
]
},
{
Expand All @@ -45,16 +46,18 @@
"folder_data = './data/'\n",
"\n",
"phase_maps = [\n",
" hs.load(folder_data+'phase_map_nmf.hspy'), \n",
" hs.load(folder_data+'phase_map_nmf_overlap.hspy'), \n",
" hs.load(folder_data+'phase_map_nmf_overlap_nmf.hspy'), \n",
" hs.load(folder_data+'phase_map_nmf_overlap_clustering.hspy')]\n",
" hs.load(Path(folder_data+'phase_map_nmf.hspy')), \n",
" hs.load(Path(folder_data+'phase_map_nmf_overlap.hspy')), \n",
" hs.load(Path(folder_data+'phase_map_nmf_overlap_nmf.hspy')), \n",
" hs.load(Path(folder_data+'phase_map_nmf_overlap_clustering.hspy'))\n",
"]\n",
"\n",
"max_nccs = [\n",
" hs.load(folder_data+'nccmax_nmf.hspy'), \n",
" hs.load(folder_data+'nccmax_nmf_overlap.hspy'), \n",
" hs.load(folder_data+'nccmax_nmf_overlap_nmf.hspy'), \n",
" hs.load(folder_data+'nccmax_nmf_overlap_clustering.hspy')]"
" hs.load(Path(folder_data+'nccmax_nmf.hspy')), \n",
" hs.load(Path(folder_data+'nccmax_nmf_overlap.hspy')), \n",
" hs.load(Path(folder_data+'nccmax_nmf_overlap_nmf.hspy')), \n",
" hs.load(Path(folder_data+'nccmax_nmf_overlap_clustering.hspy'))\n",
" ]"
]
},
{
Expand Down Expand Up @@ -162,7 +165,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "58d4c2d38cf04b93b0da2206c2e35dc3",
"model_id": "e1c152e96ef64a09bef56ab8c9b64cca",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -176,7 +179,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "bbc96d0745884970b7fcabfde6650c30",
"model_id": "4c49480a75cc4fa2ae963e77e1370acd",
"version_major": 2,
"version_minor": 0
},
Expand Down Expand Up @@ -256,14 +259,6 @@
"template_widget.observe(update_plot, names='value')\n",
"display(template_widget)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "f81732fa-cd13-4d69-b104-1186a5c1109c",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down
13 changes: 7 additions & 6 deletions notebooks/ground_truth_comparison.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"import hyperspy.api as hs\n",
"from matplotlib.colors import to_rgba, LinearSegmentedColormap, ListedColormap\n",
"from IPython.display import display\n",
"from ipywidgets import Dropdown, interactive, Layout"
"from ipywidgets import Dropdown, interactive, Layout\n",
"from pathlib import Path"
]
},
{
Expand All @@ -44,7 +45,7 @@
"outputs": [],
"source": [
"folder_data = './data/'\n",
"gt = hs.load(folder_data + 'ground_truth.hspy')\n",
"gt = hs.load(Path(folder_data + 'ground_truth.hspy'))\n",
"\n",
"file_names = []\n",
"diffs = []\n",
Expand All @@ -56,11 +57,11 @@
" for file in files:\n",
" file_names.append(file[:-5])\n",
" if file.startswith('diff_'):\n",
" diff = hs.load(folder_data+file)\n",
" diff = hs.load(Path(folder_data+file))\n",
" diffs.append(diff)\n",
" diffs_names.append(file[:-5])\n",
" elif file.startswith('phase_map_') and file.endswith('_gt.hspy'):\n",
" phase_map = hs.load(folder_data+file)\n",
" phase_map = hs.load(Path(folder_data+file))\n",
" phase_maps.append(phase_map)\n",
" phase_maps_names.append(file[:-5])"
]
Expand Down Expand Up @@ -93,7 +94,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "35826eefc6d54c15bb8d86eb4d4c5c64",
"model_id": "87dcf68ef3f8471492da761c83523d69",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -107,7 +108,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "e7023c14637b41459a9db04e5314f491",
"model_id": "7472c77dd90b46eca97bd16d7d2cdd7e",
"version_major": 2,
"version_minor": 0
},
Expand Down
29 changes: 16 additions & 13 deletions notebooks/nmf_components.ipynb

Large diffs are not rendered by default.

32 changes: 12 additions & 20 deletions notebooks/preprocessing.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,10 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 2,
"id": "f8bb324c-10a2-4a0a-aded-c5929b200d44",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/Users/gvarnavides/Documents/git-repos/pattern-matching-paper/.venv/lib/python3.12/site-packages/hyperspy/misc/utils.py:72: VisibleDeprecationWarning: `_get_block_pattern` has moved to `hyperspy.misc.dask_utils`. It is for internal use only and may be removed in the future.\n",
" warnings.warn(\n"
]
}
],
"outputs": [],
"source": [
"%matplotlib widget\n",
"import numpy as np\n",
Expand All @@ -33,6 +24,7 @@
"from matplotlib.colors import LogNorm\n",
"from IPython.display import display\n",
"from ipywidgets import Dropdown, interactive, Layout, FloatSlider\n",
"from pathlib import Path\n",
"\n",
"plt.rcParams['figure.figsize'] = (3, 2)\n",
"plt.rcParams.update({'font.size': 8})\n",
Expand All @@ -41,21 +33,21 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 3,
"id": "8841172e-5d75-41db-9ab1-d5f629377a63",
"metadata": {},
"outputs": [],
"source": [
"folder_data = './data/'\n",
"s = hs.load(folder_data + '2xxx_selected_patterns.hspy')\n",
"tmds = hs.load(folder_data + '2xxx_selected_patterns_tmds.hspy')\n",
"signal_mask = hs.load(folder_data + 'signal_mask.hspy')\n",
"s = hs.load(Path(folder_data + '2xxx_selected_patterns.hspy'))\n",
"tmds = hs.load(Path(folder_data + '2xxx_selected_patterns_tmds.hspy'))\n",
"signal_mask = hs.load(Path(folder_data + 'signal_mask.hspy'))\n",
"names = ['Al', r'$\\theta^{\\prime}_{001}$', r'$\\theta^{\\prime}_{100-1}$', r'$\\theta^{\\prime}_{100-2}$', r'T$_{1-1}$', r'T$_{1-2}$']"
]
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 4,
"id": "f1049b13-049e-4541-bb37-e2f73664291c",
"metadata": {},
"outputs": [],
Expand All @@ -76,7 +68,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 5,
"id": "d892732b-3a86-42ec-b469-795c9b3253df",
"metadata": {},
"outputs": [],
Expand All @@ -92,14 +84,14 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 6,
"id": "e7e0d526-dccf-4977-960b-3d63e8ee6728",
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "057d0bb1df694d6f9bf3fd5674c4f83f",
"model_id": "2a2c53a379994ca5ba5826c45a54d8bb",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -113,7 +105,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "366fcb6349c74d5092373ad04af4f1c8",
"model_id": "8c5724651f5448fea447c00f334e94a1",
"version_major": 2,
"version_minor": 0
},
Expand Down
Loading