Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env bash
set -e pipefail
NC='\033[0m'
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
gpuminer_image="local/gpuminer:latest"
bcnode_image="local/bcnode:latest"
#
# Copyright 2015 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
32.866 test_corrected_jets_factory test_jetmet_tools.py:347
└─ 32.866 build coffea/jetmet_tools/CorrectedJetsFactory.py:275
├─ 32.376 __setitem__ awkward1/highlevel.py:966
│ └─ 32.176 with_field awkward1/operations/structure.py:438
│ ├─ 25.561 broadcast_and_apply awkward1/_util.py:492
│ │ ├─ 21.474 apply awkward1/_util.py:549
│ │ │ ├─ 8.790 apply awkward1/_util.py:549
│ │ │ │ ├─ 4.407 getfunction awkward1/operations/structure.py:500
│ │ │ │ │ └─ 4.406 of awkward1/nplike.py:10
│ │ │ │ │ └─ 4.404 kernels awkward1/operations/convert.py:532
class GraphWeightsNetwork(nn.Module):
def __init__ (self, continuous_dim, cat_dim, output_dim=1, hidden_dim=32, conv_depth=1):
super(GraphMETNetwork, self).__init__()
self.embed_charge = nn.Embedding(3, hidden_dim//4)
self.embed_pdgid = nn.Embedding(7, hidden_dim//4)
self.embed_pv = nn.Embedding(8, hidden_dim//4)
self.embed_continuous = nn.Sequential(nn.Linear(continuous_dim,hidden_dim//2),
nn.ELU(),
class GraphMETNetwork(nn.Module):
def __init__ (self, continuous_dim, cat_dim, output_dim=1, hidden_dim=32, conv_depth=1):
super(GraphMETNetwork, self).__init__()
self.embed_charge = nn.Embedding(3, hidden_dim//4)
self.embed_pdgid = nn.Embedding(8, hidden_dim//4)
self.embed_pv = nn.Embedding(2, hidden_dim//4)
self.embed_continuous = nn.Sequential(nn.Linear(continuous_dim,hidden_dim//2),
nn.ELU(),
@lgray
lgray / graphmet_embedding.py
Created October 8, 2020 20:26
graphmet with embeddings
class GraphMETNetwork(nn.Module):
def __init__ (self, continuous_dim, cat_dim, output_dim=1, hidden_dim=32, conv_depth=1):
super(GraphMETNetwork, self).__init__()
self.embed_charge = nn.Embedding(3, hidden_dim//4)
self.embed_pdgid = nn.Embedding(8, hidden_dim//4)
self.embed_pv = nn.Embedding(2, hidden_dim//4)
self.embed_continuous = nn.Sequential(nn.Linear(continuous_dim,hidden_dim),
nn.ReLU(),
@lgray
lgray / efficiency.py
Last active September 29, 2020 17:45
code for making efficiency plots
pt_true = []
matched_pt_true = []
pred_pt = []
eta_true = []
matched_eta_true = []
pred_eta = []
phi_true = []
matched_phi_true = []
#!/bin/bash
cmsrel CMSSW_11_1_0_pre6
cd CMSSW_11_1_0_pre6/src
cmsenv
git cms-init
git remote add thomas-cmssw git@github.com:tklijnsma/cmssw.git
git fetch thomas-cmssw dev-finecalo:dev-finecalo
git cms-merge-topic tklijnsma:dev-finecalo
git checkout dev-finecalo
def forward(self, x, batch: OptTensor=None):
x = self.datanorm * x
x = self.inputnet(x)
for ec in self.edgeconvs:
edge_index = knn_graph(x, self.k, batch, loop=False, flow=ec.flow)
x = ec(x, edge_index)
out = self.output(x) # output the embedding directly from the dgcnn
import torch
import numpy as np
import awkward as ak
def make_embedding_truth(truth_label_by_hits, device='cpu'):
truth_ordering = np.argsort(truth_label_by_hits)
uniques, counts = np.unique(truth_label_by_hits, return_counts=True)
truth_indices = ak.JaggedArray.fromcounts(counts, truth_ordering) # delete noise?
pairwise_truth = truth_indices.choose(2)
other_samples = np.zeros(pairwise_truth.counts.sum() + (pairwise_truth.counts==0).sum(), dtype=np.int64)