-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinet_recon_medium_noise.py
More file actions
98 lines (61 loc) · 3.06 KB
/
inet_recon_medium_noise.py
File metadata and controls
98 lines (61 loc) · 3.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
import numpy as np
import torch
import matplotlib.pyplot as plt
from inversionnet import *
if __name__ == "__main__":
with torch.no_grad():
dev = torch.device('cuda:0')
inet = InversionNet().to(dev)
inet.load_state_dict(torch.load("Networks/inet_medium_noise.pth"))
inet.eval()
std = 6e-5
nb = 5
p_np = np.load("Measurements/type_d_wave_offset.npy")
p_np += std*np.random.standard_normal(p_np.shape)
x_np = 0*np.load("Initial_Guesses/type_d_initial_guess.npy")+ 1.5
for b in range(nb):
p = torch.from_numpy(p_np[b::nb,:,:,-496:]).to(dev)
x_np[b::nb, :, 3:-3, 3:-3] = inet(p).cpu().detach().numpy()
np.save("Recons/type_d_inet_recon_medium_noise.npy", x_np)
nb *= 8
p_np = np.load("Measurements/other_wave_offset.npy")
p_np += std*np.random.standard_normal(p_np.shape)
x_np = 0*np.load("Initial_Guesses/other_initial_guess.npy")+ 1.5
for b in range(nb):
p = torch.from_numpy(p_np[b::nb,:,:,-496:]).to(dev)
x_np[b::nb,:, 3:-3, 3:-3] = inet(p).cpu().detach().numpy()
np.save("Recons/other_inet_recon_medium_noise.npy", x_np)
std = 3e-5
nb = 5
p_np = np.load("Measurements/type_d_wave_offset.npy")
p_np += std*np.random.standard_normal(p_np.shape)
x_np = 0*np.load("Initial_Guesses/type_d_initial_guess.npy")+ 1.5
for b in range(nb):
p = torch.from_numpy(p_np[b::nb,:,:,-496:]).to(dev)
x_np[b::nb, :, 3:-3, 3:-3] = inet(p).cpu().detach().numpy()
np.save("Recons/type_d_inet_recon_medium_low.npy", x_np)
nb *= 8
p_np = np.load("Measurements/other_wave_offset.npy")
p_np += std*np.random.standard_normal(p_np.shape)
x_np = 0*np.load("Initial_Guesses/other_initial_guess.npy")+ 1.5
for b in range(nb):
p = torch.from_numpy(p_np[b::nb,:,:,-496:]).to(dev)
x_np[b::nb,:, 3:-3, 3:-3] = inet(p).cpu().detach().numpy()
np.save("Recons/other_inet_recon_medium_low.npy", x_np)
std = 15e-5
nb = 5
p_np = np.load("Measurements/type_d_wave_offset.npy")
p_np += std*np.random.standard_normal(p_np.shape)
x_np = 0*np.load("Initial_Guesses/type_d_initial_guess.npy")+ 1.5
for b in range(nb):
p = torch.from_numpy(p_np[b::nb,:,:,-496:]).to(dev)
x_np[b::nb, :, 3:-3, 3:-3] = inet(p).cpu().detach().numpy()
np.save("Recons/type_d_inet_recon_medium_high.npy", x_np)
nb *= 8
p_np = np.load("Measurements/other_wave_offset.npy")
p_np += std*np.random.standard_normal(p_np.shape)
x_np = 0*np.load("Initial_Guesses/other_initial_guess.npy")+ 1.5
for b in range(nb):
p = torch.from_numpy(p_np[b::nb,:,:,-496:]).to(dev)
x_np[b::nb,:, 3:-3, 3:-3] = inet(p).cpu().detach().numpy()
np.save("Recons/other_inet_recon_medium_high.npy", x_np)