s1 = s0n #%% training dataset for MLP, CNN, and CWT-CNN traces_step = 4 traces_train = np.arange(0, s1.shape[1], traces_step) X = np.zeros((int(len(traces_train)*nt/tw), int(tw/tinc) )) Xcwt = np.zeros((int(len(traces_train)*nt/tw), len(freq_index), int(tw/tinc))) Y = np.zeros((int(len(traces_train)*nt/tw), )) for i in traces_train: itrace = s1[:,i] itrace_samps = f.trace_samp(itrace, tw, tinc) X[int(i/traces_step*nt/tw):int((i/traces_step+1)*nt/tw),:] = itrace_samps isamps_cwt = f.trace_cwt_samp(itrace, dt, freq_index, tw, tinc) Xcwt[int(i/traces_step*nt/tw):int((i/traces_step+1)*nt/tw),:,:]=isamps_cwt ilabel = s1_labels[:,i] Y[int(i/traces_step*nt/tw):int((i/traces_step+1)*nt/tw),] = ilabel '''plot the selected traces''' fig,ax = f.seisplot_wig(s1, scale=0.8, lw=0.5, highlight=True, lightstep=traces_step) #ax.set_yticks(np.arange(0,nt,50)) #ax.set_yticklabels(np.arange(0,nt,50)*dt ) ax.set_ylabel('Time (ms)', fontsize=13) #fig.savefig('fig/s0n_partition_snr=%.2f.pdf'%ssnr, dpi=200)
ax.set_ylabel('Time (s)', fontsize=13) #fig.savefig('fig/micro_labels.pdf', dpi=200) #%% training dataset for MLP, CNN, and CWT-CNN traces_step = 4 traces_train = np.arange(0, s1.shape[1], traces_step) X = np.zeros((int(len(traces_train) * nt / tw), int(tw / tinc))) Xcwt = np.zeros( (int(len(traces_train) * nt / tw), len(freq_index), int(tw / tinc))) Y = np.zeros((int(len(traces_train) * nt / tw), )) for i in traces_train: itrace = s1[:, i] itrace_samps = f.trace_samp(itrace, tw, tinc) X[int(i / traces_step * nt / tw):int((i / traces_step + 1) * nt / tw), :] = itrace_samps isamps_cwt = f.trace_cwt_samp(itrace, dt, freq_index, tw, tinc) Xcwt[int(i / traces_step * nt / tw):int((i / traces_step + 1) * nt / tw), :, :] = isamps_cwt ilabel = s1_labels[:, i] Y[int(i / traces_step * nt / tw):int((i / traces_step + 1) * nt / tw), ] = ilabel '''plot the selected traces''' fig, ax = f.seisplot_wig(s1, scale=0.8, lw=0.5,
ax.set_yticks(np.arange(0, nt / tw + 1, 400 / tw)) 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).astype(int)) #fig.savefig('fig/obs_label', dpi=200) #%% training dataset for MLP, CNN, and CWT-CNN traces_step = 80 traces_train = np.arange(0, 967, traces_step) X = np.zeros((int(len(traces_train) * nt / tw), int(tw / tinc))) Xcwt = np.zeros((int(len(traces_train) * nt / tw), 15, int(tw / tinc))) Y = np.zeros((int(len(traces_train) * nt / tw), )) for i in traces_train: itrace = Obs[:, i] itrace_samps = f.trace_samp(itrace, tw, tinc) X[int(i / traces_step * nt / tw):int((i / traces_step + 1) * nt / tw), :] = itrace_samps isamps_cwt = f.trace_cwt_samp(itrace, dt, freq_index, tw, tinc) Xcwt[int(i / traces_step * nt / tw):int((i / traces_step + 1) * nt / tw), :, :] = isamps_cwt ilabel = Obs_labels[:, i] Y[int(i / traces_step * nt / tw):int((i / traces_step + 1) * nt / tw), ] = ilabel '''plot the selected traces''' fig, ax = f.seisplot_wig(Obs, inc=10, scale=30, lw=0.2,