From 7cbaec6ff9e8091ec1336ad7ab9a7665b8187e60 Mon Sep 17 00:00:00 2001 From: yosata Date: Tue, 2 Aug 2022 20:01:24 +0200 Subject: [PATCH] Added descriptions to all scripts, checked functioning --- demonstration scripts/fixing_things.py | 23 ----- .../generate_PSF_with_WFE.py | 10 +- .../generate_bahtinov_dispersion.py | 14 ++- demonstration scripts/generate_field.py | 21 ++-- .../generate_propagation_figures.py | 9 +- .../thesis_propagation_figures.py | 16 +-- .../__pycache__/optics.cpython-39.pyc | Bin 25089 -> 25089 bytes scripts/ELT_off_axis_test.py | 6 +- scripts/ELT_wfe_analysis.py | 45 +++++---- scripts/MICADO_ADC_with_WFE.py | 10 +- scripts/MICADO_paraxial_system_dispersion.py | 28 +++--- .../Thesis/generate_fp_wfe_phase_array.py | 3 - scripts/SPIE/Thesis/geometric_distortions.py | 2 - .../Thesis/geometric_distortions_fp_wfe.py | 10 -- ...geometric_distortions_fp_wfe_continuous.py | 2 - .../geometric_distortions_incl_rotations.py | 1 - scripts/SPIE/Thesis/plotting_detectors.py | 1 - .../plotting_geometric_distortions_IFP.py | 2 - ...plotting_geometric_distortions_IFP_zern.py | 1 - .../SPIE/Thesis/retrieving_average_tilt.py | 9 +- scripts/SPIE/centroid_shift_analysis.py | 2 +- scripts/SPIE/generate_ADC_footprint.py | 2 +- scripts/SPIE/generate_ADC_input_field.py | 2 +- scripts/SPIE/generate_ray_trace_plot.py | 2 +- scripts/SPIE/generate_strehl_relation.py | 2 +- scripts/SPIE/generate_wfe.py | 1 - scripts/SPIE/geometric_distortions.py | 2 - .../geometric_distortions_incl_rotations.py | 1 - scripts/SPIE/plot_centroid_shift.py | 2 +- scripts/SPIE/plot_geometric_distortions.py | 2 +- scripts/SPIE/plot_strehl.py | 2 +- scripts/SPIE/plot_wfe_analysis.py | 2 +- .../wavefront_error_frequency_analysis.py | 2 +- scripts/annular_mask_lens.py | 22 +++-- scripts/artificial_speckles_test.py | 13 ++- .../gratama_seeing_limited_dispersion_test.py | 93 ++---------------- scripts/high_contrast_imager.py | 10 +- scripts/movie_atm_dispersion.py | 14 +-- scripts/off_axis_test.py | 10 +- scripts/planewave_rotation_test.py | 11 ++- scripts/planewave_rotation_test_2020.py | 18 +++- scripts/planewave_rotation_test_2020_2.py | 19 +++- scripts/psd_filtering_ELT_equiv.py | 14 +-- scripts/psd_filtering_ELT_zernikes.py | 9 +- scripts/psd_scaling_test.py | 8 +- scripts/psd_scaling_test_ELT_equiv.py | 3 +- scripts/simple_lens_system.py | 26 +++-- scripts/verify_strehl.py | 10 +- 48 files changed, 262 insertions(+), 255 deletions(-) delete mode 100644 demonstration scripts/fixing_things.py diff --git a/demonstration scripts/fixing_things.py b/demonstration scripts/fixing_things.py deleted file mode 100644 index 86dd445..0000000 --- a/demonstration scripts/fixing_things.py +++ /dev/null @@ -1,23 +0,0 @@ -import numpy as np -import sys -sys.path.insert(0, '/Users/joost/Dropbox/Werk/PhD/Documents/Published/FourierOptics GitHub release/') -# sys.path.insert(0, '/Users/joost/Dropbox/Werk/PhD/Analyses/Python/Analytical/Fourier Optics') -from fourierOptics import * - -if __name__ == '__main__': - # Initiate MICADO paraxial model - mcd = ParaxialMICADO() - # mcd.plot_ray_trace() - - print(mcd.platescale) - # Initiate WFE object - wfe = WavefrontError(mcd.n, mcd.m) - - # Generate PSD surfaces - psd = wfe.generate_height_map(200e-6, 2, 1) - - # Add it to ADC-P1 - mcd.ELT_ADC.p1.add_wavefront_error(psd) - - # Generate the PSF and plot it - E, x, y = mcd.propagate(l=1.35e-3,surface=-1, zoom=True, show=True) # image_output=[-.4,.4,-.4,.4] \ No newline at end of file diff --git a/demonstration scripts/generate_PSF_with_WFE.py b/demonstration scripts/generate_PSF_with_WFE.py index 745a763..d83ae60 100644 --- a/demonstration scripts/generate_PSF_with_WFE.py +++ b/demonstration scripts/generate_PSF_with_WFE.py @@ -1,8 +1,16 @@ import numpy as np import sys -sys.path.insert(0, '/Users/joost/Dropbox/Werk/PhD/Analyses/Python/Analytical/Fourier Optics') +sys.path.insert(0, '/Users/joost/Dropbox/Werk/PhD/Documents/Published/FourierOptics GitHub release/') from fourierOptics import * +''' + Description: + This script generates a point spread function of the MICADO optical model. + During the setup a wavefront error of 200 nm RMS is added to the first + prisms of the MICADO atmospheric dispersion corrector. +''' + + if __name__ == '__main__': # Initiate MICADO paraxial model mcd = ParaxialMICADO() diff --git a/demonstration scripts/generate_bahtinov_dispersion.py b/demonstration scripts/generate_bahtinov_dispersion.py index dbae72b..43ca057 100644 --- a/demonstration scripts/generate_bahtinov_dispersion.py +++ b/demonstration scripts/generate_bahtinov_dispersion.py @@ -1,9 +1,21 @@ import numpy as np import sys -sys.path.insert(0, '/Users/joost/Dropbox/Werk/PhD/Analyses/Python/Analytical/Fourier Optics') +sys.path.insert(0, '/Users/joost/Dropbox/Werk/PhD/Documents/Published/FourierOptics GitHub release/') from fourierOptics import * +''' + Description: + This script generates a point spread function of the MICADO optical model. + Here we apply a Bahtinov mask to the pupil and simulate a broadband PSF, + done through the summation of multiple (here: 15) wavelength slices. + When there is atmospheric dispersion, the diffraction speckles created by the + Bahtinov mask will start to point to a location outside the zeroth order + PSF core. + Here, atmospheric dispersion is modelled as a wavelength dependent phase + tilt. +''' + if __name__ == '__main__': # Initiate MICADO paraxial model mcd = ParaxialMICADO() diff --git a/demonstration scripts/generate_field.py b/demonstration scripts/generate_field.py index 5eb02c4..2c632eb 100644 --- a/demonstration scripts/generate_field.py +++ b/demonstration scripts/generate_field.py @@ -1,8 +1,17 @@ import numpy as np import sys -sys.path.insert(0, '/Users/joost/Dropbox/Werk/PhD/Analyses/Python/Analytical/Fourier Optics') +sys.path.insert(0, '/Users/joost/Dropbox/Werk/PhD/Documents/Published/FourierOptics GitHub release/') from fourierOptics import * -from pdb import set_trace + + +''' + Description: + This script generates nine points in a small field to illustrate the + most basic form of off-axis propagation. + For larger off-axis distances the hx and hy values should directly + be supplied to the propagate function. +''' + def field_angle(hx, hy): fx = hx * 0.0075 @@ -14,14 +23,6 @@ if __name__ == '__main__': # Initializing MICADO paraxial model mcd = ParaxialMICADO() wfe = WavefrontError(mcd.n, mcd.m) - - # Uncomment to load in WFE (coma) - # Problem here is that the field of view is too small to see - # a radial effect... - # xin, yin = load_variable('../adc_data_coordinates.pkl') - # adcObj = ADC_surfaces(xin,yin) - # zern = wfe.zernike_cartesian([0,0,0,0,0,0,0,100e-5], adcObj.xz, adcObj.yz, rescale=False) - # mcd.ELT_ADC.p1.add_wavefront_error(zern) # Setup l = 1.49e-3 diff --git a/demonstration scripts/generate_propagation_figures.py b/demonstration scripts/generate_propagation_figures.py index 922a09e..81a0a20 100644 --- a/demonstration scripts/generate_propagation_figures.py +++ b/demonstration scripts/generate_propagation_figures.py @@ -1,9 +1,14 @@ import numpy as np import sys -sys.path.insert(0, '/Users/joost/Dropbox/Werk/PhD/Analyses/Python/Analytical/Fourier Optics') +sys.path.insert(0, '/Users/joost/Dropbox/Werk/PhD/Documents/Published/FourierOptics GitHub release/') from fourierOptics import * import matplotlib.pyplot as plt -from pdb import set_trace + +''' + Description: + This script generates the amplitude and phase information of all surfaces + in the MICADO paraxial model in a nicely presented form. +''' if __name__ == '__main__': plt.rc('font', family='serif') diff --git a/demonstration scripts/thesis_propagation_figures.py b/demonstration scripts/thesis_propagation_figures.py index 5a2715c..7901698 100644 --- a/demonstration scripts/thesis_propagation_figures.py +++ b/demonstration scripts/thesis_propagation_figures.py @@ -1,10 +1,16 @@ import numpy as np import sys -# sys.path.insert(0, '/Users/joost/Dropbox/Werk/PhD/Analyses/Python/Analytical/Fourier Optics') sys.path.insert(0, '/Users/joost/Dropbox/Werk/PhD/Documents/Published/FourierOptics GitHub release/') from fourierOptics import * import matplotlib.pyplot as plt -from pdb import set_trace + +''' + Description: + This script generates the amplitude and phase information of all surfaces + in the MICADO paraxial model in a nicely presented form. +''' + + if __name__ == '__main__': plt.rc('font', family='serif') @@ -13,13 +19,9 @@ if __name__ == '__main__': # Initiate MICADO paraxial model mcd = ParaxialMICADO(n=3001, m=3001, dpix=50) - # Generate the PSF and plot it - # E, x, y = mcd.propagate(l=1.35e-3,surface=-1, zoom=True, show=True, save='all') - confList = [ ( 1, [-0.4, 0.4, -0.4, 0.4], '02_fourier_ELT-IFP.pdf'), ( 2, [-50, 50, -50, 50], '03_fourier_ELT-COL.pdf'), ( 4, [-50, 50, -50, 50], '04_fourier_ELT-MCD-ADC-P2.pdf'), - # (-1, [-1.2, 1.2, -1.2, 1.2], '05_fourier_ELT-MCD-DET.pdf')] (-1, [-1.2/2.669, 1.2/2.669, -1.2/2.669, 1.2/2.669], '05_fourier_ELT-MCD-DET.pdf')] @@ -50,4 +52,4 @@ if __name__ == '__main__': _fig.colorbar(_im2, ax=_ax2, label='Phase') plt.tight_layout() # plt.savefig('01_fourier_ELT-M1.pdf', bbox_inches='tight', transparent=True) - plt.close()#show() \ No newline at end of file + plt.show() \ No newline at end of file diff --git a/fourierOptics/__pycache__/optics.cpython-39.pyc b/fourierOptics/__pycache__/optics.cpython-39.pyc index 83ef3f58595da1d097cb06d724281582bf9d75ae..143ed2f5423c155634f953f8d708ddf65ced5f5e 100644 GIT binary patch delta 22 ccmZoX!q|9(kvox>mx}=iPU^ng$o(x5082s#4*&oF delta 22 ccmZoX!q|9(kvox>mx}=i1RWo4