Commit b95e9b2e authored by Magnus Nord's avatar Magnus Nord

Merge branch 'master' into release

parents 51e6715f 06716b1e
Pipeline #47852979 passed with stage
in 17 minutes and 15 seconds
......@@ -12,10 +12,12 @@ test_non_release_branches:
- xvfb-run -a python3 -m pytest --nbval-lax introduction_to_atomap.ipynb
- cd nanoparticle_example_notebook
- xvfb-run -a python3 -m pytest --nbval-lax --current-env
- cd ../adf_quantification_notebook
- xvfb-run -a python3 -m pytest --nbval-lax --current-env
- cd ../scripts
- xvfb-run -a python3 minimal_example_perovskite_100.py
- xvfb-run -a python3 minimal_example_perovskite_100_manual.py
- xvfb-run -a python3 minimal_example_perovskite_110.py
- python3 minimal_example_perovskite_100.py
- python3 minimal_example_perovskite_100_manual.py
- python3 minimal_example_perovskite_110.py
except:
- release
......@@ -33,9 +35,11 @@ test_release_branch:
- xvfb-run -a python3 -m pytest --nbval-lax introduction_to_atomap.ipynb
- cd nanoparticle_example_notebook
- xvfb-run -a python3 -m pytest --nbval-lax --current-env
- cd ../adf_quantification_notebook
- xvfb-run -a python3 -m pytest --nbval-lax --current-env
- cd ../scripts
- xvfb-run -a python3 minimal_example_perovskite_100.py
- xvfb-run -a python3 minimal_example_perovskite_100_manual.py
- xvfb-run -a python3 minimal_example_perovskite_110.py
- python3 minimal_example_perovskite_100.py
- python3 minimal_example_perovskite_100_manual.py
- python3 minimal_example_perovskite_110.py
only:
- release
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Analysing and Quantifying the Intensity of ADF STEM Images"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"- 2018/3: First written by Katherine E. MacArthur \n",
"- 2018/8: Minor improvements by Magnus Nord"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Step 1 : Import hyperspy and atomap."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": [
"nbval-skip"
]
},
"outputs": [],
"source": [
"%matplotlib nbagg"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"import hyperspy.api as hs\n",
"import atomap.api as am"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Step 2: Import and analyse electron flux."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"s = hs.load('PACBED.tif')\n",
"s.plot()\n",
"flux_pattern = s.data"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The following step creates an interactive plot to select the region which to fit a power law to the flux patter. Until anything is selected 'profiler' will be empty intially."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"profiler = am.quant.find_flux_limits(flux_pattern, 25)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Select the left limit with the left mouse button, the right limit with the right mouse button and then confirm with the Enter key. Good values here could be 103 for the left limit, and 406 for the right limit.\n",
"\n",
"Once coordinates have been selected a message will be printed above confirming.\n",
"\n",
"The limits can also be given directly to the function:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"profiler = am.quant.find_flux_limits(flux_pattern, 25, limits=(103, 406))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Running `analyse_flux` fits a power law to the flux profile in the selected region."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"expo = am.quant.analyse_flux(profiler[0].coords, profiler[1], 25)\n",
"expo"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Step 3: Import the an experimental image and a detector map."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"s = hs.load('Pt0.7Ni0.3_ADF.tif')\n",
"s.plot()\n",
"det_image = am.example_data.get_detector_image_signal()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Step 4: Normalised images to an absolute scale."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"For detector quantification with flux weighting use:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"s_normalised = am.quant.detector_normalisation(s, det_image, inner_angle=60, outer_angle=None, flux_expo=expo[0])\n",
"s_normalised.plot()"
]
},
{
"cell_type": "markdown",
"metadata": {
"collapsed": true
},
"source": [
"For detector quantification without flux weighting simply remove the flux exponent."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"s_normalised2 = am.quant.detector_normalisation(s, det_image, inner_angle=60, outer_angle=None)"
]
},
{
"cell_type": "markdown",
"metadata": {
"collapsed": true
},
"source": [
"## Step 5: Carry out peak finding on normalised image."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"s_peaks = am.get_feature_separation(s, separation_range=(5,30), threshold_rel=0.1)\n",
"s_peaks.plot()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"atom_positions = am.get_atom_positions(s, 8, threshold_rel=0.1)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"sublattice = am.Sublattice(atom_positions, s.data)\n",
"sublattice.plot()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"sublattice.construct_zone_axes()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"sublattice.refine_atom_positions_using_2d_gaussian(sublattice.image)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Step 6: Carry out integration of intensity over each atomic column."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"(integrated_s, intensityRecord, pointRecord) = am.integrate(\n",
" s, sublattice.x_position, sublattice.y_position, method='Voronoi', max_radius=13)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"intensityRecord.plot(cmap='viridis')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Please note no multiplication is added au"
]
}
],
"metadata": {
"anaconda-cloud": {},
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"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.6.7"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
......@@ -53,7 +53,7 @@
},
"outputs": [],
"source": [
"%matplotlib qt5"
"%matplotlib nbagg"
]
},
{
......@@ -62,7 +62,7 @@
"source": [
"Atomap relies heavily on HyperSpy for visualization and fitting, and uses HyperSpy signals for most of the outputs. So we need to import both HyperSpy and Atomap.\n",
"\n",
"You might get a \"WARNING:hyperspy_gui_ipywidgets\", this can be ignored."
"You might get a \"WARNING:hyperspy_gui_traitsui\", this can be ignored."
]
},
{
......@@ -188,6 +188,22 @@
"atom_positions = am.get_atom_positions(s, separation=12, pca=True)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"To add or remove atoms, use `add_atoms_with_gui`. Any changes will automatically be updated in the output list `atom_positions_manual`."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"atom_positions_manual = am.add_atoms_with_gui(s, atom_positions)"
]
},
{
"cell_type": "markdown",
"metadata": {},
......@@ -208,7 +224,7 @@
"metadata": {},
"outputs": [],
"source": [
"sublattice = am.Sublattice(atom_position_list=atom_positions, image=s.data)"
"sublattice = am.Sublattice(atom_position_list=atom_positions_manual, image=s.data)"
]
},
{
......@@ -790,7 +806,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.5+"
"version": "3.6.7"
},
"widgets": {
"state": {},
......
......@@ -24,7 +24,7 @@
},
"outputs": [],
"source": [
"%matplotlib qt"
"%matplotlib nbagg"
]
},
{
......@@ -205,7 +205,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.5"
"version": "3.6.7"
}
},
"nbformat": 4,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment