ATLAS Offline Software
Functions | Variables
python.libcore Namespace Reference

Functions

def dcsofl_cool_record ()
 
def make_multi_mapping (iterable)
 
def map_channels (iovs, mapping, folder)
 
def connect_adjacent_iovs_defect (generator)
 

Variables

 log
 

Function Documentation

◆ connect_adjacent_iovs_defect()

def python.libcore.connect_adjacent_iovs_defect (   generator)

Definition at line 69 of file libcore.py.

69 def connect_adjacent_iovs_defect(generator):
70  previous = None
71  for iov in generator:
72  if (previous and previous.connected_to(iov) and
73  previous.comment==iov.comment and previous.channel==iov.channel and
74  previous.present==iov.present):
75  previous = previous._replace(until=iov.until)
76  else:
77  if previous:
78  yield previous
79  previous = iov
80  if previous:
81  yield previous
82 

◆ dcsofl_cool_record()

def python.libcore.dcsofl_cool_record ( )

Definition at line 8 of file libcore.py.

9  from PyCool import cool
10  ST = cool.StorageType
11  return [("Code", ST.Int32),
12  ("deadFrac", ST.Float),
13  ("Thrust", ST.Float),
14  ("NConfig", ST.Int32),
15  ("NWorking", ST.Int32)]
16 

◆ make_multi_mapping()

def python.libcore.make_multi_mapping (   iterable)
When more than one value can map to the same key, we need 
{key, [value1, value2]}. 

This function builds it out of [(key, value1), (key, value2)]

Beware, values cannot be lists.

Definition at line 17 of file libcore.py.

17 def make_multi_mapping(iterable):
18  """
19  When more than one value can map to the same key, we need
20  {key, [value1, value2]}.
21 
22  This function builds it out of [(key, value1), (key, value2)]
23 
24  Beware, values cannot be lists.
25  """
26 
27  result = {}
28 
29  for key, value in iterable:
30  if key in result and not isinstance(result[key], list):
31  result[key] = [result[key], value]
32  elif key in result:
33  result[key].append(value)
34  else:
35  result[key] = value
36 
37  return result
38 

◆ map_channels()

def python.libcore.map_channels (   iovs,
  mapping,
  folder 
)
Remap the input channel identifiers.  Returns a new IOVSet 
with the channel number changed according to the provided mapping

Definition at line 39 of file libcore.py.

39 def map_channels(iovs, mapping, folder):
40  """
41  Remap the input channel identifiers. Returns a new IOVSet
42  with the channel number changed according to the provided mapping
43  """
44 
45  # look for unmapped channels
46  bad_channels = set()
47  def has_channel(c):
48  result = c in mapping
49  if not result:
50  bad_channels.add(c)
51  return result
52 
53  IOVSet = iovs.empty
54  iovs = IOVSet(iov._replace(channel=mapping[iov.channel])
55  for iov in iovs if has_channel(iov.channel))
56 
57  if bad_channels:
58  log.debug("WARNING: %s has %i unmapped channels %r",
59  folder, len(bad_channels), repr(bad_channels))
60 
61  # Remove lists from channel field of iovs
62  iovs = flatten_channels(iovs)
63 
64  # Traditional COOL ordering
65  iovs.sort(key=lambda iov: (iov.channel, iov.since))
66 
67  return IOVSet(iovs)
68 

Variable Documentation

◆ log

python.libcore.log

Definition at line 3 of file libcore.py.

python.libcore.map_channels
def map_channels(iovs, mapping, folder)
Definition: libcore.py:39
python.libcore.make_multi_mapping
def make_multi_mapping(iterable)
Definition: libcore.py:17
dumpHVPathFromNtuple.append
bool append
Definition: dumpHVPathFromNtuple.py:91
PyAthena::repr
std::string repr(PyObject *o)
returns the string representation of a python object equivalent of calling repr(o) in python
Definition: PyAthenaUtils.cxx:106
CxxUtils::set
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.
Definition: bitmask.h:232
python.libcore.connect_adjacent_iovs_defect
def connect_adjacent_iovs_defect(generator)
Definition: libcore.py:69
python.libcore.dcsofl_cool_record
def dcsofl_cool_record()
Definition: libcore.py:8
python.iov_arrangement.flatten_channels
def flatten_channels(iovs)
Definition: iov_arrangement.py:79