#%% multi-channel synthetic data ''' multi-channel synthetic data (clean) ''' s0 = np.array(pd.read_csv("data/syn_data.csv", header=None)) #fig, ax = plt.subplots(figsize=(10,8)) #ax.imshow(s1,interpolation='quadric', aspect='auto',vmax=0.2,vmin=-0.2) s0 = s0[350:350+360, :][:, 40:101] min_max_scaler = preprocessing.MaxAbsScaler() s0 = min_max_scaler.fit_transform(s0) #fig, ax = plt.subplots(figsize=(10,8)) #ax.imshow(s1,interpolation='quadric', aspect='auto') s0fb = f.fb_pick_gather_wholetrace(s0,fb_tr_step=1,method='kmeans',w=21, c=2) fig, ax = f.seisplot_wig(s0) #ax.scatter(s0fb[:,0],s0fb[:,1], s=50,facecolors='none',edgecolors='b',lw=1) #fig.savefig('fig/s1.pdf', dpi=200) #% ''' multi-channel synthetic data (noisy) ''' np.random.seed(20180320) #20180320 s0n = s0 + np.random.randn(s0.shape[0],s0.shape[1])*0.2 f.fb_pick_wholetrace(s0n[:,14], method='kmeans', plot=True, c=2, w=21, nlta=20, nsta=10, a=0) #%
t = np.arange(400) * dt * 1000 cwtmatr, freqs = tf.spectrum_cwt(t, s1[:, 13], wavelet='morl', widths=200, cmap='RdBu', colorscale=1, contour_dvision=41, freqmax=100, figsize=(12, 3), plot=True, ymin=5, ymax=80) s1fb = f.fb_pick_gather_wholetrace(s1, fb_tr_step=1, method='kmeans', w=5, c=2) fig, ax = f.seisplot_wig(s1, lw=0.8) ax.scatter(s1fb[:, 0], s1fb[:, 1], s=50, facecolors='none', edgecolors='r', lw=2) ax.set_yticks(np.arange(0, nt + 1, 50)) ax.set_yticklabels(np.arange(0, nt + 1, 50) * dt) #fig.savefig('fig/micro_fb', dpi=200) #%% parameter defination and label generate dt = 0.002 # time interval freq_index = [4, 5, 6, 7, 8, 9, 11, 13, 15, 19, 26, 39, 80] #124
testsize = 0.2 seed = 20180319 channel = 1 tinc = 2 # time increment of samples, inside time window length = int(tw / tinc) classes = 2 cbar_binary = ListedColormap(["darkgray", "yellow"]) tr_num = 260 # trace number #%% Obsfb = f.fb_pick_gather_wholetrace(Obs, fb_tr_step=10, method='kmeans', w=21, c=2) fig, ax = f.seisplot_wig( Obs, inc=10, scale=30, lw=0.2, ) #ax.scatter(Obsfb[:,0],Obsfb[:,1], s=30,facecolors='none',edgecolors='r',lw=1) ax.set_yticks(np.arange(0, nt + 1, 400)) ax.set_yticklabels(np.arange(0, nt + 1, 400) * dt) ax.set_xticks(np.arange(0, 967, 100)) ax.set_xticklabels(np.arange(0, 967, 100) / 10) #fig.savefig('fig/obs', dpi=200)