Skip to content

Commit

Permalink
minor
Browse files Browse the repository at this point in the history
  • Loading branch information
astronomyk committed Oct 12, 2022
1 parent 683e959 commit acfaba6
Showing 1 changed file with 48 additions and 49 deletions.
97 changes: 48 additions & 49 deletions scopesim_templates/tests/test_micado/test_spectral_calibrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,52 +49,51 @@ def test_returns_a_smoothed_spectrum(self):
assert flux1.max() > flux2.max()
assert flux1.sum() == approx(flux2.sum(), rel=2e-2)

def test_micado_lines(self):

import numpy as np
from astropy import units as u
from matplotlib import pyplot as plt
from matplotlib.colors import LogNorm

import scopesim as sim

sim.rc.__config__["!SIM.file.local_packages_path"] = "F:/Work/irdb"

cmds = sim.UserCommands(use_instrument="MICADO",
set_modes=["SCAO", "SPEC_3000x20"])
cmds["!OBS.dit"] = 3600 # [s] Exposure time (more or less)
cmds["!OBS.filter_name_fw1"] = "Spec_HK" # Spec_IJ, Spec_HK
cmds["!OBS.filter_name_fw2"] = "open"
cmds["!SIM.spectral.spectral_bin_width"] = 1e-4

micado = sim.OpticalTrain(cmds)

# Turn off the effects that are not needed (see below for more on this)
micado["skycalc_atmosphere"].include = False
micado["telescope_reflection"].include = False

# Set to False to test if everything is working, then flip to True
USE_FULL_DETECTOR = False
micado["full_detector_array"].include = USE_FULL_DETECTOR
micado["detector_window"].include = not USE_FULL_DETECTOR

src_lines = mic_sc.line_list(unit_flux=3e23, dwave=1e-1, smoothing_fwhm=None)

micado.observe(src_lines)

plt.figure(figsize=(15, 15))
plt.imshow(micado.image_planes[0].data, norm=LogNorm())
plt.colorbar()
plt.show()

fl = micado.fov_manager._fovs_list
for fov in fl[1:3]:
w = fov.spectra[0].model.points[0]
f = fov.spectra[0].model.lookup_table
plt.plot(w, f)
plt.show()

plt.figure(figsize=(15, 15))
plt.imshow(fl[3].cube.data.sum(axis=1), norm=LogNorm())
plt.show()

# def test_micado_lines(self):
#
# import numpy as np
# from astropy import units as u
# from matplotlib import pyplot as plt
# from matplotlib.colors import LogNorm
#
# import scopesim as sim
#
# sim.rc.__config__["!SIM.file.local_packages_path"] = "F:/Work/irdb"
#
# cmds = sim.UserCommands(use_instrument="MICADO",
# set_modes=["SCAO", "SPEC_3000x20"])
# cmds["!OBS.dit"] = 3600 # [s] Exposure time (more or less)
# cmds["!OBS.filter_name_fw1"] = "Spec_HK" # Spec_IJ, Spec_HK
# cmds["!OBS.filter_name_fw2"] = "open"
# cmds["!SIM.spectral.spectral_bin_width"] = 1e-4
#
# micado = sim.OpticalTrain(cmds)
#
# # Turn off the effects that are not needed (see below for more on this)
# micado["skycalc_atmosphere"].include = False
# micado["telescope_reflection"].include = False
#
# # Set to False to test if everything is working, then flip to True
# USE_FULL_DETECTOR = False
# micado["full_detector_array"].include = USE_FULL_DETECTOR
# micado["detector_window"].include = not USE_FULL_DETECTOR
#
# src_lines = mic_sc.line_list(unit_flux=3e23, dwave=1e-1, smoothing_fwhm=None)
#
# micado.observe(src_lines)
#
# plt.figure(figsize=(15, 15))
# plt.imshow(micado.image_planes[0].data, norm=LogNorm())
# plt.colorbar()
# plt.show()
#
# fl = micado.fov_manager._fovs_list
# for fov in fl[1:3]:
# w = fov.spectra[0].model.points[0]
# f = fov.spectra[0].model.lookup_table
# plt.plot(w, f)
# plt.show()
#
# plt.figure(figsize=(15, 15))
# plt.imshow(fl[3].cube.data.sum(axis=1), norm=LogNorm())
# plt.show()

0 comments on commit acfaba6

Please sign in to comment.