diff --git a/ELT/ELT.yaml b/ELT/ELT.yaml index fc1b1599..54e339c5 100644 --- a/ELT/ELT.yaml +++ b/ELT/ELT.yaml @@ -21,6 +21,13 @@ effects : kwargs : filename : LIST_ELT_combined.tbl + - name : telescope_fits_keywords + description : FITS keywords specific to the telescope + class : ExtraFitsKeywords + include : True + kwargs : + filename: FITS_telescope_keywords.yaml + # - name : scope_vibration # description : residual vibration of telescope # class : Vibration diff --git a/ELT/FITS_telescope_keywords.yaml b/ELT/FITS_telescope_keywords.yaml new file mode 100644 index 00000000..070d2f38 --- /dev/null +++ b/ELT/FITS_telescope_keywords.yaml @@ -0,0 +1,11 @@ +- ext_type: PrimaryHDU + keywords: + HIERARCH: + WISE: + TEL: + NAME: "ELT" + TELESCOP: "ELT" + TER: + FILENAME: "!TEL.ter_curve.filename" + REF: + FILENAME: "#telescope_reflection.filename" diff --git a/METIS/METIS.yaml b/METIS/METIS.yaml index bb58bebf..4ff74705 100644 --- a/METIS/METIS.yaml +++ b/METIS/METIS.yaml @@ -57,12 +57,19 @@ effects: minimum_throughput: !!float 0. - name : common_fits_keywords - decription : FITS keywords common to all modes + description : FITS keywords common to all modes class : ExtraFitsKeywords include : True kwargs : filename: headers/FITS_common_keywords.yaml + - name: cfo_fits_keywords + description: FITS keywords to CFO elements + class: ExtraFitsKeywords + include: True + kwargs: + filename: headers/FITS_cfo_keywords.yaml + # - name : metis_adc_residuals # class : AtmosphericDispersionCorrection # include : False diff --git a/METIS/METIS_DET_IFU.yaml b/METIS/METIS_DET_IFU.yaml index d17f1e11..c3387675 100644 --- a/METIS/METIS_DET_IFU.yaml +++ b/METIS/METIS_DET_IFU.yaml @@ -7,6 +7,7 @@ description: A set of 4 H2RG detectors date_modified: 2021-12-16 changes: - 2021-12-16 (OC) some rearrangements + - 2024-10-11 (OC) add ADConversion, gain from B.Serra (2024-10-09) properties: image_plane_id: 0 @@ -15,6 +16,11 @@ properties: ndit: "!OBS.ndit" mindit: 1.3 # seconds, Roy van Boekel, pers. communication full_well: !!float 1.E5 # electrons, E-TNT-MPIA-1004, v1-0 + gain: + 1: 2.0 # electrons/ADU, email B.Serra 2024-10-09 + 2: 2.0 + 3: 2.0 + 4: 2.0 dark_current: 0.1 # [e-/s] readout_noise: 70 # electrons, AI on RvB: check layout: @@ -72,8 +78,16 @@ effects: noise_std: "!DET.readout_noise" n_channels: 32 - - name: quantization - description: Turn photon count into integers - class: Quantization + - name: ad_conversion + description: Apply gain and convert electron count into integers + class: ADConversion kwargs: dtype: uint16 + gain: "!DET.gain" + + - name: det_ifu_fits_keywords + descriptions: FITS keywords specific to IFU detectors + class: ExtraFitsKeywords + include: True + kwargs: + filename: headers/FITS_det_ifu_keywords.yaml diff --git a/METIS/METIS_DET_IMG_LM.yaml b/METIS/METIS_DET_IMG_LM.yaml index 0a7724e2..55229dc0 100644 --- a/METIS/METIS_DET_IMG_LM.yaml +++ b/METIS/METIS_DET_IMG_LM.yaml @@ -10,6 +10,8 @@ changes: - 2022-01-25 (KL, OC) added DetectorModePropertiesSetter effect - 2022-01-26 (OC) added DET.detector - 2022-02-21 (OC) rename effects + - 2024-10-11 (OC) rename quantization to ADConversion, gain values + from email by B.Serra (2024-10-09) properties: detector: HAWAII2RG @@ -40,12 +42,14 @@ effects: description: "HAWAII2RG, fast mode" "!DET.mindit": 0.04 "!DET.full_well": !!float 1e5 + "!DET.gain": 4.0 # e/ADU (email B.Serra) "!DET.readout_noise": 70 "!DET.dark_current": 0.05 slow: description: "HAWAII2RG, slow mode" "!DET.mindit": 1.3 "!DET.full_well": !!float 1e5 + "!DET.gain": 2.5 # e/ADU (email B.Serra) "!DET.readout_noise": 15 "!DET.dark_current": 0.05 @@ -91,8 +95,16 @@ effects: noise_std: "!DET.readout_noise" n_channels: 32 - - name: quantization - description: Turn photon count into integers - class: Quantization + - name: ad_conversion + description: Apply gain and convert electron counts into integers + class: ADConversion kwargs: dtype: uint16 + gain: "!DET.gain" + + - name: det_lm_fits_keywords + descriptions: FITS keywords specific to LM detector + class: ExtraFitsKeywords + include: True + kwargs: + filename: headers/FITS_det_lm_keywords.yaml diff --git a/METIS/METIS_DET_IMG_N_Aquarius.yaml b/METIS/METIS_DET_IMG_N_Aquarius.yaml index cbff95de..9ea8c294 100644 --- a/METIS/METIS_DET_IMG_N_Aquarius.yaml +++ b/METIS/METIS_DET_IMG_N_Aquarius.yaml @@ -20,6 +20,7 @@ properties: full_well: !!float 1.e6 # electrons, low-capacity mode dark_current: 13 # [e-/s] E-REP-NOVA-MET-1191, v2-0 readout_noise: 12 + gain: 15 # wild guess to make full_well fit into int16 layout: file_name: "FPA_metis_img_nq_aquarius_layout.dat" qe_curve: @@ -100,8 +101,9 @@ effects: nod_offsets: "!OBS.nod_offsets" pixel_scale: "!INST.pixel_scale" - - name: quantization - description: Turn photon count into integers - class: Quantization + - name: ad_conversion + description: Apply gain and convert electron count into integers + class: ADConversion kwargs: dtype: uint16 + gain: "!DET.gain" diff --git a/METIS/METIS_DET_IMG_N_GeoSnap.yaml b/METIS/METIS_DET_IMG_N_GeoSnap.yaml index 907b7f6d..d810ab32 100644 --- a/METIS/METIS_DET_IMG_N_GeoSnap.yaml +++ b/METIS/METIS_DET_IMG_N_GeoSnap.yaml @@ -10,6 +10,10 @@ changes: - 2022-01-25 (KL, OC) added DetectorModePropertiesSetter effect - 2022-01-26 (OC) added DET.detector, linearity set explicitely - 2022-02-21 (OC) rename effects + - 2024-08-22 (OC) rename quantization to ADConversion, add gain + from Bowens2024 for high-capacity and a guess + for low-capacity + - 2024-10-11 (OC) gain values from email by B.Serra (2024-10-09) properties: detector: Teledyne GeoSnap @@ -38,6 +42,7 @@ effects: description: "Geosnap, high-capacity mode" "!DET.mindit": 0.011 # seconds "!DET.full_well": !!float 2.8e6 # electrons + "!DET.gain": 201 # electron/ADU (email B.Serra) "!DET.readout_noise": 300 # electrons (DCS) "!DET.dark_current": !!float 1e5 # electrons/second "!DET.linearity.incident": [0, !!float 2.8e6, !!float 1e99] @@ -46,6 +51,7 @@ effects: description: "Geosnap, low-capacity mode" "!DET.mindit": 0.011 # seconds "!DET.full_well": !!float 1.8e5 # electrons + "!DET.gain": 14 # electron/ADU (email B.Serra) "!DET.readout_noise": 35 # electrons (DCS) "!DET.dark_current": !!float 1e5 # electrons/second "!DET.linearity.incident": [0, !!float 1.8e5, !!float 1e99] @@ -103,8 +109,16 @@ effects: nod_offsets: "!OBS.nod_offsets" pixel_scale: "!INST.pixel_scale" - - name: quantization - description: Turn photon count into integers - class: Quantization + - name: ad_conversion + description: Apply gain and convert electron count into integers + class: ADConversion kwargs: dtype: uint16 + gain: "!DET.gain" + + - name: det_n_fits_keywords + descriptions: FITS keywords specific to N detector + class: ExtraFitsKeywords + include: True + kwargs: + filename: headers/FITS_det_n_keywords.yaml diff --git a/METIS/METIS_IMG_LM.yaml b/METIS/METIS_IMG_LM.yaml index 337492f4..a56cc3c5 100644 --- a/METIS/METIS_IMG_LM.yaml +++ b/METIS/METIS_IMG_LM.yaml @@ -12,6 +12,7 @@ changes: - 2022-01-12 (OC) change default bkg_width to -1 - 2022-02-17 (OC) increase spectral_bin_width for imaging - 2022-02-21 (OC) renamed effects + - 2025-04-16 (OC) add ExtraFitsKeywords properties: pixel_scale: 0.00547 # arcsec / pixel, METIS_1097 @@ -81,6 +82,13 @@ effects: wave_key: "WAVELENG" bkg_width: -1 + - name: img_lm_fits_keywords + descriptions: FITS keywords specific to IMG-LM + class: ExtraFitsKeywords + include: True + kwargs: + filename: headers/FITS_img_lm_keywords.yaml + --- ### default simulation parameters needed for a METIS simulation object: simulation diff --git a/METIS/METIS_IMG_N.yaml b/METIS/METIS_IMG_N.yaml index ed069eb6..a09027a6 100644 --- a/METIS/METIS_IMG_N.yaml +++ b/METIS/METIS_IMG_N.yaml @@ -75,6 +75,14 @@ effects: wave_key: "WAVELENG" bkg_width: -1 + - name: img_n_fits_keywords + descriptions: FITS keywords specific to IMG-N + class: ExtraFitsKeywords + include: True + kwargs: + filename: headers/FITS_img_n_keywords.yaml + + --- ### default simulation parameters needed for a METIS simulation object: simulation diff --git a/METIS/METIS_LMS.yaml b/METIS/METIS_LMS.yaml index c45952ed..1fe02c57 100644 --- a/METIS/METIS_LMS.yaml +++ b/METIS/METIS_LMS.yaml @@ -56,7 +56,12 @@ effects: col_number_start: 1 slice_samples: 5 # number of samples along slice width - + - name: lms_fits_keywords + description: FITS keywords specific to LMS elements + class: ExtraFitsKeywords + include: True + kwargs: + filename: headers/FITS_lms_keywords.yaml --- ### default simulation parameters needed for a METIS simulation diff --git a/METIS/METIS_LSS.yaml b/METIS/METIS_LSS.yaml index 6d8db5f1..5b045800 100644 --- a/METIS/METIS_LSS.yaml +++ b/METIS/METIS_LSS.yaml @@ -34,6 +34,13 @@ effects: s_colname: "xi" col_number_start: 1 + - name: lss_fits_keywords + descriptions: FITS keywords specific to LSS + class: ExtraFitsKeywords + include: True + kwargs: + filename: headers/FITS_lss_keywords.yaml + --- ### default simulation parameters needed for a METIS simulation object: simulation diff --git a/METIS/METIS_WCU.yaml b/METIS/METIS_WCU.yaml index f58eb28c..ea7caf77 100644 --- a/METIS/METIS_WCU.yaml +++ b/METIS/METIS_WCU.yaml @@ -38,6 +38,12 @@ effects: transmissions: [0.6098, 0.6312, 0.5879, 0.6073, 0.5795, 0.7342, 0.7509, 0.7429, 0.6170, 0.4362, 0.4476, 0.6098, 0.6312, 0.6076, 0.8201] current_mask: "open" + - name: wcu_fits_keywords + description: FITS keywords specific to the WCU + class: ExtraFitsKeywords + include: True + kwargs: + filename: headers/FITS_wcu_keywords.yaml --- # Required parameters to replace telescope alias: TEL diff --git a/METIS/default.yaml b/METIS/default.yaml index cbc381d4..fc10a0ad 100644 --- a/METIS/default.yaml +++ b/METIS/default.yaml @@ -74,6 +74,7 @@ mode_yamls: - METIS_IMG_LM.yaml - METIS_DET_IMG_LM.yaml properties: + ins_mode: IMG_LM # use as FITS header keyword psf_file: PSF_SCAO_9mag_06seeing.fits filter_name: Lp nd_filter_name: open @@ -93,6 +94,7 @@ mode_yamls: - METIS_IMG_N.yaml - METIS_DET_IMG_N_GeoSnap.yaml properties: + ins_mode: IMG_N # use as FITS header keyword psf_file: PSF_SCAO_9mag_06seeing.fits filter_name: N2 nd_filter_name: open @@ -115,11 +117,14 @@ mode_yamls: - METIS_LSS.yaml - METIS_DET_IMG_LM.yaml properties: + ins_mode: LSS_L # use as FITS header keyword psf_file: PSF_LM_9mag_06seeing.fits trace_file: TRACE_LSS_L.fits efficiency_file: TER_grating_L.fits slit: C-38_1 adc: const_90 + grism_opti9: GRISM_L + grism_opti12: open filter_name: L_spec nd_filter_name: open detector_readout_mode: slow @@ -137,11 +142,14 @@ mode_yamls: - METIS_LSS.yaml - METIS_DET_IMG_LM.yaml properties: + ins_mode: IMG_M # use as FITS header keyword psf_file: PSF_LM_9mag_06seeing.fits trace_file: TRACE_LSS_M.fits efficiency_file: TER_grating_M.fits slit: C-38_1 adc: const_90 + grism_opti9: GRISM_M + grism_opti12: open filter_name: M_spec nd_filter_name: open detector_readout_mode: slow @@ -159,13 +167,18 @@ mode_yamls: - METIS_LSS.yaml - METIS_DET_IMG_N_GeoSnap.yaml properties: + ins_mode: IMG_N # use as FITS header keyword psf_file: PSF_N_9mag_06seeing.fits trace_file: TRACE_LSS_N.fits efficiency_file: TER_grating_N.fits slit: D-57_1 adc: false + grism_opti9: open + grism_opti12: GRISM_N filter_name: N_spec nd_filter_name: open + chop_offsets: [3, 0] # perpendicular chopping and nodding + nod_offsets: [0, 3] detector_readout_mode: low_capacity - object: observation @@ -180,6 +193,7 @@ mode_yamls: - METIS_LMS.yaml - METIS_DET_IFU.yaml properties: + ins_mode: LMS # use as FITS header keyword psf_file: PSF_LM_9mag_06seeing.fits slit: false adc: false @@ -199,6 +213,7 @@ mode_yamls: - METIS_LMS_EXT.yaml - METIS_DET_IFU.yaml properties: + ins_mode: LMS # use as FITS header keyword slit: false adc: false detector_readout_mode: slow @@ -213,6 +228,7 @@ mode_yamls: - METIS_IMG_LM.yaml - METIS_DET_IMG_LM.yaml properties: + ins_mode: IMG_LM # use as FITS header keyword psf_file: PSF_SCAO_9mag_06seeing.fits # REPLACE! filter_name: Lp nd_filter_name: open @@ -230,6 +246,7 @@ mode_yamls: - METIS_IMG_N.yaml - METIS_DET_IMG_N_GeoSnap.yaml properties: + ins_mode: IMG_N # use as FITS header keyword psf_file: PSF_SCAO_9mag_06seeing.fits # REPLACE! filter_name: N2 nd_filter_name: open @@ -250,11 +267,14 @@ mode_yamls: - METIS_LSS.yaml - METIS_DET_IMG_LM.yaml properties: + ins_mode: LSS_L # use as FITS header keyword psf_file: PSF_LM_9mag_06seeing.fits # REPLACE! trace_file: TRACE_LSS_L.fits efficiency_file: TER_grating_L.fits slit: C-38_1 adc: const_90 + grism_opti9: GRISM_L + grism_opti12: open filter_name: L_spec nd_filter_name: open detector_readout_mode: slow @@ -270,11 +290,14 @@ mode_yamls: - METIS_LSS.yaml - METIS_DET_IMG_LM.yaml properties: + ins_mode: LSS_M # use as FITS header keyword psf_file: PSF_LM_9mag_06seeing.fits # REPLACE! trace_file: TRACE_LSS_M.fits efficiency_file: TER_grating_M.fits slit: C-38_1 adc: const_90 + grism_opti9: GRISM_M + grism_opti12: open filter_name: M_spec nd_filter_name: open detector_readout_mode: slow @@ -290,13 +313,18 @@ mode_yamls: - METIS_LSS.yaml - METIS_DET_IMG_N_GeoSnap.yaml properties: + ins_mode: LSS_N # use as FITS header keyword psf_file: PSF_N_9mag_06seeing.fits # REPLACE! trace_file: TRACE_LSS_N.fits efficiency_file: TER_grating_N.fits slit: D-57_1 adc: false + grism_opti9: open + grism_opti12: GRISM_N filter_name: N_spec nd_filter_name: open + chop_offsets: [3, 0] # perpendicular chopping and nodding + nod_offsets: [0, 3] detector_readout_mode: low_capacity - object: observation @@ -309,6 +337,7 @@ mode_yamls: - METIS_LMS.yaml - METIS_DET_IFU.yaml properties: + ins_mode: LMS # use as FITS header keyword psf_file: PSF_LM_9mag_06seeing.fits # REPLACE! slit: false adc: false @@ -326,6 +355,7 @@ mode_yamls: - METIS_LMS_EXT.yaml - METIS_DET_IFU.yaml properties: + ins_mode: LMS # use as FITS header keyword slit: false adc: false detector_readout_mode: slow diff --git a/METIS/docs/example_notebooks/METIS_WCU.ipynb b/METIS/docs/example_notebooks/METIS_WCU.ipynb index c194f2da..fa795683 100644 --- a/METIS/docs/example_notebooks/METIS_WCU.ipynb +++ b/METIS/docs/example_notebooks/METIS_WCU.ipynb @@ -48,18 +48,8 @@ "outputs": [], "source": [ "import numpy as np\n", - "from astropy import units as u" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "3c430849", - "metadata": {}, - "outputs": [], - "source": [ - "from matplotlib import pyplot as plt\n", - "%matplotlib inline" + "from astropy import units as u\n", + "from matplotlib import pyplot as plt" ] }, { @@ -72,7 +62,7 @@ "import scopesim as sim\n", "\n", "# Edit this path if you have a custom install directory, otherwise comment it out. [For ReadTheDocs only]\n", - "sim.rc.__config__[\"!SIM.file.local_packages_path\"] = \"../../../\"" + "sim.link_irdb(\"../../../\")" ] }, { @@ -186,8 +176,9 @@ "metadata": {}, "outputs": [], "source": [ - "plt.imshow(metis.image_planes[0].data, origin='lower')\n", - "plt.colorbar();" + "fig, ax = plt.subplots()\n", + "img = ax.imshow(metis.image_planes[0].data, origin=\"lower\")\n", + "fig.colorbar(img);" ] }, { @@ -210,24 +201,6 @@ "print(f\"{metis.image_planes[0].data.mean():.2g}\")" ] }, - { - "cell_type": "markdown", - "id": "fc75f237-c61c-4659-b0db-be6a2c661bcc", - "metadata": {}, - "source": [ - "To make `readout` work, we currently have to turn off the effect that adds keywords to the resulting fits file. Including it would cause failure as it expects keywords related to the telescope, which are not available in WCU mode." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "de47de6a-6947-4c9e-ba06-494f7b6c2aa6", - "metadata": {}, - "outputs": [], - "source": [ - "metis['common_fits_keywords'].include = False" - ] - }, { "cell_type": "code", "execution_count": null, @@ -245,8 +218,9 @@ "metadata": {}, "outputs": [], "source": [ - "plt.imshow(hdul[1].data, vmin=92000, vmax=92600)\n", - "plt.colorbar();\n", + "fig, ax = plt.subplots()\n", + "img = ax.imshow(hdul[1].data, vmin=92000, vmax=92600)\n", + "fig.colorbar(img)\n", "print(f\"Mean: {hdul[1].data.mean():7.1f}\")\n", "print(f\"Standard deviation: {hdul[1].data.std(): 7.1f}\")" ] @@ -276,9 +250,10 @@ " metis.observe()\n", " signal[i] = metis.image_planes[0].data.mean()\n", "\n", - "plt.plot(temps, signal, 'o')\n", - "plt.xlabel(\"Black-body temperature [K]\")\n", - "plt.ylabel(\"Image-plane flux [ph/s/pixel]\");" + "_, ax = plt.subplots()\n", + "ax.plot(temps, signal, 'o')\n", + "ax.set_xlabel(\"Black-body temperature [K]\")\n", + "ax.set_ylabel(\"Image-plane flux [ph/s/pixel]\");" ] }, { @@ -306,9 +281,10 @@ " metis.observe()\n", " signal[i] = metis.image_planes[0].data.mean()\n", "\n", - "plt.plot(bb_ap, signal, 'o')\n", - "plt.xlabel(\"Fraction of flux transmitted into IS\")\n", - "plt.ylabel(\"Image-plane flux [ph/s/pixel]\");" + "_, ax = plt.subplots()\n", + "ax.plot(bb_ap, signal, 'o')\n", + "ax.set_xlabel(\"Fraction of flux transmitted into IS\")\n", + "ax.set_ylabel(\"Image-plane flux [ph/s/pixel]\");" ] }, { @@ -344,7 +320,8 @@ "wcu.set_fpmask(\"grid_lm\", angle=20, shift=(1, 0.5))\n", "print(wcu.fpmask)\n", "metis.observe()\n", - "plt.imshow(metis.image_planes[0].data, norm='log', origin='lower')" + "_, ax = plt.subplots()\n", + "ax.imshow(metis.image_planes[0].data, norm=\"log\", origin=\"lower\");" ] }, { @@ -436,9 +413,9 @@ "metadata": {}, "outputs": [], "source": [ - "fig, axes = plt.subplots(1, 2, figsize=(10, 10))\n", - "axes[0].imshow(implane_bb - implane_off, origin='lower', norm='symlog')\n", - "axes[1].imshow(implane_laser - implane_off, origin='lower', norm='symlog');" + "fig, (ax0, ax1) = plt.subplots(1, 2, figsize=(10, 5))\n", + "ax0.imshow(implane_bb - implane_off, origin=\"lower\", norm=\"symlog\")\n", + "ax1.imshow(implane_laser - implane_off, origin=\"lower\", norm=\"symlog\");" ] }, { diff --git a/METIS/docs/example_notebooks/demos/demo_filter_wheel.ipynb b/METIS/docs/example_notebooks/demos/demo_filter_wheel.ipynb index 33f30bc2..37ce47ce 100644 --- a/METIS/docs/example_notebooks/demos/demo_filter_wheel.ipynb +++ b/METIS/docs/example_notebooks/demos/demo_filter_wheel.ipynb @@ -79,8 +79,7 @@ "metadata": {}, "outputs": [], "source": [ - "metis = sim.OpticalTrain(cmd)\n", - "metis['quantization'].include = False" + "metis = sim.OpticalTrain(cmd)" ] }, { @@ -371,7 +370,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.2" + "version": "3.12.9" } }, "nbformat": 4, diff --git a/METIS/headers/FITS_cfo_keywords.yaml b/METIS/headers/FITS_cfo_keywords.yaml new file mode 100644 index 00000000..94687a88 --- /dev/null +++ b/METIS/headers/FITS_cfo_keywords.yaml @@ -0,0 +1,18 @@ +- ext_type: PrimaryHDU + keywords: + + HIERARCH: + ESO: + INS: + OPTI1: # CFO PP1 mask wheel + # TODO: There are no names yet. We use the + # transmission, which is returned as an + # inconvenient list. + DESC: "CFO PP1 mask wheel" + NAME: "#cold_stop.transmission!" + OPTI2: # CFO PP1 ADC wheel + DESC: "ADC wheel" + NAME: "#adc_wheel.current_adc!" + OPTI3: # CFO FP2 mask/slit wheel + DESC: "Slit wheel" + NAME: "#slit_wheel.current_slit!" diff --git a/METIS/headers/FITS_common_keywords.yaml b/METIS/headers/FITS_common_keywords.yaml index 5a5ed8f0..1fb8d6aa 100644 --- a/METIS/headers/FITS_common_keywords.yaml +++ b/METIS/headers/FITS_common_keywords.yaml @@ -87,7 +87,7 @@ # # Many more are defined in E-LIS-KUL-MET-1002. Not all possible INS # keywords are applicable to all observation modes. - # + MODE: "!OBS.ins_mode" # Instrument mode # TODO: Add the OPTI keywords, but probably in separate yaml files # for each mode. #OPTI6: @@ -138,13 +138,7 @@ # TODO: Include a ReferencePixelBorder effect? #REF: # ALL: "#border_reference_pixels.all" - TEL: - NAME: "ELT" - TELESCOP: "ELT" - TER: - FILENAME: "!TEL.ter_curve.filename" - REF: - FILENAME: "#telescope_reflection.filename" + OCS: PXSCALE: "!INST.pixel_scale" OBS: diff --git a/METIS/headers/FITS_det_ifu_keywords.yaml b/METIS/headers/FITS_det_ifu_keywords.yaml new file mode 100644 index 00000000..09fb3048 --- /dev/null +++ b/METIS/headers/FITS_det_ifu_keywords.yaml @@ -0,0 +1,24 @@ +- ext_type: PrimaryHDU + keywords: + HIERARCH: + ESO: + DET3: + DIT: "!OBS.dit" + NDIT: "!OBS.ndit" + CUBE: + MODE: "F" + +- ext_type: ImageHDU + keywords: + + HIERARCH: + ESO: + DET3: + CHIP: + ID: "!DET.detector" + #MODE: "#detector_readout_parameters.mode_properties" + MINDIT: "!DET.mindit" + FULLWELL: "!DET.full_well" + RON: "!DET.readout_noise" + DARK: "!DET.dark_current" + #GAIN: "!DET.gain" diff --git a/METIS/headers/FITS_det_lm_keywords.yaml b/METIS/headers/FITS_det_lm_keywords.yaml new file mode 100644 index 00000000..39422dae --- /dev/null +++ b/METIS/headers/FITS_det_lm_keywords.yaml @@ -0,0 +1,23 @@ +- ext_type: PrimaryHDU + keywords: + HIERARCH: + ESO: + DET1: + DIT: "!OBS.dit" + NDIT: "!OBS.ndit" + CUBE: + MODE: "F" + +- ext_type: ImageHDU + keywords: + HIERARCH: + ESO: + DET1: + CHIP: + ID: "!DET.detector" + MODE: "!OBS.detector_readout_mode!" + MINDIT: "!DET.mindit" + FULLWELL: "!DET.full_well" + RON: "!DET.readout_noise" + DARK: "!DET.dark_current" + #GAIN: "!DET.gain" diff --git a/METIS/headers/FITS_det_n_keywords.yaml b/METIS/headers/FITS_det_n_keywords.yaml new file mode 100644 index 00000000..bfe85680 --- /dev/null +++ b/METIS/headers/FITS_det_n_keywords.yaml @@ -0,0 +1,29 @@ +- ext_type: PrimaryHDU + keywords: + HIERARCH: + ESO: + DET2: + DIT: "!OBS.dit" + NDIT: "!OBS.ndit" + CUBE: + MODE: "F" + SEQ: + CHOPNOD: + ST: "#chop_nod.include" + OFFSCHOP: ["!OBS.chop_offsets", "[arcsec]"] + OFFSNOD: ["!OBS.nod_offsets", "[arcsec"] + +- ext_type: ImageHDU + keywords: + + HIERARCH: + ESO: + DET2: + CHIP: + ID: "!DET.detector" + MODE: "!OBS.detector_readout_mode!" + MINDIT: "!DET.mindit" + FULLWELL: "!DET.full_well" + RON: "!DET.readout_noise" + DARK: "!DET.dark_current" + #GAIN diff --git a/METIS/headers/FITS_img_lm_keywords.yaml b/METIS/headers/FITS_img_lm_keywords.yaml new file mode 100644 index 00000000..854d157f --- /dev/null +++ b/METIS/headers/FITS_img_lm_keywords.yaml @@ -0,0 +1,20 @@ +- ext_type: PrimaryHDU + keywords: + + HIERARCH: + ESO: + DPR: + TECH: "IMAGE,LM" + INS: + OPTI4: # LMS beamsplitter pickoff wheel + DESC: "LMS pickoff" + NAME: "OUT" # could be IN for parallel observing + OPTI9: # IMG-LM mask/grism wheel + DESC: "IMG-LM mask/grism" + NAME: "open" + OPTI10: # IMG-LM science filter wheel + DESC: "IMG-LM science filter" + NAME: "#filter_wheel.current_filter!" + OPTI11: # IMG-LM neutral density filter wheel + DESC: "IMG-LM neutral density filter" + NAME: "#nd_filter_wheel.current_filter!" diff --git a/METIS/headers/FITS_img_n_keywords.yaml b/METIS/headers/FITS_img_n_keywords.yaml new file mode 100644 index 00000000..f1f25553 --- /dev/null +++ b/METIS/headers/FITS_img_n_keywords.yaml @@ -0,0 +1,20 @@ +- ext_type: PrimaryHDU + keywords: + + HIERARCH: + ESO: + DPR: + TECH: "IMAGE,N" + INS: + OPTI4: # LMS beamsplitter pickoff wheel + DESC: "LMS pickoff" + NAME: "OUT" # could be IN for parallel observing + OPTI12: # IMG-N mask/grism wheel + DESC: "IMG-N mask/grism" + NAME: "open" + OPTI13: # IMG-N science filter wheel + DESC: "IMG-N science filter" + NAME: "#filter_wheel.current_filter!" + OPTI14: # IMG-N neutral-density filter wheel + DESC: "IMG-N neutral density filter" + NAME: "#nd_filter_wheel.current_filter!" diff --git a/METIS/headers/FITS_lms_keywords.yaml b/METIS/headers/FITS_lms_keywords.yaml new file mode 100644 index 00000000..2a4b80ff --- /dev/null +++ b/METIS/headers/FITS_lms_keywords.yaml @@ -0,0 +1,30 @@ +- ext_type: PrimaryHDU + keywords: + + HIERARCH: + ESO: + DPR: + TECH: "IFU" + INS: + LMS: # LMS mode (Nominal or Extended) + MODE: "Nominal" + WLEN: # LMS central wavelength and range + CEN: ["!OBS.wavelen", "Central wavelength [um]"] + START: "TBD" # "#lms_spectral_traces.wave_min" ain't workin' + END: "TBD" + GRAT: + ANGLE: "TBD" + OPTI4: # LMS beamsplitter pickoff wheel + DESC: "LMS pickoff" + NAME: "IN" + OPTI5: # LMS PP1 mask wheel + DESC: "LMS PP1 mask wheel" + NAME: "open" # TODO: not defined in irdb + OPTI6: # LMS spectral IFU mechanism + DESC: "LMS spectral IFU mechanism" + NAME: "OUT" + OPTI7: # LMS pre-disperser + DESC: "LMS pre-disperser" + NAME: "TBD" + OPTI8: # LMS main disperser + NAME: "TBD" # identical to GRAT.ANGLE? diff --git a/METIS/headers/FITS_lss_keywords.yaml b/METIS/headers/FITS_lss_keywords.yaml new file mode 100644 index 00000000..6199bb2d --- /dev/null +++ b/METIS/headers/FITS_lss_keywords.yaml @@ -0,0 +1,17 @@ +- ext_type: PrimaryHDU + keywords: + + HIERARCH: + ESO: + DPR: + TECH: "LSS" # TODO: How to add the filter name? + INS: + OPTI4: # LMS beamsplitter pickoff wheel + DESC: "LMS pickoff" + NAME: "OUT" # could be IN for parallel observing + OPTI9: # IMG-LM mask/grism wheel + DESC: "IMG-LM mask/grism" + NAME: "!OBS.grism_opti9" + OPTI12: # IMG-N mask/grism wheel + DESC: "IMG-N mask/grism" + NAME: "!OBS.grism_opti12" diff --git a/METIS/headers/FITS_wcu_keywords.yaml b/METIS/headers/FITS_wcu_keywords.yaml new file mode 100644 index 00000000..d5c7c13d --- /dev/null +++ b/METIS/headers/FITS_wcu_keywords.yaml @@ -0,0 +1,27 @@ +- ext_type: PrimaryHDU + keywords: + + HIERARCH: + ESO: + INS: + OPTI17: # WCU periscope arm + DESC: "WCU periscope" + NAME: "IN" + OPTI18: # WCU PP1 masks + DESC: "WCU PP1 masks" + NAME: "#pupil_masks.current_mask" + OPTI19: # WCU BB exit aperture masks + DESC: "WCU BB exit aperture" + NAME: "#wcu_source.bb_aperture" + OPTI20: # WCU FP2.1 mask wheel + DESC: "WCU FP2.1 mask" + NAME: "#wcu_source.current_fpmask" + SEQ: + WCU_BB_TEMP: "#wcu_source.bb_temp" + WCU: + LASER1: "ON" + LASER2: "ON" # TODO: need a wavelength + LASER3: "ON" + LAMP: # WCU lamp TODO: made up keyword + DESC: "WCU lamp" + NAME: "#wcu_source.current_lamp" diff --git a/METIS/tests/test_readout_exptime.py b/METIS/tests/test_readout_exptime.py index 5855cba3..f8183fab 100644 --- a/METIS/tests/test_readout_exptime.py +++ b/METIS/tests/test_readout_exptime.py @@ -11,7 +11,7 @@ PLOTS = False -class TestReadoutExptime: +def test_readout_exptime(): """Test whether giving exptime in readout() is respected. The implementation of Quantization and Autoexposure has lead @@ -26,6 +26,7 @@ class TestReadoutExptime: See also https://github.com/AstarVienna/ScopeSim/issues/438 """ + star = sim.source.source_templates.star() # Shift the source, so it can be detected through center_of_mass. star.shift(0.5, 1.0) @@ -34,7 +35,7 @@ class TestReadoutExptime: # The first readout might ignore the exptime. metis_l = sim.OpticalTrain(cmd_l) metis_l.observe(star, update=True) - result_first = metis_l.readout(exptime=100.)[0] + result_first = metis_l.readout(exptime=0.1)[0] # We need to copy the first readeout, because # the second readout might overwrite the first... result_first_copy = copy.deepcopy(result_first) @@ -42,10 +43,10 @@ class TestReadoutExptime: # The second readout might not properly have the detector reset. metis_l = sim.OpticalTrain(cmd_l) metis_l.observe(star, update=True) - result_temp = metis_l.readout(exptime=100.)[0] + result_temp = metis_l.readout(exptime=.1)[0] result_temp_copy = copy.deepcopy(result_temp) assert (result_temp[1].data == result_temp_copy[1].data).all() - result_second = metis_l.readout(exptime=100.)[0] + result_second = metis_l.readout(exptime=.1)[0] if PLOTS: plt.figure(figsize=(10, 5)) @@ -74,10 +75,10 @@ class TestReadoutExptime: assert 1090 < x2 < 1110 assert 1050 < y2 < 1070 - assert 10**12 < flux2 + assert 10**8 < flux2 assert 1090 < x1 < 1110 assert 1050 < y1 < 1070 - assert 10**12 < flux1 + assert 10**8 < flux1 # TOOD: fix this bug, https://github.com/AstarVienna/ScopeSim/issues/439 # assert (result_temp[1].data == result_temp_copy[1].data).all() diff --git a/irdb/publish.py b/irdb/publish.py index d1fe26e3..acb10da6 100644 --- a/irdb/publish.py +++ b/irdb/publish.py @@ -8,7 +8,7 @@ from typing import Optional from warnings import warn from pathlib import Path -from datetime import datetime as dt +from datetime import datetime as dt, timezone from zipfile import ZIP_DEFLATED, ZipFile import yaml @@ -19,6 +19,9 @@ except ImportError: from publish_utils import _is_stable, get_stable, get_all_package_versions +# After 3.11, can just import UTC directly from datetime +UTC = timezone.utc + PATH_HERE = Path(__file__).parent PKGS_DIR = PATH_HERE.parent ZIPPED_DIR = PKGS_DIR / "_ZIPPED_PACKAGES" @@ -105,7 +108,7 @@ def make_package(pkg_name: str, stable: bool = False, pkg_version_path = PKGS_DIR / pkg_name / "version.yaml" if not keep_version: # Collect the info for the version.yaml file - time = dt.utcnow() + time = dt.now(UTC) version_dict = {"version": f"{time.date()}{suffix}", "timestamp": time.strftime("%Y-%m-%d %H:%M:%S"), "release": "stable" if stable else "dev"}