From 6b7ea3341fbaaa6bb46f1107966c6f01a3e37979 Mon Sep 17 00:00:00 2001 From: Marshall Perrin Date: Tue, 20 Feb 2018 11:28:26 -0500 Subject: [PATCH] Allow FQPM image plane shifts like any other AnalyticOpticalElement; related to mperrin/webbpsf#191 --- poppy/optics.py | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/poppy/optics.py b/poppy/optics.py index 6215ee62..723efdd1 100644 --- a/poppy/optics.py +++ b/poppy/optics.py @@ -47,7 +47,8 @@ class AnalyticOpticalElement(OpticalElement): error if you try to set one. shift_x, shift_y : Optional floats Translations of this optic, given in meters relative to the optical - axis. + axis for pupil plane elements, or arcseconds relative to the optical axis + for image plane elements. rotation : Optional float Rotation of the optic around its center, given in degrees counterclockwise. Note that if you apply both shift and rotation, @@ -610,14 +611,8 @@ def get_opd(self, wave): raise ValueError("4QPM get_opd must be called with a Wavefront to define the spacing") assert (wave.planetype == _IMAGE) - # TODO this computation could be sped up a lot w/ optimzations - phase = np.empty(wave.shape) - n0 = wave.shape[0] / 2 - n0 = int(round(n0)) - phase[:n0, :n0] = 0.5 - phase[n0:, n0:] = 0.5 - phase[n0:, :n0] = 0 - phase[:n0, n0:] = 0 + y, x = self.get_coordinates(wave) + phase = (1- np.sign(x)*np.sign(y))*0.25 return phase * self.central_wavelength.to(u.meter).value