{ "cells": [ { "cell_type": "raw", "id": "6b9662fe", "metadata": { "raw_mimetype": "text/restructuredtext" }, "source": [ "Level-0 Dataset\n", "===============\n", "\n", "The Level-0 data are the raw images gathered by the DACS during flight.\n", "This tutorial will show how to load this dataset and make a\n", "movie using a few of the images.\n", "We will also show how to plot the temperatures and voltages available\n", "in the dataset." ] }, { "cell_type": "code", "id": "initial_id", "metadata": {}, "source": [ "import matplotlib.pyplot as plt\n", "import astropy.visualization\n", "import named_arrays as na\n", "import esis" ], "outputs": [], "execution_count": null }, { "cell_type": "raw", "id": "287ff3ec", "metadata": { "raw_mimetype": "text/restructuredtext" }, "source": [ "Start by defining the names of the time axis and channel axis." ] }, { "cell_type": "raw", "id": "8f34bc4e", "metadata": { "raw_mimetype": "text/restructuredtext" }, "source": [ "Now we can use these axis names to load the Level-0 dataset into memory " ] }, { "cell_type": "code", "id": "5b4174a1", "metadata": {}, "source": "level_0 = esis.flights.f1.data.level_0()", "outputs": [], "execution_count": null }, { "cell_type": "raw", "id": "20c77c32", "metadata": { "raw_mimetype": "text/restructuredtext" }, "source": [ "We'll plot only every 4th frame to ease the computation time of this script." ] }, { "cell_type": "code", "id": "92cf21c8", "metadata": {}, "source": "index = {level_0.axis_time: slice(None, None, 4)}", "outputs": [], "execution_count": null }, { "cell_type": "raw", "id": "b42f92d6", "metadata": { "raw_mimetype": "text/restructuredtext" }, "source": [ "Plot an animation of the frames captured by each channel." ] }, { "cell_type": "code", "id": "6c1a2d77", "metadata": {}, "source": "level_0[index].to_jshtml()", "outputs": [], "execution_count": null }, { "cell_type": "raw", "id": "87ce72c0", "metadata": { "raw_mimetype": "text/restructuredtext" }, "source": [ "Convert the times into :class:`datetime.datetime` objects for easier plotting" ] }, { "cell_type": "code", "id": "5c6ebab1", "metadata": {}, "source": [ "time = level_0.inputs.time\n", "time = time.replace(ndarray=time.ndarray.datetime)" ], "outputs": [], "execution_count": null }, { "cell_type": "raw", "id": "39a6dadf", "metadata": { "raw_mimetype": "text/restructuredtext" }, "source": [ "Plot the temperature of the FPGA for each channel." ] }, { "cell_type": "code", "id": "04dbfdb8", "metadata": {}, "source": [ "with astropy.visualization.quantity_support():\n", " fig, ax = plt.subplots()\n", " na.plt.plot(\n", " time,\n", " level_0.inputs.temperature_fpga,\n", " axis=level_0.axis_time,\n", " ax=ax,\n", " label=level_0.channel,\n", " )\n", " ax.set_ylabel(f\"FPGA temperature ({ax.get_ylabel()})\")\n", " ax.legend()" ], "outputs": [], "execution_count": null }, { "cell_type": "raw", "id": "e3c5f647", "metadata": { "raw_mimetype": "text/restructuredtext" }, "source": [ "Plot the temperature of the ADCs for each channel." ] }, { "cell_type": "code", "id": "ca8d91c7", "metadata": {}, "source": [ "with astropy.visualization.quantity_support():\n", " fig, ax = plt.subplots(\n", " nrows=4,\n", " sharex=True,\n", " constrained_layout=True,\n", " )\n", " na.plt.plot(\n", " time,\n", " level_0.inputs.temperature_adc_1,\n", " axis=level_0.axis_time,\n", " ax=ax[0],\n", " label=level_0.channel,\n", " )\n", " na.plt.plot(\n", " time,\n", " level_0.inputs.temperature_adc_2,\n", " axis=level_0.axis_time,\n", " ax=ax[1],\n", " label=level_0.channel,\n", " )\n", " na.plt.plot(\n", " time,\n", " level_0.inputs.temperature_adc_3,\n", " axis=level_0.axis_time,\n", " ax=ax[2],\n", " label=level_0.channel,\n", " )\n", " na.plt.plot(\n", " time,\n", " level_0.inputs.temperature_adc_4,\n", " axis=level_0.axis_time,\n", " ax=ax[3],\n", " label=level_0.channel,\n", " )\n", " ax[0].set_title(\"ADC 1\")\n", " ax[1].set_title(\"ADC 2\")\n", " ax[2].set_title(\"ADC 3\")\n", " ax[3].set_title(\"ADC 4\")\n", " ax[3].set_xlabel(\"time (UTC)\")\n", " ax[0].set_ylabel(f\"temp. ({ax[0].get_ylabel()})\")\n", " ax[1].set_ylabel(f\"temp. ({ax[1].get_ylabel()})\")\n", " ax[2].set_ylabel(f\"temp. ({ax[2].get_ylabel()})\")\n", " ax[3].set_ylabel(f\"temp.({ax[3].get_ylabel()})\")\n", " ax[0].legend(loc=\"lower right\")" ], "outputs": [], "execution_count": null }, { "cell_type": "code", "id": "67ec3cc0", "metadata": {}, "source": [ "with astropy.visualization.quantity_support():\n", " fig, ax = plt.subplots(\n", " nrows=3,\n", " sharex=True,\n", " constrained_layout=True,\n", " )\n", " na.plt.plot(\n", " time,\n", " level_0.inputs.voltage_fpga_vccint,\n", " axis=level_0.axis_time,\n", " ax=ax[0],\n", " label=level_0.channel,\n", " )\n", " na.plt.plot(\n", " time,\n", " level_0.inputs.voltage_fpga_vccaux,\n", " axis=level_0.axis_time,\n", " ax=ax[1],\n", " label=level_0.channel,\n", " )\n", " na.plt.plot(\n", " time,\n", " level_0.inputs.voltage_fpga_vccbram,\n", " axis=level_0.axis_time,\n", " ax=ax[2],\n", " label=level_0.channel,\n", " )\n", " ax[0].set_title(\"FPGA VCCINT\")\n", " ax[1].set_title(\"FPGA VCCAUX\")\n", " ax[2].set_title(\"FPGA VCCBRAM\")\n", " ax[2].set_xlabel(\"time (UTC)\")\n", " ax[0].set_ylabel(f\"voltage ({ax[0].get_ylabel()})\")\n", " ax[1].set_ylabel(f\"voltage ({ax[1].get_ylabel()})\")\n", " ax[2].set_ylabel(f\"voltage ({ax[2].get_ylabel()})\")\n", " ax[0].legend(loc=\"lower right\")" ], "outputs": [], "execution_count": null } ], "metadata": { "celltoolbar": "Raw Cell Format", "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.11.1" } }, "nbformat": 4, "nbformat_minor": 5 }