.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/dpc/magnetic_dpc.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_dpc_magnetic_dpc.py: Magnetic DPC ============ This example shows a basic workflow for doing magnetic DPC on a simple simulated test dataset. The dataset consists of alternating stripes of switching magnetic fields resulting in reversals of the direction of the magnetic field. This is a generalization of some of the real datasets which are more completely analyzed in the longer Demo Notebooks. .. GENERATED FROM PYTHON SOURCE LINES 12-21 .. code-block:: Python import pyxem as pxm s = pxm.data.simulated_stripes() s_beam_pos = s.get_direct_beam_position( method="center_of_mass", half_square_width=20 ) # Just the center of the DP .. rst-class:: sphx-glr-script-out .. code-block:: none 0%| | 0/49 [00:00, ] .. GENERATED FROM PYTHON SOURCE LINES 30-33 Visualizing the Shifts as color signal -------------------------------------- To plot the shifts in one signal, with the color showing the magnitude and direction. .. GENERATED FROM PYTHON SOURCE LINES 33-37 .. code-block:: Python s_magnitude_phase = s_beam_pos.get_magnitude_phase_signal() s_magnitude_phase.plot() .. image-sg:: /examples/dpc/images/sphx_glr_magnetic_dpc_002.png :alt: Signal :srcset: /examples/dpc/images/sphx_glr_magnetic_dpc_002.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 38-41 Plotting Magnitude and Direction -------------------------------- Since each probe position is a vector, we can plot the magnitude and phase (direction). .. GENERATED FROM PYTHON SOURCE LINES 41-48 .. code-block:: Python s_magnitude = s_beam_pos.get_magnitude_signal() s_magnitude.plot() s_phase = s_beam_pos.get_phase_signal() s_phase.plot() .. rst-class:: sphx-glr-horizontal * .. image-sg:: /examples/dpc/images/sphx_glr_magnetic_dpc_003.png :alt: Magnitude of Signal :srcset: /examples/dpc/images/sphx_glr_magnetic_dpc_003.png :class: sphx-glr-multi-img * .. image-sg:: /examples/dpc/images/sphx_glr_magnetic_dpc_004.png :alt: Signal :srcset: /examples/dpc/images/sphx_glr_magnetic_dpc_004.png :class: sphx-glr-multi-img .. rst-class:: sphx-glr-script-out .. code-block:: none 0%| | 0/33 [00:00 .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 1.765 seconds) .. _sphx_glr_download_examples_dpc_magnetic_dpc.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: magnetic_dpc.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: magnetic_dpc.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: magnetic_dpc.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_