plt.plot(binsm[:-1], gen_mass_hist_diff, label='Generated', color='blue') plt.xlabel('Mass', x=0.5) plt.ylabel('# Exact - # EFP Jets') lg = plt.legend(loc=1, prop={'size': 18}) plt.savefig(figpath + "_100000_jets_mass_diff.pdf", bbox_inches='tight') plt.show() num_pixels = 100 Njets = 100000 img_width = 0.8 average_real_jet_image = np.zeros((num_pixels, num_pixels, 1)) for i in range(Njets): average_real_jet_image += ut.pixelate(X_efp_format[i, :, :], npix=num_pixels, img_width=img_width, nb_chan=1, norm=False, charged_counts_only=False) average_real_jet_image /= Njets average_gen_jet_image = np.zeros((num_pixels, num_pixels, 1)) for i in range(Njets): average_gen_jet_image += ut.pixelate(gen_out_efp_format[i, :, :], npix=num_pixels, img_width=img_width, nb_chan=1, norm=False, charged_counts_only=False) average_gen_jet_image /= Njets plt.rcParams.update({'font.size': 12})
################################################################################ # load data X, y = qg_jets.load(num_data=num_data) # convert labels to categorical Y = to_categorical(y, num_classes=2) print('Loaded quark and gluon jets') # make jet images images = np.asarray([ pixelate(x, npix=npix, img_width=img_width, nb_chan=nb_chan, charged_counts_only=True, norm=norm) for x in X ]) print('Done making jet images') # do train/val/test split (X_train, X_val, X_test, Y_train, Y_val, Y_test) = data_split(images, Y, val=val_frac, test=test_frac) print('Done train/val/test split') # preprocess by zero centering images and standardizing each pixel
dataset = dataset.detach().numpy() _ = plt.hist(dataset[:, :, 0].reshape(-1), bins=bins[0], histtype='step') datasett = torch.load('datasets/all_t_jets_30p_polarrel.pt') X = datasett.detach().numpy() X_efp_format = np.concatenate( (np.expand_dims(X[:, :, 2], 2), X[:, :, :2], np.zeros((len(X), 30, 1))), axis=2) Xims = [] for i in tqdm(range(len(X))): Xims.append( ut.pixelate(X_efp_format[i, :, :], npix=25, img_width=0.85, nb_chan=1, norm=False, charged_counts_only=False)) datasetg = torch.load('datasets/all_g_jets_30p_polarrel.pt') Xg = datasetg.detach().numpy() Xg_efp_format = np.concatenate( (np.expand_dims(Xg[:, :, 2], 2), Xg[:, :, :2], np.zeros((len(Xg), 30, 1))), axis=2) Xgims = [] for i in tqdm(range(len(Xg))): Xgims.append( ut.pixelate(Xg_efp_format[i, :, :], npix=25, img_width=0.85,
# network training parameters num_epoch = 2 batch_size = 100 ################################################################################ # load data X, y = cepc.load(num_data=num_data) # convert labels to categorical Y = to_categorical(y, num_classes=2) print('Loaded quark and gluon jets') # make jet images images = np.asarray([pixelate(x, npix=npix, img_width=img_width, nb_chan=nb_chan, norm=norm,charged_counts_only=True) for x in X]) print('Done making jet images') # do train/val/test split (X_train, X_val, X_test, Y_train, Y_val, Y_test) = data_split(images, Y, val=val_frac, test=test_frac) print('Done train/val/test split') # preprocess by zero centering images and standardizing each pixel X_train, X_val, X_test = standardize(*zero_center(X_train, X_val, X_test)) print('Finished preprocessing') print('Model summary:')