.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/plot_insitu_heating.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_insitu_heating.py: In-situ heating =============== A simulated heating chip is stepped to 650 C. Every droplet is its own crystal, and each nucleates as the thermal budget accumulates: the glassy halo gives way to spotty powder rings. A ``ManualClock`` lets the anneal run as fast as the renderer allows. .. GENERATED FROM PYTHON SOURCE LINES 9-37 .. image-sg:: /auto_examples/images/sphx_glr_plot_insitu_heating_001.png :alt: t = 0 s, 25 C, t = 40 s, 650 C, t = 80 s, 650 C, t = 160 s, 650 C :srcset: /auto_examples/images/sphx_glr_plot_insitu_heating_001.png :class: sphx-glr-single-img .. code-block:: Python import matplotlib.pyplot as plt import numpy as np from de_twin import DigitalTwin, ManualClock from de_twin.state import Projection clock = ManualClock() twin = DigitalTwin("Droplet crystallization", camera="DESim", clock=clock, holder="sim-heating", seed=3) twin.column.set("Magnification", 20000) feature = twin.specimen.features()[0] twin.column.move_stage(x=-feature.center_um[0], y=-feature.center_um[1]) twin.column.set_projection(Projection.DIFFRACTION) twin.specimen.update(0.0, twin.holder_state(0.0)) twin.holder.set(650.0) fig, axes = plt.subplots(1, 4, figsize=(12, 3.4)) for ax, t_end in zip(axes, [0, 40, 80, 160]): while clock.now() < t_end: clock.advance(1.0) twin.specimen.update(clock.now(), twin.holder_state()) dp = np.log1p(twin.flux(twin.request())) ax.imshow(dp, cmap="gray", vmin=np.percentile(dp, 1), vmax=np.percentile(dp, 99.95)) ax.set_title(f"t = {t_end} s, {twin.holder_state().temperature_c:.0f} C", fontsize=9) ax.axis("off") fig.tight_layout() plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 1.913 seconds) .. _sphx_glr_download_auto_examples_plot_insitu_heating.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_insitu_heating.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_insitu_heating.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_insitu_heating.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_