IAP GITLAB

Skip to content
Snippets Groups Projects
Commit ccb85349 authored by Alan Coleman's avatar Alan Coleman
Browse files

python format

parent a63bcce1
No related branches found
No related tags found
1 merge request!604"Need for writing first interaction information"
Pipeline #12671 failed
......@@ -9,6 +9,7 @@
from .bethe_bloch import BetheBlochPDG
from .energy_loss import EnergyLoss
from .interaction import Interactions
from .longitudinal_profile import LongitudinalProfile
from .observation_plane import ObservationPlane
from .output import Output
......@@ -16,7 +17,6 @@ from .particle_cut import ParticleCut
from .primary import Particle, PrimaryParticle
from .radio_process import RadioProcess
from .track_writer import TrackWriter
from .interaction import Interactions
__all__ = [
"Output",
......@@ -29,4 +29,5 @@ __all__ = [
"RadioProcess",
"PrimaryParticle",
"Particle",
"Interactions",
]
......@@ -17,6 +17,7 @@ import pyarrow.parquet as pq
from ..converters import arrow_to_numpy
from .output import Output
class Interactions(Output):
"""
Reads the interactions and secondaries
......
......@@ -12,7 +12,9 @@ import corsika
here = os.path.abspath(os.path.dirname(__file__))
parser = argparse.ArgumentParser()
parser.add_argument("--input-dir", required=True, help="output directory of the CORSIKA 8 simulation")
parser.add_argument(
"--input-dir", required=True, help="output directory of the CORSIKA 8 simulation"
)
parser.add_argument(
"--output-dir",
default=os.path.join(here, "example_plots"),
......@@ -57,13 +59,13 @@ for sh_id in shower_ids:
ax[sh_id].plot([-px, 0], [-pz, 0], label=name)
# Get daughters, filter out zero-momentum particles
daughters = data[data["primary"] == False]
daughters = data[data["primary"] is False]
p_tot = np.sqrt(daughters["px"] ** 2 + daughters["py"] ** 2 + daughters["pz"] ** 2)
daughters = daughters[p_tot > 0]
for i in range(len(daughters)):
pz = daughters["pz"].iloc[i]
px = np.cos(-angle) * daughters["px"].iloc[i] + np.sin(-angle) * daughters["py"].iloc[i]
pt = np.sqrt(daughters["px"].iloc[i] ** 2 + daughters["py"].iloc[i] ** 2)
pdg = int(daughters["pdg"].iloc[i])
try:
......@@ -71,7 +73,7 @@ for sh_id in shower_ids:
except Exception:
name = "Unknown"
ax[sh_id].plot([px, 0], [pz, 0], label=name)
ax[sh_id].plot([pt, 0], [pz, 0], label=name)
ax[sh_id].set_aspect("equal")
ax[sh_id].legend()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment