Show code cell source
%config InlineBackend.rc = {"figure.dpi": 72, 'figure.figsize': (6.0, 4.0)}
%matplotlib inline
import ase
import matplotlib.pyplot as plt
import numpy as np
from IPython.display import HTML
import abtem
abtem.config.set({"local_diagnostics.progress_bar": True});
Animations#
abTEM visualizations can be animated over ensemble axes. In this example, we animate a probe over different values of astigmatism. We ramp the astigmatism from \(-70 \ \mathrm{Å}\) to \(70 \ \mathrm{Å}\) and back again at an angle of \(\pi / 4\), with a static value for the defocus of \(70 \ \mathrm{Å}\).
astigmatism = np.linspace(-70, 70, 50)
astigmatism = np.concatenate([astigmatism, astigmatism[:-1][::-1]])
probe = abtem.Probe(
semiangle_cutoff=30,
defocus=70,
astigmatism=astigmatism,
astigmatism_angle=np.pi / 4,
gpts=256,
extent=10,
energy=200e3,
)
probes = probe.build().complex_images().compute()
[########################################] | 100% Completed | 520.85 ms
VAnimations are created via the .animate
method, which can be rendered in HTML using Javascript via the to_jshtml
method.
visualization = probes.show(cmap="hsluv", display=False, cbar=True, vmin=0, vmax=8e-5)
visualization.adjust_figure_aspect()
visualization.set_panel_labels(
labels="metadata", frameon=False, prop={"color": "w", "fontsize": 12}
)
animation = visualization.animate(adjust_scale=False, interval=100)
HTML(animation.to_jshtml())