Skip to content

Commit

Permalink
Grism shift tests
Browse files Browse the repository at this point in the history
  • Loading branch information
andykee committed Jun 21, 2020
1 parent c96deef commit 7b442c0
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/plane/test_grism.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import numpy as np
import lentil


def test_grism_center():
dispersion = [1, 650e-9]
trace = [2, 0]
grism = lentil.Grism(dispersion=dispersion, trace=trace)

x0 = np.random.uniform(low=-5, high=5)
y0 = np.random.uniform(low=-5, high=5)
x, y = grism.shift(wavelength=650e-9, xs=x0, ys=y0)
assert np.all((x == x0, y == y0))


def test_grism_shift():
grism = lentil.Grism()
grism.trace = [1, 1]
grism.dispersion = [1, 650e-9]
wave = 900e-9
x, y = grism.shift(wavelength=wave)

assert x == (wave - grism.dispersion[1])/np.sqrt(2)
assert y == 1+x

0 comments on commit 7b442c0

Please sign in to comment.