.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/plot_magnification.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_auto_examples_plot_magnification.py: Zooming in on a seeded specimen =============================== One seeded specimen, gold particles on holey carbon over a copper mesh grid, seen from a low-magnification atlas down to single particles. The images are the noiseless electron flux the twin renders before the detector model. .. GENERATED FROM PYTHON SOURCE LINES 9-31 .. image-sg:: /auto_examples/images/sphx_glr_plot_magnification_001.png :alt: 120x, field 85.3 um, 2,500x, field 4.1 um, 20,000x, field 0.512 um, 60,000x, field 0.171 um :srcset: /auto_examples/images/sphx_glr_plot_magnification_001.png :class: sphx-glr-single-img .. code-block:: Python import matplotlib.pyplot as plt from de_twin import DigitalTwin, ManualClock twin = DigitalTwin("Dense Au on holey C", camera="DESim", clock=ManualClock(), seed=3) feature = twin.specimen.features()[0] # a particle cluster, in world micrometres fig, axes = plt.subplots(1, 4, figsize=(12, 3.4)) for ax, (mag, intensity) in zip(axes, [(120, 0.97), (2500, 0.75), (20000, 0.5), (60000, 0.5)]): twin.column.set("Magnification", mag) twin.column.set_intensity(intensity) # spread the beam at low magnification if mag >= 20000: twin.column.move_stage(x=-feature.center_um[0], y=-feature.center_um[1]) flux = twin.flux(twin.request()) optics = twin.optics(twin.request()) ax.imshow(flux, cmap="gray") fov_um = optics.specimen_pixel_nm * flux.shape[1] / 1000 ax.set_title(f"{mag:,}x, field {fov_um:.3g} um", fontsize=9) ax.axis("off") fig.tight_layout() plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 5.071 seconds) .. _sphx_glr_download_auto_examples_plot_magnification.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_magnification.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_magnification.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_magnification.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_