AstarVienna/ScopeSim

Add IFU (/ METIS LMS) tests and notebooks

Opened this issue · 1 comments

ScopeSim has proper IFU support since #258 is merged.

However, this is now broken, because we have no tests or demo notebooks for this feature, neither here nor in the irdb.

E.g., based on the comment in #258, we need something like

import scopesim as sim
from astropy import units as u
from matplotlib import pyplot as plt

cmd = sim.UserCommands(use_instrument="METIS", set_modes=['lms'],
                       properties={"!OBS.wavelen": 3.555})
lms = sim.OpticalTrain(cmd)
src = sim.source.source_templates.star(flux=0.01 * u.Jy, x=0, y=0)

lms.observe(src, update=True)
ip = lms.image_planes[0]
plt.imshow(ip.data)

hdul = lms.readout(exptime=3600.)[0]
data_raw = hdul[1].data
plt.imshow(data_raw)

rectified = lms["lms_spectral_traces"].rectify_cube(hdul)
plt.imshow(rectified.data[3,:,:])
plt.imshow(rectified.data[:,3,:])
plt.imshow(rectified.data[:,:,3])

This code works with 2027780 and AstarVienna/irdb@ce56795 , but not with dev_master.

So we should perhaps just start with the above in a notebook in the IRDB and then patch ScopeSim till this works again. Then after that we can add proper tests to ScopeSim itself.

The first exception that is triggered is due to the missing/broken updates to from_currsys as described in #372 (comment) :

ValueError: !-string filename should be resolved upstream: !OBS.trace_file