Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements for inelasticity reconstructions and other utilities #763

Merged
merged 12 commits into from
Nov 28, 2024
Prev Previous commit
Next Next commit
Remove an old test reconstruction task
pweigel committed Nov 1, 2024
commit b52540de9608b8819ff433ba45296e3acec2e130
2 changes: 1 addition & 1 deletion src/graphnet/data/extractors/icecube/i3truthextractor.py
Original file line number Diff line number Diff line change
@@ -41,7 +41,7 @@ def __init__(
stopping within the detector. Defaults to hard-coded boundary
coordinates.
mctree: Str of which MCTree to use for truth values.
extend_boundary: Float to extend the convex hull of the detector
extend_boundary: Distance to extend the convex hull of the detector
for defining starting events.
"""
# Base class constructor
14 changes: 2 additions & 12 deletions src/graphnet/models/task/reconstruction.py
Original file line number Diff line number Diff line change
@@ -111,18 +111,7 @@ def _forward(self, x: Tensor) -> Tensor:
# Transform, thereby preventing overflow and underflow error.
return torch.nn.functional.softplus(x, beta=0.05) + eps_like(x)

class PlainEnergyReconstruction(StandardLearnedTask):
"""Reconstructs energy using stable method."""

# Requires one feature: untransformed energy
default_target_labels = ["energy"]
default_prediction_labels = ["energy_pred"]
nb_inputs = 1

def _forward(self, x: Tensor) -> Tensor:
return x


class EnergyReconstructionWithPower(StandardLearnedTask):
"""Reconstructs energy."""

@@ -243,6 +232,7 @@ def _forward(self, x: Tensor) -> Tensor:
# Transform output to unit range
return torch.sigmoid(x)


class VisibleInelasticityReconstruction(StandardLearnedTask):
"""Reconstructs interaction visible inelasticity.

@@ -256,4 +246,4 @@ class VisibleInelasticityReconstruction(StandardLearnedTask):

def _forward(self, x: Tensor) -> Tensor:
# Transform output to unit range
return 0.5 * (torch.tanh(2.0 * x) + 1.0)
return 0.5 * (torch.tanh(2.0 * x) + 1.0)