.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/virtual_imaging/interactive_virtual_images.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_virtual_imaging_interactive_virtual_images.py: =================================== Creating Interactive Virtual Images =================================== We can create interactive virtual images by using the `interactive` method from hyperspy. Because this requires that we recalculate the virtual images every time we change the ROIs it works best with small datasets or datasets loaded completely into memory. You can drag the ROI to update the virtual image if you use the ipympl or qt5 backends for plotting! .. GENERATED FROM PYTHON SOURCE LINES 12-19 .. code-block:: Python import pyxem as pxm import hyperspy.api as hs s = pxm.data.dummy_data.get_cbed_signal() circle = hs.roi.CircleROI(cx=26, cy=74, r=5.5, r_inner=0) s.plot_integrated_intensity(circle) .. rst-class:: sphx-glr-horizontal * .. image-sg:: /examples/virtual_imaging/images/sphx_glr_interactive_virtual_images_001.png :alt: interactive virtual images :srcset: /examples/virtual_imaging/images/sphx_glr_interactive_virtual_images_001.png :class: sphx-glr-multi-img * .. image-sg:: /examples/virtual_imaging/images/sphx_glr_interactive_virtual_images_002.png :alt: Signal :srcset: /examples/virtual_imaging/images/sphx_glr_interactive_virtual_images_002.png :class: sphx-glr-multi-img * .. image-sg:: /examples/virtual_imaging/images/sphx_glr_interactive_virtual_images_003.png :alt: Integrated intensity Signal :srcset: /examples/virtual_imaging/images/sphx_glr_interactive_virtual_images_003.png :class: sphx-glr-multi-img .. GENERATED FROM PYTHON SOURCE LINES 20-27 .. code-block:: Python # Also we can do the same with a 1D signal s = pxm.data.dummy_data.get_cbed_signal() s.calibration(center=None) s1d = s.get_azimuthal_integral1d(npt=100, mean=True) span = hs.roi.SpanROI(left=15.5, right=20) s1d.plot_integrated_intensity(span) .. rst-class:: sphx-glr-horizontal * .. image-sg:: /examples/virtual_imaging/images/sphx_glr_interactive_virtual_images_004.png :alt: interactive virtual images :srcset: /examples/virtual_imaging/images/sphx_glr_interactive_virtual_images_004.png :class: sphx-glr-multi-img * .. image-sg:: /examples/virtual_imaging/images/sphx_glr_interactive_virtual_images_005.png :alt: Signal :srcset: /examples/virtual_imaging/images/sphx_glr_interactive_virtual_images_005.png :class: sphx-glr-multi-img * .. image-sg:: /examples/virtual_imaging/images/sphx_glr_interactive_virtual_images_006.png :alt: Integrated intensity Signal :srcset: /examples/virtual_imaging/images/sphx_glr_interactive_virtual_images_006.png :class: sphx-glr-multi-img .. rst-class:: sphx-glr-script-out .. code-block:: none [ ] | 0% Completed | 141.67 us [########################################] | 100% Completed | 100.48 ms .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 7.201 seconds) .. _sphx_glr_download_examples_virtual_imaging_interactive_virtual_images.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: interactive_virtual_images.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: interactive_virtual_images.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_