From bdfe33ee89c78c2a6b885e01668111a6675e2daa Mon Sep 17 00:00:00 2001
From: Maximilian Reininghaus <maximilian.reininghaus@tu-dortmund.de>
Date: Sun, 23 Jun 2024 16:29:30 +0200
Subject: [PATCH] load NPZ differently

---
 corsika/detail/modules/pythia8/Interaction.inl | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/corsika/detail/modules/pythia8/Interaction.inl b/corsika/detail/modules/pythia8/Interaction.inl
index 8db70a58d..263c2f9e2 100644
--- a/corsika/detail/modules/pythia8/Interaction.inl
+++ b/corsika/detail/modules/pythia8/Interaction.inl
@@ -109,10 +109,9 @@ namespace corsika::pythia8 {
               fmt::format("xs_{}_{}.npz",
                           static_cast<PDGCodeIntType>(get_PDG(projectile)),
                           static_cast<PDGCodeIntType>(get_PDG(target)));
-          auto const energies =
-              cnpy::npz_load(tablePath.native(), "elab").as_vec<float>();
-          auto const total_xs =
-              cnpy::npz_load(tablePath.native(), "sig_tot").as_vec<float>();
+          auto const tables = cnpy::npz_load(tablePath.native());
+          auto const energies = tables.at("elab").as_vec<float>();
+          auto const total_xs = tables.at("sig_tot").as_vec<float>();
 
           if (auto const e_size = energies.size(), xs_size = total_xs.size();
               xs_size != e_size) {
@@ -136,8 +135,9 @@ namespace corsika::pythia8 {
         dataPath / "pythia8311_xsec" /
         fmt::format("xs_{}_{}.npz", static_cast<PDGCodeIntType>(get_PDG(Code::Proton)),
                     static_cast<PDGCodeIntType>(get_PDG(Code::Proton)));
-    auto const energies = cnpy::npz_load(ppTablePath.native(), "elab").as_vec<float>();
-    auto const xs = cnpy::npz_load(ppTablePath.native(), key).as_vec<float>();
+    auto const tables = cnpy::npz_load(ppTablePath.native());
+    auto const energies = tables.at("elab").as_vec<float>();
+    auto const xs = tables.at(key).as_vec<float>();
 
     if (auto e_size = energies.size(), xs_size = xs.size(); xs_size != e_size) {
       throw std::runtime_error{fmt::format(
-- 
GitLab