Skip to content

Commit

Permalink
Update demo.py
Browse files Browse the repository at this point in the history
  • Loading branch information
mao114 authored Jan 20, 2022
1 parent 40ba604 commit 7a64201
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
'''

from simulator import Simulator
from turbStats import tilt_mat, corr_mat
from turbStats import tilt_mat, corr_mat, get_r0
import matplotlib.pyplot as plt
import torch

Expand All @@ -39,11 +39,19 @@
x = x.transpose((2,0,1))
x = torch.tensor(x, device = device, dtype=torch.float32)

D = 0.1
L = 3000
# r0 can also be calculated from Cn2 and L using the get_r0 function:
# r0 = get_r0(Cn2, L)
r0 = 0.05
L = 3000
im_size = x.shape[1] # The current version works for square image only

# Generate correlation matrix for tilt. Do this once for each different turbulence parameter.
tilt_mat(x.shape[1], 0.1, 0.05, 3000)
tilt_mat(im_size, D, r0, L)

# Simulate
simulator = Simulator(2, 512).to(device, dtype=torch.float32)
simulator = Simulator(D/r0, im_size).to(device, dtype=torch.float32)

out = simulator(x).detach().cpu().numpy()

Expand Down

0 comments on commit 7a64201

Please sign in to comment.