-
Notifications
You must be signed in to change notification settings - Fork 10
Add simplified virtual cube readout mode to METIS #233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 19 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
cc541ab
Add "lms_cube" mode to METIS
teutoburg cd2c6ac
Create METIS_LMS_SMPL.yaml
teutoburg fffe4d1
Create METIS_DET_IFU_SMPL.yaml
teutoburg fe86c66
Create FPA_metis_lms_smpl_layout.dat
teutoburg 90fd6cb
Update METIS_LMS_SMPL.yaml
teutoburg 23eeaf6
Fix dates
teutoburg 121dd51
Re-include atmosphere
teutoburg 61a071b
Update METIS_DET_IFU_SMPL.yaml
teutoburg a29d2a5
Fix gain
teutoburg 28ea2aa
Add flux binning effect
teutoburg 29bfae9
wip
teutoburg b7b9a4c
Re-include ADConversion and AutoExposure
teutoburg 4ab7758
Include LineSpreadFunction
oczoske 34ede17
Slice width explicit (somewhat redundant)
oczoske e2ae38c
script to compute dispersion fit parameters
oczoske 9ff9615
Complete parameters for LSF
oczoske f176c84
add required 'v' for needs_scopesim
oczoske aa14b62
LSF effect description for mode `lms_cube` (#236)
oczoske 55f06ae
Fix ins_mode, add psf switch
teutoburg 3e2a4f2
Output float32
oczoske 5e25011
Merge branch 'dev_master' into fh/simple-ifu
teutoburg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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: uint16 | ||
teutoburg marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| gain: "!DET.gain" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.