#!/usr/bin/env Python3 import numpy as np import matplotlib.pyplot as plt from matplotlib.ticker import FormatStrFormatter from matplotlib.colors import LogNorm import sys sys.path.insert(0, '/Users/joost/Dropbox/Werk/PhD/Documents/Published/FourierOptics GitHub release/') from fourierOptics import * ''' Description: This script was a first attempt at simulating the concept described in Pathak et al., 2016. We apply a waffle pattern to the incoming wavefront to create artificial speckles next to the PSF core. If atmospheric dispersion is present for a broadband observation, then these speckles will point to a common intersection point outside of the PSF core. ''' plt.rc('font', family='serif') plt.rc('axes', labelsize='large') # Parameters dpix = 160 n, m = 1001, 1001 oC = [-2.5, 2.5, -2.5, 2.5] l = 1.49e-3 # wavelength lList = np.linspace(1.49e-3, 1.78e-3, 11).tolist() dispMax = 17.9e-3 / 3600 # degrees dispersion = np.linspace(0, dispMax, len(lList)).tolist() Exyz_list = [] print ('Your resolution is {}x{} with a pixel size of {}'.format(n,m,dpix)) # Start of the ELT-lens system # Initiate Fourier Optics, profile and wavefront error objects for l in lList: i = lList.index(l) print(l, dispersion[i]) fou = FourierOptics(l=l) prof = Profiles() wfe = WavefrontError(n,m) # A = prof.top_hat(38854/2, n, m, dpix=dpix, oversample=1) A = prof.ELT_pupil(n,m,dpix) # Create an input grid, equivalent to the size of ELT-M1 x, y = np.meshgrid(np.linspace(-n/2*dpix, n/2*dpix, n), np.linspace(-m/2*dpix, m/2*dpix, m)) # Create a ELT-M1 parabolic mirror M1 = ParabolicMirror(dx=0, dy=0, name='ELT-M1', CA=38854/2, f=679945) t_l = M1.phase_delay(x,y,l) U_in = A * t_l z = wfe.generate_sine_pattern(1e-4, 1e-4, 180, 180) dispersion_tilt = wfe.generate_tilt(x,y,tx=0, ty=dispersion[i]) # psd_surface = wfe.generate_height_map(30e-6, 2, 1) M1.add_wavefront_error(z+dispersion_tilt)# + psd_surface) t_l = M1.phase_delay(x,y,l) U_in2 = A * t_l # Propagating the original, unperturbed, system and calculating encircled energy Exyz_s,xs,ys = fou.fresnel_propagation(U_in2, x, y, dz=M1.f, show=False, outputCoordinates=oC) Exyz_list.append(Exyz_s) Exyz_s = np.asarray(Exyz_list).sum(axis=0) plt.imshow(np.abs(Exyz_s), cmap='hot');plt.colorbar();plt.show() plt.imshow(np.abs(Exyz_s)**2, cmap='hot', norm=LogNorm(vmin=1e-7));plt.colorbar();plt.show()