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
2 changes: 2 additions & 0 deletions ZShooter_v2/ZShooter_ALTDETECT.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,5 @@ properties:
dark_k: 0.006388888888888889 # 23 e/hour/pixel
excess_noise_factor_k: 1.0
avalanche_gain_k: 1
x_size_k: 2048
y_size_k: 2048
50 changes: 50 additions & 0 deletions ZShooter_v2/ZShooter_ALTDETECT4k.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Alternative detector engineering package; optical prescription is unchanged.
object: detector
alias: DET
name: zshooter_alternative_detectors_4k
properties:
detector_mode: SPEC_ALTDETECT4K
detector_type_b: CCD
ron_b: 2.5
dark_b: 0.0005555555555555556 # 2 e/hour/pixel
qe_class_b: SpectralQuantumEfficiency
qe_kwargs_b:
filename: detector_specs/ccd_uv_enhanced_TER.dat
detector_type_g: CCD
ron_g: 2.5
dark_g: 0.0005555555555555556 # 2 e/hour/pixel
qe_class_g: SpectralQuantumEfficiency
qe_kwargs_g:
filename: detector_specs/ccd_ml_uv_enhanced_TER.dat
detector_type_r: CCD
ron_r: 2.5
dark_r: 0.0005555555555555556 # 2 e/hour/pixel
qe_class_r: SpectralQuantumEfficiency
qe_kwargs_r:
filename: detector_specs/ccd_ml2_uv_enhanced_hirho_TER.dat
detector_type_yj: H2RG
pixel_size_yj: 0.018
pixel_scale_yj: 0.1884654 # Same 10.4703 arcsec/mm camera plate scale
usable_well_yj: 60000
ron_yj: 6.0
dark_yj: 0.006388888888888889 # 23 e/hour/pixel
excess_noise_factor_yj: 1.0
avalanche_gain_yj: 1
detector_type_h: H2RG
pixel_size_h: 0.018
pixel_scale_h: 0.1884654 # Same 10.4703 arcsec/mm camera plate scale
usable_well_h: 60000
ron_h: 6.0
dark_h: 0.006388888888888889 # 23 e/hour/pixel
excess_noise_factor_h: 1.0
avalanche_gain_h: 1
detector_type_k: H4RG
pixel_size_k: 0.010
pixel_scale_k: 0.104703 # Same 10.4703 arcsec/mm camera plate scale
usable_well_k: 60000
ron_k: 6.0
dark_k: 0.006388888888888889 # 23 e/hour/pixel
excess_noise_factor_k: 1.0
avalanche_gain_k: 1
x_size_k: 4096
y_size_k: 4096
8 changes: 5 additions & 3 deletions ZShooter_v2/ZShooter_DET.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ properties :
plate_scale_yj: 10.4703
plate_scale_h: 10.4703
plate_scale_k: 10.4703
x_size_k: 2048
y_size_k: 2048
# tapered_qe_example:
# enabled: False
# description: >
Expand Down Expand Up @@ -320,7 +322,7 @@ effects :
detector: "!DET.detector_type_h"

- name: detector_k
description: Single 2k x 2k detector for ZShooter_v2 K arm
description: Single detector for ZShooter_v2 K arm
include: True
class: DetectorList
kwargs:
Expand All @@ -331,8 +333,8 @@ effects :
id: [5]
x_cen: [0.0]
y_cen: [0.0]
x_size: [2048]
y_size: [2048]
x_size: ["!DET.x_size_k"]
y_size: ["!DET.y_size_k"]
pixel_size: ['!DET.pixel_size_k']
angle: [0.0]
gain: [1.0]
Expand Down
9 changes: 9 additions & 0 deletions ZShooter_v2/default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,15 @@ mode_yamls:
- ZShooter_DET.yaml
- ZShooter_ALTDETECT.yaml

- object: instrument
alias: OBS
name: SPEC_ALTDETECT4K
description: "Editable alternative detector engineering package"
yamls:
- ZShooter_SPEC.yaml
- ZShooter_DET.yaml
- ZShooter_ALTDETECT4k.yaml

- object: instrument
alias: OBS
name: IMAGER
Expand Down
27 changes: 27 additions & 0 deletions ZShooter_v2/tests/test_detector_modes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from pathlib import Path

import numpy as np
import pytest
import scopesim as sim


@pytest.mark.parametrize('mode,detector_type,pitch,size', [('SPEC', 'LmAPD', .015, 2048), ('SPEC_ALTDETECT', 'H2RG', .018, 2048), ('SPEC_ALTDETECT4K', 'H4RG', .010, 4096)])
def test_k_detector_mode_reaches_geometry_and_readout_metadata(monkeypatch, mode, detector_type, pitch, size):
root = Path(__file__).resolve().parents[2]
monkeypatch.setitem(sim.rc.__config__, '!SIM.file.local_packages_path', str(root))
commands = sim.UserCommands(use_instrument='ZShooter_v2', set_modes=[mode], properties={'!OBS.mjdobs': 60310.25})
ignore = ['atmo_transmission', 'continuum_emission', 'airglow_and_interline_continuum', 'adc_residuals']
for document in commands.yaml_dicts:
if 'effects' in document:
document['effects'] = [effect for effect in document['effects'] if effect['name'] not in ignore]
train = sim.OpticalTrain(commands)
assert train.cmds['!DET.detector_mode'] == mode
detector, = train.detector_managers[5]
header = detector._native_header
assert header['DETMODE'] == mode
assert header['DETTYPE'] == detector_type
assert (header['NAXIS1'], header['NAXIS2']) == (size, size)
np.testing.assert_allclose(abs(header['CDELT1D']), pitch)
np.testing.assert_allclose(abs(header['CDELT2D']), pitch)
traces = train['trace_list_analytical'].spectral_traces
assert len([trace for trace in traces.values() if trace.meta['image_plane_id'] == 5]) == 8
2 changes: 1 addition & 1 deletion ZShooter_v2/traces/echelle_trace_parameters.dat
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ g 1 1 85 30 430 650 18000
r 2 2 56 20 650 980 18000 65.6 225 270 4.46 0.7 10.4703 10 !DET.pixel_size_r 2048 4096 50.150 625 10 x 14.10 -6.00 -2.867205 -5.372810 1500 1250 0.5306
yj 3 3 80 23 960 1340 18000 65.6 225 270 4.46 0.7 10.4703 10 !DET.pixel_size_yj 2048 2048 24.000 350 10 x 10.90 -5.00 -0.441923 -3.921145 1500 1250 0.5306
h 4 4 51 10 1470 1830 18000 65.6 225 270 4.46 0.7 10.4703 10 !DET.pixel_size_h 2048 2048 24.000 300 10 x 13.70 -6.10 -2.474361 -4.610933 1500 1250 0.5306
k 5 5 38 8 1990 2450 18000 65.6 225 270 4.46 0.7 10.4703 10 !DET.pixel_size_k 2048 2048 24.000 270 10 x 16.80 -6.50 -0.621554 -5.307695 1500 1250 0.5306
k 5 5 38 8 1990 2450 18000 65.6 225 270 4.46 0.7 10.4703 10 !DET.pixel_size_k !DET.x_size_k !DET.y_size_k 24.000 270 10 x 16.80 -6.50 -0.621554 -5.307695 1500 1250 0.5306