Skip to content

Commit 5a91f74

Browse files
authored
Merge pull request #95 from kaareendrup/VertexReconstruction
Vertex reconstruction, add tasks and constant
2 parents 5e217a4 + 4a9779b commit 5a91f74

2 files changed

Lines changed: 32 additions & 1 deletion

File tree

src/gnn_reco/data/constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ class TRUTH:
3333
'elasticity',
3434
'sim_type',
3535
'interaction_type',
36+
'interaction_time', ## Added for vertex reconstruction
3637
]
3738
DEEPCORE = ICECUBE86
3839
UPGRADE = DEEPCORE

src/gnn_reco/models/task/reconstruction.py

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ def _forward(self, x):
5454
kappa = torch.abs(x[:,1]) + eps_like(x)
5555
return torch.stack((angle, kappa), dim=1)
5656

57-
5857
class EnergyReconstruction(Task):
5958
"""Reconstructs energy."""
6059
# Requires one feature: untransformed energy
@@ -76,9 +75,40 @@ def _forward(self, x):
7675
pred = torch.stack((energy, log_var), dim=1)
7776
return pred
7877

78+
class VertexReconstruction(Task):
79+
# Requires four features, x, y, z and t
80+
nb_inputs = 4
81+
82+
def _forward(self, x):
83+
84+
# Scale xyz to roughly the right order of magnitude, leave time
85+
x[:,0] = x[:,0] * 1e2
86+
x[:,1] = x[:,1] * 1e2
87+
x[:,2] = x[:,2] * 1e2
88+
89+
return x
90+
91+
class PositionReconstruction(Task):
92+
# Requires three features, x, y, z
93+
nb_inputs = 3
7994

95+
def _forward(self, x):
96+
97+
# Scale to roughly the right order of magnitude
98+
x[:,0] = x[:,0] * 1e2
99+
x[:,1] = x[:,1] * 1e2
100+
x[:,2] = x[:,2] * 1e2
101+
102+
return x
80103

104+
class TimeReconstruction(Task):
105+
# Requires on feature, time
106+
nb_inputs = 1
107+
108+
def _forward(self, x):
81109

110+
# Leave as it is
111+
return x
82112

83113
class BinaryClassificationTask(Task):
84114
#requires one feature: probability of being neutrino?

0 commit comments

Comments
 (0)