From 4ab7758a4d1521cd2d31e3046f3d486f528daa93 Mon Sep 17 00:00:00 2001 From: oczoske Date: Wed, 21 May 2025 14:44:45 +0200 Subject: [PATCH 1/5] Include LineSpreadFunction --- METIS/METIS_LMS_SMPL.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/METIS/METIS_LMS_SMPL.yaml b/METIS/METIS_LMS_SMPL.yaml index 719d4ef7..08127324 100644 --- a/METIS/METIS_LMS_SMPL.yaml +++ b/METIS/METIS_LMS_SMPL.yaml @@ -38,6 +38,14 @@ effects: wave_key: "WAVELENG" bkg_width: -1 + - name: lsf + description: line-spread function for spectroscopic domain + class: LineSpreadFunction + kwargs: + wavelen: "!OBS.wavelen" + fit_slope: 0.96 # pix/um TODO: Change back to lambda + fit_intercept: -0.12 # pix + - name: flux_binning description: turn per arcsec per um to ph per s class: FluxBinning3D From 34ede17cb5d16c5b61e3b28a80422b6311235137 Mon Sep 17 00:00:00 2001 From: oczoske Date: Wed, 21 May 2025 14:54:29 +0200 Subject: [PATCH 2/5] Slice width explicit (somewhat redundant) --- METIS/METIS_LMS_SMPL.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/METIS/METIS_LMS_SMPL.yaml b/METIS/METIS_LMS_SMPL.yaml index 08127324..56a5d348 100644 --- a/METIS/METIS_LMS_SMPL.yaml +++ b/METIS/METIS_LMS_SMPL.yaml @@ -13,6 +13,7 @@ properties: pixel_scale: 0.0082 # arcsec / pixel plate_scale: 0.455555555556 # arcsec / mm fp2_platescale: 0.303 # arcsec / mm + slice_width: 0.0207 # arcsec / slice decouple_detector_from_sky_headers: True # needed for spectroscopy flatten: False # cube output From e2ae38ca2964bcc372599391dd5cb91a50944076 Mon Sep 17 00:00:00 2001 From: oczoske Date: Wed, 21 May 2025 21:47:48 +0200 Subject: [PATCH 3/5] script to compute dispersion fit parameters --- METIS/code/fit_ifu_dispersion.py | 46 ++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 METIS/code/fit_ifu_dispersion.py diff --git a/METIS/code/fit_ifu_dispersion.py b/METIS/code/fit_ifu_dispersion.py new file mode 100644 index 00000000..30bf46dc --- /dev/null +++ b/METIS/code/fit_ifu_dispersion.py @@ -0,0 +1,46 @@ +"""Compute IFU mean dispersion as a function of central wavelength + +The LineSpreadFunction effect needs the dispersion dlam_per_pix on +the LMS detector to determine the width of the LSF kernel to be +applied to the cube in mode `lms_cube`. The script computes the mean +dispersion as (lam_max - lam_min)/4220 for a number of wavelength settings, +and then performs a linear regression of dlam_per_pix against wavelength. +LineSpreadFunction() uses the slope and intercept to get a sufficient +approximation to the dispersion without having to reference TRACE_LMS.fits +or instantiate MetisLMSSpectralTraces itself. +""" +# Author: Oliver Czoske +# Date: 2025-05-21 + +import numpy as np +from scipy.stats import linregress +from matplotlib import pyplot as plt +import scopesim as sim + +if __name__ == "__main__": + sim.link_irdb("../../") # from METIS/code/ + + NPIX = 4220 # twice 2048 plus gap, from FPA_metis_lms_layout.dat + wavelens = np.linspace(2.677, 5.332, 100) # um + dlam_per_pix = np.zeros_like(wavelens) + + for i, lamc in enumerate(wavelens): + cmd = sim.UserCommands(use_instrument="METIS", + set_modes=["lms"], + properties={"!OBS.wavelen": lamc}) + metis = sim.OpticalTrain(cmd) + splist = metis['lms_spectral_traces'] + lam_min = splist.meta['wave_min'] + lam_max = splist.meta['wave_max'] + + dlam_per_pix[i] = (lam_max - lam_min) / NPIX + + linfit = linregress(wavelens, dlam_per_pix) + slope = linfit.slope + intercept = linfit.intercept + print("Slope: ", slope, "# um/pix") + print("Intercept:", intercept, "# um") + + plt.plot(wavelens, dlam_per_pix, 'o') + plt.plot(wavelens, intercept + slope * wavelens) + plt.show() From 9ff96158dd2b5fe821c5424b34ca41b18103bfc5 Mon Sep 17 00:00:00 2001 From: oczoske Date: Wed, 21 May 2025 23:15:28 +0200 Subject: [PATCH 4/5] Complete parameters for LSF --- METIS/METIS_LMS_SMPL.yaml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/METIS/METIS_LMS_SMPL.yaml b/METIS/METIS_LMS_SMPL.yaml index 56a5d348..4984bc42 100644 --- a/METIS/METIS_LMS_SMPL.yaml +++ b/METIS/METIS_LMS_SMPL.yaml @@ -44,8 +44,11 @@ effects: class: LineSpreadFunction kwargs: wavelen: "!OBS.wavelen" - fit_slope: 0.96 # pix/um TODO: Change back to lambda - fit_intercept: -0.12 # pix + fit_slope: 3.795e-06 # use to compute dlam_per_pix [um/pix] as + fit_intercept: -4.659e-07 # a function of wavelength [um] + slice_width: "!INST.slice_width" + pixel_scale: "!INST.pixel_scale" + spec_binwidth: "!SIM.spectral.spectral_bin_width" - name: flux_binning description: turn per arcsec per um to ph per s From f176c84391c74cfc322543df95b6781d9effe0ca Mon Sep 17 00:00:00 2001 From: oczoske Date: Sun, 25 May 2025 10:18:37 +0200 Subject: [PATCH 5/5] add required 'v' for needs_scopesim --- METIS/default.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/METIS/default.yaml b/METIS/default.yaml index f3504a3c..64407d68 100644 --- a/METIS/default.yaml +++ b/METIS/default.yaml @@ -6,7 +6,7 @@ alias: OBS name: METIS_default_configuration description: default parameters needed for a METIS simulation status: development -needs_scopesim: "0.9" +needs_scopesim: "v0.9" date_modified: 2024-09-04 changes: - 2021-12-16 (OC) chopnod defaults to perpendicular @@ -366,7 +366,7 @@ mode_yamls: name: lms_cube description: "METIS LM-band integral-field spectroscopy, nominal mode, cube output" status: experimental - needs_scopesim: "0.10.0a1" + needs_scopesim: "v0.10.0a1" yamls: - Armazones.yaml - ELT.yaml