def file_organizer(self, index, quiet=False): #Initializing relevant dictionaries and FileTools objects current_FT = dR.fileTools(self.file_list[index], self.rfile_path, fast_channel_count=self.FAST, debug=self.debug) self.master_file_dct[index] = current_FT self.master_tree_dct[index] = current_FT.tree_dct self.master_exp_dct[index] = current_FT.exp_dct self.master_N_channels_dct[index] = current_FT.N_channels_dct
def __construct_ranges(self): #Construct ranges for newly submitted .root files constructed_lst = [] #Check which range files are already at rfile_path for rootfile in self.queue_construct: with dR.cd(self.rootfile_path): FT = dR.fileTools(rootfile, self.rfile_path, debug=self.debug) FT.construct_all_ranges() constructed_lst.append(rootfile) #Append to the rangefile metadata if any(constructed_lst): with dR.cd(self.rfile_path): with open(self.rfile_meta_fname, "r") as file_handle: rfmeta = json.load(file_handle) for new in constructed_lst: rfmeta.append(new) with open(self.rfile_meta_fname, "w+") as file_handle: file_handle.write(json.dumps(rfmeta))
def __construct_ranges(self): # Construct ranges for newly submitted .root files # Check which range files are already at rfile_path constructed_lst = [] with dR.cd("%s/%s" % (self.rfile_path, self.rfile_directory)): pwd = os.getcwd() for rootfile in self.append_files: if rootfile in os.listdir(pwd): continue with dR.cd(self.rootfile_path): FT = dR.fileTools(rootfile, self.rfile_path, debug=self.debug) FT.construct_all_ranges() constructed_lst.append(rootfile) # Append to the rangefile metadata if any(constructed_lst): with dR.cd(self.rfile_path): with open(self.rfile_meta_fname, "r") as file_handle: rfmeta = json.load(file_handle) for new in constructed_lst: rfmeta.append(new) with open(self.rfile_meta_fname, "w+") as file_handle: file_handle.write(json.dumps(rfmeta))