src: delphes module remove 'six'
-from __future__ import absolute_import, division, print_function, unicode_literals
-
-import six
-from collections import OrderedDict
-import numpy as np
import logging
+import numpy as np
import os
+from collections import OrderedDict
from madminer.utils.interfaces.madminer_hdf5 import (
save_events_to_madminer_file,
@@ -725,10 +722,8 @@ class DelphesReader:
# {systematics_name : {nuisance_parameter_name : ((benchmark0, weight0), (benchmark1, weight1), processing)}}
# Store nuisance parameters
- for systematics_name, nuisance_info in six.iteritems(systematics_dict):
- for nuisance_parameter_name, ((benchmark0, weight0), (benchmark1, weight1), _) in six.iteritems(
- nuisance_info
- ):
+ for systematics_name, nuisance_info in systematics_dict.items():
+ for nuisance_parameter_name, ((benchmark0, weight0), (benchmark1, weight1), _) in nuisance_info.items():
if (
self.nuisance_parameters is not None
and nuisance_parameter_name in self.nuisance_parameters
@@ -791,7 +786,7 @@ class DelphesReader:
# Apply cuts
logger.debug("Applying Delphes-based cuts to LHE weights")
- for key, weights in six.iteritems(this_weights):
+ for key, weights in this_weights.items():
this_weights[key] = weights[cut_filter]
if this_weights is None:
@@ -808,7 +803,7 @@ class DelphesReader:
# Background scenario: we only have one set of weights, but these should be true for all benchmarks
if is_background:
logger.debug("Sample is background")
- benchmarks_weight = list(six.itervalues(this_weights))[0]
+ benchmarks_weight = list(this_weights.values())[0]
for benchmark_name in self.benchmark_names_phys:
this_weights[benchmark_name] = benchmarks_weight
@@ -847,7 +842,7 @@ class DelphesReader:
""" Sanity checks """
# Check number of events in observables
n_events = None
- for key, obs in six.iteritems(this_observations):
+ for key, obs in this_observations.items():
this_n_events = len(obs)
if n_events is None:
n_events = this_n_events
@@ -870,7 +865,7 @@ class DelphesReader:
def _check_sample_weights(self, n_events, this_weights):
""" Sanity checks """
# Check number of events in weights
- for key, weights in six.iteritems(this_weights):
+ for key, weights in this_weights.items():
this_n_events = len(weights)
if n_events is None:
n_events = this_n_events
