if __name__ == '__main__': ut.list_to_csv(head=head) result = [] df_list = [] name_list = ut_light.gen_list_title(data_type='bgs') for index, name in enumerate(name_list[0:5]): for threshold in thresholds: ut.checkFolderandCreate("{}\\ROC\\{}".format(main_path, algo_name)) pickle_ROC_file = '{}\\ROC\\{}\\_{}_threshold{}.pkl'.format( main_path, algo_name, name, threshold) if not os.path.exists(pickle_ROC_file): result = [] data = ut_light.load_light_select_dataset(input_path=path, file_name=name) print("##### cal name : {} , threshold = {} #####".format( name, threshold)) ROC_row = genROCFile(name=name, data=data, threshold=threshold) result.append(ROC_row) df = pd.DataFrame(result, columns=ROC_head) with open(pickle_ROC_file, 'wb') as output: pickle.dump(df, output) else: print("##### Load name : {} , threshold = {} #####".format( name, threshold)) with open(pickle_ROC_file, 'rb') as pickle_input: df = pickle.load(pickle_input) df_list.append(df) df = ut.union_DF(df_list=df_list, head_list=ROC_head) print("a")
window = core.get_window() return change_points,window def save_all_tran(data_list,name_list): for index, data in enumerate(data_list): ut.checkFolderandCreate("{}{}".format(pic_path, name_list[index])) randomlist = random.sample(range(0, data.get_len_tran()), 100) for index_tran in randomlist: fig = data.plot_tran_sten(index_tran=index_tran, start_index=0 , end_index=8520, plot_change=False, plot_tran=True) # plt.show() target_file = "{}{}\\{}.png".format(pic_path, name_list[index],"{:02d}".format(index_tran)) plt.savefig(target_file) plt.clf() if __name__ == '__main__': result = [] df_list = [] # name_list = ut_light.gen_list_title(data_type='bgs') # bin_period = 10 name_list = ut_light.gen_list_mix(dataset_path, data_type='bgs', mix_size=mix_size) for index, name in enumerate(name_list): data = ut_light.load_light_select_dataset(input_path=dataset_path, file_name=name, is_mix=is_mix) data_list.append(data) # save_all_tran(data_list,name_list) input_case(data_list)
if __name__ == '__main__': name_list = ut_light.gen_list_title(data_type = data_type) new_list = gen_new_list_mix(path) for index, target_list in enumerate(new_list): main_tran = target_list[0] target_tran = target_list[1] folder = "{}_{}".format(main_tran.replace("{}_".format(data_type), ""), target_tran.replace("{}_".format(data_type), "")) print(folder) ut.checkFolderandCreate("{}\\{}\\{}".format(path, data_type ,folder)) test_list_path = "{}{}\\{}\\test".format(path, data_type, folder) ut.checkFolderandCreate(test_list_path) answer_list_path = "{}{}\\{}\\answer".format(path, data_type, folder) ut.checkFolderandCreate(answer_list_path) data_1 = ut_light.load_light_select_dataset(input_path=path, file_name=main_tran, is_mix=True) data_2 = ut_light.load_light_select_dataset(input_path=path, file_name=target_tran) merge_file(data_1, data_2,test_list_path,answer_list_path) # for i in range(len(name_list)): # data_1 = ut_light.load_light_select_dataset(input_path=path, # file_name=name_list[i]) # mainfolder = "Mix_{}".format(name_list[i].replace("{}_".format(data_type), "")) # # for j in range(len(name_list)): # folder = "{}_{}".format(mainfolder, # name_list[j].replace("{}_".format(data_type), "")) # print(folder) # # ut.checkFolderandCreate("{}\\{}\\{}".format(path, data_type ,folder))