Skip to content

Commit

Permalink
Second half of upload
Browse files Browse the repository at this point in the history
  • Loading branch information
nchimitt authored Jul 7, 2021
1 parent efdac77 commit 1acb20d
Show file tree
Hide file tree
Showing 3 changed files with 572 additions and 0 deletions.
32 changes: 32 additions & 0 deletions Turbulence_Sim_v1_python/TiltOnly.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
from matplotlib import pyplot as plt
import numpy as np
import utilities as util

'''
This script shows an example case of a tilt-only simulation. Tilt-only is useful when when is considering worst case
latent effects of shifting, study of spatial statistics, etc. The parameters given are standard parameters for such
a simulation, and are infact very similar to its "full" simulation counterpart.
'''


def rgb2gray(rgb):
return np.dot(rgb[...,:3], [0.2989, 0.5870, 0.1140])


img = rgb2gray(plt.imread('chart.png'))
N = 225 # size of the image -- assumed to be square (pixels)
D = 0.1 # length of aperture diameter (meters)
L = 7000 # length of propagation (meters)
r0 = D/2 # the Fried parameter r0. Most importantly, the denominator is the desired D/r0 ratio
wvl = 0.5e-6 # the mean wavelength -- typically somewhere suitably in the middle of the spectrum will be sufficient

param_obj = util.p_obj(N, D, L, r0, wvl) # generating the parameter object, some other things are computed within this
# function, see the def for details
S = util.gen_PSD(param_obj) # finding the PSD, see the def for details
param_obj['S'] = S # appending the PSD to the parameter object for convenience

for i in range(100):
img_, _ = util.genTiltImg(img, param_obj) # generating the tilt-only image

plt.imshow(img_,cmap='gray',vmin=0,vmax=1)
plt.show()
Loading

0 comments on commit 1acb20d

Please sign in to comment.