{ "cells": [ { "cell_type": "raw", "id": "0", "metadata": { "editable": true, "raw_mimetype": "text/x-rst", "slideshow": { "slide_type": "" }, "tags": [] }, "source": [ "Image Simulation\n", "----------------\n", "The Atmospheric Imaging Assembly (AIA) :cite:p:`Lemen2012` on the Solar Dynamics Observatory :cite:p:`Pesnell2012` is a NASA satellite that continuously observes the Sun in extreme ultraviolet (EUV). Since some of the EUV channels that AIA observes are close in temperature to the lines that ESIS observes, we can use AIA observations to simulate ESIS images.\n", "In this notebook, we select the AIA images from during the ESIS-I 2019 flight and simulate sythetic images using the ideal ESIS design." ] }, { "cell_type": "code", "execution_count": null, "id": "1", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "outputs": [], "source": [ "import warnings\n", "import matplotlib.pyplot as plt\n", "import named_arrays as na\n", "import esis" ] }, { "cell_type": "code", "execution_count": null, "id": "2", "metadata": {}, "outputs": [], "source": [ "warnings.filterwarnings(\"ignore\")" ] }, { "cell_type": "raw", "id": "3", "metadata": { "editable": true, "raw_mimetype": "text/x-rst", "slideshow": { "slide_type": "" }, "tags": [] }, "source": [ "Define the logical axis corresponding to changes in time." ] }, { "cell_type": "code", "execution_count": null, "id": "4", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "outputs": [], "source": [ "axis_time = \"time\"" ] }, { "cell_type": "raw", "id": "5", "metadata": { "editable": true, "raw_mimetype": "text/x-rst", "slideshow": { "slide_type": "" }, "tags": [] }, "source": [ "Define the logical axis corresponding to changes in line-of-sight velocity." ] }, { "cell_type": "code", "execution_count": null, "id": "6", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "outputs": [], "source": [ "axis_velocity = \"velocity\"" ] }, { "cell_type": "raw", "id": "7", "metadata": { "editable": true, "raw_mimetype": "text/x-rst", "slideshow": { "slide_type": "" }, "tags": [] }, "source": [ "Define the logical axes corresponding to changes in position on the disk of the Sun." ] }, { "cell_type": "code", "execution_count": null, "id": "8", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "outputs": [], "source": [ "axis_x = \"detector_x\"\n", "axis_y = \"detector_y\"" ] }, { "cell_type": "raw", "id": "9", "metadata": { "editable": true, "raw_mimetype": "text/x-rst", "slideshow": { "slide_type": "" }, "tags": [] }, "source": [ "Load the sythetic scene composed of AIA images.\n", "Here, we use the :func:`~esis.flights.f1.data.synth.scene_aia` function, which recreates the brightest three lines in the ESIS passband." ] }, { "cell_type": "code", "execution_count": null, "id": "10", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "outputs": [], "source": [ "scene = esis.flights.f1.data.synth.scene_aia(\n", " axis_time=axis_time,\n", " axis_detector_x=axis_x,\n", " axis_detector_y=axis_y,\n", " axis_velocity=axis_velocity,\n", " limit=1,\n", ")" ] }, { "cell_type": "raw", "id": "11", "metadata": { "editable": true, "raw_mimetype": "text/x-rst", "slideshow": { "slide_type": "" }, "tags": [] }, "source": [ "Load a single channel of the ideal ESIS optical model." ] }, { "cell_type": "code", "execution_count": null, "id": "12", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "outputs": [], "source": [ "instrument = esis.flights.f1.optics.design_single(num_distribution=0)" ] }, { "cell_type": "raw", "id": "13", "metadata": { "editable": true, "raw_mimetype": "text/x-rst", "slideshow": { "slide_type": "" }, "tags": [] }, "source": [ "Reduce the number of rays traced per field angle so that this tutorial has a reasonable runtime.\n", "This number should be increased to simulate research-quality images." ] }, { "cell_type": "code", "execution_count": null, "id": "14", "metadata": {}, "outputs": [], "source": [ "instrument.pupil.num = 2" ] }, { "cell_type": "raw", "id": "15", "metadata": { "editable": true, "raw_mimetype": "text/x-rst", "slideshow": { "slide_type": "" }, "tags": [] }, "source": [ "Also halve the number of pixels in each axis to increase the signal-to-noise ratio of the final image." ] }, { "cell_type": "code", "execution_count": null, "id": "16", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "outputs": [], "source": [ "sensor = instrument.camera.sensor\n", "sensor.width_pixel = 2 * sensor.width_pixel\n", "sensor.num_pixel_x = sensor.num_pixel_x // 2\n", "sensor.num_pixel_y = sensor.num_pixel_y // 2" ] }, { "cell_type": "raw", "id": "17", "metadata": { "editable": true, "raw_mimetype": "text/x-rst", "slideshow": { "slide_type": "" }, "tags": [] }, "source": [ "Image the sythetic scene using our model of the ESIS optical system." ] }, { "cell_type": "code", "execution_count": null, "id": "18", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "outputs": [], "source": [ "%%time\n", "images = instrument.system.image(\n", " scene=scene[{axis_time: 0}],\n", " axis_wavelength=axis_velocity,\n", " axis_field=(axis_x, axis_y),\n", ")" ] }, { "cell_type": "raw", "id": "19", "metadata": { "editable": true, "raw_mimetype": "text/x-rst", "slideshow": { "slide_type": "" }, "tags": [] }, "source": [ "Display the simulated image." ] }, { "cell_type": "code", "execution_count": null, "id": "20", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "outputs": [], "source": [ "fig, ax = plt.subplots(\n", " figsize=(11, 5),\n", " constrained_layout=True,\n", ")\n", "vmax = images.outputs.percentile(99.9).value\n", "img = na.plt.pcolormesh(\n", " images.inputs.position.x,\n", " images.inputs.position.y,\n", " C=images.outputs.sum((\"wavelength\", axis_velocity)).value,\n", " cmap=\"gray\",\n", " vmin=0,\n", " vmax=vmax,\n", ")\n", "ax.set_xticks([])\n", "ax.set_yticks([])\n", "ax.set_aspect(\"equal\")\n", "plt.colorbar(img.ndarray.item(), label=f\"signal ({images.outputs.unit})\");" ] } ], "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.3" } }, "nbformat": 4, "nbformat_minor": 5 }