Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bar mask transmission #190

Merged
merged 5 commits into from
Feb 20, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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