def create_list_from_exp_data(self): """ Creates features for an interval and normalizes them according to the maximum among all intervals. """ l_data = [] l_t = [] l_exp = [] for exp_no, folder_name in enumerate(self.train_exp_folders): folder_path = os.path.join(self.exp_csv_dir, folder_name) l_data.append([]) l_t.append([]) l_exp.append([]) # Each folder contain many files contain a single type of exp (class) for file_name in os.listdir( folder_path)[self.SPLIT[0]:self.SPLIT[1]]: data, t, exp = read_data_from_file(os.path.join( folder_path, file_name), N_CH=8) l_data[exp_no].append(np.array(data)) l_t[exp_no].append(np.array(t)) l_exp[exp_no].append(np.array(exp)) return l_data, l_t, l_exp
def read_data(self, layout): data, t, exp = \ read_data_from_file(self.path_line_edit.text(), N_CH=self.gv.N_CH) # clean this part for ch in range(self.gv.N_CH): fg = self.right_gr.full_graphs[ch] slider = self.right_gr.sliders[ch] acg = self.left_gr.avg_classif_graphs[ch] pgs = self.left_gr.portion_graphs[ch] cg = self.left_gr.classif_graphs[ch] self.pbar.setValue(int(100 * (ch + 1) / self.gv.N_CH)) # Right panel fg.plot_data(data[ch], color='w') slider.setMaximum(len(data[0])) # Left panel pgs.data = np.array(data[ch]) pgs.t = np.array(t) pgs.plot_data(data[ch], color='g') pgs.add_all_experimentation_regions(ch, exp) classified_data = self.left_gr.classif_graphs[ch].classify_data( data[ch]) cg.plot_data(classified_data, color='b') acg.curve = acg.plot_data(np.zeros(self.gv.emg_signal_len), color='b') acg.classif_region_curve = acg.plot_data(np.zeros( self.gv.emg_signal_len), color='r') acg.combo_box_curve = acg.plot_data(np.zeros( self.gv.emg_signal_len), color='y') acg.classified_data = classified_data acg.update_pos_and_avg_graph(classif_region_pos=0)