{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Test ADC wheel\n", "\n", "This notebook demonstrates how to use the various atmospheric dispersion correctors in METIS. Note that the action of an adc is currently restricted to a transmission loss. The implementation of the geometric differential refraction residuals will follow at a later stage." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import scopesim as sim\n", "sim.bug_report()\n", "\n", "# Edit this path if you have a custom install directory, otherwise comment it out.\n", "sim.rc.__config__[\"!SIM.file.local_packages_path\"] = \"../../../../\" " ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import numpy as np\n", "from matplotlib import pyplot as plt\n", "%matplotlib inline" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "If you haven't got the instrument packages yet, uncomment the following cell" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# sim.download_packages([\"METIS\", \"ELT\", \"Armazones\"]) " ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "cmd = sim.UserCommands(use_instrument=\"METIS\", set_modes=['img_lm'])" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The ADC to use is defined by `\"!OBS.adc\"`. This can be set to `false` when no ADC is in the path. The default for LM band imaging is" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "cmd[\"!OBS.adc\"]" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "src = sim.source.source_templates.empty_sky()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "metis = sim.OpticalTrain(cmd)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The effect `metis['adc_wheel']` works the same way as e.g. `metis['filter_wheel']`. The following ADCs are now available (yes, there's only one) and can be selected with `metis['adc_wheel'].change_adc()` as demonstrated below." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "scrolled": true }, "outputs": [], "source": [ "metis['adc_wheel'].adcs" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Run a simulation with the ADC in the path:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "metis.observe(src, update=True)\n", "implane_adc = metis.image_planes[0].data" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Now remove the ADC from the path by changing to `False`. Run the simulation without the ADC:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "metis['adc_wheel'].change_adc(False)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "metis.observe(src, update=True)\n", "implane_no_adc = metis.image_planes[0].data" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Compare the image plane simulated with and without the ADC. The ratio should be equal to the throughput of the ADC (90 per cent):" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "med_adc = np.median(implane_adc)\n", "med_no_adc = np.median(implane_no_adc)\n", "print(\"With ADC: {:.1f}\".format(np.median(med_adc)))\n", "print(\"Without ADC: {:.1f}\".format(np.median(med_no_adc)))\n", "print(\"Ratio: {:.1f}\".format(med_adc/med_no_adc))" ] } ], "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.11.2" } }, "nbformat": 4, "nbformat_minor": 4 }