Exemplo n.º 1
0
#ax.set_ylabel('Time (s)', fontsize=13)
#fig.savefig('fig/s0n_labels_dnn_snr=%.2f.pdf'%ssnr, dpi=200)

fig, ax = f.labels_plot(Y_pred)
ax.set_yticks(np.arange(0,nt/tw,2.5)-0.5)
ax.set_yticklabels( ((np.arange(0,nt/tw,2.5)-0.5)*tw+tw/2).astype(int) )
ax.set_ylabel('Time (ms)', fontsize=13)
#fig.savefig('fig/s0n_labels_mlp_snr=%.2f.pdf'%ssnr, dpi=200)
#%% Classification results on one trace
import f

tr_num = 31

s1_samps = f.trace_samp(s1[:,tr_num], tw, tinc)
f.trace_samp_fb_plot(s1_samps, tw, tinc, nrows, ncols, ann=True, 
                  Y=s1_labels[:,tr_num], 
                  Y_predit=Y_pred_cnn[:,int(tr_num/pred_tr_step)],
                  annx=1, anny=1.5, ymax=2.5)

#%% First-break pick -- gather   ##############
import time
t0 = time.time()


fb_tr_step = 1
w = 21  # window for attribute calculation
c = 2  # clusters
n = 1  # the neighbouring window for clustering
a = 0  # correction for picked arrival time

t0 = time.time()
'''1-wave classification, 2-clustering inside the first effective wave'''
#            facecolors='none',edgecolors='b', lw=1, label='fuzzy')
ax.scatter(fb3[:, 0],
           fb3[:, 1],
           s=60,
           marker='^',
           facecolors='none',
           edgecolors='r',
           lw=2,
           label='KC')
#ax.scatter(fb4[:,0],fb4[:,1], s=60, marker='s',
#            facecolors='none',edgecolors='r', lw=1, label='fuzzy-wholetrace')
ax.legend(loc='lower right', fontsize=12)
ax.set_yticks(np.arange(0, nt + 1, 50))
ax.set_yticklabels(np.arange(0, nt + 1, 50) * dt)
#fig.savefig('fig/micro_fb.pdf', dpi=200)
"""
#%% First-break pick -- one trace

i=2#25 #37  #13
isamps = f.trace_samp(s1[:,i], tw, tinc)

'''1-wave classification, 2-clustering inside the first effective wave'''
ifb1, fw1, t1, y1 = f.fb_pick_trace(s1, i, tw, tinc, Y_pred_cnn, pred_tr_step,
                                    method='kmeans', w=w, c=c, n=n, a=a)
#ifb2, fw2, t2, y2 = f.fb_pick_trace(s1, i, tw, tinc, Y_pred_cnn, pred_tr_step,
#                                    method='fuzzy', w=w, c=c, n=n)

#'''1-wave classification, 2-clustering with all the first effective waves
#with fuzzy clustering'''
#ifb2, fw2, t2, y2, cntr = f.fb_pick_trace_allfw(s1, i, tw, tinc, fb_tr_step,
#                                          Y_pred_cwtc, pred_tr_step, w=w, c=c)
Exemplo n.º 3
0
#                                    method='fuzzy', w=w, c=c, n=n)
'''1-clustering using one whole trace data with fuzzy clustering'''
ifb3 = f.fb_pick_wholetrace(Obs[:, i], method='kmeans', w=w, c=c)
#ifb4 = f.fb_pick_wholetrace(Obs[:,i], method='fuzzy', w=31, c=c)
y2 = Obs[:, i][ifb3]
t2 = ifb3 % tw

f.trace_samp_fb_plot(isamps,
                     tw,
                     tinc,
                     nrows,
                     ncols,
                     fb_plot=True,
                     fw=fw1,
                     t1=t1,
                     y1=y1,
                     t2=t2,
                     y2=y2,
                     ann=True,
                     Y=Obs_labels[:, i],
                     Y_predit=Y_pred_cnn[:, int(i / pred_tr_step)],
                     annx=1,
                     anny=1,
                     ymax=1.5)

fig, ax = plt.subplots(figsize=(13, 3))
ax.plot(np.arange(nt), Obs[:, i], 'k', lw=0.8)
ax.scatter(ifb1, 0, s=80, facecolors='none', edgecolors='b', lw=2)
#ax.scatter(ifb2,0, s=50, marker='D', facecolors='none',edgecolors='b',lw=2)
ax.scatter(ifb3, 0, s=80, marker='o', facecolors='none', edgecolors='r', lw=2)
#ax.scatter(ifb4,0, s=50, marker='s', facecolors='none',edgecolors='y',lw=2)