|
def | __init__ (self, folder_name, evaluator, **kwargs) |
|
def | quantize (self, lbtime, iovs) |
|
def | __hash__ (self) |
|
def | __repr__ (self) |
|
def | read (self, query_range, folder_base, folder_name) |
|
def | print_time_info (self, iovs) |
|
def | map_input_channels (self, iovs) |
|
def | make_good_iov (self, iov) |
|
def | make_good_iovs (self, iovs) |
|
def | calculate_good_iovs (self, lbtime, subdetector) |
|
Global variable which emits defects
Definition at line 275 of file variable.py.
◆ __init__()
def python.variable.DCSC_Defect_Global_Variable.__init__ |
( |
|
self, |
|
|
|
folder_name, |
|
|
|
evaluator, |
|
|
** |
kwargs |
|
) |
| |
◆ __hash__()
def python.variable.DCSC_Variable.__hash__ |
( |
|
self | ) |
|
|
inherited |
Useful for verifying if input variables have changed.
Definition at line 61 of file variable.py.
63 Useful for verifying if input variables have changed.
67 return hash(tuple(self.input_hashes))
◆ __repr__()
def python.variable.DCSC_Variable.__repr__ |
( |
|
self | ) |
|
|
inherited |
Definition at line 69 of file variable.py.
70 return "<DCSCVariable %s>" % self.folder_name
◆ calculate_good_iovs()
def python.variable.DCSC_Variable.calculate_good_iovs |
( |
|
self, |
|
|
|
lbtime, |
|
|
|
subdetector |
|
) |
| |
|
inherited |
Calculate LB-wise "good" states
Definition at line 180 of file variable.py.
180 def calculate_good_iovs(self, lbtime, subdetector):
182 Calculate LB-wise "good" states
185 self.subdetector = subdetector
187 if self.timewise_folder:
188 query_range =
RANGEIOV_VAL(lbtime.first.since, lbtime.last.until)
190 a, b = lbtime.first, lbtime.last
195 iovs = self.read(query_range, subdetector.folder_base, self.folder_name)
199 iovs = self.make_good_iovs(iovs)
205 iovs = self.map_input_channels(iovs)
207 if self.timewise_folder
and not config.opts.timewise:
209 with timer(
"Quantize %s (%i iovs over %i lbs)" %
210 (self.folder_name, len(iovs), len(lbtime))):
212 iovs = self.quantize(lbtime, iovs)
◆ make_good_iov()
def python.variable.DCSC_Variable.make_good_iov |
( |
|
self, |
|
|
|
iov |
|
) |
| |
|
inherited |
◆ make_good_iovs()
def python.variable.DCSC_Variable.make_good_iovs |
( |
|
self, |
|
|
|
iovs |
|
) |
| |
|
inherited |
◆ map_input_channels()
def python.variable.DCSC_Variable.map_input_channels |
( |
|
self, |
|
|
|
iovs |
|
) |
| |
|
inherited |
By default, do nothing. Overloaded by DCSC_Variable_With_Mapping.
Reimplemented in python.variable.DCSC_Variable_With_Mapping.
Definition at line 142 of file variable.py.
142 def map_input_channels(self, iovs):
144 By default, do nothing. Overloaded by DCSC_Variable_With_Mapping.
◆ print_time_info()
def python.variable.DCSC_Variable.print_time_info |
( |
|
self, |
|
|
|
iovs |
|
) |
| |
|
inherited |
Logs the first and last insertion times of the IoVs, and their ranges.
Definition at line 125 of file variable.py.
125 def print_time_info(self, iovs):
127 Logs the first and last insertion times of the IoVs, and their ranges.
129 first_value, last_value = iovs.range_iov
131 log.info(
"Times for %s:", self)
132 log.info(
" IoV : (first)%26s (last)%26s",
133 first_value.date, last_value.date)
135 if not hasattr(iovs.first,
"insertion_time"):
136 log.info(
"Insertion time not available")
138 insertion_times = [iov.insertion_time
for iov
in iovs]
139 log.info(
" Insertion: (first)%26s (last)%26s",
140 min(insertion_times),
max(insertion_times))
◆ quantize()
def python.variable.DCSC_Defect_Global_Variable.quantize |
( |
|
self, |
|
|
|
lbtime, |
|
|
|
iovs |
|
) |
| |
Quantize "good state" timewise-iovs to lumiblocks.
OUT_OF_CONFIG gets priority over BAD if BAD and OUT_OF_CONFIG overlap
the same lumiblock.
Reimplemented from python.variable.DCSC_Variable.
Definition at line 294 of file variable.py.
294 def quantize(self, lbtime, iovs):
295 iovs = [iovs_
for c, iovs_
in sorted(iovs.by_channel.items())]
297 DCSC_Defect_Global_Variable.quantizing_function)
298 return IOVSet(
DefectIOV(*iov, comment=
'Automatically set')
301 if iov[0].run == iov[1].run)
◆ quantizing_function()
def python.variable.DCSC_Defect_Global_Variable.quantizing_function |
( |
|
current_events | ) |
|
|
static |
Definition at line 285 of file variable.py.
285 def quantizing_function(current_events):
286 if len(current_events) == 0:
◆ read()
def python.variable.DCSC_Variable.read |
( |
|
self, |
|
|
|
query_range, |
|
|
|
folder_base, |
|
|
|
folder_name |
|
) |
| |
|
inherited |
Read the relevant data from COOL for this variable
Definition at line 72 of file variable.py.
72 def read(self, query_range, folder_base, folder_name):
74 Read the relevant data from COOL for this variable
76 if folder_name.startswith(
"/"):
77 folder_path = folder_name
80 folder_path =
"/".
join((folder_base, folder_name))
82 log.info(
"Querying COOL folder %s", folder_path)
84 if config.opts.check_input_time:
85 self.fetch_args[
"with_time"] =
True
88 if '/' in self.input_db:
89 newdbstring = self.input_db.rsplit(
'/', 1)[0]
91 newdbstring = self.input_db
92 if config.opts.input_database.startswith(
'sqlite'):
93 self.fetch_args[
'database'] = config.opts.input_database
95 self.fetch_args[
'database'] = (
'%s/%s' % (newdbstring, config.opts.input_database))
97 log.debug(
"Fetching with args: %r", self.fetch_args)
99 iovs =
fetch_iovs(folder_path, *query_range, **self.fetch_args)
109 original_length=len(
list(iovs))
110 if folder_path==
'/TGC/DCS/PSHVCHSTATE':
111 for i
in range(original_length-1, -1, -1):
112 if list(iovs)[i].channel
in range(5504,5552)
or list(iovs)[i].channel
in range(7362,7411):
115 if config.opts.check_input_time:
116 self.print_time_info(iovs)
118 if log.isEnabledFor(logging.INFO):
119 input_hash =
hash(iovs)
120 self.input_hashes.
append(input_hash)
121 log.info(
" -> Input hash: % 09x (len=%i)", input_hash, len(iovs))
◆ evaluator
python.variable.DCSC_Variable.evaluator |
|
inherited |
◆ fetch_args
python.variable.DCSC_Variable.fetch_args |
|
inherited |
◆ folder_name
python.variable.DCSC_Variable.folder_name |
|
inherited |
◆ input_db
python.variable.DCSC_Variable.input_db |
|
inherited |
◆ input_hashes
python.variable.DCSC_Variable.input_hashes |
|
inherited |
◆ iovs
python.variable.DCSC_Variable.iovs |
|
inherited |
◆ is_config_variable
bool python.variable.DCSC_Variable.is_config_variable = False |
|
staticinherited |
◆ is_global
bool python.variable.DCSC_Defect_Global_Variable.is_global = True |
|
static |
◆ subdetector
python.variable.DCSC_Variable.subdetector |
|
inherited |
◆ timewise_folder
bool python.variable.DCSC_Variable.timewise_folder = True |
|
staticinherited |
The documentation for this class was generated from the following file:
def fetch_iovs(folder_name, since=None, until=None, channels=None, tag="", what="all", max_records=-1, with_channel=True, loud=False, database=None, convert_time=False, named_channels=False, selection=None, runs=None, with_time=False, unicode_strings=False)