🎯时域、时频域以及时间和频率相关联偏振特性分析三种算法 | 🎯时域波参数估计算法 | 🎯机器学习模型波形指纹分析算法 | 🎯色散曲线和频率相关波分析算法 | 🎯动态倾斜校正算法 | 🎯声学地震波像分析
在许多应用中,声波或电磁波被用来观察事物:水下声学、雷达、声纳、医学超声波、探地雷达、地震成像、全球地震学。在其中一些应用中,测量是被动的,我们记录调查对象发出的波,并试图推断其位置、大小等。在主动测量中,会产生波并记录对象的响应。
import numpy as np
import matplotlib.pyplot as plt
import scipy.sparse as sp
from scipy.ndimage import laplace
def solve(q,c,dt,dx,T=1.0,L=1.0,n=1):
gamma = dt*c/dx
nt = int(T/dt + 1)
nx = int(2*L/dx + 2)
u = np.zeros((nx**n,nt))
for k in range(1,nt-1):
u[:,k+1] = A@u[:,k] + L@u[:,k] + B@u[:,k-1] + (dx**2)*C@q[:,k]
return u
def getMatrices(gamma,nx,n):
l = (gamma**2)*np.ones((3,nx))
l[1,:] = -2*(gamma**2)
l[1,0] = -gamma
l[2,0] = gamma
l[0,nx-2] = gamma
l[1,nx-1] = -gamma
if n == 1:
a = 2*np.ones(nx)
a[0] = 1
a[nx-1] = 1
b = -np.ones(nx)
b[0] = 0
b[nx-1] = 0
c = (gamma)**2*np.ones(nx)
c[0] = 0
c[nx-1] = 0
L = sp.diags(l,[-1, 0, 1],shape=(nx,nx))
else:
a = 2*np.ones((nx,nx))
a[0,:] = 1
a[nx-1,:] = 1
a[:,0] = 1
a[:,nx-1] = 1
a.resize(nx**2)
b = -np.ones((nx,nx))
b[0,:] = 0
b[nx-1,:] = 0
b[:,0] = 0
b[:,nx-1] = 0
b.resize(nx**2)
c = (gamma)**2*np.ones((nx,nx))
c[0,:] = 0
c[nx-1,:] = 0
c[:,0] = 0
c[:,nx-1] = 0
c.resize(nx**2)
L = sp.kron(sp.diags(l,[-1, 0, 1],shape=(nx,nx)),sp.eye(nx)) + sp.kron(sp.eye(nx),sp.diags(l,[-1, 0, 1],shape=(nx,nx)))
return A,B,C,L
L = 1.0
T = 1.0
dx = 1e-2
dt = .5e-2
nt = int(T/dt + 1)
nx = int(2*L/dx + 2)
c = 1
u = np.zeros((nx,nx))
u[nx//2 - 10:nx//2+10,nx//2 - 10:nx//2+10] = 1
q = np.zeros((nx*nx,nt))
q[:,1] = u.flatten()
w_forward = solve(q,c,dt,dx,T=T,L=L,n=2)
theta = np.linspace(0,2*np.pi,20,endpoint=False)
xs = 0.8*np.cos(theta)
ys = 0.8*np.sin(theta)
I = np.ravel_multi_index(np.array([[xs/dx + nx//2],[ys//dx + nx//2]],dtype=np.int), (nx,nx))
d = w_forward[I,:]
r = np.zeros((nx*nx,nt))
r[I,:] = d
r = np.flip(r,axis=1)
w_adjoint = solve(r,c,dt,dx,T=T,L=L,n=2)
fig, ax = plt.subplots(nrows=2, ncols=3, figsize=(8, 5), sharey=True)
plt.gray()
ax[0,0].plot(xs,ys,'r*')
ax[0,0].imshow(w_forward[:,2].reshape((nx,nx)), extent=(-L,L,-L,L))
ax[0,0].set_title('t = 0')
ax[0,1].plot(xs,ys,'r*')
ax[0,1].imshow(w_forward[:,101].reshape((nx,nx)), extent=(-L,L,-L,L))
ax[0,1].set_title('t = 0.5')
ax[0,2].plot(xs,ys,'r*')
ax[0,2].imshow(w_forward[:,200].reshape((nx,nx)), extent=(-L,L,-L,L))
ax[0,2].set_title('t = 1')
ax[1,0].plot(xs,ys,'r*')
ax[1,0].imshow(w_adjoint[:,200].reshape((nx,nx)), extent=(-L,L,-L,L))
ax[1,1].plot(xs,ys,'r*')
ax[1,1].imshow(w_adjoint[:,101].reshape((nx,nx)), extent=(-L,L,-L,L))
ax[1,2].plot(xs,ys,'r*')
ax[1,2].imshow(w_adjoint[:,2].reshape((nx,nx)), extent=(-L,L,-L,L))
plt.show()