Added descriptions to all scripts, checked functioning

This commit is contained in:
yosata committed 2022-08-02 20:01:24 +02:00
1 parent 9ce4b7045f
commit 7cbaec6ff9
48 files changed
+262 -255

No files matched your search

+14 -8
View File
@@ -1,12 +1,21 @@
#!/usr/bin/env Python3
import numpy as np
from pdb import set_trace
import matplotlib.pyplot as plt
from matplotlib.ticker import FormatStrFormatter
from matplotlib.colors import LogNorm
import time
import sys
sys.path.insert(0, '/Users/joost/Dropbox/Werk/PhD/Documents/Published/FourierOptics GitHub release/')
from fourierOptics import *
'''
Description:
This script looks how the PSF behaves for an annular lens.
Specifically at 30 microns. After plotting the PSF at the
focal length, a cross section of the intensity profile
at different distances from the lens is shown.
'''
if __name__ == '__main__':
plt.rc('font', family='serif')
plt.rc('axes', labelsize='large')
@@ -27,30 +36,27 @@ if __name__ == '__main__':
# Initiate the profiles class and pick a profile (tophat, obscured tophat or spider)
prof = Profiles()
A = prof.obscured_top_hat(2.5, 2.3, n, m, dpix=dpix, oversample=1)
A = prof.obscured_top_hat(2.5, 2.3, n, m, dpix=dpix)
plt.imshow(A); plt.show()
# Create an input grid
x, y = np.meshgrid(np.linspace(-n/2*dpix, n/2*dpix, n), np.linspace(-m/2*dpix, m/2*dpix, m))
# Create a lens with a focal length ~100 mm, with a clear aperture radius of 4 mm and thickness of 1 mm.
L1 = LensObject('N-BK7', 50, 1e99, 1, 4, name='L1')
L1 = SphericalLens('N-BK7', R1=50, R2=1e99, thickness=1, CA=8, name='L1')
print('Focal length of lens {} is {:.1f} mm.'.format(L1.name, L1.f))
# Calculate the phase delay introduced by the lens
t_l = L1.phase_delay(x,y,l, paraxial=True)
U_in = A * t_l
# Performing the propagation using Fresnel approximation to the focal plane.
oC = [x.min(), x.max(), y.min(), y.max()]
savename = False
Exyz_og,_,_ = fou.fresnel_propagation(U_in, x, y, dz=L1.f, show=True, save=savename, outputCoordinates=oC)
# Plotting the Modulation Transfer Function of this lens system
E1, fx1, fy1 = fou.modulation_transfer_function(np.abs(Exyz_og)**2, x,y,dpix)
plt.figure()
plt.plot(fx1[1000:], E1[1000, 1000:],'b-')