{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "46fa1f5a-f9a8-4117-937c-c8a4ebd6c38c", "metadata": { "tags": [ "hide-input" ] }, "outputs": [], "source": [ "%config InlineBackend.rc = {\"figure.dpi\": 72, 'figure.figsize': (6.0, 4.0)}\n", "%matplotlib inline\n", "\n", "import ase\n", "import matplotlib.pyplot as plt\n", "import numpy as np\n", "from IPython.display import HTML\n", "\n", "import abtem\n", "\n", "abtem.config.set({\"local_diagnostics.progress_bar\": True});" ] }, { "cell_type": "markdown", "id": "3048121d-f027-4cd2-887e-c99016d5da4d", "metadata": {}, "source": [ "(examples:animations)=\n", "# Animations\n", "\n", "*ab*TEM 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{Å}$." ] }, { "cell_type": "code", "execution_count": 2, "id": "3502551c-b81d-4243-b998-4b68ccfe930d", "metadata": { "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[########################################] | 100% Completed | 520.85 ms\n" ] } ], "source": [ "astigmatism = np.linspace(-70, 70, 50)\n", "\n", "astigmatism = np.concatenate([astigmatism, astigmatism[:-1][::-1]])\n", "\n", "probe = abtem.Probe(\n", " semiangle_cutoff=30,\n", " defocus=70,\n", " astigmatism=astigmatism,\n", " astigmatism_angle=np.pi / 4,\n", " gpts=256,\n", " extent=10,\n", " energy=200e3,\n", ")\n", "probes = probe.build().complex_images().compute()" ] }, { "cell_type": "markdown", "id": "40e41e57-8e45-4cf7-8b86-1cb1298788cc", "metadata": {}, "source": [ "VAnimations are created via the `.animate` method, which can be rendered in HTML using Javascript via the `to_jshtml` method." ] }, { "cell_type": "code", "execution_count": 3, "id": "346eec1b-7e12-4c1e-a19f-15ae961f3ce8", "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "\n", "\n", "\n", "\n", "\n", "