Skip to content

Commit

Permalink
Merge pull request spacetelescope#190 from JarronL/master
Browse files Browse the repository at this point in the history
Bar mask transmission fix for x==0 vs y==0 typo.
  • Loading branch information
mperrin authored Feb 20, 2018
2 parents 1e2b52d + 2eea86e commit 7d87f7b
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions webbpsf/optics.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import astropy.io.fits as fits
import astropy.units as units

from scipy.interpolate import griddata

from . import utils
from . import constants

Expand Down Expand Up @@ -824,7 +826,7 @@ def get_transmission(self, wave):
sigmar.clip(min=np.finfo(sigmar.dtype).tiny, max=2*np.pi, out=sigmar)
self.transmission = (1 - (np.sin(sigmar) / sigmar) ** 2)
# TODO pattern should be truncated past first sidelobe
self.transmission[x==0] = 0 # special case center point (value based on L'Hopital's rule)
self.transmission[y==0] = 0 # special case center point (value based on L'Hopital's rule)
# the bar should truncate at +- 10 arcsec:
woutside = np.where(np.abs(x) > 10)
self.transmission[woutside] = 1.0
Expand Down Expand Up @@ -1088,7 +1090,20 @@ def __init__(self, instrument, include_oversize=False, **kwargs):
field_point=self.row['field_point_name']
)
# Retrieve those Zernike coeffs (no interpolation for now)
coeffs = [self.row['Zernike_{}'.format(i)] for i in range(1, 36)]
#coeffs = [self.row['Zernike_{}'.format(i)] for i in range(1, 36)]

# Field point interpolation
v2_tel,v3_tel = telcoords_am
coeffs = []
for i in range(1,36):
zkey = 'Zernike_{}'.format(i)
zvals = self.ztable[zkey]

# Cubic interpolation of of non-uniform 2D grid
cf = griddata((v2, v3), zvals, (v2_tel, v3_tel), method='cubic').tolist()
# If outside of grid space, then use nearest neighbor
if np.isnan(cf): cf = self.row[zkey]
coeffs.append(cf)

self.zernike_coeffs = coeffs

Expand Down

0 comments on commit 7d87f7b

Please sign in to comment.