Skip to content
Snippets Groups Projects
Commit 8a13c18a authored by Tamas Gal's avatar Tamas Gal :speech_balloon:
Browse files

Fix definitions access

parent 5d370edd
No related branches found
No related tags found
No related merge requests found
Pipeline #14217 failed
......@@ -4,7 +4,7 @@ import numpy as np
import awkward1 as ak1
import uproot
from .definitions import fitparameters, reconstruction, w2list_genhen, w2list_gseagen
import km3io.definitions as kdef
# 110 MB based on the size of the largest basket found so far in km3net
BASKET_CACHE_SIZE = 110 * 1024**2
......@@ -105,7 +105,7 @@ def w2list_genhen_keys():
dict_keys
genhen w2list keys.
"""
return w2list_genhen.keys()
return kdef.reconstruction.w2list_genhen.keys()
def w2list_gseagen_keys():
......@@ -117,7 +117,7 @@ def w2list_gseagen_keys():
dict_keys
gseagen w2list keys.
"""
return w2list_gseagen.keys()
return kdef.reconstruction.w2list_gseagen.keys()
def get_w2list_param(events, generator, param):
......@@ -141,9 +141,9 @@ def get_w2list_param(events, generator, param):
array of the values of interest.
"""
if generator == "gseagen":
return events.w2list[:, w2list_gseagen[param]]
return events.w2list[:, kdef.reconstruction.w2list_gseagen[param]]
if generator == "genhen":
return events.w2list[:, w2list_genhen[param]]
return events.w2list[:, kdef.reconstruction.w2list_genhen[param]]
def rec_types():
......@@ -155,7 +155,7 @@ def rec_types():
dict_keys
reconstruction types.
"""
return reconstruction.keys()
return kdef.reconstruction.keys()
def fitinf(fitparam, tracks):
......@@ -176,7 +176,7 @@ def fitinf(fitparam, tracks):
awkward array of the values of the fit parameter requested.
"""
fit = tracks.fitinf
index = fitparameters[fitparam]
index = kdef.fitparameters[fitparam]
try:
params = fit[count_nested(fit, axis=2) > index]
return ak1.Array([i[:, index] for i in params])
......@@ -195,7 +195,7 @@ def fitparams():
dict_keys
fit parameters keys.
"""
return fitparameters.keys()
return kdef.fitparameters.keys()
def count_nested(Array, axis=0):
......@@ -328,12 +328,12 @@ def best_track(tracks, strategy="default", rec_type=None):
if strategy == "default" and rec_type is not None:
if n_events == 1:
rec_types = tracks[tracks.rec_type == reconstruction[rec_type]]
rec_types = tracks[tracks.rec_type == kdef.reconstruction[rec_type]]
len_stages = count_nested(rec_types.rec_stages, axis=1)
longest = rec_types[len_stages == ak1.max(len_stages, axis=0)]
out = longest[longest.lik == ak1.max(longest.lik, axis=0)]
else:
rec_types = tracks[tracks.rec_type == reconstruction[rec_type]]
rec_types = tracks[tracks.rec_type == kdef.reconstruction[rec_type]]
len_stages = count_nested(rec_types.rec_stages, axis=2)
longest = rec_types[len_stages == ak1.max(len_stages, axis=1)]
out = longest[longest.lik == ak1.max(longest.lik, axis=1)]
......
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