Skip to content

Data generation #15

@minchen073

Description

@minchen073

Hello author, your work is excellent. I am currently trying to utilize the forward operator in solving FWI, and have attempted to compute receiver signals based on velocity using both deepwave and handwritten numerical methods. Unfortunately, the solutions I obtained seem to have significant discrepancies compared to the dataset. May I ask if the solutions in the dataset have undergone any normalization processing? I believe I have implemented the methods based on the MATLAB code provided in your paper, but I am currently unable to resolve this issue.
Thank you very much for your attention.

Image

`import deepwave
import matplotlib.pyplot as plt
import torch
import numpy as np
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
ny = 70
nx = 70
dx = 10.0
v = torch.from_numpy(np.load("data_download/curvevel-A/model1.npy")[0]).reshape(ny, nx).to(device)
n_shots = 5
n_sources_per_shot = 1
d_source = 14
first_source = 7
source_depth = 1
n_receivers_per_shot = 70
d_receiver = 1
first_receiver = 0
receiver_depth = 1
freq = 15
nt = 1000
dt = 0.001
peak_time = 1.5 / freq

source_locations = torch.zeros(
n_shots, n_sources_per_shot, 2, dtype=torch.long, device=device
)
source_locations[..., 1] = source_depth
source_locations[:, 0, 0] = torch.arange(n_shots) * d_source + first_source

receiver_locations = torch.zeros(
n_shots, n_receivers_per_shot, 2, dtype=torch.long, device=device
)
receiver_locations[..., 1] = receiver_depth
receiver_locations[:, :, 0] = (
torch.arange(n_receivers_per_shot) * d_receiver + first_receiver
).repeat(n_shots, 1)

source_amplitudes = (
deepwave.wavelets.ricker(freq, nt, dt, peak_time)
.repeat(n_shots, n_sources_per_shot, 1)
.to(device)
)

output = deepwave.scalar(
v.T,
dx,
dt,
source_amplitudes=source_amplitudes,
source_locations=source_locations,
receiver_locations=receiver_locations,
accuracy=8,
pml_width = 20,
pml_freq=freq,
)

receiver_amplitudes = output[-1].permute(0,2,1)
label = np.load("data_download/curvevel-A/data1.npy")[0]
vmin, vmax = torch.quantile(
receiver_amplitudes[0], torch.tensor([0.05, 0.95]).to(device)
)
_, ax = plt.subplots(1, 2, figsize=(10.5, 7), sharey=True)
ax[0].imshow(
receiver_amplitudes[1].cpu(),
aspect="auto",
cmap="gray",
vmin = vmin, vmax = vmax
)
ax[1].imshow(
label[1],
aspect="auto",
cmap="gray",
vmin = vmin, vmax = vmax
)
ax[0].set_xlabel("Channel")
ax[0].set_ylabel("Time Sample")
ax[1].set_xlabel("Shot")
plt.tight_layout()
plt.savefig("example_forward_model.jpg")`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions