<jupyter_start><jupyter_text>Aberrating the JWST segments on the OTE<jupyter_code>import os
import astropy.units as u
import matplotlib
%matplotlib inline
from matplotlib.colors import LogNorm
import matplotlib.pyplot as plt
import numpy as np
import webbpsf

from pastis.config import CONFIG_PASTIS
from pastis.e2e_simulators import webbpsf_imaging
import pastis.util<jupyter_output><empty_output><jupyter_text>Get your coro images<jupyter_code>jwst = webbpsf_imaging.set_up_nircam()    # this returns a tuple of two: jwst[0] is the nircam object, jwst[1] its ote
jwst[0].image_mask = CONFIG_PASTIS.get('JWST','focal_plane_mask')
plt.figure(figsize=(20,10))
direct = jwst[0].calc_psf(nlambda=1, display=True)
direct_psf = direct[0].data
norm = direct_psf.max()
plt.figure(figsize=(10,10))
plt.imshow(direct_psf, norm=LogNorm())
plt.colorbar()
webbpsf_imaging.display_ote_and_psf(jwst[0], jwst[1], psf_vmax=1e-6, title='Unaberrated OTE')<jupyter_output><empty_output><jupyter_text>Aberrate a segment pair<jupyter_code>#jwst[1].zero(zero_original=True)
jwst[1].zero()
jwst[1].move_seg_local('B6', piston=100, trans_unit='nm')
jwst[1].move_seg_local('B3', piston=100, trans_unit='nm')
webbpsf_imaging.display_ote_and_psf(jwst[0], jwst[1], psf_vmax=1e-6, title='Tilt one segment')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1262433052792655, 'fraction_numerical': 0.026778882938026015, 'mean_word_length': 9.299212598425196, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '44356', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 563, 'n_tokens_neox': 541, 'n_words': 93, 'path': 'notebooks/JWST and WebbPSF/3b_Aberrating the OTE segments.ipynb', 'repo_name': 'spacetelescope/PASTIS', 'size': '1307'}