{ "cells": [ { "metadata": {}, "cell_type": "markdown", "source": [ "# Throughput\n", "\n", "This report investigates the efficiency of each ESIS optical component\n", "and estimates the total sensitivity of the optics (not including the sensor).\n", "\n", "To accomplish this,\n", "we trace a grid of rays through the system and compute the ratios of the intensity\n", "of the unvignetted rays.\n", "This allows us to compute the average efficiency over the whole FOV,\n", "instead of just the on-axis efficiency.\n" ], "id": "75f4ec00464c9d50" }, { "cell_type": "code", "id": "initial_id", "metadata": { "collapsed": true }, "source": [ "import matplotlib.pyplot as plt\n", "import astropy.visualization\n", "import named_arrays as na\n", "import esis" ], "outputs": [], "execution_count": null }, { "metadata": {}, "cell_type": "markdown", "source": "Load the optical design", "id": "d5a705d59f31b6c1" }, { "metadata": {}, "cell_type": "code", "source": [ "instrument = esis.flights.f1.optics.design_single(num_distribution=0)\n", "instrument.wavelength = na.linspace(-1, 1, axis=\"wavelength\", num=101)" ], "id": "9402b7567be4e449", "outputs": [], "execution_count": null }, { "metadata": {}, "cell_type": "markdown", "source": "Trace rays through the optical design", "id": "527e01bf1d647cf7" }, { "metadata": {}, "cell_type": "code", "source": "rays = instrument.system.raytrace().outputs", "id": "6666c7055cc1b99a", "outputs": [], "execution_count": null }, { "metadata": {}, "cell_type": "markdown", "source": "Create a list with the names of each surface", "id": "88620e2df33bf51c" }, { "metadata": {}, "cell_type": "code", "source": "surface_names = [s.name for s in instrument.system.surfaces_all]", "id": "61fbc5b9902c298f", "outputs": [], "execution_count": null }, { "metadata": {}, "cell_type": "markdown", "source": "Isolate the name of the logical axis indicating different surfaces", "id": "2c9e1ac0a44f61be" }, { "metadata": {}, "cell_type": "code", "source": "axis_surface = instrument.system.axis_surface", "id": "8f1c8bc22b01f3e9", "outputs": [], "execution_count": null }, { "metadata": {}, "cell_type": "markdown", "source": "Compute the index of each surface", "id": "731a045bfe64aad0" }, { "metadata": {}, "cell_type": "code", "source": [ "index_source = 0\n", "index_primary = surface_names.index(instrument.primary_mirror.surface.name)\n", "index_grating = surface_names.index(instrument.grating.surface.name)\n", "index_filter = surface_names.index(instrument.filter.surface.name)" ], "id": "c702b83c2632b2b4", "outputs": [], "execution_count": null }, { "metadata": {}, "cell_type": "markdown", "source": "Compute the intensity of the rays at each surface", "id": "4b16225849254f9" }, { "metadata": {}, "cell_type": "code", "source": [ "axis_sum = instrument.field.axes + instrument.pupil.axes\n", "kwargs_sum = dict(\n", " axis=axis_sum, \n", " where=rays.unvignetted[{axis_surface: ~0}],\n", ")\n", "intensity_source = rays.intensity[{axis_surface: index_source}].sum(**kwargs_sum)\n", "intensity_primary = rays.intensity[{axis_surface: index_primary}].sum(**kwargs_sum)\n", "intensity_grating = rays.intensity[{axis_surface: index_grating}].sum(**kwargs_sum)\n", "intensity_filter = rays.intensity[{axis_surface: index_filter}].sum(**kwargs_sum)" ], "id": "1c5016ff84c96bec", "outputs": [], "execution_count": null }, { "metadata": {}, "cell_type": "markdown", "source": "Compute the efficiency of each surface by taking intensity ratios", "id": "9144f88901186289" }, { "metadata": {}, "cell_type": "code", "source": [ "efficiency_primary = intensity_primary / intensity_source\n", "efficiency_grating = intensity_grating / intensity_primary\n", "efficiency_filter = intensity_filter / intensity_grating\n", "efficiency_total = intensity_filter / intensity_source" ], "id": "467550a44c217455", "outputs": [], "execution_count": null }, { "metadata": {}, "cell_type": "markdown", "source": "Plot the efficiencies as a function of wavelength.", "id": "3320bf7950533dd" }, { "metadata": {}, "cell_type": "code", "source": [ "with astropy.visualization.quantity_support():\n", " fig, ax = plt.subplots(\n", " nrows=2,\n", " sharex=True,\n", " constrained_layout=True,\n", " )\n", " na.plt.plot(\n", " instrument.wavelength_physical,\n", " efficiency_primary,\n", " ax=ax[0],\n", " label=instrument.primary_mirror.surface.name,\n", " color=\"tab:blue\",\n", " )\n", " na.plt.plot(\n", " instrument.wavelength_physical,\n", " efficiency_grating,\n", " ax=ax[0],\n", " label=instrument.grating.surface.name,\n", " color=\"tab:orange\",\n", " )\n", " na.plt.plot(\n", " instrument.wavelength_physical,\n", " efficiency_filter,\n", " ax=ax[0],\n", " label=instrument.filter.surface.name,\n", " color=\"tab:green\",\n", " )\n", " na.plt.plot(\n", " instrument.wavelength_physical,\n", " efficiency_total,\n", " ax=ax[1],\n", " label=\"total\",\n", " color=\"tab:purple\",\n", " )\n", " fig.legend()\n", " ax[1].set_xlabel(f\"wavelength ({ax[1].get_xlabel()})\")\n", " ax[0].set_ylabel(\"efficiency\")\n", " ax[1].set_ylabel(\"efficiency\")" ], "id": "6296ad5a7c5c8cb0", "outputs": [], "execution_count": null }, { "metadata": {}, "cell_type": "markdown", "source": "Plot a schematic of the three multilayer stacks to compare", "id": "53a967528aa1fc96" }, { "metadata": {}, "cell_type": "code", "source": [ "with astropy.visualization.quantity_support():\n", " fig, ax = plt.subplots(\n", " ncols=3,\n", " sharey=True,\n", " figsize=(8,4),\n", " constrained_layout=True,\n", " )\n", " instrument.primary_mirror.material.plot_layers(ax=ax[0])\n", " instrument.grating.material.plot_layers(ax=ax[1])\n", " instrument.filter.material.plot_layers(ax=ax[2])\n", " ax[0].set_title(instrument.primary_mirror.surface.name)\n", " ax[1].set_title(instrument.grating.surface.name)\n", " ax[2].set_title(instrument.filter.surface.name)\n", " ax[0].set_axis_off()\n", " ax[1].set_axis_off()\n", " ax[2].set_axis_off()\n", " ax[2].autoscale()" ], "id": "fb6f8936267f333c", "outputs": [], "execution_count": null } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.6" } }, "nbformat": 4, "nbformat_minor": 5 }