.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/standards/pixel_coodinates.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_standards_pixel_coodinates.py: ==================== Coordinates in Pyxem ==================== Pyxem is flexible in how it handles coordinates for a diffraction pattern. There are three main ways to handle coordinates in Pyxem: 1. Pixel coordinates 2. Calibrated Coordinates with evenly spaced axes 3. Calibrated Coordinates with unevenly spaced axes (e.g. corrected for the Ewald sphere) .. GENERATED FROM PYTHON SOURCE LINES 14-23 .. code-block:: Python import pyxem as pxm from skimage.morphology import disk s = pxm.signals.Diffraction2D(disk((10))) s.calibration.center = None print(s.calibration.center) .. rst-class:: sphx-glr-script-out .. code-block:: none [10.0, 10.0] .. GENERATED FROM PYTHON SOURCE LINES 24-26 .. code-block:: Python s.plot(axes_ticks=True) .. image-sg:: /examples/standards/images/sphx_glr_pixel_coodinates_001.png :alt: Signal :srcset: /examples/standards/images/sphx_glr_pixel_coodinates_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 27-31 From the plot above you can see that hyperspy automatically sets the axes ticks to be centered on each pixel. This means that for a 21x21 pixel image, the center is at (-10, -10) in pixel coordinates. if we change the scale using the calibration function it will automatically adjust the center. Here it is now (-1, -1) .. GENERATED FROM PYTHON SOURCE LINES 31-38 .. code-block:: Python s.calibration.scale = 0.1 s.calibration.units = "nm$^{-1}$" s.plot(axes_ticks=True) print(s.calibration.center) .. image-sg:: /examples/standards/images/sphx_glr_pixel_coodinates_002.png :alt: Signal :srcset: /examples/standards/images/sphx_glr_pixel_coodinates_002.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none [10.0, 10.0] .. GENERATED FROM PYTHON SOURCE LINES 39-43 Azimuthal Integration --------------------- Now if we do integrate this dataset it will choose the appropriate center based on the center pixel. .. GENERATED FROM PYTHON SOURCE LINES 43-47 .. code-block:: Python az = s.get_azimuthal_integral2d(npt=30) az.plot() .. image-sg:: /examples/standards/images/sphx_glr_pixel_coodinates_003.png :alt: Signal :srcset: /examples/standards/images/sphx_glr_pixel_coodinates_003.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none 0%| | 0/2 [00:00` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: pixel_coodinates.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: pixel_coodinates.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_