-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathd_obs_deepwave.py
48 lines (37 loc) · 1.34 KB
/
d_obs_deepwave.py
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
from config import *
# export CXX=/usr/local/opt/llvm/bin/clang old mac
# export CXX=/opt/homebrew/opt/llvm/bin/clang m1 mac
SAVE = 1
vp, _ = earth_model(MODEL, smooth=10,
device=DEVICE)
vs = torch.zeros(1)
rho = torch.ones(1)
# print(f"sources: {N_SHOTS}\nreceivers: {rec_loc.shape[0]}")
if not SAVE:
fig, ax = plt.subplots(1, 1)
ax.imshow(vp, cmap="jet")
ax.plot(rec_loc_temp[:,0]/DH, rec_loc_temp[:, 1]/DH, 'k*', markersize=1)
ax.plot(src_loc_temp[:,0]/DH, src_loc_temp[:, 1]/DH, 'rv', markersize=4)
out = deepwave.scalar(vp, DH, DT,
source_amplitudes=src,
source_locations=src_loc,
receiver_locations=rec_loc)
taux = (out[-1].cpu()).permute(0, 2, 1)
ns, nt, nr = taux.shape
print(f"Number of \n{'-'*10}")
print(f"sources: {ns}\nreceivers: {nr}\ntime samples: {nt}")
if NOISE:
taux = awgn(taux, NOISE)
print("Noise added")
vmin, vmax = torch.quantile(taux[N_SHOTS//2],
torch.tensor([0.01, 0.99]))
if SAVE:
torch.save(taux,
f= PATH + "/data_model/taux_obs_" + PACKAGE + "_" + MODEL + "_" + str(N_SHOTS))
else:
plt.figure()
plt.imshow(taux[N_SHOTS//2], aspect='auto', cmap='gray',
vmin=vmin, vmax=vmax)
plt.xlabel("Receiver")
plt.ylabel("Time sample")
plt.show()