Skip to content
Snippets Groups Projects
Commit c9d6a705 authored by Johannes Schumann's avatar Johannes Schumann
Browse files

Update uproot & awkward import style

parent 78794069
No related branches found
No related tags found
No related merge requests found
Pipeline #16269 passed with warnings
......@@ -18,8 +18,8 @@ from io import StringIO
from os import listdir
from os.path import isfile, join, abspath
from tempfile import TemporaryDirectory
import awkward1
import uproot4
import awkward as ak
import uproot
from scipy.interpolate import UnivariateSpline
from scipy.spatial.transform import Rotation
import scipy.constants as constants
......@@ -202,7 +202,7 @@ class GiBUUOutput:
Parameters
----------
roottuple_data: awkward1.highlevel.Array
roottuple_data: awkward.highlevel.Array
"""
d = roottuple_data
k_in = np.vstack([
......@@ -233,7 +233,7 @@ class GiBUUOutput:
Parameters
----------
roottuple_data: awkward1.highlevel.Array
roottuple_data: awkward.highlevel.Array
"""
d = roottuple_data
y = 1 - np.divide(np.array(d.lepOut_E), np.array(d.lepIn_E))
......@@ -257,7 +257,7 @@ class GiBUUOutput:
GiBUU output data in pandas dataframe format
"""
import pandas as pd
df = awkward1.to_pandas(self.arrays)
df = ak.to_pandas(self.arrays)
sec_df = df[df.index.get_level_values(1) == 0].copy()
sec_df.loc[:, "E"] = sec_df.lepOut_E
sec_df.loc[:, "Px"] = sec_df.lepOut_Px
......@@ -275,11 +275,11 @@ class GiBUUOutput:
@property
def arrays(self):
"""
GiBUU output data in awkward1 format
GiBUU output data in awkward format
"""
retval = None
for ifile in self.root_pert_files:
fobj = uproot4.open(join(self.data_path, ifile))
fobj = uproot.open(join(self.data_path, ifile))
if retval is None:
retval = fobj["RootTuple"].arrays()
else:
......
......@@ -16,7 +16,7 @@ import numpy as np
import scipy.constants as const
import proposal as pp
from particle import Particle
import awkward1 as ak
import awkward as ak
from collections import defaultdict
from .config import Config
......@@ -61,7 +61,7 @@ def propagate_lepton(lepout_data, pdgid):
Parameters
----------
lepout_data: awkward1.highlevel.Array
lepout_data: awkward.highlevel.Array
Lepton data in the GiBUU output shape containing the fields
'lepOut_E, lepOut_Px, lepOut_Py, lepOut_Pz'
pdgid:
......@@ -69,7 +69,7 @@ def propagate_lepton(lepout_data, pdgid):
Returns
-------
awkward1.highlevel.Array (E, Px, Py, Pz, x, y, z)
awkward.highlevel.Array (E, Px, Py, Pz, x, y, z)
"""
lepton_info = Particle.from_pdgid(pdgid)
prop_range = const.c * lepton_info.lifetime * 1e11 * np.max(
......
......@@ -13,7 +13,7 @@ __status__ = "Development"
import csv
import unittest
import numpy as np
import uproot4
import uproot
from os.path import abspath, join, dirname
from thepipe.logger import get_logger
from km3net_testdata import data_path
......@@ -34,7 +34,7 @@ class TestTauPropagation(unittest.TestCase):
log.setLevel("INFO")
self.gibuu_output = GiBUUOutput(TESTDATA_DIR)
fname = join(TESTDATA_DIR, self.gibuu_output.root_pert_files[0])
fobj = uproot4.open(fname)
fobj = uproot.open(fname)
data = fobj["RootTuple"].arrays()
self.sec = propagate_lepton(data, 15)
......
......@@ -6,8 +6,8 @@ thepipe
particle
click
f90nml
uproot4
awkward1>=0.4.4
uproot>=4.0.0
awkward>=1.0.0
pandas
mendeleev
proposal
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