{ "cells": [ { "cell_type": "markdown", "id": "a51d07a3-36cf-46eb-89af-cf509dad0def", "metadata": {}, "source": [ "# Plot RPA data" ] }, { "cell_type": "markdown", "id": "59f9cc35-8009-4204-abe4-b51104fa44cc", "metadata": {}, "source": [ "Show how we can exploit the signals from the Retarding Potential Analyzer/Retarding Field Analyzer." ] }, { "cell_type": "markdown", "id": "98b865fc-c2b4-4f61-ba7d-95046dbe752f", "metadata": {}, "source": [ "## Set up" ] }, { "cell_type": "markdown", "id": "e99fdaea-3e53-4cc7-b6d4-6b6119771c94", "metadata": {}, "source": [ "Load some libraries" ] }, { "cell_type": "code", "execution_count": 1, "id": "c5d8bcd6-b2b9-45d7-bdb8-e0adf0f3497f", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "outputs": [], "source": [ "import tomllib\n", "import pandas as pd\n", "from pathlib import Path\n", "from pprint import pprint\n", "\n", "from multipac_testbench.instruments import RPACurrent, RPAPotential, RPA\n", "from multipac_testbench.multipactor_test import MultipactorTest" ] }, { "cell_type": "raw", "id": "cfe43d1f-0f39-4fe0-a5a8-5930c952e7ab", "metadata": { "editable": true, "raw_mimetype": "text/restructuredtext", "slideshow": { "slide_type": "" }, "tags": [] }, "source": [ "Here is a sample of the ``TOML`` we will load, with some comments.\n", "\n", ".. code-block:: toml\n", " \n", " [global.instruments_kw.NI9205_ERPA]\n", " caliber_mA = 20.0 # Caliber for the current data; used to rescale the measured signal\n", " class_name = \"RPACurrent\"\n", " # keyword arguments for the `average_y_for_nearby_x_within_distance` function\n", " # it is used to average RPACurrent values measured at the same RPAPotential\n", " average = true # Activate averaging\n", " keep_shape = true # Recommended\n", " max_index_distance = 1 # Averaging is performed on neighboring identical potential values.\n", " # Increase it to like 1000 if you want to average over the whole tests\n", " # (eg several power cycles) \n", " tol = 1e-6\n", "\n", " [global.instruments_kw.NI9205_Spellman]\n", " class_name = \"RPAPotential\"\n", "\n", ".. seealso::\n", " Check the documentation of :func:`.average_y_for_nearby_x_within_distance` for more information on the the averaging arguments." ] }, { "cell_type": "code", "execution_count": 2, "id": "b448b878-7330-440c-ba32-0036dd9f6ab1", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "outputs": [], "source": [ "project = Path(\"../data/campaign_ERPA\")\n", "config_path = Path(project, \"testbench_configuration.toml\")\n", "\n", "with open(config_path, \"rb\") as f:\n", " config = tomllib.load(f)\n", "\n", "results_path = Path(project, \"MVE5-120MHz-50Ohm-BDTcomp-ERPA1_1dBm.csv\")" ] }, { "cell_type": "markdown", "id": "85c070b5-91b1-4400-b549-10de54708a9d", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "source": [ "Load data. Note that the `info` key will be appended to plots titles." ] }, { "cell_type": "code", "execution_count": 3, "id": "aedd3b7e-b63a-4f6d-8998-6c62f32b9626", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "ERROR:root:Your Sample index column does not start at 0. I should patch this, but meanwhile expect some index mismatches.\n" ] } ], "source": [ "multipactor_test = MultipactorTest(results_path, config, freq_mhz=120.0, swr=1.0, sep=\",\", info=\"1dBm (175W)\")" ] }, { "cell_type": "markdown", "id": "56d0e2c7-0800-4fe0-8eea-2a29ed750ac7", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "source": [ "## Plot collected current vs grid potential" ] }, { "cell_type": "raw", "id": "e9ab3edf-8620-418a-806f-8d677886651b", "metadata": { "editable": true, "raw_mimetype": "text/restructuredtext", "slideshow": { "slide_type": "" }, "tags": [] }, "source": [ "In this test, RPA Current was measured twice at every potential.\n", "This is why we averaged it.\n", "\n", "As we want to keep the shape of averaged data consistent with all the other instruments, we introduced ``NaN`` numbers for duplicated potential values." ] }, { "cell_type": "code", "execution_count": 4, "id": "1c881e16-da23-486a-ab3b-8cdabfb6e994", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "outputs": [ { "data": { "text/html": [ "
| \n", " | RPA potential [V] | \n", "Averaged RPA current [uA] | \n", "
|---|---|---|
| Sample index | \n", "\n", " | \n", " |
| 41 | \n", "5.0 | \n", "6.518785 | \n", "
| 42 | \n", "5.0 | \n", "NaN | \n", "
| 43 | \n", "10.0 | \n", "6.500730 | \n", "
| 44 | \n", "10.0 | \n", "NaN | \n", "
| 45 | \n", "15.0 | \n", "6.513861 | \n", "
| 46 | \n", "15.0 | \n", "NaN | \n", "
| 47 | \n", "20.0 | \n", "6.297208 | \n", "
| 48 | \n", "20.0 | \n", "NaN | \n", "
| 49 | \n", "25.0 | \n", "6.154414 | \n", "
| 50 | \n", "25.0 | \n", "NaN | \n", "