Author: Yannick Copin y.copin@ipnl.in2p3.fr
We construct a very simple optical model mimicking the red channel of the Supernova Integral Field Spectrograph.
In [1]:
%load_ext autoreload
%autoreload 2
%matplotlib inline
import mpld3
mpld3.enable_notebook()
In [2]:
import warnings
warnings.filterwarnings("ignore")
import numpy as N
from spectrogrism import spectrogrism as S
from spectrogrism import snifs
Load the SNIFS-R channel optical configuration:
In [3]:
optcfg = snifs.SNIFS_R
print(optcfg)
Load the simulation configuration:
In [4]:
simcfg = snifs.SNIFS_SIMU
print(simcfg)
Create a Spectrograph
instance from optical configuration:
In [5]:
spectro = S.Spectrograph(optcfg)
print(spectro)
Test the optical model:
In [6]:
if not spectro.test(simcfg.get_wavelengths(optcfg), verbose=False):
print "ERROR: backward modeling does not match."
else:
print " SUCCESSFUL ROUND-TRIP TEST ".center(70, '-')
Simulate spectra on the detector and plot:
In [7]:
detector = spectro.predict_positions(simcfg)
ax = detector.plot(modes=(-1, 0, 1, 2), blaze=True)
ax.set_aspect('auto')
ax.axis(N.array([-2000, 2000, -4000, 4000]) *
spectro.detector.pxsize / 1e-3) # [mm]
ax.figure.set_size_inches(12, 10)
This sequence of actions is readily available under snifs.plot_SNIFS()
function.