From 94b3597880e1f0dd495c3cc83433739ce3f21ab5 Mon Sep 17 00:00:00 2001 From: oczoske Date: Mon, 25 May 2026 06:44:54 +0200 Subject: [PATCH 01/35] Inter-pixel capacitance for MICADO --- MICADO/MICADO_H4RG.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/MICADO/MICADO_H4RG.yaml b/MICADO/MICADO_H4RG.yaml index 9e3fc291..97fbb658 100644 --- a/MICADO/MICADO_H4RG.yaml +++ b/MICADO/MICADO_H4RG.yaml @@ -14,6 +14,7 @@ properties: x: 0 y: 0 gain: 1 # should be taken from FPA layout?? + include_ipc: false # inter-pixel capacitance effects: - name: full_detector_array @@ -71,6 +72,15 @@ effects: kwargs: border: [0, 0, 0, 0] + - name: ipc + description: Inter-pixel capacitance + class: InterPixelCapacitance + include: "!DET.include_ipc" + kwargs: # values from Kannawadi+2016 (H4RG!) + alpha_edge: 0.02 + alpha_corner: 0.002 + alpha_aniso: 0. + - name: readout_noise description: Readout noise frames class: PoorMansHxRGReadoutNoise From 9acc595dcc02a20c8f75dcdc79e6df598d863aa2 Mon Sep 17 00:00:00 2001 From: "Fabian H." <73600109+teutoburg@users.noreply.github.com> Date: Mon, 29 Jun 2026 13:36:15 +0200 Subject: [PATCH 02/35] Fix CI using old ScopeSim version --- requirements.github_actions.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.github_actions.txt b/requirements.github_actions.txt index 5fb0ee11..971af25a 100644 --- a/requirements.github_actions.txt +++ b/requirements.github_actions.txt @@ -5,7 +5,7 @@ astropy[jupyter] pyyaml paramiko astar-utils -scopesim +scopesim>=0.11.0 scopesim_templates jupytext ipykernel From 55f66ad015115d476333afd77fd6af5213ef10b1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 29 Jun 2026 12:22:31 +0000 Subject: [PATCH 03/35] Bump actions/checkout from 6 to 7 Bumps [actions/checkout](https://github.com/actions/checkout) from 6 to 7. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v6...v7) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: '7' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/badge_report.yml | 2 +- .github/workflows/internal_tests.yml | 2 +- .github/workflows/notebooktests.yml | 8 ++++---- .github/workflows/tests.yml | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/badge_report.yml b/.github/workflows/badge_report.yml index 462dd712..41c0ea3e 100644 --- a/.github/workflows/badge_report.yml +++ b/.github/workflows/badge_report.yml @@ -27,7 +27,7 @@ jobs: name: Generate Badges runs-on: ubuntu-latest steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@v7 - name: Set up Python uses: actions/setup-python@v6 diff --git a/.github/workflows/internal_tests.yml b/.github/workflows/internal_tests.yml index 354e284e..1246915f 100644 --- a/.github/workflows/internal_tests.yml +++ b/.github/workflows/internal_tests.yml @@ -46,7 +46,7 @@ jobs: name: Run internal tests runs-on: ubuntu-latest steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@v7 - name: Set up Python uses: actions/setup-python@v6 diff --git a/.github/workflows/notebooktests.yml b/.github/workflows/notebooktests.yml index b5e70139..07d8d85c 100644 --- a/.github/workflows/notebooktests.yml +++ b/.github/workflows/notebooktests.yml @@ -50,7 +50,7 @@ jobs: name: Run MICADO Notebooks runs-on: ubuntu-latest steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@v7 - name: Set up Python uses: actions/setup-python@v6 @@ -89,7 +89,7 @@ jobs: name: Run MOSAIC Notebooks runs-on: ubuntu-latest steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@v7 - name: Set up Python uses: actions/setup-python@v6 with: @@ -123,7 +123,7 @@ jobs: name: Run METIS Notebooks runs-on: ubuntu-latest steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@v7 - name: Set up Python uses: actions/setup-python@v6 with: @@ -157,7 +157,7 @@ jobs: name: Run METIS Demo Notebooks runs-on: ubuntu-latest steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@v7 - name: Set up Python uses: actions/setup-python@v6 with: diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 096ab46a..ef9c92fa 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -56,7 +56,7 @@ jobs: python-version: ['3.10', '3.11', '3.12', '3.13'] steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@v7 - name: Set up Python uses: actions/setup-python@v6 with: From e753b7b6ab838031edc6e05d2dbb90f6c6acd5f9 Mon Sep 17 00:00:00 2001 From: oczoske Date: Thu, 25 Jun 2026 12:48:52 +0200 Subject: [PATCH 04/35] PSF interpolation parameters --- METIS/METIS_IMG_LM.yaml | 9 +++++++-- METIS/METIS_IMG_N.yaml | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/METIS/METIS_IMG_LM.yaml b/METIS/METIS_IMG_LM.yaml index 1f18a166..2b729c70 100644 --- a/METIS/METIS_IMG_LM.yaml +++ b/METIS/METIS_IMG_LM.yaml @@ -18,7 +18,7 @@ properties: pixel_scale: 0.00547 # arcsec / pixel, METIS_1097 plate_scale: 0.30389 # arcsec / mm filter_file_format: "filters/TC_filter_{}.dat" - include_illumination: False + include_illumination: False effects: - name: img_lm_optics @@ -87,6 +87,8 @@ effects: filename_format: "METIS_psfs/PSF_{}.fits" wave_key: "WAVELENG" bkg_width: -1 + interp_psf: "!SIM.psf.interp_psf" + interp_order: "!SIM.psf.interp_order" - name: img_lm_fits_keywords descriptions: FITS keywords specific to IMG-LM @@ -99,7 +101,7 @@ effects: description: Large-scale illumination variation across the image plane class: Illumination include: "!INST.include_illumination" - + --- ### default simulation parameters needed for a METIS simulation object: simulation @@ -111,3 +113,6 @@ properties: spectral: spectral_bin_width: 1.e-3 # microns, defines fov wavelengths spectral_resolution: 5000 # defines skycalc resolution + psf: + interp_psf: True + interp_order: 1 diff --git a/METIS/METIS_IMG_N.yaml b/METIS/METIS_IMG_N.yaml index e4a13d11..4bd69833 100644 --- a/METIS/METIS_IMG_N.yaml +++ b/METIS/METIS_IMG_N.yaml @@ -80,6 +80,8 @@ effects: filename_format: "METIS_psfs/PSF_{}.fits" wave_key: "WAVELENG" bkg_width: -1 + interp_psf: "!SIM.psf.interp_psf" + interp_order: "!SIM.psf.interp_order" - name: img_n_fits_keywords descriptions: FITS keywords specific to IMG-N @@ -87,12 +89,12 @@ effects: include: True kwargs: filename: headers/FITS_img_n_keywords.yaml - + - name: illumination description: Large-scale illumination variation across the image plane class: Illumination include: "!INST.include_illumination" - + --- ### default simulation parameters needed for a METIS simulation object: simulation @@ -104,3 +106,6 @@ properties: spectral: spectral_bin_width: 1.e-3 # microns, defines fov wavelengths spectral_resolution: 5000 # defines skycalc resolution + psf: + interp_psf: True + interp_order: 1 From ab1d103b2d863f5c19f9bec71d0b989587badd2d Mon Sep 17 00:00:00 2001 From: oczoske Date: Sun, 5 Jul 2026 11:20:58 +0200 Subject: [PATCH 05/35] PSF interpolation parameters LMS --- METIS/METIS_LMS.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/METIS/METIS_LMS.yaml b/METIS/METIS_LMS.yaml index fb2a871c..7593ef26 100644 --- a/METIS/METIS_LMS.yaml +++ b/METIS/METIS_LMS.yaml @@ -64,6 +64,8 @@ effects: filename_format: "METIS_psfs/PSF_{}.fits" wave_key: "WAVELENG" bkg_width: -1 + interp_psf: "!SIM.psf.interp_psf" + interp_order: "!SIM.psf.interp_order" - name: lms_spectral_traces description: list of spectral order trace geometry on the focal plane @@ -94,3 +96,6 @@ properties: spectral: spectral_bin_width: 1.e-5 # microns, defines fov wavelengths spectral_resolution: 200000 # defines skycalc resolution + psf: + interp_psf: False + interp_order: 1 From a99594c4814eaab7b404ed8c41789a07a4d55ad8 Mon Sep 17 00:00:00 2001 From: oczoske Date: Sun, 5 Jul 2026 15:50:07 +0200 Subject: [PATCH 06/35] PSF interpolation parameters for MICADO --- MICADO/MICADO_Standalone_RO.yaml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/MICADO/MICADO_Standalone_RO.yaml b/MICADO/MICADO_Standalone_RO.yaml index 112106b4..2e578496 100644 --- a/MICADO/MICADO_Standalone_RO.yaml +++ b/MICADO/MICADO_Standalone_RO.yaml @@ -15,6 +15,8 @@ effects : kwargs: filename : "!RO.psf_file" warning : "Default PSF is NOT field varying. See documentation." + interp_psf: "!SIM.psf.interp_psf" + interp_order: "!SIM.psf.interp_order" - name: relay_surface_list description : list of surfaces in the relay optics @@ -46,4 +48,14 @@ alias : OBS name : SCAO properties : - ins_mode: "SCAO" \ No newline at end of file + ins_mode: "SCAO" + +--- +object: simulation +alias: SIM +name: simulation_parameters + +properties: + psf: + interp_psf: True + interp_order: 1 From 59e0f5913001704f7d4234f24ee9f1fe2a0f309b Mon Sep 17 00:00:00 2001 From: oczoske Date: Tue, 7 Jul 2026 16:23:47 +0200 Subject: [PATCH 07/35] VLT psf parameters --- VLT/VLT.yaml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/VLT/VLT.yaml b/VLT/VLT.yaml index f1f9deed..9b41d8a0 100644 --- a/VLT/VLT.yaml +++ b/VLT/VLT.yaml @@ -19,3 +19,18 @@ effects: kwargs: filename: PSF_VLT_poppy.fits warning: "Default PSF was generated Poppy for a UT4 optical system" + interp_psf: "!SIM.psf.interp_psf" + interp_order: "!SIM.psf.interp_order" + + +--- +### default simulation parameters +object: simulation +alias: SIM +name: VLT_simulation_parameters +description: RC simulation parameters for VLT simulations + +properties: + psf: + interp_psf: True + interp_order: 1 From 79e06000731966259dc6d3960a3c1ea85855cf85 Mon Sep 17 00:00:00 2001 From: oczoske Date: Tue, 7 Jul 2026 16:36:13 +0200 Subject: [PATCH 08/35] Complete interpolation params for FieldConstantPSFs --- GTC/GTC.yaml | 16 ++++++++++++++++ MORFEO/MORFEO.yaml | 13 +++++++++++++ NIRCam/NIRCam_LW.yaml | 14 ++++++++++++++ NIRCam/NIRCam_SW.yaml | 14 ++++++++++++++ 4 files changed, 57 insertions(+) diff --git a/GTC/GTC.yaml b/GTC/GTC.yaml index dce558d4..f418100c 100644 --- a/GTC/GTC.yaml +++ b/GTC/GTC.yaml @@ -8,6 +8,7 @@ date_created: 2022-03-02 date_modified: 2022-03-02 changes: - 2022-02-17 (KL) Created file based on ELT.yaml + - 2026-07-07 (OC) Added interpolation parameters for PSF properties: @@ -54,3 +55,18 @@ effects: kwargs: filename: PSF_GTC_OSIRIS.fits warning: "Default PSF for r-band from GTC website" + interp_psf: "!SIM.psf.interp_psf" + interp_order: "!SIM.psf.interp_order" + + +--- +### default simulation parameters +object: simulation +alias: SIM +name: GTC_simulation_parameters +description: RC simulation parameters for GTC simulations + +properties: + psf: + interp_psf: True + interp_order: 1 diff --git a/MORFEO/MORFEO.yaml b/MORFEO/MORFEO.yaml index 7dde679d..ce00ac49 100644 --- a/MORFEO/MORFEO.yaml +++ b/MORFEO/MORFEO.yaml @@ -22,6 +22,8 @@ effects : kwargs: filename : "!RO.psf_file" warning : "Default PSF is not Field Varying. See Documentation" + interp_psf: "!SIM.psf.interp_psf" + interp_order: "!SIM.psf.interp_order" ####################### Alternative effects #################################### @@ -36,3 +38,14 @@ effects : # dit : "!OBS.dit" # ndit : "!OBS.ndit" +--- +### default simulation parameters +object: simulation +alias: SIM +name: MORFEO_simulation_parameters +description: RC simulation parameters for MORFEO simulations + +properties: + psf: + interp_psf: True + interp_order: 1 diff --git a/NIRCam/NIRCam_LW.yaml b/NIRCam/NIRCam_LW.yaml index eb169a25..2103117b 100644 --- a/NIRCam/NIRCam_LW.yaml +++ b/NIRCam/NIRCam_LW.yaml @@ -60,3 +60,17 @@ effects: kwargs: filename: "psfs/PSF_NIRCam_in_flight_opd_filter_F322W2.fits" wave_key: "WAVELEN" + interp_psf: "!SIM.psf.interp_psf" + interp_order: "!SIM.psf.interp_order" + +--- +### default simulation parameters +object: simulation +alias: SIM +name: NIRCam_simulation_parameters +description: RC simulation parameters for NIRCam simulations + +properties: + psf: + interp_psf: True + interp_order: 1 diff --git a/NIRCam/NIRCam_SW.yaml b/NIRCam/NIRCam_SW.yaml index 647f0287..05ae8260 100644 --- a/NIRCam/NIRCam_SW.yaml +++ b/NIRCam/NIRCam_SW.yaml @@ -55,3 +55,17 @@ effects: kwargs: filename: "psfs/PSF_NIRCam_in_flight_opd_filter_F150W2.fits" wave_key: "WAVELEN" + interp_psf: "!SIM.psf.interp_psf" + interp_order: "!SIM.psf.interp_order" + +--- +### default simulation parameters +object: simulation +alias: SIM +name: NIRCam_simulation_parameters +description: RC simulation parameters for NIRCam simulations + +properties: + psf: + interp_psf: True + interp_order: 1 From c35cfbaf44e0051970044ee2668e38363477522e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 Jul 2026 10:43:33 +0000 Subject: [PATCH 09/35] Bump actions/setup-python from 6 to 7 Bumps [actions/setup-python](https://github.com/actions/setup-python) from 6 to 7. - [Release notes](https://github.com/actions/setup-python/releases) - [Commits](https://github.com/actions/setup-python/compare/v6...v7) --- updated-dependencies: - dependency-name: actions/setup-python dependency-version: '7' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/badge_report.yml | 2 +- .github/workflows/internal_tests.yml | 2 +- .github/workflows/notebooktests.yml | 8 ++++---- .github/workflows/tests.yml | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/badge_report.yml b/.github/workflows/badge_report.yml index 41c0ea3e..1ae1fc9b 100644 --- a/.github/workflows/badge_report.yml +++ b/.github/workflows/badge_report.yml @@ -30,7 +30,7 @@ jobs: - uses: actions/checkout@v7 - name: Set up Python - uses: actions/setup-python@v6 + uses: actions/setup-python@v7 with: python-version: 3.12 diff --git a/.github/workflows/internal_tests.yml b/.github/workflows/internal_tests.yml index 1246915f..8522b764 100644 --- a/.github/workflows/internal_tests.yml +++ b/.github/workflows/internal_tests.yml @@ -49,7 +49,7 @@ jobs: - uses: actions/checkout@v7 - name: Set up Python - uses: actions/setup-python@v6 + uses: actions/setup-python@v7 with: # No matrix is used since this is a time-consuming task. python-version: 3.13 diff --git a/.github/workflows/notebooktests.yml b/.github/workflows/notebooktests.yml index 07d8d85c..ec36bf0d 100644 --- a/.github/workflows/notebooktests.yml +++ b/.github/workflows/notebooktests.yml @@ -53,7 +53,7 @@ jobs: - uses: actions/checkout@v7 - name: Set up Python - uses: actions/setup-python@v6 + uses: actions/setup-python@v7 with: # No matrix is used since this is a time-consuming task. python-version: 3.13 @@ -91,7 +91,7 @@ jobs: steps: - uses: actions/checkout@v7 - name: Set up Python - uses: actions/setup-python@v6 + uses: actions/setup-python@v7 with: # No matrix is used since this is a time-consuming task. python-version: 3.13 @@ -125,7 +125,7 @@ jobs: steps: - uses: actions/checkout@v7 - name: Set up Python - uses: actions/setup-python@v6 + uses: actions/setup-python@v7 with: # No matrix is used since this is a time-consuming task. python-version: 3.13 @@ -159,7 +159,7 @@ jobs: steps: - uses: actions/checkout@v7 - name: Set up Python - uses: actions/setup-python@v6 + uses: actions/setup-python@v7 with: # No matrix is used since this is a time-consuming task. python-version: 3.13 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ef9c92fa..ffaf4603 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -58,7 +58,7 @@ jobs: steps: - uses: actions/checkout@v7 - name: Set up Python - uses: actions/setup-python@v6 + uses: actions/setup-python@v7 with: python-version: ${{ matrix.python-version }} From d3d728410099edbae11254135dca061cdc8e452c Mon Sep 17 00:00:00 2001 From: "Fabian H." <73600109+teutoburg@users.noreply.github.com> Date: Mon, 27 Jul 2026 13:24:20 +0200 Subject: [PATCH 10/35] Update Python version test matrix to 3.12-14 --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ef9c92fa..d605477b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -53,7 +53,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - python-version: ['3.10', '3.11', '3.12', '3.13'] + python-version: ['3.12', '3.13', '3.14'] steps: - uses: actions/checkout@v7 From 3ecec9df170a067d059c4de380c4f1703fa09b53 Mon Sep 17 00:00:00 2001 From: oczoske Date: Tue, 28 Jul 2026 17:01:09 +0200 Subject: [PATCH 11/35] New CALIB submode --- MICADO/default.yaml | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/MICADO/default.yaml b/MICADO/default.yaml index 6f5937f9..cdbea0d5 100644 --- a/MICADO/default.yaml +++ b/MICADO/default.yaml @@ -15,6 +15,7 @@ changes: - 2025-10-17 (JB) add parametes for FITS keywords, tplstart as MJD - 2026-01-02 (OC) random seed to None - 2026-04-09 (OC) new SPEC mode, rename slits + - 2026-07-28 (OC) new CALIB mode, full yaml list in mode definitions packages: - Armazones @@ -22,12 +23,6 @@ packages: - MORFEO - MICADO -yamls: -- Armazones.yaml -- ELT.yaml -- MICADO.yaml -- MICADO_H4RG.yaml - properties : instrument : MICADO modes : ["SCAO", "IMG_4mas"] @@ -63,6 +58,8 @@ mode_yamls : name : SCAO description : "SCAO optical system" yamls : + - Armazones.yaml + - ELT.yaml - MICADO_Standalone_RO.yaml - object : instrument @@ -70,17 +67,28 @@ mode_yamls : name : MCAO description : "MCAO optical system" yamls : + - Armazones.yaml + - ELT.yaml - MORFEO.yaml properties : ins_mode: "MCAO" +- object: instrument + alias: OBS + name: CALIB + description: "Calibration assembly" + yaml: + - MICADO_Calibration.yaml + - object : observation alias: OBS name : IMG_4mas description : "wide-field imager : 4mas/pix" status: development yamls : + - MICADO.yaml - MICADO_IMG_wide.yaml + - MICADO_H4RG.yaml properties : filter_name_fw1: open filter_name_fw2: Ks @@ -93,7 +101,9 @@ mode_yamls : description : "high resolution imager : 1.5mas/pix" status: development yamls : + - MICADO.yaml - MICADO_IMG_zoom.yaml + - MICADO_H4RG.yaml properties : filter_name_fw1: open filter_name_fw2: Ks @@ -106,7 +116,9 @@ mode_yamls : description : "High contrast imaging" status: experimental yamls : + - MICADO.yaml - MICADO_IMG_HCI.yaml + - MICADO_H4RG.yaml - object: observation alias: OBS @@ -114,7 +126,9 @@ mode_yamls : description: "spectrograph: all slits" status: development yamls: + - MICADO.yaml - MICADO_SPEC.yaml + - MICADO_H4RG.yaml properties: # Todo: these parameters all need to be changeable trace_file: TRACE_MICADO.fits slit: Short @@ -132,7 +146,9 @@ mode_yamls : status: deprecated deprecate: "Deprecated mode, use SPEC with '!OBS.slit'='Long' instead" yamls : + - MICADO.yaml - MICADO_SPEC.yaml + - MICADO_H4RG.yaml properties : trace_file : TRACE_MICADO.fits slit : Long @@ -148,7 +164,9 @@ mode_yamls : status: deprecated deprecate: "Deprecated mode, use SPEC with '!OBS.slit'='Wide' instead" yamls : + - MICADO.yaml - MICADO_SPEC.yaml + - MICADO_H4RG.yaml properties : trace_file : TRACE_MICADO.fits slit : Wide @@ -164,7 +182,9 @@ mode_yamls : status: deprecated deprecate: "Deprecated mode, use SPEC with '!OBS.slit'='Short' instead" yamls : + - MICADO.yaml - MICADO_SPEC.yaml + - MICADO_H4RG.yaml properties : trace_file : TRACE_MICADO.fits slit: Short From 17c7049e65013c645bd915d73e0eef2eb5161fa6 Mon Sep 17 00:00:00 2001 From: oczoske Date: Tue, 28 Jul 2026 17:11:11 +0200 Subject: [PATCH 12/35] change.log not needed --- MICADO/change.log | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 MICADO/change.log diff --git a/MICADO/change.log b/MICADO/change.log deleted file mode 100644 index cbc15c85..00000000 --- a/MICADO/change.log +++ /dev/null @@ -1,5 +0,0 @@ -- version: 1.0 - date: 2022.09.23 - author: Kieran Leschinski - notes: - - added Hugo's FITS keywords From 8357c3b48b6559688248cad8acc83a1ee54624d0 Mon Sep 17 00:00:00 2001 From: oczoske Date: Tue, 28 Jul 2026 17:47:58 +0200 Subject: [PATCH 13/35] Start of calibration yaml --- MICADO/MICADO_Calibration.yaml | 63 ++++++++++++++++++++++++++++++++++ MICADO/default.yaml | 2 +- 2 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 MICADO/MICADO_Calibration.yaml diff --git a/MICADO/MICADO_Calibration.yaml b/MICADO/MICADO_Calibration.yaml new file mode 100644 index 00000000..daff4e27 --- /dev/null +++ b/MICADO/MICADO_Calibration.yaml @@ -0,0 +1,63 @@ +### Calibration assembly +object : calibration assembly +alias : CALIB +name : MICADO_Calibration +description : Micado calibration assembly +needs_scopesim: "v0.11.3" # CHECK +date_modified: 2026-07-28 +changes: + - 2026-07-28 (OC) new file from MICADO_Standalone_RO.yaml + +properties : + temperature : "!ATMO.temperature" + +effects : +- name : psf + description : PSF + class : SeeingPSF + kwargs: + fwhm: 0.02 # [arcsec] + interp_psf: "!SIM.psf.interp_psf" + interp_order: "!SIM.psf.interp_order" + +- name: relay_surface_list + description : list of surfaces in the relay optics + class: SurfaceList + kwargs: + filename: LIST_RO_SCAO_mirrors.dat + +- name : extra_fits_keywords_calib + description : adds extra FITS keywords for Relay Optics + class : ExtraFitsKeywords + include : True + kwargs : + filename : FITS_extra_keywords_Standalone_RO.yaml + +################################################################################ + +# This one can be used if a filename from a FV-PSF file if provided +#- name : relay_fv_psf +# description : SCAO FV PSF +# class : FieldVaryingPSF +# include : False +# kwargs: +# filename : None + +### set instrument mode +--- +object: observation +alias : OBS +name : SCAO + +properties : + ins_mode: "SCAO" + +--- +object: simulation +alias: SIM +name: simulation_parameters + +properties: + psf: + interp_psf: True + interp_order: 1 diff --git a/MICADO/default.yaml b/MICADO/default.yaml index cdbea0d5..c98d0182 100644 --- a/MICADO/default.yaml +++ b/MICADO/default.yaml @@ -7,7 +7,7 @@ name: MICADO_default_configuration description: default parameters needed for a MICADO simulation status: development needs_scopesim: "v0.11.3" -date_modified: 2025-10-09 +date_modified: 2026-07-28 changes: - 2023-07-13 (OC) add modes for FDR slits, deprecate pre-FDR slits - 2025-06-27 (FH) add needs_scopesim keyword From a17838772d2203308b2b23e571735528229b1aa8 Mon Sep 17 00:00:00 2001 From: oczoske Date: Thu, 6 Aug 2026 19:11:20 +0200 Subject: [PATCH 14/35] Set output formats per mode --- MOSAIC/MOSAIC_DET_NIR.yaml | 10 ++++++---- MOSAIC/MOSAIC_DET_VIS.yaml | 9 +++++---- MOSAIC/default.yaml | 22 +++++++++++++++------- 3 files changed, 26 insertions(+), 15 deletions(-) diff --git a/MOSAIC/MOSAIC_DET_NIR.yaml b/MOSAIC/MOSAIC_DET_NIR.yaml index 740b8e61..fedb8a3a 100644 --- a/MOSAIC/MOSAIC_DET_NIR.yaml +++ b/MOSAIC/MOSAIC_DET_NIR.yaml @@ -6,6 +6,8 @@ description: H4RG detector 2.5 um cut-off date_modified: 2025-08-07 changes: - 2025-08-07 (OC) adapted from MICADO H4RG + - 2026-08-06 (OC) use MosaicOutputFormat + properties: detector: HAWAII4RG image_plane_id: 0 @@ -92,12 +94,12 @@ effects: dtype: float32 gain: "!DET.gain" - - name: collapse_1d - description: Collapse fiber bundle to 1D spectrum - class: MosaicCollapseSpectralTraces - include: "!OBS.do_collapse_1d" + - name: output_format + description: Reformat MOS/mIFU output + class: MosaicOutputFormat kwargs: filename: "!OBS.trace_file" + format: "!OBS.output_format" # - name: det_nir_fits_keywords # description: FITS keywords specific to NIR detector diff --git a/MOSAIC/MOSAIC_DET_VIS.yaml b/MOSAIC/MOSAIC_DET_VIS.yaml index ee8fb79e..29980257 100644 --- a/MOSAIC/MOSAIC_DET_VIS.yaml +++ b/MOSAIC/MOSAIC_DET_VIS.yaml @@ -4,7 +4,7 @@ object: detector alias: DET name: MOSAIC_DET_VIS description: virtual detector for one fiber bundle -data_modified: 2025-10-24 +data_modified: 2026-08-06 properties: @@ -64,8 +64,9 @@ effects: dtype: float32 gain: "!DET.gain" - - name: collapse_1d - description: Collapse fiber bundle to 1D spectrum - class: MosaicCollapseSpectralTraces + - name: output_format + description: Reformat MOS/mIFU output + class: MosaicOutputFormat kwargs: filename: "!OBS.trace_file" + format: "!OBS.output_format" diff --git a/MOSAIC/default.yaml b/MOSAIC/default.yaml index 07c61d28..8c57d911 100644 --- a/MOSAIC/default.yaml +++ b/MOSAIC/default.yaml @@ -5,9 +5,10 @@ alias : OBS name : MOSAIC_default_configuration description : default parameters needed for a MOSAIC simulation needs_scopesim: "v0.11.0" -date_modified: 2025-09-01 +date_modified: 2026-08-06 changes: - 2025-09-01 (OC) adjusted resolutions for modes + - 2026-08-06 (OC) set output format per mode packages : - Armazones @@ -31,8 +32,7 @@ properties : ra : 0.0 dec : 0.0 psf_fwhm : 0.2 - include_fibres : True - do_collapse_1d: True + output_format: collapse1d mode_yamls : - object: observation @@ -50,6 +50,7 @@ mode_yamls : trace_file: TRACE_MOS-LR-B.fits dispersion: 1.9e-5 # um/pixel on the output detector resolution: 32000 # resolution of sky spectrum + output_format: collapse1d - object: observation alias: OBS @@ -65,6 +66,7 @@ mode_yamls : trace_file: TRACE_MOS-HR-B1.fits dispersion: 6.5e-6 # um/pixel on detector resolution: 72000 # resolution of sky spectrum + output_format: collapse1d - object: observation alias: OBS @@ -80,6 +82,7 @@ mode_yamls : trace_file: TRACE_MOS-HR-B2.fits dispersion: 5e-6 # um/pixel on detector resolution: 72000 # resolution of sky spectrum + output_format: collapse1d - object: observation alias: OBS @@ -96,6 +99,7 @@ mode_yamls : trace_file: TRACE_MOS-LR-R.fits dispersion: 3e-5 # um/pixel on the output detector resolution: 32000 # resolution of sky spectrum + output_format: collapse1d - object: observation alias: OBS @@ -111,6 +115,7 @@ mode_yamls : trace_file: TRACE_MOS-HR-R1.fits dispersion: 8e-6 # um/pixel on detector resolution: 72000 # resolution of sky spectrum + output_format: collapse1d - object: observation alias: OBS @@ -126,6 +131,7 @@ mode_yamls : trace_file: TRACE_MOS-HR-R2.fits dispersion: 1e-5 # um/pixel on detector resolution: 72000 # resolution of sky spectrum + output_format: collapse1d - object : instrument alias: OBS @@ -142,6 +148,7 @@ mode_yamls : trace_file: TRACE_MOS-LR-J.fits dispersion: 9.5e-5 # um/pixel on detector resolution: 16000 # resolution of sky spectrum + output_format: collapse1d - object : instrument alias: OBS @@ -158,6 +165,7 @@ mode_yamls : trace_file: TRACE_MOS-LR-H.fits dispersion: 9.e-5 # um/pixel on detector resolution: 16000 # resolution of sky spectrum + output_format: collapse1d - object : instrument alias: OBS @@ -174,6 +182,7 @@ mode_yamls : trace_file: TRACE_MOS-HR-H.fits dispersion: 2.4e-5 # um/pixel on detector resolution: 72000 # resolution of sky spectrum + output_format: collapse1d - object : instrument alias: OBS @@ -190,7 +199,7 @@ mode_yamls : trace_file: TRACE_mIFU-LR-J.fits dispersion: 9.5e-5 # um/pixel on detector resolution: 16000 # resolution of sky spectrum - do_collapse_1d: False + output_format: table - object : instrument alias: OBS @@ -207,7 +216,7 @@ mode_yamls : trace_file: TRACE_mIFU-LR-H.fits dispersion: 9.e-5 # um/pixel on detector resolution: 16000 # resolution of sky spectrum - do_collapse_1d: False + output_format: table - object : instrument alias: OBS @@ -224,8 +233,7 @@ mode_yamls : trace_file: TRACE_mIFU_NIR-HR-H.fits dispersion: 2.4e-5 # um/pixel on detector resolution: 72000 # resolution of sky spectrum - do_collapse_1d: False - + output_format: table --- From fe8e8cb2f668309b1948f2e7159dbd09ceccbf30 Mon Sep 17 00:00:00 2001 From: "Fabian H." <73600109+teutoburg@users.noreply.github.com> Date: Fri, 7 Aug 2026 13:47:42 +0200 Subject: [PATCH 15/35] Reorder reinstall from branches --- .github/workflows/notebooktests.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/notebooktests.yml b/.github/workflows/notebooktests.yml index ec36bf0d..f43761a9 100644 --- a/.github/workflows/notebooktests.yml +++ b/.github/workflows/notebooktests.yml @@ -68,8 +68,8 @@ jobs: run: | echo "Re-installing ScopeSim from source" >> $GITHUB_STEP_SUMMARY pip uninstall -y scopesim scopesim_templates - pip install git+https://github.com/AstarVienna/ScopeSim.git@${{ inputs.ScopeSim }} pip install git+https://github.com/AstarVienna/ScopeSim_Templates.git@${{ inputs.ScopeSim_Templates }} + pip install git+https://github.com/AstarVienna/ScopeSim.git@${{ inputs.ScopeSim }} - name: Run Notebooks env: @@ -105,8 +105,8 @@ jobs: run: | echo "Re-installing ScopeSim from source" >> $GITHUB_STEP_SUMMARY pip uninstall -y scopesim scopesim_templates - pip install git+https://github.com/AstarVienna/ScopeSim.git@${{ inputs.ScopeSim }} pip install git+https://github.com/AstarVienna/ScopeSim_Templates.git@${{ inputs.ScopeSim_Templates }} + pip install git+https://github.com/AstarVienna/ScopeSim.git@${{ inputs.ScopeSim }} - name: Run Notebooks env: PYDEVD_DISABLE_FILE_VALIDATION: 1 @@ -139,8 +139,8 @@ jobs: run: | echo "Re-installing ScopeSim from source" >> $GITHUB_STEP_SUMMARY pip uninstall -y scopesim scopesim_templates - pip install git+https://github.com/AstarVienna/ScopeSim.git@${{ inputs.ScopeSim }} pip install git+https://github.com/AstarVienna/ScopeSim_Templates.git@${{ inputs.ScopeSim_Templates }} + pip install git+https://github.com/AstarVienna/ScopeSim.git@${{ inputs.ScopeSim }} - name: Run Notebooks env: PYDEVD_DISABLE_FILE_VALIDATION: 1 @@ -173,8 +173,8 @@ jobs: run: | echo "Re-installing ScopeSim from source" >> $GITHUB_STEP_SUMMARY pip uninstall -y scopesim scopesim_templates - pip install git+https://github.com/AstarVienna/ScopeSim.git@${{ inputs.ScopeSim }} pip install git+https://github.com/AstarVienna/ScopeSim_Templates.git@${{ inputs.ScopeSim_Templates }} + pip install git+https://github.com/AstarVienna/ScopeSim.git@${{ inputs.ScopeSim }} - name: Run Notebooks env: PYDEVD_DISABLE_FILE_VALIDATION: 1 From a730ea0b41250711e71cd4b242efd286fe14fec5 Mon Sep 17 00:00:00 2001 From: "Fabian H." <73600109+teutoburg@users.noreply.github.com> Date: Fri, 7 Aug 2026 13:57:01 +0200 Subject: [PATCH 16/35] Allow pre-release versions for ScopeSim installations --- .github/workflows/notebooktests.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/notebooktests.yml b/.github/workflows/notebooktests.yml index f43761a9..a8420b07 100644 --- a/.github/workflows/notebooktests.yml +++ b/.github/workflows/notebooktests.yml @@ -68,8 +68,8 @@ jobs: run: | echo "Re-installing ScopeSim from source" >> $GITHUB_STEP_SUMMARY pip uninstall -y scopesim scopesim_templates - pip install git+https://github.com/AstarVienna/ScopeSim_Templates.git@${{ inputs.ScopeSim_Templates }} - pip install git+https://github.com/AstarVienna/ScopeSim.git@${{ inputs.ScopeSim }} + pip install --pre git+https://github.com/AstarVienna/ScopeSim_Templates.git@${{ inputs.ScopeSim_Templates }} + pip install --pre git+https://github.com/AstarVienna/ScopeSim.git@${{ inputs.ScopeSim }} - name: Run Notebooks env: @@ -105,8 +105,8 @@ jobs: run: | echo "Re-installing ScopeSim from source" >> $GITHUB_STEP_SUMMARY pip uninstall -y scopesim scopesim_templates - pip install git+https://github.com/AstarVienna/ScopeSim_Templates.git@${{ inputs.ScopeSim_Templates }} - pip install git+https://github.com/AstarVienna/ScopeSim.git@${{ inputs.ScopeSim }} + pip install --pre git+https://github.com/AstarVienna/ScopeSim_Templates.git@${{ inputs.ScopeSim_Templates }} + pip install --pre git+https://github.com/AstarVienna/ScopeSim.git@${{ inputs.ScopeSim }} - name: Run Notebooks env: PYDEVD_DISABLE_FILE_VALIDATION: 1 @@ -139,8 +139,8 @@ jobs: run: | echo "Re-installing ScopeSim from source" >> $GITHUB_STEP_SUMMARY pip uninstall -y scopesim scopesim_templates - pip install git+https://github.com/AstarVienna/ScopeSim_Templates.git@${{ inputs.ScopeSim_Templates }} - pip install git+https://github.com/AstarVienna/ScopeSim.git@${{ inputs.ScopeSim }} + pip install --pre git+https://github.com/AstarVienna/ScopeSim_Templates.git@${{ inputs.ScopeSim_Templates }} + pip install --pre git+https://github.com/AstarVienna/ScopeSim.git@${{ inputs.ScopeSim }} - name: Run Notebooks env: PYDEVD_DISABLE_FILE_VALIDATION: 1 @@ -173,8 +173,8 @@ jobs: run: | echo "Re-installing ScopeSim from source" >> $GITHUB_STEP_SUMMARY pip uninstall -y scopesim scopesim_templates - pip install git+https://github.com/AstarVienna/ScopeSim_Templates.git@${{ inputs.ScopeSim_Templates }} - pip install git+https://github.com/AstarVienna/ScopeSim.git@${{ inputs.ScopeSim }} + pip install --pre git+https://github.com/AstarVienna/ScopeSim_Templates.git@${{ inputs.ScopeSim_Templates }} + pip install --pre git+https://github.com/AstarVienna/ScopeSim.git@${{ inputs.ScopeSim }} - name: Run Notebooks env: PYDEVD_DISABLE_FILE_VALIDATION: 1 From 259c71d30a42be2ad8c19e7c300f977330597ebd Mon Sep 17 00:00:00 2001 From: "Fabian H." <73600109+teutoburg@users.noreply.github.com> Date: Fri, 7 Aug 2026 14:24:00 +0200 Subject: [PATCH 17/35] Reorder branch installs --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 1cc238eb..8a5c2adc 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -72,8 +72,8 @@ jobs: run: | echo "Re-installing ScopeSim from source" >> $GITHUB_STEP_SUMMARY pip uninstall -y scopesim scopesim_templates - pip install git+https://github.com/AstarVienna/ScopeSim.git@${{ inputs.ScopeSim }} pip install git+https://github.com/AstarVienna/ScopeSim_Templates.git@${{ inputs.ScopeSim_Templates }} + pip install git+https://github.com/AstarVienna/ScopeSim.git@${{ inputs.ScopeSim }} - name: Run Pytest run: pytest From 300cbd5c75bbfc47cb87f371d75b31ba8f070046 Mon Sep 17 00:00:00 2001 From: "Fabian H." <73600109+teutoburg@users.noreply.github.com> Date: Fri, 7 Aug 2026 14:24:29 +0200 Subject: [PATCH 18/35] Reorder branch installs --- .github/workflows/internal_tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/internal_tests.yml b/.github/workflows/internal_tests.yml index 8522b764..ece8dc64 100644 --- a/.github/workflows/internal_tests.yml +++ b/.github/workflows/internal_tests.yml @@ -64,8 +64,8 @@ jobs: run: | echo "Re-installing ScopeSim from source" >> $GITHUB_STEP_SUMMARY pip uninstall -y scopesim scopesim_templates - pip install git+https://github.com/AstarVienna/ScopeSim.git@${{ inputs.ScopeSim }} pip install git+https://github.com/AstarVienna/ScopeSim_Templates.git@${{ inputs.ScopeSim_Templates }} + pip install git+https://github.com/AstarVienna/ScopeSim.git@${{ inputs.ScopeSim }} - name: Run Pytest for internal tests run: pytest -m "irdb" From b6527ae321a991e8a3d8a491deafcc9f9dcf1ee1 Mon Sep 17 00:00:00 2001 From: oczoske Date: Fri, 7 Aug 2026 19:21:58 +0200 Subject: [PATCH 19/35] Update example notebook --- .../docs/example_notebooks/MOSAIC_demo.ipynb | 109 +++++++++++++++--- 1 file changed, 96 insertions(+), 13 deletions(-) diff --git a/MOSAIC/docs/example_notebooks/MOSAIC_demo.ipynb b/MOSAIC/docs/example_notebooks/MOSAIC_demo.ipynb index 8de9bf01..a700f67e 100644 --- a/MOSAIC/docs/example_notebooks/MOSAIC_demo.ipynb +++ b/MOSAIC/docs/example_notebooks/MOSAIC_demo.ipynb @@ -5,8 +5,6 @@ "id": "612ecdf2-d7da-4a1f-87da-ff42d5a7e222", "metadata": {}, "source": [ - "# MOSAIC Demo\n", - "\n", "This is a simple demo of the \"ETC\" mode for MOSAIC. To use this you need the `oc/mosaic` branch of Scopesim and the `oc/mosaic` branch of the irdb. The implementation creates one-dimensional spectra for the output (summed over the fibres in a bundle for the MOS modes). The first sections demonstrate how to use Scopesim for the MOS and mIFU modes. The final section provides a more detailed description of the implementation and instrument definition that is currently used." ] }, @@ -114,7 +112,7 @@ "- The visual modes map spectra to a pseudo-detector of length 13000 pixels; the gap between the two 6k detectors in the real instrument is not simulated.\n", "- The near-infrared modes map spectra to a 4k x 4k detector.\n", "- As stated above, the MOS modes collapse the 7 (low-res modes) or 19 (high-res modes) fibres in a bundle to a single one-dimensional spectrum, the output is a FITS binary table with wavelength and flux (in ADU).\n", - "- The mIFU modes return a 4k x 4k image with each of the 4xx fibre spectra mapped onto a detector row each. Rearrangement of the spectra into a cube has not been implemented." + "- The mIFU modes return a FITS binary table with one row per fiber, with wavelength and flux vectors as well as the on-sky position of the fiber relative to the centre of the bundle." ] }, { @@ -233,7 +231,7 @@ "id": "6870b5cb-da6f-48ab-b841-d1b60400c79c", "metadata": {}, "source": [ - "The actual detector \"image\" including dark current, shot noise and readout noise is created in the next step, where we have to specify the exposure time." + "The actual detector readout including dark current, shot noise and readout noise is created in the next step, where we have to specify the exposure time." ] }, { @@ -619,7 +617,34 @@ "metadata": {}, "outputs": [], "source": [ - "mosaic.observe()" + "mosaic.observe(gal)" + ] + }, + { + "cell_type": "markdown", + "id": "f0a72d51-ef19-4e0e-b958-01d660fa1565", + "metadata": {}, + "source": [ + "The arrangement of the spectra on the pseudo-detector can be shown by displaying the `ImagePlane`." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d4d3e953-795f-4c24-99d6-d5aa549a6bf2", + "metadata": {}, + "outputs": [], + "source": [ + "plt.imshow(mosaic.image_planes[0].data[900:1100, 1900:2100], norm='log', origin='lower')\n", + "plt.colorbar();" + ] + }, + { + "cell_type": "markdown", + "id": "b020e606-dfa0-47d6-b21e-c55a88f4a106", + "metadata": {}, + "source": [ + "`readout` applies the exposure time and adds shot noise and detector noises. Finally, it converts the output to a fits binary table." ] }, { @@ -635,12 +660,39 @@ { "cell_type": "code", "execution_count": null, - "id": "d4d3e953-795f-4c24-99d6-d5aa549a6bf2", + "id": "97cf4e05-0247-4db4-a93c-9da9373a3ad8", "metadata": {}, "outputs": [], "source": [ - "plt.imshow(hdul[1].data[900:1100, 1900:2100], norm='log', origin='lower')\n", - "plt.colorbar();" + "hdul[1].data.names" + ] + }, + { + "cell_type": "markdown", + "id": "46d4a767-2bfc-466d-8369-545ce131d459", + "metadata": {}, + "source": [ + "The class of `hdul[1].data` is `FITS_rec`. Converting it to an actual table makes it easier to work with." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "eeb6d0e9-73a8-47fa-8302-c9931cedf3f3", + "metadata": {}, + "outputs": [], + "source": [ + "from astropy.table import Table\n", + "fiber_table = Table(hdul[1].data)\n", + "print(fiber_table[:5])" + ] + }, + { + "cell_type": "markdown", + "id": "cbd0ef7a-863b-457f-8995-b940818f96ca", + "metadata": {}, + "source": [ + "The arrangement of the fibres in the bundle (or rather on sky) can be visualised by plotting the `x` and `y` columns. Colour-coding the points by the sum over the respective spectrum provides a crude image reconstruction." ] }, { @@ -650,15 +702,46 @@ "metadata": {}, "outputs": [], "source": [ - "plt.plot(hdul[1].data[991, :])" + "total_flux = np.zeros(len(fiber_table))\n", + "for i, spec in enumerate(fiber_table['spectrum']):\n", + " total_flux[i] = spec.sum()\n", + "\n", + "plt.scatter(fiber_table['x'], fiber_table['y'], marker='o', c=np.log(total_flux), cmap=plt.cm.hot)\n", + "plt.gca().set_aspect('equal')\n", + "plt.colorbar()\n", + "plt.xlabel(\"x [arcsec]\")\n", + "plt.ylabel(\"y [arcsec]\");" ] }, { "cell_type": "markdown", - "id": "f25addbb-0578-4ced-964d-f0560a41a963", + "id": "a7c651ad-aefa-4e2d-8b90-c92a9afe3fc4", "metadata": {}, "source": [ - "The mIFU mode is incomplete - it is currently not possible to deduce the wavelength vector and the spatial arrangement of the fibres from the readout alone. A table format might be better suited for that purpose." + "The fiber ids follow the pattern `FIBER_`. To show the spectrum of an individual fiber one could select the corresponding row as follows:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "0636371b-7848-4e05-8873-536264bad5dc", + "metadata": {}, + "outputs": [], + "source": [ + "fiber_11 = fiber_table[fiber_table['id'] == \"FIBER_11\"][0]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "08b34451-52c6-4acb-8cc6-09d7fdc6499b", + "metadata": {}, + "outputs": [], + "source": [ + "plt.plot(fiber_11['wavelength'], fiber_11['spectrum'])\n", + "plt.xlabel(\"wavelength [um]\")\n", + "plt.ylabel(\"flux [ADU]\")\n", + "plt.title(fiber_11['id']);" ] }, { @@ -699,7 +782,7 @@ "\n", " \n", "\n", - "Finally, both detector yamls include the effect `collapse_1d`, which sums up the separate spectra from the fibres and produces a single output spectrum as described above. It is possible to switch this off with `mosaic['collapse_1d'].include=False` to see the \"detector image\". However, due to the way the spectra are currently formed, this is probably not of much interest." + "Finally, both detector yamls include the effect `output_format` with the parameter `format=\"collapse1d\"` for the MOS modes and `format=\"table\"` for the mIFU modes. This effect converts the detector image to a table format. In the case of the MOS modes, the spectra from all fibers are summed up to produce a single output spectrum as described above, in the case of mIFU, the spectra are arranged in a binary table including the spatial information." ] } ], @@ -719,7 +802,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.13.5" + "version": "3.12.9" } }, "nbformat": 4, From ffd4d47e4aa9aa119266c15193d62ce6843d2c0f Mon Sep 17 00:00:00 2001 From: oczoske Date: Tue, 11 Aug 2026 13:55:59 +0200 Subject: [PATCH 20/35] Fix notebook to account for Scopesim #962 --- METIS/docs/example_notebooks/METIS_WCU.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/METIS/docs/example_notebooks/METIS_WCU.ipynb b/METIS/docs/example_notebooks/METIS_WCU.ipynb index 6ad7136c..895c74c2 100644 --- a/METIS/docs/example_notebooks/METIS_WCU.ipynb +++ b/METIS/docs/example_notebooks/METIS_WCU.ipynb @@ -513,7 +513,7 @@ "print(f\"Open: {flux_is:.1f}\")\n", "print(f\"Mask: {flux_pin:.1f}\")\n", "\n", - "assert np.allclose(flux_is/flux_pin, wcu.meta['rho_is']/wcu.meta['emiss_mask'], rtol=0.01)" + "assert np.allclose(flux_is/flux_pin, 1./wcu.meta['emiss_mask'], rtol=0.01)" ] } ], From 5977f0f653b93ba19b96eab71e0d470d363bd868 Mon Sep 17 00:00:00 2001 From: oczoske Date: Tue, 11 Aug 2026 18:13:15 +0200 Subject: [PATCH 21/35] Move laser parameters to config yaml --- METIS/metis_wcu_config.yaml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/METIS/metis_wcu_config.yaml b/METIS/metis_wcu_config.yaml index 7cab7204..5be4506e 100644 --- a/METIS/metis_wcu_config.yaml +++ b/METIS/metis_wcu_config.yaml @@ -11,6 +11,15 @@ current_fpmask: "open" fpmask_angle: 0 fpmask_shift: [0, 0] +# ------------- Available lasers +laser_l_wave: 3.39 # [um] +laser_l_power: 5e-3 # [W] +laser_t_wave: [4.70] # [um], array +laser_t_power: 70e-3 # [W], will be divided by number of lines +laser_m_wave: 5.26 # [um] +laser_m_power: 20e-3 # [W] + + # ------------- Data needed to describe the WCU bb_to_is: "wcu/WCU_BB_to_IS_throughput.fits" is_reflect: "wcu/WCU_IS_reflectivity.dat" From 8c2fd64dda295b8651227f3de206931ee5d4834d Mon Sep 17 00:00:00 2001 From: oczoske Date: Wed, 12 Aug 2026 15:34:53 +0200 Subject: [PATCH 22/35] Tunable laser defaults to 10 lines 4.68-4.77, as requested --- METIS/metis_wcu_config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/METIS/metis_wcu_config.yaml b/METIS/metis_wcu_config.yaml index 5be4506e..957f7a45 100644 --- a/METIS/metis_wcu_config.yaml +++ b/METIS/metis_wcu_config.yaml @@ -14,7 +14,7 @@ fpmask_shift: [0, 0] # ------------- Available lasers laser_l_wave: 3.39 # [um] laser_l_power: 5e-3 # [W] -laser_t_wave: [4.70] # [um], array +laser_t_wave: [4.68, 4.69, 4.70, 4.71, 4.72, 4.73, 4.74, 4.75, 4.76, 4.77] # [um], array laser_t_power: 70e-3 # [W], will be divided by number of lines laser_m_wave: 5.26 # [um] laser_m_power: 20e-3 # [W] From 14cca2a020ad7d5252f5f0628dbdb56cad15488c Mon Sep 17 00:00:00 2001 From: oczoske Date: Wed, 12 Aug 2026 16:23:56 +0200 Subject: [PATCH 23/35] Wavelength limits for tunable laser --- METIS/metis_wcu_config.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/METIS/metis_wcu_config.yaml b/METIS/metis_wcu_config.yaml index 957f7a45..d242b199 100644 --- a/METIS/metis_wcu_config.yaml +++ b/METIS/metis_wcu_config.yaml @@ -15,6 +15,7 @@ fpmask_shift: [0, 0] laser_l_wave: 3.39 # [um] laser_l_power: 5e-3 # [W] laser_t_wave: [4.68, 4.69, 4.70, 4.71, 4.72, 4.73, 4.74, 4.75, 4.76, 4.77] # [um], array +laser_t_wave_limits: [1., 30.] # um, for validation laser_t_power: 70e-3 # [W], will be divided by number of lines laser_m_wave: 5.26 # [um] laser_m_power: 20e-3 # [W] From ca0198130e8bd791f3b744e01091dd4b5a5d0f0b Mon Sep 17 00:00:00 2001 From: oczoske Date: Thu, 13 Aug 2026 18:28:04 +0200 Subject: [PATCH 24/35] AtmoLibraryTERCurve in MICADO calibration --- METIS/Leiden_sky.yaml | 4 ++- MICADO/MICADO_Calibration.yaml | 60 ++++++++++++++++++++++------------ MICADO/default.yaml | 2 +- 3 files changed, 43 insertions(+), 23 deletions(-) diff --git a/METIS/Leiden_sky.yaml b/METIS/Leiden_sky.yaml index a246080d..96118aa8 100644 --- a/METIS/Leiden_sky.yaml +++ b/METIS/Leiden_sky.yaml @@ -5,9 +5,10 @@ object: Leiden sky alias: OBS name: Leiden_sky description: Leiden sky and telescope -data_modified: 2025-08-26 +data_modified: 2026-08-13 changes: - 2025-08-26 (OC) file created + - 2026-08-13 (OC) explicit parameter in AtmoLibraryTERCurve properties: location: Leiden @@ -21,6 +22,7 @@ effects: class: AtmoLibraryTERCurve include: True kwargs: + parameter: "pwv" pwv: "!ATMO.pwv" remote_filename: "!ATMO.spectrum.filename" diff --git a/MICADO/MICADO_Calibration.yaml b/MICADO/MICADO_Calibration.yaml index daff4e27..2d4d62e6 100644 --- a/MICADO/MICADO_Calibration.yaml +++ b/MICADO/MICADO_Calibration.yaml @@ -9,29 +9,40 @@ changes: - 2026-07-28 (OC) new file from MICADO_Standalone_RO.yaml properties : - temperature : "!ATMO.temperature" + temperature : "!ATMO.temperature" + relH: "!ATMO.relH" effects : -- name : psf - description : PSF - class : SeeingPSF - kwargs: - fwhm: 0.02 # [arcsec] - interp_psf: "!SIM.psf.interp_psf" - interp_order: "!SIM.psf.interp_order" - -- name: relay_surface_list - description : list of surfaces in the relay optics - class: SurfaceList - kwargs: - filename: LIST_RO_SCAO_mirrors.dat - -- name : extra_fits_keywords_calib - description : adds extra FITS keywords for Relay Optics - class : ExtraFitsKeywords - include : True - kwargs : - filename : FITS_extra_keywords_Standalone_RO.yaml +- name : psf + description : PSF + class : SeeingPSF + kwargs: + fwhm: 0.02 # [arcsec] + interp_psf: "!SIM.psf.interp_psf" + interp_order: "!SIM.psf.interp_order" + +- name: relay_surface_list + description : list of surfaces in the relay optics + class: SurfaceList + kwargs: + filename: LIST_RO_SCAO_mirrors.dat + +- name: air_transmission + description: Transmission of air in MCA and relay optics + class: AtmoLibraryTERCurve + include: True + kwargs: + parameter: "relH" + relH: "!ATMO.relH" + #remote_filename: "!ATMO.spectrum.filename" + filename: "!ATMO.spectrum.filename" + +- name : extra_fits_keywords_calib + description : adds extra FITS keywords for Relay Optics + class : ExtraFitsKeywords + include : True + kwargs : + filename : FITS_extra_keywords_Standalone_RO.yaml ################################################################################ @@ -44,6 +55,13 @@ effects : # filename : None ### set instrument mode +--- +alias: ATMO +properties: + relH: 10 # [5:95:5] + spectrum: + filename: MICADO_water_trans.fits + --- object: observation alias : OBS diff --git a/MICADO/default.yaml b/MICADO/default.yaml index c98d0182..b8229929 100644 --- a/MICADO/default.yaml +++ b/MICADO/default.yaml @@ -77,7 +77,7 @@ mode_yamls : alias: OBS name: CALIB description: "Calibration assembly" - yaml: + yamls: - MICADO_Calibration.yaml - object : observation From 33915a5a7e48c1044a79a9dbd711bd0a883ab112 Mon Sep 17 00:00:00 2001 From: oczoske Date: Fri, 14 Aug 2026 15:11:58 +0200 Subject: [PATCH 25/35] Manicure background test --- .../test_micado_background_flux.py | 29 ++++++++++++------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/MICADO/test_micado/test_micado_background_flux.py b/MICADO/test_micado/test_micado_background_flux.py index 89e1e2a3..d38df206 100644 --- a/MICADO/test_micado/test_micado_background_flux.py +++ b/MICADO/test_micado/test_micado_background_flux.py @@ -19,13 +19,14 @@ import scopesim as sim from scopesim import rc -from scopesim.source.source_templates import empty_sky PATH_HERE = Path(__file__).parent PATH_IRDB = PATH_HERE.parent.parent rc.__config__["!SIM.file.local_packages_path"] = str(PATH_IRDB) +# pylint: disable=missing-class-docstring, +# pylint: disable=missing-function-docstring class TestInit: @pytest.mark.parametrize( @@ -51,8 +52,8 @@ class TestBackgroundLevels: from Ric's excel doc 2018-04-03 sky + instr. bkg [e-/pixel/s] for 4 mas mode:: - Z J H Ks - 0.6 5.0 28.4 78.7 + J H Ks + 5.0 28.4 78.7 """ @@ -64,19 +65,28 @@ class TestBackgroundLevels: pytest.param( "J", "open", 5, marks=pytest.mark.xfail( - reason="Fails due to changes in dev_master." + reason="Fails higher than expected." ), ), pytest.param( - "open", "H", 30, + "open", "H", 28.4, marks=pytest.mark.xfail( - reason="Fails due to changes in dev_master." + reason="Fails higher than expected." ), ), - ("open", "Ks", 79), + pytest.param( + "open", "Ks", 78.7, + marks=pytest.mark.xfail( + reason="Fails actual lower than expected." + ), + ), + # regression test actual values 2026-08-14 + ("J", "open", 7.75), + ("open", "H", 52.2), + ("open", "Ks", 50.7), ], ) - def test_bg_SCAO_IMG_4mas(self, mode, factor, fw1, fw2, bg_flux): + def test_bg_scao_imaging(self, mode, factor, fw1, fw2, bg_flux): cmds = sim.UserCommands( use_instrument="MICADO", set_modes=["SCAO", mode] ) @@ -85,8 +95,7 @@ def test_bg_SCAO_IMG_4mas(self, mode, factor, fw1, fw2, bg_flux): micado["filter_wheel_1"].change_filter(fw1) micado["filter_wheel_2"].change_filter(fw2) - src = empty_sky() - micado.observe(src) + micado.observe() implane = micado.image_planes[0].hdu.data # e-/pixel/s # Pixel size is 0.14 of the 4mas version, hence fluxes are lower From 2738f1729a98194e61c8b20b63f5d4fbf65bdb11 Mon Sep 17 00:00:00 2001 From: oczoske Date: Fri, 14 Aug 2026 15:18:17 +0200 Subject: [PATCH 26/35] MICADO has been rearranged --- irdb/tests/test_package_contents.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/irdb/tests/test_package_contents.py b/irdb/tests/test_package_contents.py index a112f873..947f1cf3 100644 --- a/irdb/tests/test_package_contents.py +++ b/irdb/tests/test_package_contents.py @@ -54,7 +54,7 @@ def test_default_yaml_contains_packages_list(self, package, badges): # METIS is special since in WCU mode it operates without METIS. # MOSAIC has no MOSAIC.yaml. # TODO: is {pkg_name}.yaml necessary? - if pkg_name not in {"METIS", "MOSAIC"}: + if pkg_name not in {"METIS", "MOSAIC", "MICADO"}: result &= "yamls" in yaml_dict \ and f"{pkg_name}.yaml" in yaml_dict["yamls"] if result: From 1eed29207a0fafb9f2ab7fffb8a9e4cdb3daf563 Mon Sep 17 00:00:00 2001 From: oczoske Date: Mon, 17 Aug 2026 10:26:56 +0200 Subject: [PATCH 27/35] Deployable mirror --- MICADO/LIST_MCA_mirrors.dat | 14 ++++++++++++++ MICADO/MICADO_Calibration.yaml | 26 ++++++++++++-------------- 2 files changed, 26 insertions(+), 14 deletions(-) create mode 100644 MICADO/LIST_MCA_mirrors.dat diff --git a/MICADO/LIST_MCA_mirrors.dat b/MICADO/LIST_MCA_mirrors.dat new file mode 100644 index 00000000..91c5fd9c --- /dev/null +++ b/MICADO/LIST_MCA_mirrors.dat @@ -0,0 +1,14 @@ +# author : Oliver Czoske +# source : Rodeghiero et al. 2020 (estimate) +# date_created : 2026-08-14 +# date_modified : 2026-08-14 +# status : Design +# type : mirror:list +# outer_unit : m +# inner_unit : m +# angle_unit : degree +# temperature_unit : deg_C +# changes : +# +name outer inner angle temperature action filename +MIC_MCA_M1 0.505 0. 45. !CALIB.temperature reflection TER_MICADO_mirror_mgf2agal.dat diff --git a/MICADO/MICADO_Calibration.yaml b/MICADO/MICADO_Calibration.yaml index 2d4d62e6..3d1ffc70 100644 --- a/MICADO/MICADO_Calibration.yaml +++ b/MICADO/MICADO_Calibration.yaml @@ -4,9 +4,10 @@ alias : CALIB name : MICADO_Calibration description : Micado calibration assembly needs_scopesim: "v0.11.3" # CHECK -date_modified: 2026-07-28 +date_modified: 2026-08-15 changes: - 2026-07-28 (OC) new file from MICADO_Standalone_RO.yaml + - 2026-08-15 (OC) air_transmission, deployable mirror properties : temperature : "!ATMO.temperature" @@ -21,6 +22,12 @@ effects : interp_psf: "!SIM.psf.interp_psf" interp_order: "!SIM.psf.interp_order" +- name: mca_mirror + description: deployable mirror for the MCA + class: SurfaceList + kwargs: + filename: LIST_MCA_mirrors.dat + - name: relay_surface_list description : list of surfaces in the relay optics class: SurfaceList @@ -34,8 +41,8 @@ effects : kwargs: parameter: "relH" relH: "!ATMO.relH" - #remote_filename: "!ATMO.spectrum.filename" - filename: "!ATMO.spectrum.filename" + remote_filename: "!ATMO.spectrum.filename" + #filename: "!ATMO.spectrum.filename" - name : extra_fits_keywords_calib description : adds extra FITS keywords for Relay Optics @@ -44,20 +51,11 @@ effects : kwargs : filename : FITS_extra_keywords_Standalone_RO.yaml -################################################################################ - -# This one can be used if a filename from a FV-PSF file if provided -#- name : relay_fv_psf -# description : SCAO FV PSF -# class : FieldVaryingPSF -# include : False -# kwargs: -# filename : None - -### set instrument mode +### Overrides --- alias: ATMO properties: + temperature: 7 relH: 10 # [5:95:5] spectrum: filename: MICADO_water_trans.fits From 8921e4c57c9fd8e45e4d0dc2f1d1f46986705957 Mon Sep 17 00:00:00 2001 From: oczoske Date: Tue, 18 Aug 2026 16:01:24 +0200 Subject: [PATCH 28/35] MCA fits header (a start) --- MICADO/MICADO_Calibration.yaml | 22 +++++++++---------- MICADO/headers/FITS_calibration_keywords.yaml | 11 ++++++++++ 2 files changed, 22 insertions(+), 11 deletions(-) create mode 100644 MICADO/headers/FITS_calibration_keywords.yaml diff --git a/MICADO/MICADO_Calibration.yaml b/MICADO/MICADO_Calibration.yaml index 3d1ffc70..186e6169 100644 --- a/MICADO/MICADO_Calibration.yaml +++ b/MICADO/MICADO_Calibration.yaml @@ -14,14 +14,6 @@ properties : relH: "!ATMO.relH" effects : -- name : psf - description : PSF - class : SeeingPSF - kwargs: - fwhm: 0.02 # [arcsec] - interp_psf: "!SIM.psf.interp_psf" - interp_order: "!SIM.psf.interp_order" - - name: mca_mirror description: deployable mirror for the MCA class: SurfaceList @@ -44,12 +36,20 @@ effects : remote_filename: "!ATMO.spectrum.filename" #filename: "!ATMO.spectrum.filename" -- name : extra_fits_keywords_calib - description : adds extra FITS keywords for Relay Optics +- name : psf + description : PSF + class : SeeingPSF + kwargs: + fwhm: 0.02 # [arcsec] + interp_psf: "!SIM.psf.interp_psf" + interp_order: "!SIM.psf.interp_order" + +- name : calib_fits_keywords + description : adds extra FITS keywords for calibration unit class : ExtraFitsKeywords include : True kwargs : - filename : FITS_extra_keywords_Standalone_RO.yaml + filename : headers/FITS_calibration_keywords.yaml ### Overrides --- diff --git a/MICADO/headers/FITS_calibration_keywords.yaml b/MICADO/headers/FITS_calibration_keywords.yaml new file mode 100644 index 00000000..d2d3ca8d --- /dev/null +++ b/MICADO/headers/FITS_calibration_keywords.yaml @@ -0,0 +1,11 @@ +- ext_type: PrimaryHDU + keywords: + + WISE: + ATM: + HUMIDITY: ["#air_transmission.relH!", "[per cent] relative humidity"] + REL: + PSF: + FWHM: ["#psf.fwhm!", "[arcsec] FWHM of Gaussian psf"] + SUR: + REALFILE: ["#relay_surface_list.filename", "relay optics surface list"] From 71d2500062934c38d4a2156e718b689026e130e6 Mon Sep 17 00:00:00 2001 From: oczoske Date: Tue, 18 Aug 2026 18:33:21 +0200 Subject: [PATCH 29/35] relH as float --- MICADO/MICADO_Calibration.yaml | 4 ++-- MICADO/headers/FITS_calibration_keywords.yaml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/MICADO/MICADO_Calibration.yaml b/MICADO/MICADO_Calibration.yaml index 186e6169..1c37f4e6 100644 --- a/MICADO/MICADO_Calibration.yaml +++ b/MICADO/MICADO_Calibration.yaml @@ -56,9 +56,9 @@ effects : alias: ATMO properties: temperature: 7 - relH: 10 # [5:95:5] + relH: 0.2 # [0..1] spectrum: - filename: MICADO_water_trans.fits + filename: MICADO_relay_air_trans.fits --- object: observation diff --git a/MICADO/headers/FITS_calibration_keywords.yaml b/MICADO/headers/FITS_calibration_keywords.yaml index d2d3ca8d..e699beeb 100644 --- a/MICADO/headers/FITS_calibration_keywords.yaml +++ b/MICADO/headers/FITS_calibration_keywords.yaml @@ -3,7 +3,7 @@ WISE: ATM: - HUMIDITY: ["#air_transmission.relH!", "[per cent] relative humidity"] + HUMIDITY: ["#air_transmission.relH!", "relative humidity"] REL: PSF: FWHM: ["#psf.fwhm!", "[arcsec] FWHM of Gaussian psf"] From e0bfa12821914b96aaacca625e46466847d72b37 Mon Sep 17 00:00:00 2001 From: oczoske Date: Mon, 24 Aug 2026 16:28:36 +0200 Subject: [PATCH 30/35] Define N-band lasers --- METIS/metis_wcu_config.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/METIS/metis_wcu_config.yaml b/METIS/metis_wcu_config.yaml index d242b199..bbb35572 100644 --- a/METIS/metis_wcu_config.yaml +++ b/METIS/metis_wcu_config.yaml @@ -14,12 +14,17 @@ fpmask_shift: [0, 0] # ------------- Available lasers laser_l_wave: 3.39 # [um] laser_l_power: 5e-3 # [W] + laser_t_wave: [4.68, 4.69, 4.70, 4.71, 4.72, 4.73, 4.74, 4.75, 4.76, 4.77] # [um], array laser_t_wave_limits: [1., 30.] # um, for validation laser_t_power: 70e-3 # [W], will be divided by number of lines + laser_m_wave: 5.26 # [um] laser_m_power: 20e-3 # [W] +laser_n_wave: [8.0, 9.0, 10.4, 11.5, 12.4] # [um], array +laser_n_power: [2.e-3, 1.4e-3, 2.e-3, 0.8e-3, 0.5e-3] # [W], for each laser + # ------------- Data needed to describe the WCU bb_to_is: "wcu/WCU_BB_to_IS_throughput.fits" From 7eaa1234b66792d7bf52892a89ccbbf363997cc3 Mon Sep 17 00:00:00 2001 From: oczoske Date: Mon, 24 Aug 2026 16:39:55 +0200 Subject: [PATCH 31/35] Notebook without output --- .../docs/example_notebooks/MICADO_MCA.ipynb | 456 ++++++++++++++++++ 1 file changed, 456 insertions(+) create mode 100644 MICADO/docs/example_notebooks/MICADO_MCA.ipynb diff --git a/MICADO/docs/example_notebooks/MICADO_MCA.ipynb b/MICADO/docs/example_notebooks/MICADO_MCA.ipynb new file mode 100644 index 00000000..e300e861 --- /dev/null +++ b/MICADO/docs/example_notebooks/MICADO_MCA.ipynb @@ -0,0 +1,456 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "8d031126-6b96-4e80-93f5-749c1c78d32d", + "metadata": {}, + "source": [ + "# The MICADO Calibration Assembly (MCA)" + ] + }, + { + "cell_type": "markdown", + "id": "f21c5249-7d0c-438a-a35b-b538d354265a", + "metadata": {}, + "source": [ + "This notebook describes how to simulate calibration exposures using the MICADO Calibration Assembly with ScopeSim. For this purpose a new submode `CALIB` has been introduced, which replaces the `SCAO` and `MCAO` submodes that are used for on-sky observations. It can be combined with all instrument modes, i.e. `IMG_4mas`, `SPEC`, etc. \n", + "`CALIB` does not include the Armazones (atmosphere) and ELT effects. It currently includes the following to describe the MCA:\n", + "- `mca_mirror`: a single deployable mirror that is unique to the MCA. As with all mirrors the effect describes throughput (reflectivity) as well as thermal emission.\n", + "- `relay_surface_list`: This is the list of mirrors in the relay optics that is used in stand-alone mode, identical to the mirror list in the `SCAO` submode. Note that MORFEO is not yet supported for MCA simulations.\n", + "- `air_transmission`: The optical path from the MCA to the entrance window of MICADO has a length of about 14 metres through air, which therefore imprints an absorption signal on the input (continuum) spectrum. The effect uses a library of transmission spectra for various values of relative humidity (see below for details).\n", + "- `psf`: Very simplistically, the instrumental PSF (imprinted on observations using a pinhole mask) is modeled as Gaussian PSF of FWHM = 0.02 arcsec. This can be made more realistic in the future." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e96f6127-7dda-4320-b023-66ae4f0421f0", + "metadata": {}, + "outputs": [], + "source": [ + "import scopesim as sim" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c3651e77-db22-4022-8f35-06280590106d", + "metadata": {}, + "outputs": [], + "source": [ + "sim.link_irdb(\"../../../../\")" + ] + }, + { + "cell_type": "markdown", + "id": "75e62ece-9745-445e-a0f8-84c9b9aeee56", + "metadata": {}, + "source": [ + "If you have not done so already, please download the relevant instrument packages using the following code in a new cell:\n", + "\n", + "```sim.download_packages([\"MICADO\"])```\n", + "\n", + "Alternatively, if you would like to keep the instrument packages in a separate directory, you can set the following config value:\n", + "\n", + "```sim.set_inst_pkgs_path(\"path/to/packages\")```" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1943890b-30c5-439b-98b5-fda6d6b91100", + "metadata": {}, + "outputs": [], + "source": [ + "import numpy as np\n", + "from matplotlib import pyplot as plt\n", + "from astropy import units as u\n", + "from astropy.wcs import WCS" + ] + }, + { + "cell_type": "markdown", + "id": "8da54c14-a202-4ebe-8f95-7e19b947d1e1", + "metadata": {}, + "source": [ + "## Setting up the optical train\n", + "We first set up MICADO for the nominal imaging mode:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1ea94b35-dcd9-4696-838a-1ab528816a6e", + "metadata": {}, + "outputs": [], + "source": [ + "cmd = sim.UserCommands(use_instrument=\"MICADO\", set_modes=[\"CALIB\", \"IMG_4mas\"])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "2e1dc88e-e5d7-4992-8e50-31a770947ea2", + "metadata": {}, + "outputs": [], + "source": [ + "micado = sim.OpticalTrain(cmd)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b698f5a2-f488-40d0-9744-08fb8df7d9d3", + "metadata": {}, + "outputs": [], + "source": [ + "micado.effects.pprint_all()" + ] + }, + { + "cell_type": "markdown", + "id": "f186aa16-4f7a-45fb-b740-e36e5a6bf671", + "metadata": {}, + "source": [ + "## Imaging \n", + "The MICADO calibration mode needs to use a `Source` object (unlike the METIS WCU mode). For the time being, we use a flat field from `Scopesim_Templates`. This will soon change to `Scopesim_Targets`, which will also allow implementation of pinhole masks." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c483ccb1-3146-4ef6-a231-521323ac199e", + "metadata": {}, + "outputs": [], + "source": [ + "from scopesim_templates.micado import flatlamp" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "33bacf0a-cb4c-4cad-8e7d-7b4cc393602b", + "metadata": {}, + "outputs": [], + "source": [ + "flat = flatlamp()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9a78f795-8b86-469a-b2e0-f748a9b15f80", + "metadata": {}, + "outputs": [], + "source": [ + "micado.observe(flat)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "bd5145ed-eb05-4da9-b0c3-5e7c7b8e4126", + "metadata": {}, + "outputs": [], + "source": [ + "readout = micado.readout(dit=1, ndit=1)[0]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "25a083cf-f17a-4a89-a4a1-6f8e289515ef", + "metadata": {}, + "outputs": [], + "source": [ + "print(\"Mean: \", readout[1].data.mean())\n", + "print(\"Std. dev.:\", readout[1].data.std())" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1bb25d42-4c7a-49d4-9adb-0236d8e2e2e7", + "metadata": {}, + "outputs": [], + "source": [ + "plt.hist(readout[1].data.ravel(), bins=100);" + ] + }, + { + "cell_type": "markdown", + "id": "79e9618c-39e6-4bc5-b2fb-82c064fac095", + "metadata": {}, + "source": [ + "Also from scopesim_templates, a pinhole mask, which we shall set up as a regular grid for imaging (blindly taken from the documentation)." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "08f89ccc-db86-455d-bb1f-6874f20a01d2", + "metadata": {}, + "outputs": [], + "source": [ + "from scopesim_templates.micado.pinhole_masks import pinhole_mask" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "eefcc929-52a8-43cb-8175-02eed087869c", + "metadata": {}, + "outputs": [], + "source": [ + "dr = np.arange(-5, 6, 0.5) # [arcsec]\n", + "x, y = np.meshgrid(dr, dr)\n", + "x, y = x.flatten(), y.flatten()\n", + "waves = np.arange(0.7, 2.5, 0.001) * u.um\n", + "pinh = pinhole_mask(x, y, waves, sum_factor=9001)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d4cde4ec-5685-4903-850f-f17869102330", + "metadata": {}, + "outputs": [], + "source": [ + "micado.observe(pinh)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c94b54a6-287e-4072-8478-8816efe61d59", + "metadata": {}, + "outputs": [], + "source": [ + "read_pinh = micado.readout(dit=1, ndit=1)[0]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "86ea0e0a-f96e-4022-bb87-3a15e5162f80", + "metadata": {}, + "outputs": [], + "source": [ + "plt.imshow(read_pinh[1].data)\n", + "plt.title(\"Imaging, 4 mas\");" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7efa2af3-31be-49d5-8e8a-def0868dab48", + "metadata": {}, + "outputs": [], + "source": [ + "cmd = sim.UserCommands(use_instrument=\"MICADO\", set_modes=[\"CALIB\", \"IMG_1.5mas\"])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "bbcf8295-66bb-45d1-a2f4-e2d6ee76e2f2", + "metadata": {}, + "outputs": [], + "source": [ + "micado = sim.OpticalTrain(cmd)\n", + "micado.observe(pinh)\n", + "read_pinh_zoom = micado.readout(dit=1, ndit=1)[0]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "a78e2430-3cac-4d46-beda-0199b43aa37f", + "metadata": {}, + "outputs": [], + "source": [ + "plt.imshow(read_pinh_zoom[1].data)\n", + "plt.title(\"Imaging, 1.5 mas\");" + ] + }, + { + "cell_type": "markdown", + "id": "705d55b9-58ce-4d6c-975c-5c38a8e7be7d", + "metadata": {}, + "source": [ + "# Spectroscopy" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ab69ff63-b887-421e-b256-b1088691706d", + "metadata": {}, + "outputs": [], + "source": [ + "cmd = sim.UserCommands(use_instrument=\"MICADO\", set_modes=[\"CALIB\", \"SPEC\"])\n", + "micado = sim.OpticalTrain(cmd)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "0e8e4330-78e5-4636-8261-ade7ad35ac60", + "metadata": {}, + "outputs": [], + "source": [ + "micado.effects.pprint_all()" + ] + }, + { + "cell_type": "markdown", + "id": "867deabf-0500-481e-80ce-194be4f71b55", + "metadata": {}, + "source": [ + "We will observe the flat lamp, which allows us to switch off the psf effects. We'll try to simulate a full field of view." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c1328dcd-c64f-4654-b734-40e8eee1e1b0", + "metadata": {}, + "outputs": [], + "source": [ + "micado['psf'].include = False\n", + "micado['micado_ncpas_psf'].include = False\n", + "micado['filter_wheel_1'].change_filter(\"Spec_HK\")\n", + "micado['detector_window'].include = False\n", + "micado['full_detector_array'].include = True" + ] + }, + { + "cell_type": "markdown", + "id": "113aa70e-3ff3-434b-ba7b-2a907bcec544", + "metadata": {}, + "source": [ + "The transmission of the 14 meter air column in the MCA and relay optics is provided by the `air_transmission` effect. This is a library of transmission spectra for relative humidities between 5 and 95 per cent, available in steps of 5 per cent. The default is 10 per cent, which can be changed with the `update()` method:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "2aed29dd-770d-4f89-8ad1-28d584de8cc4", + "metadata": {}, + "outputs": [], + "source": [ + "air = micado['air_transmission']\n", + "print(\"Default humidity:\", air.meta['relH'], \"(per cent)\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "8c97cea0-6e40-4c17-934b-e3ec70957c2d", + "metadata": {}, + "outputs": [], + "source": [ + "air.update(relH=50)\n", + "print(\"Current humidity:\", air.meta['relH'], \"(per cent)\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4a401844-c89f-487c-a161-7380207380f1", + "metadata": {}, + "outputs": [], + "source": [ + "air.plot();" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "91d97c4c-998a-44e9-aebb-d27fa30b7dd1", + "metadata": {}, + "outputs": [], + "source": [ + "micado.observe(flat)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4fb99fb8-6b6c-429a-a739-d67f49ba47f5", + "metadata": {}, + "outputs": [], + "source": [ + "readout = micado.readout(dit=600, ndit=1)[0]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "006b4c00-0b75-4ff2-b285-beadb7c7d230", + "metadata": {}, + "outputs": [], + "source": [ + "plt.imshow(readout[5].data)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "2a891916-29a1-4be4-84da-71c19f1339ee", + "metadata": {}, + "outputs": [], + "source": [ + "rect = micado['micado_spectral_traces'].rectify_traces(readout, -1.5, 1.5)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "58422392-95af-49f2-861f-c6ae107c9f6c", + "metadata": {}, + "outputs": [], + "source": [ + "plt.imshow(rect[1].data); \n", + "plt.xlim(500, 4000);" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "021f891e-765b-4a1a-b390-6c8c9605f79f", + "metadata": {}, + "outputs": [], + "source": [ + "j = np.arange(rect[2].data.shape[1])\n", + "wcs = WCS(rect[2].header).spectral\n", + "lam = wcs.all_pix2world(j, 0)[0]\n", + "lam = (lam * wcs.wcs.cunit[0]).to(u.um)\n", + "plt.plot(lam, rect[2].data[300, ])\n", + "plt.title(rect[2].header[\"EXTNAME\"])\n", + "plt.xlabel(\"Wavelength [um]\");" + ] + } + ], + "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.12.9" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} From bc1acdfc849ed757d7777eb9318f910c6004a5e7 Mon Sep 17 00:00:00 2001 From: oczoske Date: Mon, 24 Aug 2026 17:42:19 +0200 Subject: [PATCH 32/35] Correct path --- MICADO/docs/example_notebooks/MICADO_MCA.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MICADO/docs/example_notebooks/MICADO_MCA.ipynb b/MICADO/docs/example_notebooks/MICADO_MCA.ipynb index e300e861..f4f40fa1 100644 --- a/MICADO/docs/example_notebooks/MICADO_MCA.ipynb +++ b/MICADO/docs/example_notebooks/MICADO_MCA.ipynb @@ -38,7 +38,7 @@ "metadata": {}, "outputs": [], "source": [ - "sim.link_irdb(\"../../../../\")" + "sim.link_irdb(\"../../../\")" ] }, { From 935892660f5eb83a59db14d8201e2dd248fc379a Mon Sep 17 00:00:00 2001 From: oczoske Date: Mon, 24 Aug 2026 18:41:39 +0200 Subject: [PATCH 33/35] Move after successful test --- .../docs/{example_notebooks => extra_notebooks}/MICADO_MCA.ipynb | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename MICADO/docs/{example_notebooks => extra_notebooks}/MICADO_MCA.ipynb (100%) diff --git a/MICADO/docs/example_notebooks/MICADO_MCA.ipynb b/MICADO/docs/extra_notebooks/MICADO_MCA.ipynb similarity index 100% rename from MICADO/docs/example_notebooks/MICADO_MCA.ipynb rename to MICADO/docs/extra_notebooks/MICADO_MCA.ipynb From b4091b0842a49ad2a630d83de56e6e0d5c8697e6 Mon Sep 17 00:00:00 2001 From: oczoske Date: Tue, 1 Sep 2026 17:32:04 +0200 Subject: [PATCH 34/35] Explain how to change tunable laser settings --- METIS/docs/example_notebooks/METIS_WCU.ipynb | 100 +++++++++++++++++++ 1 file changed, 100 insertions(+) diff --git a/METIS/docs/example_notebooks/METIS_WCU.ipynb b/METIS/docs/example_notebooks/METIS_WCU.ipynb index 895c74c2..f38c404b 100644 --- a/METIS/docs/example_notebooks/METIS_WCU.ipynb +++ b/METIS/docs/example_notebooks/METIS_WCU.ipynb @@ -446,6 +446,21 @@ "fpmask_angle: 0\n", "fpmask_shift: [0, 0]\n", "\n", + "# ------------- Available lasers\n", + "## L-band\n", + "laser_l_wave: 3.39 # [um]\n", + "laser_l_power: 5e-3 # [W]\n", + "## tunable QCL\n", + "laser_t_wave: [4.68, 4.69, 4.70, 4.71, 4.72, 4.73, 4.74, 4.75, 4.76, 4.77] # [um], array\n", + "laser_t_wave_limits: [1., 30.] # um, for validation\n", + "laser_t_power: 70e-3 # [W], will be divided by number of lines\n", + "## M-band\n", + "laser_m_wave: 5.26 # [um]\n", + "laser_m_power: 20e-3 # [W]\n", + "## N-band (for AIT only)\n", + "laser_n_wave: [8.0, 9.0, 10.4, 11.5, 12.4] # [um], array\n", + "laser_n_power: [2.e-3, 1.4e-3, 2.e-3, 0.8e-3, 0.5e-3] # [W], for each laser\n", + "\n", "# ------------- Data needed to describe the WCU\n", "bb_to_is: \"wcu/WCU_BB_to_IS_throughput.fits\"\n", "is_reflect: \"wcu/WCU_IS_reflectivity.dat\"\n", @@ -458,6 +473,7 @@ "rho_is: 0.95 # [] reflectivity of integrating sphere\n", "rho_tube: 0.95 # [] reflectivity of tube between BB and IS\n", "emiss_mask: 1.00 # [] emissivity of focal-plane mask\n", + "fibre_transmission: 0.1 # [] transmission of fibres injecting laser into IS\n", "```\n", "To use your own configuration file, copy the default file into your working directory and instantiate the `OpticalTrain` as follows:\n", "```python\n", @@ -467,6 +483,90 @@ "```" ] }, + { + "cell_type": "markdown", + "id": "13ea5a99-e937-436e-8553-cfeab7c069fb", + "metadata": {}, + "source": [ + "## Changing wavelengths of the tunable laser\n", + "The wavelengths of the tunable laser as set in the configuration file are chosen to represent a scenario where the laser changes rapidly between 10 wavelengths so that 10 lines appear in a single exposure. In this scenario, the laser's power is distributed equally onto these 10 lines. In practice it might be preferable to have the laser at a single wavelength setting during the exposure. \n", + "The wavelength can be changed by setting the keyword `wcu.meta[\"laser_t_wave\"]` to the desired value or array of values. To make the change effective, the statement needs to be followed by `metis.set_lamp(\"laser\")`, as this command triggers the computation of the laser spectrum. " + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f8534a3e-d4dd-4eac-a1f1-52ab38c250e5", + "metadata": {}, + "outputs": [], + "source": [ + "cmd = sim.UserCommands(use_instrument='METIS', set_modes=['wcu_lss_m'])\n", + "metis = sim.OpticalTrain(cmd)\n", + "wcu = metis['wcu_source']" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d130f6bf-eae3-4498-89c0-9ed1e113a49b", + "metadata": {}, + "outputs": [], + "source": [ + "# Take a background frame (WCU_OFF)\n", + "wcu.set_lamp(\"off\")\n", + "metis.observe()\n", + "implane_off = metis.image_planes[0].data" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ac6d3cd1-e8b1-4fa6-b1e5-08a33c4d14a5", + "metadata": {}, + "outputs": [], + "source": [ + "# Take exposure with default laser setting\n", + "wcu.set_lamp(\"laser\")\n", + "metis.observe()\n", + "implane_default = metis.image_planes[0].data" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ac767bb1-e6f5-4612-94c7-6ae763d6f9c7", + "metadata": {}, + "outputs": [], + "source": [ + "# Change the wavelenght of the tunable laser\n", + "wcu.meta['laser_t_wave'] = [4.85]\n", + "# Make the change effective by setting the lamp to \"laser\" again \n", + "wcu.set_lamp(\"laser\")\n", + "\n", + "metis.observe()\n", + "implane_single = metis.image_planes[0].data" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d3f6d12e-5824-4bd7-83fb-ca866545707c", + "metadata": {}, + "outputs": [], + "source": [ + "fig, axes = plt.subplots(1, 2, sharey=True)\n", + "axes[0].imshow(implane_default - implane_off, origin='lower', vmin=0, vmax=2e5)\n", + "axes[1].imshow(implane_single - implane_off, origin='lower', vmin=0, vmax=2e5);" + ] + }, + { + "cell_type": "markdown", + "id": "f97289c9-58e2-435b-98c8-ff2d2307abfa", + "metadata": {}, + "source": [ + "Note that the single line is 10 times as bright as the individual lines in the default setting." + ] + }, { "cell_type": "markdown", "id": "06eaea13-7c1d-4cc9-a345-fe5d13956126", From 0832156ef5eea5417fc0a37f1d599166d05d1dd4 Mon Sep 17 00:00:00 2001 From: oczoske Date: Tue, 1 Sep 2026 17:50:18 +0200 Subject: [PATCH 35/35] Forgot about my own utility method --- METIS/docs/example_notebooks/METIS_WCU.ipynb | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/METIS/docs/example_notebooks/METIS_WCU.ipynb b/METIS/docs/example_notebooks/METIS_WCU.ipynb index f38c404b..5c3c8a0b 100644 --- a/METIS/docs/example_notebooks/METIS_WCU.ipynb +++ b/METIS/docs/example_notebooks/METIS_WCU.ipynb @@ -490,7 +490,7 @@ "source": [ "## Changing wavelengths of the tunable laser\n", "The wavelengths of the tunable laser as set in the configuration file are chosen to represent a scenario where the laser changes rapidly between 10 wavelengths so that 10 lines appear in a single exposure. In this scenario, the laser's power is distributed equally onto these 10 lines. In practice it might be preferable to have the laser at a single wavelength setting during the exposure. \n", - "The wavelength can be changed by setting the keyword `wcu.meta[\"laser_t_wave\"]` to the desired value or array of values. To make the change effective, the statement needs to be followed by `metis.set_lamp(\"laser\")`, as this command triggers the computation of the laser spectrum. " + "The wavelength can be changed with the utility function `wcu.tune_laser(wavelength=...)`, where the argument is either a number or a list of wavelengths (units are assumed to be micrometers)." ] }, { @@ -538,11 +538,8 @@ "metadata": {}, "outputs": [], "source": [ - "# Change the wavelenght of the tunable laser\n", - "wcu.meta['laser_t_wave'] = [4.85]\n", - "# Make the change effective by setting the lamp to \"laser\" again \n", - "wcu.set_lamp(\"laser\")\n", - "\n", + "# Change the wavelength of the tunable laser\n", + "wcu.tune_laser(wavelength=4.85)\n", "metis.observe()\n", "implane_single = metis.image_planes[0].data" ]