try: file_trig_times = f["trigger_times"][:] except: file_trig_times = None if use_old_reco: file_reco_labels = f["reco_labels"][:] f.close() del f if file_labels.shape[0] == 0: print("Empty file...skipping...") continue # Applying cuts type_mask = CutMask(file_labels) vertex_mask = VertexMask(file_labels,azimuth_index=azimuth_index,track_index=track_index,max_track=track_max) vertex_cut = np.logical_and(vertex_mask[start_cut], vertex_mask[end_cut]) mask = np.logical_and(type_mask[cut_name], vertex_cut) mask = np.array(mask,dtype=bool) energy = file_labels[:,0] keep_index = [False]*len(energy) print("Total events this file: %i"%len(energy)) # Check how many events already in each bin, save if under max for index,e in enumerate(energy): if e > emax: continue if e < emin: continue
Y_train[:, 0] = np.log10(Y_train[:, 0]) Y_validate[:, 0] = np.log10(Y_validate[:, 0]) if chop_energy: cut_train = Y_train[:, 0] < ecut / 100. cut_validate = Y_validate[:, 0] < ecut / 100. Y_train = Y_train[cut_train] X_train_DC = X_train_DC[cut_train] X_train_IC = X_train_IC[cut_train] Y_validate = Y_validate[cut_validate] X_validate_DC = X_validate_DC[cut_validate] X_validate_IC = X_validate_IC[cut_validate] if vertex_cut: vertex_mask_train = VertexMask(Y_train, azimuth_index=7, track_index=2, max_track=200.) cut_train = vertex_mask_train["start_IC19"] vertex_mask_val = VertexMask(Y_validate, azimuth_index=7, track_index=2, max_track=200.) cut_validate = vertex_mask_val["start_IC19"] print("Removing %i events from train, %i events from validate" % ((len(cut_train) - sum(cut_train)), (len(cut_validate) - sum(cut_validate)))) Y_train = Y_train[cut_train] X_train_DC = X_train_DC[cut_train] X_train_IC = X_train_IC[cut_train] Y_validate = Y_validate[cut_validate] X_validate_DC = X_validate_DC[cut_validate]