Skip to content

Commit

Permalink
testing of vikings field green =)
Browse files Browse the repository at this point in the history
  • Loading branch information
astronomyk committed Apr 19, 2022
1 parent 6f9bc55 commit 187a5ab
Showing 1 changed file with 37 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
from matplotlib import pyplot as plt
from matplotlib.colors import LogNorm

from scopesim import load_example_optical_train

from scopesim_templates.calibration.micado import viking_fields as vf

PLOTS = False
Expand Down Expand Up @@ -58,11 +60,45 @@ def test_load_viking_field(self):
stars = viking_src.table_fields
star_x, star_y = stars[0]["x"].data, stars[0]["y"].data

if not PLOTS:
if PLOTS:
plt.figure(figsize=(10, 10))
plt.scatter(gal_x, gal_y, c="b")
plt.scatter(star_x, star_y, c="r")
plt.show()

assert len(viking_src.fields) > 1
assert len(viking_src.fields) == len(gals) + len(stars)


class TestWithScopeSim:
def test_runs_through_scopesim_basic_instrument(self):
# configure basic_instrument to MICADO specs
opt = load_example_optical_train()
opt.cmds["!OBS.psf_fwhm"] = 0.01
opt.cmds["!TEL.area"] = 1000 * u.m**2
opt.cmds["!INST.pixel_scale"] = 0.004
opt.cmds["!INST.plate_scale"] = 0.4
opt.cmds["!DET.width"] = 4096
opt.cmds["!DET.height"] = 4096
opt.cmds["!DET.dit"] = 30
opt.cmds["!DET.ndit"] = 120

opt["source_fits_keywords"].include = False

src = vf.viking_field()
opt.observe(src)
hdul = opt.readout()[0]

imp_im = opt.image_planes[0].data
imp_im += np.min(imp_im)

if PLOTS:
plt.figure(figsize=(15, 8))
plt.subplot(121)
plt.imshow(opt.image_planes[0].data, norm=LogNorm())
plt.subplot(122)
plt.imshow(hdul[1].data, norm=LogNorm())
plt.show()

assert isinstance(imp_im, np.ndarray)
assert np.max(imp_im) > 1

0 comments on commit 187a5ab

Please sign in to comment.