Matched-Field Processing - Synthetic case

[1]:
from itertools import product
import dask.array as da
import matplotlib.pyplot as plt
import numpy as np
import xarray as xr
import pylab as plt
import torch
from tqdm import tqdm
from scipy.signal import ricker

# specific das_ice function
import das_ice.io as di_io
import das_ice.signal.filter as di_filter
import das_ice.processes as di_p
import das_ice.plot as di_plt
import das_ice.mfp as di_mfp

# classic librairy
import torch
import xarray as xr
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import LogNorm
from tqdm import trange
%matplotlib inline
[2]:
from dask.distributed import Client,LocalCluster

cluster = LocalCluster(n_workers=8)
client = Client(cluster)
client.dashboard_link
[2]:
'http://127.0.0.1:8787/status'

Defined captor position

[3]:
nb_sensor=8
random_sensor=[]
for i in range(nb_sensor):
    random_sensor.append([np.random.randint(-70, 71),np.random.randint(-70, 71)])

sensors=np.array(random_sensor)

Generate signal

This section shows how to genrate signal that are similar to DAS data.

[4]:
nb_sources=8
random_sources=[]
for i in range(nb_sources):
    random_sources.append([np.random.randint(-70, 71),np.random.randint(-70, 71)])
    if i==0:
        dart=di_mfp.artificial_sources_freq(sensors,random_sources[-1],2500,window_length=.1,sampling_rate=25000)
    else:
        dart2=di_mfp.artificial_sources_freq(sensors,random_sources[-1],2500,window_length=.1,sampling_rate=25000)
        dart2['time']=dart2['time']+dart['time'][-1]+dart['time'][1]
        dart=xr.concat([dart,dart2],'time')

plt.figure()
for i in range(dart.shape[0]):
    dart[i,:].plot(label=i)

plt.legend()
plt.grid()
../_images/Tutorials_MFP_synthetic_case_6_0.png

Performed MFP

This MPF implementation if taken from the dask implementation from this git repository.

2D MFP

Example of 2D MFP. In practice the function di_mfp.MFP_2Dshould not be used because it is slow. You should used di_mfp.MFP_2D_series.

[5]:
MFP=di_mfp.MFP_2D_series(dart,0.1,sensors,xrange=[-100,100],dx=.25,zrange=[-100,100],dz=.25,freqrange=[30,60],vrange=[2400,2600],dv=100)
/home/chauvet/miniforge3/envs/das_ice/lib/python3.11/site-packages/distributed/client.py:3362: UserWarning: Sending large graph of size 469.94 MiB.
This may cause some slowdown.
Consider loading the data with Dask directly
 or using futures or delayed objects to embed the data into the graph without repetition.
See also https://docs.dask.org/en/stable/best-practices.html#load-data-with-dask for more information.
  warnings.warn(
[11]:
fig, axes = plt.subplots(2, 4, sharex=True, sharey=True, figsize=(15, 8))
for i, ax in enumerate(axes.flat):
    sources_find=MFP[...,i].where(MFP[...,i] == MFP[...,i].max(), drop=True).coords

    MFP[...,1,i].plot(cmap='seismic',vmin=-1,vmax=1,ax=ax)
    ax.scatter(sensors[:,0],sensors[:,1],label='sensors')
    ax.scatter(random_sources[i][0],random_sources[i][1],s=100,label='sources')
    ax.scatter(sources_find['x'][0],sources_find['z'],marker='^',label='best beam')
    ax.set_title('')

../_images/Tutorials_MFP_synthetic_case_9_0.png