def exec(self, task_input, task_output): labels_information_loc = task_input["labels_information_location"] resources_path = task_output["res_loc"] labels_info = jReader.parse_data(labels_information_loc) os.makedirs(task_input["training_loc"], True) resources = os.dir_res_list(resources_path) training_path = f"{task_input['training_loc']}{os.get_path_seperator()}training.csv" labels_path = f"{task_input['training_loc']}{os.get_path_seperator()}labels.csv" with open(training_path, 'w') as training_file: with open(labels_path, 'w') as labels_file: labels_file.write("Sinus, AF\n") index = 0 while index < task_input["readings"]: training_file.write(f"x_{index}") index += 1 if index < task_input["readings"]: training_file.write(',') training_file.write("\n") self.prep_training_file(training_file, labels_file, labels_info, task_output["res_loc"], resources)
def exec(self, task_input, task_output): target_labels_loc = task_input["labels_loc"] #TODO - make sure folder exists os.makedirs(target_labels_loc, True) #TODO - join taining folder with name of label file target_labels_loc = os.path_join(target_labels_loc, "labels.csv") data_labels_mappings = jReader.parse_data( task_input["data_labels_mappings"]) self.create_labels_file(target_labels_loc, data_labels_mappings)
def _training_loc(self, res_loc): path_split = res_loc.split(os.get_path_seperator()) training_path = f"{path_split[0]}{os.get_path_seperator()}{path_split[1]}" for x in range(2, len(path_split) - 1): training_path = os.path_join(training_path, path_split[x]) training_path = os.path_join(training_path, "training") os.makedirs(training_path, True) return os.path_join(training_path, f"{path_split[len(path_split) - 1]}.csv")
def _prep_split_folder(self): os.makedirs(self.res_path.split('.')[0], True)