From b41327666c67125c80e5a93a9f515819ae4ca68b Mon Sep 17 00:00:00 2001 From: Marvin Gottowik <marvingottowik@web.de> Date: Mon, 7 Oct 2024 09:53:28 +0200 Subject: [PATCH] move momentum definition to Particle class such that mypy knows about its existence without setting it to None in FirstInteraction --- python/corsika/io/outputs/interaction.py | 3 --- python/corsika/io/outputs/primary.py | 1 + 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/python/corsika/io/outputs/interaction.py b/python/corsika/io/outputs/interaction.py index 21a1b1d54..956d1d75b 100644 --- a/python/corsika/io/outputs/interaction.py +++ b/python/corsika/io/outputs/interaction.py @@ -36,9 +36,6 @@ class FirstInteraction(Particle): """ Particle.__init__(self, prop_dict) - # need to define for momentum prop - self.px = self.py = self.pz = None - def __repr__(self) -> str: """ Return a string representation of this class. diff --git a/python/corsika/io/outputs/primary.py b/python/corsika/io/outputs/primary.py index d0105f1a0..d5ee863ce 100644 --- a/python/corsika/io/outputs/primary.py +++ b/python/corsika/io/outputs/primary.py @@ -34,6 +34,7 @@ class Particle(object): # need to define for position/direction functions self.x = self.y = self.z = None self.nx = self.ny = self.nz = None + self.px = self.py = self.pz = None # wrap the files of the dictionary so that there is a property # assigned to each value, i.e. print(my_primary.pdg) -- GitLab