.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/orientation_mapping/on_zone_orientation.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_orientation_mapping_on_zone_orientation.py: On Zone Orientation =================== Sometimes you have a tilt boundary and you might want to know the orientation of the grains on each side of the boundary. This can be done using the :meth:`pyxem.signals.PolarSignal2D.get_orientation` method. For more information on the orientation mapping process see :cite:`pyxemorientationmapping2022` .. GENERATED FROM PYTHON SOURCE LINES 10-18 .. code-block:: Python from pyxem.data import si_tilt, si_phase from diffsims.generators.simulation_generator import SimulationGenerator from orix.quaternion import Rotation from orix.vector import Vector3d simulated_si_tilt = si_tilt() .. GENERATED FROM PYTHON SOURCE LINES 19-26 Pre-Processing -------------- First we center the diffraction patterns and get a polar signal Increasing the number of npt_azim with give better polar sampling but will take longer to compute the orientation map The mean=True argument will return the mean pixel value in each bin rather than the sum this makes the high k values more visible .. GENERATED FROM PYTHON SOURCE LINES 26-33 .. code-block:: Python simulated_si_tilt.calibration.center = None polar_si_tilt = simulated_si_tilt.get_azimuthal_integral2d( npt=100, npt_azim=360, inplace=False, mean=True ) polar_si_tilt.plot() .. rst-class:: sphx-glr-horizontal * .. image-sg:: /examples/orientation_mapping/images/sphx_glr_on_zone_orientation_001.png :alt: on zone orientation :srcset: /examples/orientation_mapping/images/sphx_glr_on_zone_orientation_001.png :class: sphx-glr-multi-img * .. image-sg:: /examples/orientation_mapping/images/sphx_glr_on_zone_orientation_002.png :alt: Signal :srcset: /examples/orientation_mapping/images/sphx_glr_on_zone_orientation_002.png :class: sphx-glr-multi-img .. rst-class:: sphx-glr-script-out .. code-block:: none [ ] | 0% Completed | 153.43 us [ ] | 0% Completed | 100.47 ms [ ] | 0% Completed | 200.87 ms [ ] | 0% Completed | 301.27 ms [ ] | 0% Completed | 401.68 ms [ ] | 0% Completed | 502.08 ms [########################################] | 100% Completed | 602.49 ms .. GENERATED FROM PYTHON SOURCE LINES 34-64 .. code-block:: Python # Building a Simulation # --------------------- # Now we can get make the orientation map. In this case we have aligned the tilt axis with the z-axis # so we can use the :func:`orix.vector.Vector3d.from_euler` method to get the rotation axis. # As always ``with_direct_beam=False`` is important to make sure that the center # beam does not affect the orientation mapping. phase = si_phase() generator = SimulationGenerator(200) sim = generator.calculate_diffraction2d( phase, rotation=Rotation.from_euler( [[0, 0, 0], [0, 0, 0]], degrees=True, ), max_excitation_error=0.1, reciprocal_radius=1.5, with_direct_beam=False, ) # Getting the Orientation # ----------------------- # This should be fairly good at finding the orientation of the grains on each side of the tilt boundary. # The rotation is stored in the rotation column of the orientation map or .isg[2,0] if you want to use the # rotation as a navigator or plot it directly. polar_si_tilt = polar_si_tilt**0.5 # gamma correction orientation_map = polar_si_tilt.get_orientation(sim) orientation_map.plot_over_signal(simulated_si_tilt) .. rst-class:: sphx-glr-horizontal * .. image-sg:: /examples/orientation_mapping/images/sphx_glr_on_zone_orientation_003.png :alt: on zone orientation :srcset: /examples/orientation_mapping/images/sphx_glr_on_zone_orientation_003.png :class: sphx-glr-multi-img * .. image-sg:: /examples/orientation_mapping/images/sphx_glr_on_zone_orientation_004.png :alt: Signal :srcset: /examples/orientation_mapping/images/sphx_glr_on_zone_orientation_004.png :class: sphx-glr-multi-img .. rst-class:: sphx-glr-script-out .. code-block:: none [ ] | 0% Completed | 153.70 us [########################################] | 100% Completed | 100.53 ms [ ] | 0% Completed | 140.62 us [########################################] | 100% Completed | 100.49 ms [ ] | 0% Completed | 146.91 us [########################################] | 100% Completed | 100.50 ms [ ] | 0% Completed | 283.35 us [########################################] | 100% Completed | 112.48 ms .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 8.288 seconds) .. _sphx_glr_download_examples_orientation_mapping_on_zone_orientation.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: on_zone_orientation.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: on_zone_orientation.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_