|
ATLAS Offline Software
|
|
def | worst_status (iovs, *dummy_args) |
|
def | worst (iterable) |
|
def | first (iterable) |
|
def | best (iterable, priorities=[3, 2, 1, -1, 0]) |
|
def | best_status (iovs, *dummy_args) |
|
def | iovs_in_time (wanted_start_time, wanted_end_time) |
|
def | get_root_version () |
|
def | fix_iovkey (iovkey) |
|
def | make_functor (expression, location, global_env={}, input_translation=None) |
|
def | make_floats_pretty (x) |
|
def | pprint_objects (objects, where=stdout) |
|
def | describe_colour (colour) |
|
def | tree (key_wrapper=None) |
|
def | directory_like (*key) |
|
def | get_array (hist) |
|
AthConfigFlags | getFlagsForActiveConfig (AthConfigFlags flags, str config_name, logging.Logger log) |
|
AthConfigFlags | cloneFlagsToActiveConfig (AthConfigFlags flags, str config_name) |
|
|
| BUILTIN_NAMES = set(("True", "False")) |
|
| WHITE = None |
|
int | GREY = 0 |
|
string | TAIL = lambda s: u' └── {} '.format(s) |
|
string | BRANCH = lambda s: u' ├── {} '.format(s) |
|
string | LINE = lambda s: u' │ {} '.format(s) |
|
string | SPACE = lambda s: u' {} '.format(s) |
|
◆ best()
def python.utils.best |
( |
|
iterable, |
|
|
|
priorities = [3, 2, 1, -1, 0] |
|
) |
| |
a min() function whose priorities can be chosen
Definition at line 50 of file DataQuality/DQUtils/python/utils.py.
50 def best(iterable, priorities=[3, 2, 1, -1, 0]):
52 a min() function whose priorities can be chosen
54 return worst(iterable, [3, 2, 1, -1, 0])
◆ best_status()
def python.utils.best_status |
( |
|
iovs, |
|
|
* |
dummy_args |
|
) |
| |
Return the worst status. (Different from worst_of).
Definition at line 56 of file DataQuality/DQUtils/python/utils.py.
58 Return the worst status. (Different from worst_of).
60 if len(iovs) == 1:
return iovs[0][2]
61 statuses = zip(*iovs)[2]
◆ cloneFlagsToActiveConfig()
AthConfigFlags python.utils.cloneFlagsToActiveConfig |
( |
AthConfigFlags |
flags, |
|
|
str |
config_name |
|
) |
| |
do InDet/ITk specific clone and replace of ActiveConfig without checking flags vs config_name
Definition at line 55 of file Trigger/TrigTools/TrigInDetConfig/python/utils.py.
56 flags: AthConfigFlags, config_name: str) -> AthConfigFlags:
58 do InDet/ITk specific clone and replace of ActiveConfig without checking flags vs config_name
61 return flags.cloneAndReplace(
62 "Tracking.ActiveConfig",
63 (
"Trigger.ITkTracking." if flags.Detector.GeometryITk
else "Trigger.InDetTracking.") + config_name,
◆ describe_colour()
def python.utils.describe_colour |
( |
|
colour | ) |
|
◆ directory_like()
def python.utils.directory_like |
( |
* |
key | ) |
|
◆ first()
def python.utils.first |
( |
|
iterable | ) |
|
Return the first filled (and not grey) flag
Definition at line 38 of file DataQuality/DQUtils/python/utils.py.
40 Return the first filled (and not grey) flag
43 for element
in iterable:
44 if element
not in [WHITE, GREY]:
◆ fix_iovkey()
def python.utils.fix_iovkey |
( |
|
iovkey | ) |
|
If an IoV starts on the 0th lumiblock, then move it forward one.
Definition at line 94 of file DataQuality/DQUtils/python/utils.py.
96 If an IoV starts on the 0th lumiblock, then move it forward one.
98 return iovkey
if iovkey & 0xFFFFFFFF
else iovkey+1
◆ get_array()
def python.utils.get_array |
( |
|
hist | ) |
|
◆ get_root_version()
def python.utils.get_root_version |
( |
| ) |
|
Return ROOT version tuple
Definition at line 86 of file DataQuality/DQUtils/python/utils.py.
88 Return ROOT version tuple
90 from ROOT
import gROOT
91 version_code = gROOT.RootVersionCode()
92 return (version_code >> 16, version_code >> 8 & 0xFF, version_code & 0xFF)
◆ getFlagsForActiveConfig()
AthConfigFlags python.utils.getFlagsForActiveConfig |
( |
AthConfigFlags |
flags, |
|
|
str |
config_name, |
|
|
logging.Logger |
log |
|
) |
| |
Get the flags for the named config, ensure that they are set to be active
Parameters
----------
flags : AthConfigFlags
The instance of the flags to check
config_name : str
The name of the desired tracking config
log : logging.Logger
Logger to print related messages
Returns
-------
Either the current flags instance if all the ActiveConfig is correct or a new
version with cloned flags
Definition at line 9 of file Trigger/TrigTools/TrigInDetConfig/python/utils.py.
10 flags: AthConfigFlags, config_name: str, log: logging.Logger) -> AthConfigFlags:
12 """Get the flags for the named config, ensure that they are set to be active
16 flags : AthConfigFlags
17 The instance of the flags to check
19 The name of the desired tracking config
21 Logger to print related messages
25 Either the current flags instance if all the ActiveConfig is correct or a new
26 version with cloned flags
28 if flags.hasFlag(
"Tracking.ActiveConfig.input_name"):
29 if flags.Tracking.ActiveConfig.input_name == config_name:
31 "flags.Tracking.ActiveConfig is for %s",
32 flags.Tracking.ActiveConfig.input_name,
37 "flags.Tracking.ActiveConfig is not for %s but %s",
39 flags.Tracking.ActiveConfig.input_name,
44 "Menu code invoked ID config without flags.Tracking.ActiveConfig for %s",
48 if flags.Trigger.useActsTracking:
49 return flags.cloneAndReplace(
"Tracking.ActiveConfig",
"Trigger.ActsTracking."+config_name)
◆ iovs_in_time()
def python.utils.iovs_in_time |
( |
|
wanted_start_time, |
|
|
|
wanted_end_time |
|
) |
| |
Return a function which selects iovs dependent on they occured
in the desired time
Definition at line 64 of file DataQuality/DQUtils/python/utils.py.
66 Return a function which selects iovs dependent on they occured
74 start_time, end_time, status = iov
78 start_time <= wanted_start_time <= end_time
or
79 start_time <= wanted_end_time <= end_time
or
81 wanted_start_time <= start_time <= wanted_end_time
or
82 wanted_start_time <= end_time <= wanted_end_time)
◆ make_floats_pretty()
def python.utils.make_floats_pretty |
( |
|
x | ) |
|
◆ make_functor()
def python.utils.make_functor |
( |
|
expression, |
|
|
|
location, |
|
|
|
global_env = {} , |
|
|
|
input_translation = None |
|
) |
| |
Compile an expression, returning the variables used and a functor which can
be called with the namespace in which the expression is run
`expression` is a single python expression to be evaluated
`location` is a string describing where the snippet of code came from
(in case of exceptions, for debugging)
`global_env` is the global environment in which the expression is executed
`input_translation` is an optional function which is executed on the
functor's arguments before it is executed.
Definition at line 100 of file DataQuality/DQUtils/python/utils.py.
100 def make_functor(expression, location, global_env={}, input_translation=None):
102 Compile an expression, returning the variables used and a functor which can
103 be called with the namespace in which the expression is run
105 `expression` is a single python expression to be evaluated
106 `location` is a string describing where the snippet of code came from
107 (in case of exceptions, for debugging)
108 `global_env` is the global environment in which the expression is executed
109 `input_translation` is an optional function which is executed on the
110 functor's arguments before it is executed.
112 compiled = compile(expression, location,
"eval")
114 provided_vars =
set(global_env.keys())
115 variables =
sorted(
set(compiled.co_names) - BUILTIN_NAMES - provided_vars)
116 if input_translation:
117 def functor(locals_={}):
118 return eval(compiled, global_env, input_translation(locals_))
120 def functor(locals_={}):
121 return eval(compiled, global_env, locals_)
122 return variables, functor
◆ pprint_objects()
def python.utils.pprint_objects |
( |
|
objects, |
|
|
|
where = stdout |
|
) |
| |
Pretty print a list of IoV-results
Definition at line 129 of file DataQuality/DQUtils/python/utils.py.
131 Pretty print a list of IoV-results
133 from six
import print_
135 since, until = obj[:2]
136 args = since, until,
"(%s)" %
", ".
join(map(str, map(make_floats_pretty, obj[2:])))
137 print_(
"[%r -> %r) : %s" % args, file=where)
◆ tree()
def python.utils.tree |
( |
|
key_wrapper = None | ) |
|
◆ worst()
def python.utils.worst |
( |
|
iterable | ) |
|
Definition at line 22 of file DataQuality/DQUtils/python/utils.py.
23 states =
set(iterable)
25 if not states:
return None
26 if -1
in states:
return -1
27 elif 1
in states:
return 1
28 elif 2
in states:
return 2
29 elif 3
in states:
return 3
30 elif 0
in states:
return 0
31 elif None in states:
return None
33 raise RuntimeError(
"Invalid Code present on database?")
◆ worst_status()
def python.utils.worst_status |
( |
|
iovs, |
|
|
* |
dummy_args |
|
) |
| |
Return the worst status of multiple IoVs. (Different from worst_of).
Definition at line 14 of file DataQuality/DQUtils/python/utils.py.
16 Return the worst status of multiple IoVs. (Different from worst_of).
18 if len(iovs) == 1:
return iovs[0][2]
19 statuses = zip(*iovs)[2]
20 return worst(statuses)
◆ BRANCH
string python.utils.BRANCH = lambda s: u' ├── {} '.format(s) |
◆ BUILTIN_NAMES
python.utils.BUILTIN_NAMES = set(("True", "False")) |
◆ GREY
int python.utils.GREY = 0 |
◆ LINE
string python.utils.LINE = lambda s: u' │ {} '.format(s) |
◆ SPACE
string python.utils.SPACE = lambda s: u' {} '.format(s) |
◆ TAIL
string python.utils.TAIL = lambda s: u' └── {} '.format(s) |
◆ WHITE
python.utils.WHITE = None |
def make_floats_pretty(x)
def worst_status(iovs, *dummy_args)
AthConfigFlags cloneFlagsToActiveConfig(AthConfigFlags flags, str config_name)
def describe_colour(colour)
AthConfigFlags getFlagsForActiveConfig(AthConfigFlags flags, str config_name, logging.Logger log)
def pprint_objects(objects, where=stdout)
def best(iterable, priorities=[3, 2, 1, -1, 0])
def best_status(iovs, *dummy_args)
std::vector< typename T::value_type > sorted(T begin, T end)
Helper function to create a sorted vector from an unsorted one.
constexpr std::enable_if_t< is_bitmask_v< E >, E & > set(E &lhs, E rhs)
Convenience function to set bits in a class enum bitmask.
std::string join(const std::vector< std::string > &v, const char c=',')
def iovs_in_time(wanted_start_time, wanted_end_time)
def make_functor(expression, location, global_env={}, input_translation=None)