3 import logging; log = logging.getLogger(
"DCSCalculator2.libcore")
5 from DQUtils.iov_arrangement
import flatten_channels
9 from PyCool
import cool
11 return [(
"Code", ST.Int32),
12 (
"deadFrac", ST.Float),
14 (
"NConfig", ST.Int32),
15 (
"NWorking", ST.Int32)]
19 When more than one value can map to the same key, we need
20 {key, [value1, value2]}.
22 This function builds it out of [(key, value1), (key, value2)]
24 Beware, values cannot be lists.
29 for key, value
in iterable:
30 if key
in result
and not isinstance(result[key], list):
31 result[key] = [result[key], value]
41 Remap the input channel identifiers. Returns a new IOVSet
42 with the channel number changed according to the provided mapping
54 iovs = IOVSet(iov._replace(channel=mapping[iov.channel])
55 for iov
in iovs
if has_channel(iov.channel))
58 log.debug(
"WARNING: %s has %i unmapped channels %r",
59 folder, len(bad_channels),
repr(bad_channels))
65 iovs.sort(key=
lambda iov: (iov.channel, iov.since))
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)