-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
572 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
Oops, something went wrong.