From 4e21e1593e6a665c4b2701c7168a60df0263c3c6 Mon Sep 17 00:00:00 2001 From: Hugo Buddelmeijer Date: Wed, 3 Jul 2024 13:28:17 +0200 Subject: [PATCH] Add DREAMS version of 7_dithered_cluster.ipynb --- .../7_dithered_cluster.ipynb | 4 +- .../7_dithered_cluster.withdreams.ipynb | 275 ++++++++++++++++++ 2 files changed, 277 insertions(+), 2 deletions(-) create mode 100644 MICADO/docs/example_notebooks/7_dithered_cluster.withdreams.ipynb diff --git a/MICADO/docs/example_notebooks/7_dithered_cluster.ipynb b/MICADO/docs/example_notebooks/7_dithered_cluster.ipynb index f0a682fc..48932404 100644 --- a/MICADO/docs/example_notebooks/7_dithered_cluster.ipynb +++ b/MICADO/docs/example_notebooks/7_dithered_cluster.ipynb @@ -178,7 +178,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -192,7 +192,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.6.8" + "version": "3.11.5" } }, "nbformat": 4, diff --git a/MICADO/docs/example_notebooks/7_dithered_cluster.withdreams.ipynb b/MICADO/docs/example_notebooks/7_dithered_cluster.withdreams.ipynb new file mode 100644 index 00000000..4e702edf --- /dev/null +++ b/MICADO/docs/example_notebooks/7_dithered_cluster.withdreams.ipynb @@ -0,0 +1,275 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "id": "f768a8f1", + "metadata": {}, + "outputs": [], + "source": [ + "%matplotlib inline\n", + "from matplotlib import pyplot as plt\n", + "from matplotlib.colors import LogNorm\n", + "import datetime\n", + "from astropy import units as u\n", + "import scopesim as sim\n", + "import scopesim_templates as sim_tp\n", + "import astropy.units as u" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "ffbdc64d", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\u001b[32mimf - sample_imf: Setting maximum allowed mass to 10000\u001b[0m\n", + "\u001b[32mimf - sample_imf: Loop 0 added 1.01e+04 Msun to previous total of 0.00e+00 Msun\u001b[0m\n" + ] + } + ], + "source": [ + "src = sim_tp.micado.cluster()\n", + "\n", + "# Shift the source in the opposite direction of the dither we want to simulate.\n", + "shift_x = (1 * u.arcsec).to(u.degree)\n", + "shift_y = (2 * u.arcsec).to(u.degree)\n", + "src.shift(-shift_x, -shift_y)" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "e3f2c0e0", + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + " FOVs: 0%| | 0/1 [00:00" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "plt.figure(figsize=(20, 20))\n", + "for i in range(1, 7):\n", + " plt.subplot(3, 2, i)\n", + " plt.imshow(hdus[0][i].data, origin=\"lower\", norm=LogNorm())" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "id": "50c31fef", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "SIMPLE = T / conforms to FITS standard \n", + "BITPIX = 8 / array data type \n", + "NAXIS = 0 / number of array dimensions \n", + "EXTEND = T \n", + "MJD-OBS = '2022-01-01T02:30:00' \n", + "RA = 0.000277777777777777 / [deg] \n", + "DEC = 0.000555555555555555 / [deg] \n", + "INSTRUME= '' \n", + "HIERARCH ESO DPR CATG = 'SCIENCE ' \n", + "HIERARCH ESO DPR TYPE = 'OBJECT ' \n", + "HIERARCH ESO DPR TECH = 'IMAGE ' \n", + "HIERARCH ESO DET DIT = 3600 \n", + "HIERARCH ESO DET NDIT = 1 \n", + "HIERARCH ESO DET READOUT = 'CDS ' \n", + "HIERARCH ESO INS FILT1 NAME = 'open ' \n", + "HIERARCH ESO INS FILT2 NAME = 'H ' \n", + "HIERARCH ESO INS DROT = 0 \n", + "HIERARCH ESO TPL START = '2022-05-04T02:30:00' \n", + "HIERARCH ESO TPL EXPNO = 2 \n", + "HIERARCH ESO OBS TPLNO = 0 \n", + "HIERARCH ESO OBS INSTRUME = 'MICADO ' \n", + "HIERARCH ESO OBS NAME = 'MyScienceTest' \n", + "HIERARCH WISE ATM LOCATION = 'Armazones' \n", + "HIERARCH WISE ATM ALTITUDE = 3060 \n", + "HIERARCH WISE ATM LONGITUD = -70.1918 \n", + "HIERARCH WISE ATM LATITUDE = -24.5899 \n", + "HIERARCH WISE ATM TEMPERAT = 7 \n", + "HIERARCH WISE ATM HUMIDITY = 0.1 \n", + "HIERARCH WISE ATM PRESSURE = 0.755 \n", + "HIERARCH WISE ATM PWV = 2.5 \n", + "HIERARCH WISE ATM BKG FILT = 'Ks ' \n", + "HIERARCH WISE ATM BKG VALUE = 13.6 \n", + "HIERARCH WISE ATM BKG UNIT = 'mag ' \n", + "HIERARCH WISE ATM SPE FILENAME = 'TER_armazones_default_FULL_IMG.dat' \n", + "HIERARCH WISE ATM SKY OBSERVAT = 'armazones' \n", + "HIERARCH WISE ATM SKY WUNIT = 'um ' \n", + "HIERARCH WISE ATM SKY WGRIDMOD = 'fixed_spectral_resolution' \n", + "HIERARCH WISE INS MODE = 'IMAGING ' \n", + "HIERARCH WISE INS NAME = 'MICADO ' \n", + "HIERARCH WISE INS TEMPERAT = -190 \n", + "HIERARCH WISE INS FILT NAME = 'open ' \n", + "HIERARCH WISE INS FILT1 MINIMUM_ = 0.000101 \n", + "HIERARCH WISE INS FILT1 OUTER = 0.2 \n", + "HIERARCH WISE INS FILT2 MINIMUM_ = 0.000101 \n", + "HIERARCH WISE INS FILT2 OUTER = 0.2 \n", + "HIERARCH WISE INS OPTI6 NAME = 'open ' \n", + "HIERARCH WISE INS DROT = 0 \n", + "HIERARCH WISE INS READMODE = 'CDS ' \n", + "HIERARCH WISE INS PLATE_SC = 0.26666666666 \n", + "HIERARCH WISE INS STA REALFILE = 'LIST_MICADO_mirrors_static.dat' \n", + "HIERARCH WISE INS NCP REALFILE = 'INST_MICADO_wavefront_error_budget.dat' \n", + "HIERARCH WISE OBS RA = 0.000277777777777777 / [deg] \n", + "HIERARCH WISE OBS DEC = 0.000555555555555555 / [deg] \n", + "HIERARCH WISE TEL NAME = 'ELT ' \n", + "HIERARCH WISE TEL TELESCOP = 'ELT ' \n", + "HIERARCH WISE TEL TER FILENAME = 'TER_ELT_5_mirror.dat' \n", + "HIERARCH WISE TEL REF REALFILE = 'LIST_ELT_combined.tbl' \n", + "HIERARCH WISE OCS PXSCALE = 0.004 \n", + "HIERARCH WISE DET NAME = '' \n", + "HIERARCH WISE DET IMAGE_PL = 0 \n", + "HIERARCH WISE DET TEMPERAT = -230 \n", + "HIERARCH WISE DET DAR VALUE = 0.1 \n", + "HIERARCH WISE DET SHO STATE = T \n", + "HIERARCH WISE DET EXP STATE = T \n", + "HIERARCH WISE DET QEC REALFILE = 'QE_detector_H4RG.dat' \n", + "HIERARCH WISE DET LIN REALFILE = 'FPA_linearity.dat' \n", + "HIERARCH WISE DET REF ALL = 0 \n", + "HIERARCH WISE REL PSF REALFILE = 'PSF_SCAO_ConstPSF_0_5off.fits' \n", + "HIERARCH WISE REL SUR REALFILE = 'LIST_RO_SCAO_mirrors.dat' " + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "hdus[0][0].header" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "id": "80727be5", + "metadata": {}, + "outputs": [], + "source": [ + "hdus[0].writeto(\"my_dithered_cluster.fits\", overwrite=True)" + ] + } + ], + "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.5" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}