.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/orientation_mapping/mulit_phase_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_mulit_phase_orientation.py: Multi Phase Orientation Mapping =============================== You can also calculate the orientation of the grains for multiple phases using the :meth:`pyxem.signals.PolarSignal2D.get_orientation` method. This requires that you simulate the entire S2 space for the phase and then compare to the simulated diffraction. For more information on the orientation mapping process see :cite:`pyxemorientationmapping2022` .. GENERATED FROM PYTHON SOURCE LINES 10-19 .. code-block:: Python import pyxem as pxm from pyxem.data import fe_multi_phase_grains, fe_bcc_phase, fe_fcc_phase from diffsims.generators.simulation_generator import SimulationGenerator from orix.quaternion import Rotation from orix.sampling import get_sample_reduced_fundamental mulit_phase = fe_multi_phase_grains() .. GENERATED FROM PYTHON SOURCE LINES 20-25 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 25-32 .. code-block:: Python mulit_phase.calibration.center = None polar_multi = mulit_phase.get_azimuthal_integral2d( npt=100, npt_azim=360, inplace=False, mean=True ) polar_multi.plot() .. rst-class:: sphx-glr-horizontal * .. image-sg:: /examples/orientation_mapping/images/sphx_glr_mulit_phase_orientation_001.png :alt: mulit phase orientation :srcset: /examples/orientation_mapping/images/sphx_glr_mulit_phase_orientation_001.png :class: sphx-glr-multi-img * .. image-sg:: /examples/orientation_mapping/images/sphx_glr_mulit_phase_orientation_002.png :alt: Signal :srcset: /examples/orientation_mapping/images/sphx_glr_mulit_phase_orientation_002.png :class: sphx-glr-multi-img .. rst-class:: sphx-glr-script-out .. code-block:: none [ ] | 0% Completed | 173.72 us [ ] | 0% Completed | 120.85 ms [ ] | 0% Completed | 221.09 ms [ ] | 0% Completed | 321.39 ms [ ] | 0% Completed | 421.68 ms [ ] | 0% Completed | 521.97 ms [ ] | 0% Completed | 622.25 ms [ ] | 0% Completed | 722.54 ms [ ] | 0% Completed | 822.82 ms [ ] | 0% Completed | 923.12 ms [ ] | 0% Completed | 1.02 s [ ] | 0% Completed | 1.12 s [ ] | 0% Completed | 1.22 s [ ] | 0% Completed | 1.32 s [ ] | 0% Completed | 1.42 s [ ] | 0% Completed | 1.52 s [ ] | 0% Completed | 1.63 s [ ] | 0% Completed | 1.73 s [ ] | 0% Completed | 1.83 s [ ] | 0% Completed | 1.93 s [ ] | 0% Completed | 2.03 s [ ] | 0% Completed | 2.13 s [ ] | 0% Completed | 2.23 s [ ] | 0% Completed | 2.33 s [ ] | 0% Completed | 2.44 s [ ] | 0% Completed | 2.54 s [ ] | 0% Completed | 2.64 s [ ] | 0% Completed | 2.74 s [ ] | 0% Completed | 2.84 s [ ] | 0% Completed | 2.94 s [ ] | 0% Completed | 3.04 s [ ] | 0% Completed | 3.14 s [ ] | 0% Completed | 3.24 s [ ] | 0% Completed | 3.34 s [ ] | 0% Completed | 3.44 s [ ] | 0% Completed | 3.54 s [ ] | 0% Completed | 3.64 s [ ] | 0% Completed | 3.74 s [ ] | 0% Completed | 3.84 s [########################################] | 100% Completed | 3.94 s .. GENERATED FROM PYTHON SOURCE LINES 33-36 Now we can get make a simulation. In this case we want to set a minimum_intensity which removes the low intensity reflections. we also sample the S2 space using the :func`orix.sampling.get_sample_reduced_fundamental` We have two phases here so we can make a simulation object with both of the phases. .. GENERATED FROM PYTHON SOURCE LINES 36-64 .. code-block:: Python bcc = fe_bcc_phase() fcc = fe_fcc_phase() bcc.name = "BCC Phase" fcc.name = "FCC Phase" fcc.color = "red" bcc.color = "blue" generator = SimulationGenerator(200, minimum_intensity=0.05) rotations_bcc = get_sample_reduced_fundamental( resolution=1, point_group=bcc.point_group ) rotations_fcc = get_sample_reduced_fundamental( resolution=1, point_group=fcc.point_group ) sim = generator.calculate_diffraction2d( [bcc, fcc], rotation=[rotations_bcc, rotations_fcc], max_excitation_error=0.1, reciprocal_radius=2, with_direct_beam=False, ) orientation_map = polar_multi.get_orientation(sim) cmap = orientation_map.to_crystal_map() cmap.plot() .. image-sg:: /examples/orientation_mapping/images/sphx_glr_mulit_phase_orientation_003.png :alt: mulit phase orientation :srcset: /examples/orientation_mapping/images/sphx_glr_mulit_phase_orientation_003.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none [ ] | 0% Completed | 182.00 us [ ] | 0% Completed | 126.17 ms [ ] | 0% Completed | 226.50 ms [ ] | 0% Completed | 326.85 ms [ ] | 0% Completed | 430.85 ms [ ] | 0% Completed | 534.85 ms [ ] | 0% Completed | 642.86 ms [ ] | 0% Completed | 744.58 ms [ ] | 0% Completed | 844.87 ms [ ] | 0% Completed | 945.16 ms [ ] | 0% Completed | 1.05 s [ ] | 0% Completed | 1.15 s [ ] | 0% Completed | 1.25 s [ ] | 0% Completed | 1.35 s [ ] | 0% Completed | 1.45 s [ ] | 0% Completed | 1.56 s [ ] | 0% Completed | 1.67 s [ ] | 0% Completed | 1.77 s [ ] | 0% Completed | 1.87 s [ ] | 0% Completed | 1.97 s [ ] | 0% Completed | 2.08 s [ ] | 0% Completed | 2.18 s [ ] | 0% Completed | 2.28 s [ ] | 0% Completed | 2.38 s [ ] | 0% Completed | 2.48 s [########################################] | 100% Completed | 2.58 s [ ] | 0% Completed | 147.85 us [########################################] | 100% Completed | 106.33 ms [ ] | 0% Completed | 132.34 us [ ] | 0% Completed | 107.77 ms [########################################] | 100% Completed | 208.10 ms [ ] | 0% Completed | 126.68 us [########################################] | 100% Completed | 105.62 ms .. GENERATED FROM PYTHON SOURCE LINES 65-66 sphinx_gallery_thumbnail_number = 3 .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 54.207 seconds) .. _sphx_glr_download_examples_orientation_mapping_mulit_phase_orientation.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: mulit_phase_orientation.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: mulit_phase_orientation.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_