def get_csi_feature(csi_data, filename_time): print('data pre_processing') time_stamp = get_timestamp(filename_time) # print(1) csi_value = get_csi_value( csi_data) # 求输入数据的模值 #input(270,50---), output csi_value(50---,270) print('csi_value done') print('csi_value', csi_value.shape) # csi_value_process = data_butter_filter(csi_value) # input:csi_value:50~~~*270 # output:csi_butter:270*50~~~ # print('csi_value_process', csi_value_process.shape) # print('buffer process done') csi_sample_array = time_stamp_cut( csi_value, time_stamp) # input:270*50~~~ output: (51, 800, 270) print('time_stamp_cut done') # print('csi_sample_array', csi_sample_array.shape) # (51, 800, 270) # csi_pca_temp = () # for i in range(csi_sample_array.shape[0]): # csi_pca_temp = np.append(csi_pca_temp, signal_pca(csi_sample_array[i, :, :])) # csi_pca = csi_pca_temp.reshape(csi_sample_array.shape[0], 800, 250) # print('pca done') # feature_data = csi_sample_array[:,25:775,0:90] print('feature_data', csi_sample_array.shape) return csi_sample_array
def get_csi_feature(csi_data, filename_time): print('data pre_processing') time_stamp = get_timestamp(filename_time) print(1) csi_value = get_csi_value(csi_data) # 求输入数据的模值 #csi_value(50~~~,270) print('csi_value done') print('csi_value', csi_value.reshape) # (124497, 90) csi_value_process = data_butter_filter( csi_value) # input:csi_value:50~~~*270 # output:csi_butter:270*50~~~ print('csi_value_process', csi_value_process.shape) # (90, 124497) print('buffer process done') csi_sample_array = time_stamp_cut( csi_value_process, time_stamp) # input:270*50~~~ output: (51, 800, 270) print('csi_sample_array', csi_sample_array.shape) # (51, 800, 270) csi_pca_temp = () for i in range(csi_sample_array.shape[0]): csi_pca_temp = np.append(csi_pca_temp, signal_pca(csi_sample_array[i, :, :])) csi_pca = csi_pca_temp.reshape(csi_sample_array.shape[0], 800, 5) print('pca done') # s = csi_pca[:, :, 1:2] # # q = s.shape[2] # plt.plot(s[0,:]) # plt.show() feature_data = feature_selection(csi_pca[:, :, 1:5]) # 取第二个主成分 print('feature_data', feature_data.shape) print('feature_selection done') return feature_data
def get_csi_feature(csi_data, filename_time): print(0) time_stamp = get_timestamp(filename_time) print(1) csi_value = get_csi_value(csi_data) # 求输入数据的模值 #csi_value(50~~~,270) # csi_ph_dif = get_csi_data_ph_dif(csi_value) #50```*2 # print(2) # print('csi_value',csi_value.shape)#(124497, 90) # csi_value_process = data_butter_filter(csi_ph_dif) # input:csi_value:50~~~*270 # output:csi_butter:270*50~~~ # print('csi_value_process',csi_value_process.shape)#(90, 124497) # print(3) csi_dif = signal_dif(csi_value) csi_sample_array = time_stamp_cut( csi_dif, time_stamp) # input:270*50~~~ output: (51, 800, 270) print('csi_sample_array', csi_sample_array.shape) #(51, 800, 270) # csi_pi_dif = () # for i in range(csi_sample_array.shape[0]): # csi_pca_temp = np.append(csi_pi_dif, get_csi_data_ph_dif(csi_sample_array[i, :, :])) # csi_p = csi_pi_dif.reshape(csi_sample_array.shape[0], 800, 2) # csi_pca = csi_p[:,:,1] # print('pca done') feature_data = feature_selection(csi_sample_array[:, :, 1]) print(4) return feature_data
def get_csi_feature(csi_data, filename_time): print('data pre_processing') time_stamp = get_timestamp(filename_time) print(1) csi_value = get_csi_value(csi_data) # 求输入数据的模值 #csi_value(50~~~,270) print('csi_value done') print('csi_value', csi_value.reshape) # (124497, 90) csi_value_process = data_butter_filter( csi_value) # input:csi_value:50~~~*270 # output:csi_butter:270*50~~~ print('csi_value_process', csi_value_process.shape) # (90, 124497) print('buffer process done') csi_sample_array = time_stamp_cut( csi_value_process, time_stamp) # input:270*50~~~ output: (51, 800, 270) print('csi_sample_array', csi_sample_array.shape) # (51, 800, 270) csi_pca_temp = () for i in range(csi_sample_array.shape[0]): csi_pca_temp = np.append(csi_pca_temp, signal_pca(csi_sample_array[i, :, :])) csi_pca = csi_pca_temp.reshape(csi_sample_array.shape[0], 800, 250) csi_pca = csi_pca[:, :, 1] print('pca done') signal_stft = () for single_sample in range(csi_pca.shape[0]): f, t, Zxx = signal.stft(csi_pca[single_sample], fs=200, nperseg=256) plt.pcolormesh(t, f, np.abs(Zxx)) plt.title('STFT Magnitude') plt.ylabel('Frequency [Hz]') plt.xlabel('Time [sec]') plt.show() signal_stft = np.append(signal_stft, Zxx) feature_data = signal_stft.reshape(csi_pca.shape[0], Zxx.shape[0] * Zxx.shape[1]) feature_data = abs(feature_data) return feature_data