Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions METIS/METIS_LMS_SMPL.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -38,6 +39,17 @@ effects:
wave_key: "WAVELENG"
bkg_width: -1

- name: lsf
description: line-spread function for spectroscopic domain
class: LineSpreadFunction
kwargs:
wavelen: "!OBS.wavelen"
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
class: FluxBinning3D
Expand Down
46 changes: 46 additions & 0 deletions METIS/code/fit_ifu_dispersion.py
Original file line number Diff line number Diff line change
@@ -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()
4 changes: 2 additions & 2 deletions METIS/default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down