{ "cells": [ { "cell_type": "markdown", "id": "e7d80e29-3aec-4498-a73f-e3eb6a77cd7d", "metadata": {}, "source": [ "# Animate the measured signals" ] }, { "cell_type": "markdown", "id": "81793eb8-89a9-4a8d-b1a2-c40f763e5308", "metadata": {}, "source": [ "Showcase how we can produce animations from measured signals." ] }, { "cell_type": "markdown", "id": "70805e7e-0a02-4a33-b98b-9b6bcbf1d73f", "metadata": {}, "source": [ "## Load data" ] }, { "cell_type": "code", "execution_count": 1, "id": "e943830e-0048-4fd4-94d1-dccfab7e3cff", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "ERROR:root:column_header = 'NI9205_E1' not present in provided file. Skipping associated instrument.\n" ] } ], "source": [ "from IPython.display import HTML\n", "import matplotlib.pyplot as plt\n", "\n", "from multipac_testbench import MultipactorTest\n", "from multipac_testbench.data import config_path\n", "from multipac_testbench.data.multipactor_tests import test_140MHz_SWR4_11\n", "from multipac_testbench.instruments import CurrentProbe, FieldProbe\n", "\n", "multipactor_test = MultipactorTest(test_140MHz_SWR4_11, config_path, freq_mhz=140.0, swr=4.0, is_raw=True)" ] }, { "cell_type": "markdown", "id": "1e1fc810-a754-46ab-8906-5e166d330567", "metadata": {}, "source": [ "## Produce animation plot" ] }, { "cell_type": "code", "execution_count": 2, "id": "c3e710ca-c6d6-466b-b7cc-badba0c20cde", "metadata": {}, "outputs": [], "source": [ "to_plot = (CurrentProbe, FieldProbe)\n", "fps = 50\n", "ani = multipactor_test.animate_instruments_vs_position(\n", " to_plot,\n", " fps=fps,\n", " keep_one_frame_over=10,\n", ")\n", "plt.close()" ] }, { "cell_type": "markdown", "id": "7b4c19b1-6748-4c14-9bee-22233a5c4aee", "metadata": {}, "source": [ "Trick to let the gif appear in the notebook (online documentation)." ] }, { "cell_type": "code", "execution_count": 3, "id": "23b600c3-3656-4a0f-b901-2f0c0d208501", "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "\n", "\n", "\n", "\n", "\n", "
\n", " \n", "
\n", " \n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
\n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", "
\n", "
\n", "
\n", "\n", "\n", "\n" ], "text/plain": [ "" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "HTML(ani.to_jshtml(fps=fps))" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.13.2" } }, "nbformat": 4, "nbformat_minor": 5 }