{ "cells": [ { "cell_type": "raw", "id": "0", "metadata": { "raw_mimetype": "text/restructuredtext" }, "source": [ "Synthetic ESIS-II Images\n", "========================\n", "\n", "This report simulates one exposure from one channel of ESIS-II, from a real solar\n", "scene: the active-region pair NOAA 12565 and 12567 observed by SDO/AIA on 2016 July 15\n", "at 00:00 UT.\n", "\n", "The scene is :func:`esis.flights.f2.data.synth.scene_dem`.\n", "The differential emission measure (DEM) of each AIA pixel is inverted from the six\n", "optically thin EUV channels with :func:`utu.dem.plowman`, against the CHIANTI 11\n", "temperature response of :func:`sdo.aia.temperature_response`,\n", "and the spectrum of the plasma it describes is computed from the CHIANTI atomic\n", "database with :mod:`utu.spectrum`, for every line in the ESIS-II passband which\n", "carries at least half a percent of its radiance.\n", "Each line is spread over bins of velocity by the thermal motion of its ions, at rest." ] }, { "cell_type": "code", "execution_count": null, "id": "1", "metadata": {}, "outputs": [], "source": [ "import matplotlib.colors\n", "import matplotlib.pyplot as plt\n", "import numpy as np\n", "import astropy.units as u\n", "import astropy.visualization\n", "import named_arrays as na\n", "import esis" ] }, { "cell_type": "raw", "id": "2", "metadata": { "raw_mimetype": "text/restructuredtext" }, "source": [ "The scene\n", "---------" ] }, { "cell_type": "raw", "id": "3", "metadata": { "raw_mimetype": "text/restructuredtext" }, "source": [ "The axes of the AIA pixels are renamed, so that they can't be mistaken for the\n", "axes of the ESIS-II detector the scene is imaged onto.\n", "The first call downloads the AIA images and computes the contribution functions of\n", "the lines, which takes about a quarter of an hour; both are cached afterwards." ] }, { "cell_type": "code", "execution_count": null, "id": "4", "metadata": {}, "outputs": [], "source": [ "axis_x = \"scene_x\"\n", "axis_y = \"scene_y\"\n", "\n", "scene = esis.flights.f2.data.synth.scene_dem(\n", " axis_detector_x=axis_x,\n", " axis_detector_y=axis_y,\n", ")\n", "scene.outputs.shape" ] }, { "cell_type": "raw", "id": "5", "metadata": { "raw_mimetype": "text/restructuredtext" }, "source": [ "The radiance of each line is its spectral radiance summed over its bins of\n", "velocity. The two lines ESIS-II was designed for are the brightest, followed by the\n", "weaker line of the Si XII doublet and the Mg VII and Mg VIII lines at the short end of\n", "the passband." ] }, { "cell_type": "code", "execution_count": null, "id": "6", "metadata": {}, "outputs": [], "source": [ "width = np.diff(scene.inputs.wavelength, axis=\"velocity\")\n", "radiance = (scene.outputs * width).sum(\"velocity\")\n", "\n", "rest = scene.inputs.wavelength_rest\n", "mean = radiance.mean((axis_x, axis_y))\n", "fraction = mean / mean.sum(\"line\")\n", "\n", "print(f\"{'wavelength':>12}{'radiance':>12}{'fraction':>10}\")\n", "for i in np.argsort(-mean.ndarray.value):\n", " index = dict(line=i)\n", " print(\n", " f\"{rest[index].ndarray.to_value(u.AA):12.3f}\"\n", " f\"{mean[index].ndarray.value:12.1f}\"\n", " f\"{fraction[index].ndarray.value:10.3f}\"\n", " )" ] }, { "cell_type": "code", "execution_count": null, "id": "7", "metadata": {}, "outputs": [], "source": [ "lines = {\n", " r\"Ne VII 465 $\\AA$\": esis.flights.f2.wavelength_Ne_VII,\n", " r\"Si XII 499 $\\AA$\": esis.flights.f2.wavelength_Si_XII,\n", "}\n", "\n", "with astropy.visualization.quantity_support():\n", " fig, axs = plt.subplots(\n", " ncols=2,\n", " figsize=(9, 4.5),\n", " sharey=True,\n", " constrained_layout=True,\n", " )\n", " for ax, (name, w) in zip(axs, lines.items()):\n", " index = np.argmin(np.abs(rest - w), axis=\"line\")\n", " na.plt.pcolormesh(\n", " scene.inputs.position,\n", " C=np.sqrt(radiance[index].value),\n", " ax=ax,\n", " cmap=\"afmhot\",\n", " )\n", " ax.set_title(name)\n", " ax.set_aspect(\"equal\")\n", " fig.supxlabel(\"offset from the boresight in $x$ (arcsec)\")\n", " fig.supylabel(\"offset from the boresight in $y$ (arcsec)\")" ] }, { "cell_type": "raw", "id": "8", "metadata": { "raw_mimetype": "text/restructuredtext" }, "source": [ "The instrument\n", "--------------" ] }, { "cell_type": "raw", "id": "9", "metadata": { "raw_mimetype": "text/restructuredtext" }, "source": [ "The forward model is a single channel of the current ESIS-II design,\n", ":func:`esis.flights.f2.optics.design_single`, with its own sensor: the quantum\n", "efficiency of its CCD, the length of one exposure of its camera, and the read noise\n", "of its readout." ] }, { "cell_type": "code", "execution_count": null, "id": "10", "metadata": {}, "outputs": [], "source": [ "instrument = esis.flights.f2.optics.design_single(num_distribution=0)\n", "system = instrument.system\n", "system.sensor.timedelta_exposure, system.sensor.read_noise" ] }, { "cell_type": "raw", "id": "11", "metadata": { "raw_mimetype": "text/restructuredtext" }, "source": [ "Projection onto the detector\n", "----------------------------" ] }, { "cell_type": "raw", "id": "12", "metadata": { "raw_mimetype": "text/restructuredtext" }, "source": [ "The scene is imaged through a linear approximation of the optical system,\n", ":meth:`optika.systems.SequentialSystem.linearize`, which fits the distortion,\n", "vignetting, effective area, and field stop of the system and then images the scene by\n", "conservative regridding, without the sampling noise of a ray trace.\n", "One approximation covers the whole passband, sampled about every angstrom; a cubic\n", "distortion puts every line within a few hundredths of a pixel of where a fit to that\n", "line alone puts it.\n", "\n", "The lines are imaged one at a time, since the regridding weights of\n", ":meth:`optika.systems.LinearSystem.weights` take a few gigabytes per line.\n", ":meth:`optika.systems.LinearSystem.image_from_weights` exposes each line with its own\n", "shot noise, but is not asked to integrate over wavelength, which would add the read\n", "noise of the sensor once per line.\n", "The read noise is added once at the end instead, for the single readout of the sensor." ] }, { "cell_type": "code", "execution_count": null, "id": "13", "metadata": {}, "outputs": [], "source": [ "linear = system.linearize(\n", " wavelength=na.linspace(\n", " start=instrument.wavelength_min,\n", " stop=instrument.wavelength_max,\n", " axis=\"_wavelength\",\n", " num=105,\n", " ),\n", " degree=2,\n", " degree_distortion=3,\n", ")\n", "\n", "axis_field = (axis_x, axis_y)\n", "electrons = 0\n", "for i in range(rest.shape[\"line\"]):\n", " line = scene[dict(line=i)].explicit\n", " weights = linear.weights(\n", " coordinates=line.inputs,\n", " axis_wavelength=\"velocity\",\n", " axis_field=axis_field,\n", " )\n", " image = linear.image_from_weights(\n", " weights,\n", " line,\n", " axis_wavelength=\"velocity\",\n", " axis_field=axis_field,\n", " integrate=False,\n", " )\n", " electrons = electrons + image.outputs.sum(\"velocity\")\n", "\n", "# the single readout of the sensor\n", "electrons = na.random.normal(loc=electrons, scale=linear.sensor.read_noise)" ] }, { "cell_type": "raw", "id": "14", "metadata": { "raw_mimetype": "text/restructuredtext" }, "source": [ "The simulated exposure\n", "----------------------" ] }, { "cell_type": "raw", "id": "15", "metadata": { "raw_mimetype": "text/restructuredtext" }, "source": [ "The electrons each pixel collects in one exposure, on a square-root scale, with the\n", "shot noise of the photons and the read noise of the camera.\n", "The read noise makes the darkest pixels negative, which are drawn as zero.\n", "\n", "The Ne VII and Si XII images of the octagonal field stop land side by side on the\n", "detector, on either side of its center.\n", "Ne VII shows the cool fan loops and moss of the two active regions, and Si XII their\n", "hot cores.\n", "The fainter octagons are lines near the peak of the effective area.\n", "Fe XIV 467.4 Å lies almost on top of Ne VII, Fe XV 481.5 Å, Ne V 483.0 Å and\n", "Fe XIII 487.0 Å straddle the center of the detector, and Fe XIII 510.0 Å and the\n", "weaker line of the Si XII doublet, 520.7 Å, run off its right edge.\n", "The Mg VII and Mg VIII lines at the short end of the passband are bright in the scene\n", "but hardly detected, since the coatings reflect little of them, and their images fall\n", "mostly off the left edge." ] }, { "cell_type": "code", "execution_count": null, "id": "16", "metadata": {}, "outputs": [], "source": [ "signal = electrons.to(u.electron).value.ndarray_aligned((\"detector_y\", \"detector_x\"))\n", "\n", "fig, ax = plt.subplots(figsize=(12, 7), constrained_layout=True)\n", "img = ax.imshow(\n", " signal,\n", " norm=matplotlib.colors.PowerNorm(gamma=1 / 2, vmin=0),\n", " origin=\"lower\",\n", " cmap=\"afmhot\",\n", " interpolation=\"none\",\n", ")\n", "ax.set_xlabel(\"detector $x$ (pixels)\")\n", "ax.set_ylabel(\"detector $y$ (pixels)\")\n", "colorbar = fig.colorbar(img, ax=ax, orientation=\"horizontal\", shrink=0.8)\n", "colorbar.set_label(\"signal (electrons)\")" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "name": "python" } }, "nbformat": 4, "nbformat_minor": 5 }