.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/amorphous_characterization/FEM.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_amorphous_characterization_FEM.py: Fluctuation Electron Microscopy =============================== This example shows you how to perform a fluctuation electron microscopy (FEM) analysis. In this example we will focus on calculating :math:`V_\Omega (k)` which is defined as, Equation 1: .. math:: V_\Omega (k) = \frac{\langle I{^2}(k) \rangle{_r} - \langle I(k)\rangle_r^2}{\langle I(k)\rangle_r^2 } - \frac{G}{\langle I(k)\rangle_r} where :math:`I(k)` is the diffracted electron intensity averaged over the polar angle at constant scattering vector magnitude k, :math:`<>_r` indicates averaging over probe positions, and G is the gain of the electron camera in counts per electron for counted or data from hybrid pixel detectors this value is 1 otherwise it will be some mean value. The first term is the definition of the variance, and the second term is a correction to the variance for Poisson noise in the data. (There are several different possible variance signals. Here, we use the notation from Daulton, et al. Ultramicroscopy 110, 1279–1289 (2010), DOI: 10.1016/j.ultramic.2010.05.010.) .. GENERATED FROM PYTHON SOURCE LINES 23-33 .. code-block:: Python import pyxem as pxm from pyxem.utils import determine_ellipse import numpy as np import hyperspy.api as hs from pyxem.utils._pixelated_stem_tools import _copy_axes_object_metadata s = pxm.data.zrcual_1(allow_download=True, signal_type="electron_diffraction") s.plot() .. rst-class:: sphx-glr-horizontal * .. image-sg:: /examples/amorphous_characterization/images/sphx_glr_FEM_001.png :alt: pos1-1 Navigator :srcset: /examples/amorphous_characterization/images/sphx_glr_FEM_001.png :class: sphx-glr-multi-img * .. image-sg:: /examples/amorphous_characterization/images/sphx_glr_FEM_002.png :alt: pos1-1 Signal :srcset: /examples/amorphous_characterization/images/sphx_glr_FEM_002.png :class: sphx-glr-multi-img .. rst-class:: sphx-glr-script-out .. code-block:: none 0%| | 0.00/18.3M [00:00 thickness) for i in range(len(bins) - 1) ] filtered = [hs.signals.Signal2D(signal.data[m.data, :, :]) for m in masks] for f in filtered: f.set_signal_type("electron_diffraction") _copy_axes_object_metadata( signal.axes_manager.signal_axes[0], f.axes_manager.signal_axes[0] ) _copy_axes_object_metadata( signal.axes_manager.signal_axes[1], f.axes_manager.signal_axes[1] ) f.metadata.add_dictionary(signal.metadata.as_dictionary()) return filtered, thickness bins = np.linspace( np.min(thickness, axis=(0, 1)), np.max(thickness, axis=(0, 1)), num=2 + 1 ) filtered, thickness = thickness_filter(s, thickness, bins) var = [ f.get_variance(npt=50, gain=4.2, radial_range=(3.0, 5.7), mask=mask) for f in filtered ] # Note that the y-axis is the variance here. Hyperspy just always labels this as "Intensity" for v in var: v.axes_manager[0].units = "$nm^{-1}$" hs.plot.plot_spectra(var, legend=["thickness<17.5nm", "thickness<18.5nm"]) .. image-sg:: /examples/amorphous_characterization/images/sphx_glr_FEM_007.png :alt: FEM :srcset: /examples/amorphous_characterization/images/sphx_glr_FEM_007.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none 0%| | 0/25 [00:00 .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 51.819 seconds) .. _sphx_glr_download_examples_amorphous_characterization_FEM.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: FEM.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: FEM.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: FEM.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_