Skip to content

Commit

Permalink
Merge pull request #95 from kaareendrup/VertexReconstruction
Browse files Browse the repository at this point in the history
Vertex reconstruction, add tasks and constant
  • Loading branch information
asogaard committed Dec 11, 2021
2 parents 5e217a4 + 4a9779b commit 5a91f74
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/gnn_reco/data/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class TRUTH:
'elasticity',
'sim_type',
'interaction_type',
'interaction_time', ## Added for vertex reconstruction
]
DEEPCORE = ICECUBE86
UPGRADE = DEEPCORE
32 changes: 31 additions & 1 deletion src/gnn_reco/models/task/reconstruction.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ def _forward(self, x):
kappa = torch.abs(x[:,1]) + eps_like(x)
return torch.stack((angle, kappa), dim=1)


class EnergyReconstruction(Task):
"""Reconstructs energy."""
# Requires one feature: untransformed energy
Expand All @@ -76,9 +75,40 @@ def _forward(self, x):
pred = torch.stack((energy, log_var), dim=1)
return pred

class VertexReconstruction(Task):
# Requires four features, x, y, z and t
nb_inputs = 4

def _forward(self, x):

# Scale xyz to roughly the right order of magnitude, leave time
x[:,0] = x[:,0] * 1e2
x[:,1] = x[:,1] * 1e2
x[:,2] = x[:,2] * 1e2

return x

class PositionReconstruction(Task):
# Requires three features, x, y, z
nb_inputs = 3

def _forward(self, x):

# Scale to roughly the right order of magnitude
x[:,0] = x[:,0] * 1e2
x[:,1] = x[:,1] * 1e2
x[:,2] = x[:,2] * 1e2

return x

class TimeReconstruction(Task):
# Requires on feature, time
nb_inputs = 1

def _forward(self, x):

# Leave as it is
return x

class BinaryClassificationTask(Task):
#requires one feature: probability of being neutrino?
Expand Down

0 comments on commit 5a91f74

Please sign in to comment.