.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/reference_frames/plot_projection_center_on_detector.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_reference_frames_plot_projection_center_on_detector.py: Plot projection center on the detector ====================================== This example shows how to plot the projection/pattern center (PC) on an :class:`~kikuchipy.detectors.EBSDDetector`. See the detector class documentation for further details on the definition of the PC and gnomonic coordinates. .. GENERATED FROM PYTHON SOURCE LINES 31-32 Imports. .. GENERATED FROM PYTHON SOURCE LINES 32-36 .. code-block:: Python import matplotlib.pyplot as plt import kikuchipy as kp .. GENERATED FROM PYTHON SOURCE LINES 37-40 Create an EBSD detector with a binning of 8 and a single projection/pattern (PC) center given in EDAX' definition, :math:`(x^{*}, y^{*}, z^{*}) = (0.421, 0.779, 0.505)`. .. GENERATED FROM PYTHON SOURCE LINES 40-51 .. code-block:: Python det = kp.detectors.EBSDDetector( shape=(60, 60), pc=[0.421, 0.779, 0.505], convention="edax", px_size=70, # Microns tilt=5, # Degrees sample_tilt=70, # Degrees binning=8, ) print(det) .. rst-class:: sphx-glr-script-out .. code-block:: none EBSDDetector shape (Ny, Nx): (60, 60) pc (PCx, PCy, PCz): (0.421, 0.221, 0.505) sample_tilt: 70.0° tilt: 5.0° azimuthal: 0.0° twist: 0.0° binning: 8 px_size: 70.0 um .. GENERATED FROM PYTHON SOURCE LINES 52-53 Load a small test dataset with (60, 60) patterns to plot the PC over. .. GENERATED FROM PYTHON SOURCE LINES 53-56 .. code-block:: Python s = kp.data.nickel_ebsd_small() print(s) .. rst-class:: sphx-glr-script-out .. code-block:: none .. GENERATED FROM PYTHON SOURCE LINES 57-61 Plot the PC on top of the pattern. Instead of pixels, we show the detector extent in gnomonic coordinates along the x and y axes. We also draw gnomonic circles at an interval of :math:`10^{\circ}`. .. GENERATED FROM PYTHON SOURCE LINES 61-68 .. code-block:: Python det.plot( pattern=s.inav[0, 0].data, coordinates="gnomonic", draw_gnomonic_circles=True, ) plt.show() .. image-sg:: /examples/reference_frames/images/sphx_glr_plot_projection_center_on_detector_001.png :alt: plot projection center on detector :srcset: /examples/reference_frames/images/sphx_glr_plot_projection_center_on_detector_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 1.869 seconds) **Estimated memory usage:** 790 MB .. _sphx_glr_download_examples_reference_frames_plot_projection_center_on_detector.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_projection_center_on_detector.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_projection_center_on_detector.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_projection_center_on_detector.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_