Skip to content

Commit

Permalink
update opd thermal slew test, in particular for a change in /jwpupil_…
Browse files Browse the repository at this point in the history
…segments.fits
  • Loading branch information
mperrin committed Jan 6, 2021
1 parent aaca6cf commit 9ef7497
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
1 change: 1 addition & 0 deletions webbpsf/opds.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ def __init__(self, name='unnamed OPD', opd=None, opd_index=0, transmission=None,

full_seg_mask_file = os.path.join(utils.get_webbpsf_data_path(), segment_mask_file)
self._segment_masks = fits.getdata(full_seg_mask_file)
self._segment_masks_version = fits.getheader(full_seg_mask_file)['VERSION']

# Where are the centers of each segment? From OTE design geometry
self._seg_centers_m = {seg[0:2]: np.asarray(cen)
Expand Down
22 changes: 19 additions & 3 deletions webbpsf/tests/test_opds.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,27 @@ def test_thermal_slew_partial_angle():

def test_thermal_slew_update_opd():
''' Test that running webbpsf.opds.OTE_Linear_Model_WSS.thermal_slew() will
give the expected output'''
give the expected output
'''
otelm = webbpsf.opds.OTE_Linear_Model_WSS()
otelm.thermal_slew(delta_time=1.0*u.day, case='EOL')
max_truth = 4.13338e-08 / 1e-9 # Convert the max truth to units of nm
assert np.isclose(np.max(otelm.opd)/1e-9, max_truth), "OPD max does not match expected value after 1 day slew."

# the exact value expected is affected by which version of the linear model is used.
if otelm._segment_masks_version < 3:
# rev V pupil segment mask file, labeled as VERSION=2 in jwpupil_segments.fits
expected_max = 41.3338 # nanometers, expected value for peak.
# value derived by kjbrooks based on thermal model coefficients
expected_rms = 11.13 # nm
# value derived by mperrin based on evaluation of opd map in this case
else:
# rev W pupil segment mask file, labeled as VERSION=3 in jwpupil_segments.fits
# Values here are by mperrin based on evaluation of the same exact linear model code as above
# changing only the data file $WEBBPSF_DATA/jwpupil_segments.fits to the newer version
expected_max = 40.7763 # nanometers, expected value for peak
expected_rms = 11.24 # nm
assert np.isclose(np.max(otelm.opd)/1e-9, expected_max, rtol=1e-3), "OPD max does not match expected value after 1 day slew."
assert np.isclose(otelm.rms(), expected_rms, rtol=1e-3), "OPD rms does not match expected value after 1 day slew."


def test_thermal_slew_reproducibility():
Expand Down

0 comments on commit 9ef7497

Please sign in to comment.