.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/processing/calibrating_recip_space.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_examples_processing_calibrating_recip_space.py: Calibrating Scales ================== This example demonstrates how to calibrate the scales in both reciprocal and real-space. Ideally this should be done using a calibration standard with a known lattice spacing. There are many ways to calibrate the microscope so raise an issue if you have a specific method you would like to see implemented or if you have any questions. .. GENERATED FROM PYTHON SOURCE LINES 13-29 .. code-block:: Python from diffsims.generators.simulation_generator import SimulationGenerator import pyxem as pxm import hyperspy.api as hs import numpy as np from diffsims.utils.sim_utils import get_electron_wavelength from scipy.optimize import curve_fit import matplotlib.pyplot as plt # Load the data and the cif file au_dpeg = pxm.data.au_grating_20cm( allow_download=True, signal_type="electron_diffraction" ) gold_phase = pxm.data.au_phase(allow_download=True) # Orix.CrystalMap.Phase object .. rst-class:: sphx-glr-script-out .. code-block:: none 0%| | 0.00/263k [00:00 Name | size | index | offset | scale | units ================ | ====== | ====== | ======= | ======= | ====== ---------------- | ------ | ------ | ------- | ------- | ------ width | 256 | 0 | non-uniform axis | k_nm^-1 height | 256 | 0 | non-uniform axis | k_nm^-1 .. GENERATED FROM PYTHON SOURCE LINES 118-122 Plotting Corrected Azimuthal Integration ---------------------------------------- When you get the Azimuthal Integration now that things are calibrated it automatically accounts for the ewald sphere now and uses the non uniform axes. .. GENERATED FROM PYTHON SOURCE LINES 122-150 .. code-block:: Python calibrated_azim = au_dpeg.get_azimuthal_integral1d(npt=200, radial_range=(2, 15)) calibrated_azim.plot() x = np.array(sim1d.reciprocal_spacing) * 10 y = [ 0.5, ] * len(x) y0 = [ 0, ] * len(x) hkl = [str(h) for h in sim1d.hkl] offsets = np.vstack((x, y)).T t = hs.plot.markers.Texts( offsets, texts=hkl, offset_transform="relative", horizontalalignment="left", verticalalignment="bottom", rotation=np.pi / 2, color="k", ) calibrated_azim.add_marker(t) lines = [[[l, 0], [l, 1]] for l in x] v = hs.plot.markers.Lines(lines, transform="relative", linestyle="--") calibrated_azim.add_marker(v) .. image-sg:: /examples/processing/images/sphx_glr_calibrating_recip_space_004.png :alt: Signal :srcset: /examples/processing/images/sphx_glr_calibrating_recip_space_004.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none 0%| | 0/2 [00:00` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: calibrating_recip_space.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: calibrating_recip_space.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_