else: sep = "/" guide = CONFIG_PATH + sep + "Hui_SuperProject" + sep + "MovDict.json" guide_dict = read_json(guide).to_dict() example_path = CONFIG_PATH + sep + "Hui_SuperProject" + sep + "Data_Examples" key = 15 features_path = "D:\PhD\Data\HuisData\Dataset1\FeatureExtracted\Features_tsfel_HuiData" filename = "features_500_15.npz" tag = 8 sub = 1 a = 10000 b = 45000 begin_feat = 5000 all_signals = loadH5(example_path + sep + guide_dict[key]["file"])[a:b:sub, :] or_signal = all_signals[:, tag] ref_signal = all_signals[:, -1] ssts_distance(or_signal) file = load_npz_featuresHui(features_path + sep + filename) feature_set = load_featuresbydomain(file, features_tag=tag) features_temp = np.array(feature_set["featurebydomain"]["temp"])[:, a:b:sub] features_stat = np.array(feature_set["featurebydomain"]["stat"])[:, a:b:sub] features_spec = np.array(feature_set["featurebydomain"]["spec"])[:, a:b:sub] features_t_norm = StandardScaler().fit_transform(features_temp) # # features_t_norm = matrix_norm(features_temp) # # print(features_t_norm)
for i in range(len(corpus)): # labels = np.append(labels, lda_model[corpus[i]][0][0]) topics = lda_model[corpus[i]] topics.sort(key=get_key, reverse=True) labels = np.append(labels, np.repeat(topics[0][0], win_size)) print(topics) # print(lda_model[corpus_i]) return labels[:-ind_end] guide = CONFIG_PATH + "/Hui_SuperProject/MovDict.json" guide_dict = read_json(guide).to_dict() example_path = CONFIG_PATH + "/Hui_SuperProject/Data_Examples/" signal = loadH5(example_path + "arthrokinemat_2018_06_03_00_08_52.h5") fs = 1000 b = 4 acc1 = signal[b * fs:, 0] acc1_sm = mean_norm(acc1) acc1_sm = smooth(abs(acc1_sm), 1000) acc1_sm = acc1_sm[::50] # plt.plot(acc1_sm) # plt.show() acc_str = Connotation2(acc1_sm) print(acc_str) # lsa_labels = movingLSA(acc_str) lda_labels = movingLDA(acc_str, win_size=50)
wave3_conc_str_tpl = runLengthEncoding(wave3_str) # ax1 = plt.subplot(1,1,1) # # plot_textcolorized(wave3, wave3_conc_str_tpl[2], ax1) # plot_textcolorized(wave3, wave3_str, ax1) # plt.show() # ax1 = plt.subplot(1,1,1) # plot_textcolorized(wave3, wave3_str, ax1) # plt.show() #Exercise 4 - Test this new approach on other signals from tools.processing_tools import * example_path = r"D:\PhD\Code\Hui_SuperProject\Data_Examples\\" signalHui1 = loadH5(example_path + "arthrokinemat_2018_06_02_23_51_55.h5") #pre process ch1 = smooth(mean_norm(signalHui1[:, 5]), 2000) ch1 = ch1[1000:] amp_level = AmplitudeTrans(ch1, 2, string.ascii_uppercase, method="quantiles") ampdiff_str = AmpChange(ch1, 0.75, "absolute") speed_str = D1Speed(ch1, 0.75) sign_str = SignConnotation(ch1) wave3_str = addArrayofStrings([sign_str, ampdiff_str, speed_str])