diff --git a/METIS/FPA_metis_lms_smpl_layout.dat b/METIS/FPA_metis_lms_smpl_layout.dat new file mode 100644 index 00000000..f9d36225 --- /dev/null +++ b/METIS/FPA_metis_lms_smpl_layout.dat @@ -0,0 +1,21 @@ +# name : METIS LMS H2RG-18 FPA +# author : Fabian Haberhauer +# sources: NA +# date_created : 2025-05-08 +# date_modified : 2025-05-08 +# x_cen_unit : mm +# y_cen_unit : mm +# z_cen_unit : um +# x_size_unit : pix +# y_size_unit : pix +# z_size_unit : pix +# pixel_size_unit : mm +# angle_unit : deg +# gain_unit : electron/adu +# image_plane_id : 0 +# +# changes: +# - 2025-05-08 (FH) create file +# +id x_cen y_cen z_cen x_size y_size z_size pixel_size angle gain + 0 0 0 0 109 109 5600 0.018 0.0 1.0 diff --git a/METIS/METIS_DET_IFU_SMPL.yaml b/METIS/METIS_DET_IFU_SMPL.yaml new file mode 100644 index 00000000..23b9cb80 --- /dev/null +++ b/METIS/METIS_DET_IFU_SMPL.yaml @@ -0,0 +1,83 @@ +--- +### H2RG DETECTOR +object: detector +alias: DET +name: metis_lms_detector_array +description: Simplified IFU cube detector +date_modified: 2025-05-08 +changes: + - 2025-05-08 (FH) create file as copy of METIS_DET_IFU.yaml + - 2025-05-16 (FH) update included effects + +properties: + image_plane_id: 0 + temperature: -233 + dit: "!OBS.dit" + 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: 2 + dark_current: 0.1 # [e-/s] + readout_noise: 70 # electrons, AI on RvB: check + layout: + file_name: "FPA_metis_lms_smpl_layout.dat" + qe_curve: + file_name: "QE_detector_H2RG_METIS.dat" + linearity: + file_name: "FPA_linearity_HxRG.dat" + +effects: + - name: detector_array_list + description: METIS LMS detector array list + class: DetectorList3D + kwargs: + filename: "!DET.layout.file_name" + + - name: quantum_efficiency + description: Quantum efficiency curves for each detector + class: QuantumEfficiencyCurve + kwargs: + filename: "!DET.qe_curve.file_name" + + - name: auto_exposure + description: automatic determination of DIT and NDIT + class: AutoExposure + include: True + kwargs: + fill_frac: "!OBS.auto_exposure.fill_frac" + + - name: exposure_action + description: Summing up sky signal for all DITs and NDITs + class: SummedExposure + + - name: dark_current + description: METIS LMS dark current + class: DarkCurrent + kwargs: + value: "!DET.dark_current" + + - name: shot_noise + description: apply poisson shot noise to images + class: ShotNoise + + - name: detector_linearity + description: Linearity characteristics of H2RG chips + class: LinearityCurve + include: False + kwargs: + filename: "!DET.linearity.file_name" + + - name: readout_noise + description: Readout noise frames + class: BasicReadoutNoise + kwargs: + noise_std: "!DET.readout_noise" + n_channels: 32 + + - name: ad_conversion + description: Apply gain and convert electron count into integers + class: ADConversion + include: True + kwargs: + dtype: float32 + gain: "!DET.gain" diff --git a/METIS/METIS_LMS_SMPL.yaml b/METIS/METIS_LMS_SMPL.yaml new file mode 100644 index 00000000..4984bc42 --- /dev/null +++ b/METIS/METIS_LMS_SMPL.yaml @@ -0,0 +1,67 @@ +--- +### METIS LMS NOMINAL MODE +object: instrument +alias: INST +name: METIS_LMS +description: base configuration for METIS LMS +date_modified: 2025-05-08 +changes: + - 2025-05-08 (FH) create file as copy of METIS_LMS.yaml + - 2025-05-16 (FH) remove unneeded effects, add flux binning effect + +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 + +effects: + - name: metis_lms_surfaces + description: list of extra mirrors needed for the SPEC LMS mode + class: SurfaceList + kwargs: + filename: LIST_METIS_mirrors_lms.dat + + - name: lms_efficiency + description: grating efficiency of METIS LMS + class: MetisLMSEfficiency + kwargs: + filename: "!OBS.trace_file" + wavelen: "!OBS.wavelen" + + - name: psf + description: field constant, wavelength dependent PSF for imaging mode + class: FieldConstantPSF + kwargs: + filename: "!OBS.psf_file" + 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 + +--- +### default simulation parameters needed for a METIS simulation +object: simulation +alias: SIM +name: METIS_simulation_parameters +description: RC simulation parameters which need to change for a METIS run + +properties: + spectral: + spectral_bin_width: 1E-5 # microns, defines fov wavelengths + spectral_resolution: 200000 # defines skycalc resolution 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() diff --git a/METIS/default.yaml b/METIS/default.yaml index fc10a0ad..d4648297 100644 --- a/METIS/default.yaml +++ b/METIS/default.yaml @@ -6,6 +6,7 @@ alias: OBS name: METIS_default_configuration description: default parameters needed for a METIS simulation status: development +needs_scopesim: "v0.9" date_modified: 2024-09-04 changes: - 2021-12-16 (OC) chopnod defaults to perpendicular @@ -360,6 +361,28 @@ mode_yamls: adc: false detector_readout_mode: slow + - object: observation + alias: OBS + name: lms_cube + description: "METIS LM-band integral-field spectroscopy, nominal mode, cube output" + status: experimental + needs_scopesim: "v0.10.0a1" + yamls: + - Armazones.yaml + - ELT.yaml + - METIS.yaml + - METIS_LMS_SMPL.yaml + - METIS_DET_IFU_SMPL.yaml + properties: + ins_mode: LMS_cube # use as FITS header keyword + psf_file: PSF_LM_9mag_06seeing.fits + interp_psf: False + slit: false + adc: false + trace_file: TRACE_LMS.fits + wavelen: 4.2 + detector_readout_mode: slow + --- ### default simulation parameters needed for a METIS simulation object: simulation