Belle II Software  release-05-01-25
iov.py
1 #!/usr/bin/env python3
2 
3 """
4 conditions_db.iov
5 -----------------
6 
7 This module contains classes to work with validity intervals. There's a class
8 for a single interval, `IntervalOfValidity` and a class to manage a set of
9 validities, `IoVSet`, which can be used to manipulate iov ranges
10 """
11 
12 import math
13 from itertools import product
14 
15 
17  """
18  Interval of validity class to support set operations like union and
19  intersection.
20 
21  An interval of validity is a set of runs for which something is valid. An
22  IntervalOfValidity consists of a `first` valid run and a `final` valid run.
23 
24  Warning:
25  The `final` run is inclusive so the the validity is including the final run.
26 
27  Each run is identified by a experiment number and a run number. Accessing
28  `first` or `final` will return a tuple ``(experiment, run)`` but the
29  elements can also be accessed separately with `first_exp`, `first_exp`,
30  `final_exp` and `final_run`.
31 
32  For `final` there's a special case where either the run or both, the run and
33  the experiment number are infinite. This means the validity extends to all
34  values. If only the run number is infinite then it's valid for all further
35  runs in this experiment. If both are infinite the validity extends to everything.
36 
37  For simplicity ``-1`` can be passed in instead of infinity when creating objects.
38  """
39  def __init__(self, *iov):
40  """Create a new object.
41 
42  It can be either instantiated by providing four values or one tuple/list
43  with four values for first_exp, first_run, final_exp, final_run
44  """
45  if len(iov) == 1 and isinstance(iov[0], (list, tuple)):
46  iov = iov[0]
47  if len(iov) != 4:
48  raise ValueError("A iov should have four values")
49 
50  self.__first = tuple(iov[:2])
51 
52  self.__final = tuple(math.inf if x == -1 else x for x in iov[2:])
53  if math.isinf(self.__final[0]) and not math.isinf(self.__final[1]):
54  raise ValueError(f"Unlimited final experiment but not unlimited run: {self}")
55  if self.__first[0] > self.__final[0]:
56  raise ValueError(f"First exp larger than final exp: {self}")
57  if self.__first[0] == self.__final[0] and self.__first[1] > self.__final[1]:
58  raise ValueError(f"First run larger than final run: {self}")
59  if self.__first[0] < 0 or self.__first[1] < 0:
60  raise ValueError(f"Negative first exp or run: {self}")
61 
62  @staticmethod
63  def always():
64  """Return an iov that is valid everywhere
65 
66  >>> IntervalOfValidity.always()
67  (0, 0, inf, inf)
68  """
69  return IntervalOfValidity(0, 0, -1, -1)
70 
71  @property
72  def first(self):
73  """Return the first valid experiment,run"""
74  return self.__first
75 
76  @property
77  def first_exp(self):
78  """Return the first valid experiment"""
79  return self.__first[0]
80 
81  @property
82  def first_run(self):
83  """Return the first valid run"""
84  return self.__first[1]
85 
86  @property
87  def final(self):
88  """Return the final valid experiment,run"""
89  return self.__final
90 
91  @property
92  def final_exp(self):
93  """Return the final valid experiment"""
94  return self.__final[0]
95 
96  @property
97  def final_run(self):
98  """Return the final valid run"""
99  return self.__final[1]
100 
101  def __repr__(self):
102  """Return a printable representation"""
103  return str(self.__first + self.__final)
104 
105  def __eq__(self, other):
106  """Check for equality"""
107  if not isinstance(other, IntervalOfValidity):
108  return NotImplemented
109  return (self.__first, self.__final) == (other.__first, other.__final)
110 
111  def __lt__(self, other):
112  """Sort by run values"""
113  if not isinstance(other, IntervalOfValidity):
114  return NotImplemented
115  return (self.__first, self.__final) < (other.__first, other.__final)
116 
117  def __and__(self, other):
118  """Intersection between iovs. Will return None if the payloads don't overlap"""
119  if not isinstance(other, IntervalOfValidity):
120  return NotImplemented
121  return self.intersect(other)
122 
123  def __or__(self, other):
124  """Union between iovs. Will return None if the iovs don't overlap or
125  connect to each other"""
126  if not isinstance(other, IntervalOfValidity):
127  return NotImplemented
128  return self.union(other, False)
129 
130  def __sub__(self, other):
131  """Difference between iovs. Will return None if nothing is left over"""
132  if not isinstance(other, IntervalOfValidity):
133  return NotImplemented
134  return self.subtract(other)
135 
136  def __hash__(self):
137  """Make object hashable"""
138  return hash((self.__first, self.__final))
139 
140  def subtract(self, other):
141  """Return a new iov with the validity of the other removed.
142  Will return None if everything is removed.
143 
144  Warning:
145  If the other iov is in the middle of the validity we will return a
146  tuple of two new iovs
147 
148  >>> iov1 = IntervalOfValidity(0,0,10,-1)
149  >>> iov2 = IntervalOfValidity(5,0,5,-1)
150  >>> iov1 - iov2
151  ((0, 0, 4, inf), (6, 0, 10, inf))
152  """
153  if other.first <= self.first and other.final >= self.final:
154  # full overlap
155  return None
156  if other.first > self.first and other.final < self.final:
157  # the one we want to remove is in the middle, return a pair of iovs
158  # by subtracting two extended once
159  iov1 = self.subtract(IntervalOfValidity(other.first + (-1, -1)))
160  iov2 = self.subtract(IntervalOfValidity((0, 0) + other.final))
161  return (iov1, iov2)
162  if other.first <= self.final and other.final >= self.first:
163  # one sided overlap, figure out which side and calculate the remainder
164  if self.first < other.first:
165  end_run = other.first_run - 1
166  end_exp = other.first_exp if end_run >= 0 else other.first_exp - 1
167  return IntervalOfValidity(self.first + (end_exp, end_run))
168  else:
169  start_run = other.final_run + 1
170  start_exp = other.final_exp
171  if math.isinf(other.final_run):
172  start_exp += 1
173  start_run = 0
174  return IntervalOfValidity((start_exp, start_run) + self.final)
175  # no overlap so return unchanged
176  return self
177 
178  def intersect(self, other):
179  """Intersection with another iov.
180 
181  Will return None if the payloads don't overlap
182 
183  >>> iov1 = IntervalOfValidity(1,0,2,5)
184  >>> iov2 = IntervalOfValidity(2,0,2,-1)
185  >>> iov3 = IntervalOfValidity(2,10,5,-1)
186  >>> iov1.intersect(iov2)
187  (2, 0, 2, 5)
188  >>> iov2.intersect(iov3)
189  (2, 10, 2, inf)
190  >>> iov3.intersect(iov1) is None
191  True
192 
193  """
194  if other.first <= self.final and other.final >= self.first:
195  return IntervalOfValidity(*(max(self.first, other.first) + min(self.final, other.final)))
196  return None
197 
198  def union(self, other, allow_startone=False):
199  """
200  Return the union with another iov.
201 
202  >>> iov1 = IntervalOfValidity(1,0,1,-1)
203  >>> iov2 = IntervalOfValidity(2,0,2,-1)
204  >>> iov3 = IntervalOfValidity(2,10,5,-1)
205  >>> iov1.union(iov2)
206  (1, 0, 2, inf)
207  >>> iov2.union(iov3)
208  (2, 0, 5, inf)
209  >>> iov3.union(iov1) is None
210  True
211 
212  Warning:
213  This method will return None if the iovs don't overlap or connect to
214  each other as no union can be formed.
215 
216  Parameters:
217  other (IntervalOfValidity): IoV to calculate the union with
218  allow_startone (bool): If True we will consider run 0 and run 1 the
219  first run in an experiment. This means that if one of the iovs has
220  un unlimited final run it can be joined with the other iov if the
221  experiment number increases and the iov starts at run 0 and 1. If
222  this is False just run 0 is considered the next run.
223 
224  >>> iov1 = IntervalOfValidity(0,0,0,-1)
225  >>> iov2 = IntervalOfValidity(1,1,1,-1)
226  >>> iov1.union(iov2, False) is None
227  True
228  >>> iov1.union(iov2, True)
229  (0, 0, 1, inf)
230 
231  """
232  # check the trivial case of overlapping
233  if other.first <= self.final and other.final >= self.first:
234  return IntervalOfValidity(min(self.first, other.first) + max(self.final, other.final))
235  # ok, let's do the less simple case where they don't overlap but join directly
236  for i1, i2 in (self, other), (other, self):
237  if (i1.first == (i2.final_exp, i2.final_run + 1) or
238  (math.isinf(i2.final_run) and (i1.first_exp == i2.final_exp + 1) and
239  (i1.first_run == 0 or allow_startone and i1.first_run == 1))):
240  return IntervalOfValidity(i2.first + i1.final)
241  # no union possible: not directly connected and not overlapping
242  return None
243 
244  def contains(self, exp, run):
245  """Check if a run is part of the validtiy"""
246  return self.first <= (exp, run) <= self.final
247 
248  @property
249  def is_open(self):
250  """Check whether the iov is valid until infinity"""
251  return self.final == (math.inf, math.inf)
252 
253  @property
254  def tuple(self):
255  """Return the iov as a tuple with experiment/run numbers replaced with -1
256 
257  This is mostly helpful where infinity is not supported and is how the
258  intervals are represented in the database.
259 
260  >>> a = IntervalOfValidity.always()
261  >>> a
262  (0, 0, inf, inf)
263  >>> a.tuple
264  (0, 0, -1, -1)
265  """
266  return self.__first + tuple(-1 if math.isinf(x) else x for x in self.__final)
267 
268 
269 class IoVSet:
270  """A set of iovs.
271 
272  This class allows to combine iovs into a set. New iovs can be added with
273  `add()` and will be combined with existing iovs if possible.
274 
275  The final, minimal number of iovs can be obtained with the `iovs` property
276 
277  >>> a = IoVSet()
278  >>> a.add((0,0,0,2))
279  >>> a.add((0,3,0,5))
280  >>> a.add((0,8,0,9))
281  >>> a
282  {(0, 0, 0, 5), (0, 8, 0, 9)}
283  """
284  def __init__(self, iterable=None, *, allow_overlaps=False, allow_startone=False):
285  """Create a new set.
286 
287  >>> a = IoVSet([IntervalOfValidity(3,6,3,-1), (0,0,3,5)])
288  >>> a
289  {(0, 0, 3, inf)}
290 
291  Parameters:
292  iterable: if not None it should be an iterable of IntervalOfValidity
293  objects or anything that can be converted to an IntervalOfValidity.
294  allow_overlaps (bool): If False adding which overlaps with any
295  existing iov in the set will raise a ValueError.
296  allow_startone (bool): If True also join iovs if one covers the
297  whole experiment and the next one starts at run 1 in the next
298  experiment. If False they will only be joined if the next one
299  starts at run 0.
300  """
301 
302  self.__iovs = set()
303 
304  self.__allow_overlaps = allow_overlaps
305 
307  self.__allow_startone = allow_startone
308  if iterable is not None:
309  for element in iterable:
310  self.add(element)
311 
312  def add(self, iov, allow_overlaps=None):
313  """
314  Add a new iov to the set.
315 
316  The new iov be combined with existing iovs if possible. After the
317  operation the set will contain the minimal amount of separate iovs
318  possible to represent all added iovs
319 
320  >>> a = IoVSet()
321  >>> a.add((0, 0, 0, 2))
322  >>> a.add((0, 3, 0, 5))
323  >>> a.add((0, 8, 0, 9))
324  >>> a
325  {(0, 0, 0, 5), (0, 8, 0, 9)}
326  >>> a.add(IoVSet([(10, 0, 10, 1), (10, 2, 10, -1)]))
327  >>> a
328  {(0, 0, 0, 5), (0, 8, 0, 9), (10, 0, 10, inf)}
329 
330  Be aware, by default it's not possible to add overlapping iovs to the set.
331  This can be changed either on construction or per `add` call using
332  ``allow_overlap``
333 
334  >>> a.add((0, 2, 0, 3))
335  Traceback (most recent call last):
336  ...
337  ValueError: Overlap between (0, 0, 0, 5) and (0, 2, 0, 3)
338  >>> a.add((0, 2, 0, 3), allow_overlaps=True)
339  >>> a
340  {(0, 0, 0, 5), (0, 8, 0, 9), (10, 0, 10, inf)}
341 
342  Parameters:
343  iov (Union[IoVSet, IntervalOfValidity, tuple(int)]): IoV or
344  set of IoVs to add to this set
345  allow_overlaps (bool): Can be used to override global overlap setting
346  of this set to allow/restrict overlaps for a single insertion
347  operation
348 
349  Warning:
350  This method modifies the set in place
351  """
352  # check whether we override overlap settings
353  if allow_overlaps is None:
354  allow_overlaps = self.__allow_overlaps
355  # we can add a set to a set :D
356  if isinstance(iov, IoVSet):
357  for element in iov:
358  self.add(element, allow_overlaps)
359  return
360  # make sure it's actually an IoV, this will raise an error on failure
361  if not isinstance(iov, IntervalOfValidity):
362  iov = IntervalOfValidity(iov)
363  # and now check for all existing iovs ... (but use a copy since we modify the set)
364  for existing in list(self.__iovs):
365  # if there's an overlap to the new iov
366  if (not allow_overlaps) and (existing & iov):
367  raise ValueError(f"Overlap between {existing} and {iov}")
368  # and if they can be combined to a bigger iov
369  combined = existing.union(iov, self.__allow_startone)
370  # if we now have a combined iov, remove the one that we were able to
371  # combine it with from the existing iovs because we now check
372  # against the combined one. Since the only way to add a new iov is
373  # this loop we know all previous existing iovs we checked before
374  # didn't have a union with this new iov or any other existing iovs
375  # so if the just check the remaining iovs against the new combined
376  # one we can cascade combine all iovs in one go.
377  if combined is not None:
378  self.__iovs.remove(existing)
379  iov = combined
380  # done, we now have a new iov which combines all existing iovs it had an
381  # overlap with and we removed the existing iovs so nothing else to do
382  # but add the iov back in the list
383  self.__iovs.add(iov)
384 
385  def remove(self, iov):
386  """Remove an iov or a set of iovs from this set
387 
388  After this operation the set will not be valid for the given iov or set
389  of iovs:
390 
391  >>> a = IoVSet()
392  >>> a.add((0,0,10,-1))
393  >>> a.remove((1,0,1,-1))
394  >>> a.remove((5,0,8,5))
395  >>> a
396  {(0, 0, 0, inf), (2, 0, 4, inf), (8, 6, 10, inf)}
397  >>> a.remove(IoVSet([(3,0,3,10), (3,11,3,-1)]))
398  >>> a
399  {(0, 0, 0, inf), (2, 0, 2, inf), (4, 0, 4, inf), (8, 6, 10, inf)}
400 
401  Parameters:
402  iov (Union[IoVSet, IntervalOfValidity, tuple(int)]): IoV or
403  set of IoVs to remove from this set
404 
405  Warning:
406  This method modifies the set in place
407  """
408  # we can remove a set from a set :D
409  if isinstance(iov, IoVSet):
410  for element in iov:
411  self.remove(element)
412  return
413  # make sure it's actually an IoV, this will raise an error on failure
414  if not isinstance(iov, IntervalOfValidity):
415  iov = IntervalOfValidity(iov)
416  # and subtract the iov from all existing iovs
417  for existing in list(self.__iovs):
418  delta = existing - iov
419  if delta != existing:
420  self.__iovs.remove(existing)
421  if isinstance(delta, tuple):
422  # got two new iovs, apparently we split the old one
423  for new in delta:
424  self.__iovs.add(new)
425  elif delta is not None:
426  self.__iovs.add(delta)
427 
428  def intersect(self, iov):
429  """Intersect this set with another set and return a new set
430  which is valid exactly where both sets have been valid before
431 
432  >>> a = IoVSet()
433  >>> a.add((0,0,10,-1))
434  >>> a.intersect((5,0,20,-1))
435  {(5, 0, 10, inf)}
436  >>> a.intersect(IoVSet([(0,0,3,-1), (9,0,20,-1)]))
437  {(0, 0, 3, inf), (9, 0, 10, inf)}
438 
439  Parameters:
440  iov (Union[IoVSet, IntervalOfValidity, tuple(int)]): IoV or
441  set of IoVs to intersect with this set
442  """
443  if not isinstance(iov, (IoVSet, IntervalOfValidity)):
444  iov = IntervalOfValidity(iov)
445  if isinstance(iov, IntervalOfValidity):
446  iov = IoVSet([iov])
447 
448  # ok for all combinations a,b from set1 and set2 check the intersection
449  # and if not empty add to the result
450  result = IoVSet()
451  for a, b in product(self.iovs, iov.iovs):
452  c = a & b
453  if c:
454  result.add(c)
455  return result
456 
457  def contains(self, iov):
458  """
459  Check if an iov is fully covered by the set
460 
461  >>> a = IoVSet([(0,0,2,-1), (5,0,5,-1)])
462  >>> a.contains((0,0,1,-1))
463  True
464  >>> a.contains(IntervalOfValidity(0,0,3,2))
465  False
466  >>> a.contains(IoVSet([(0,1,1,23), (5,0,5,23)]))
467  True
468  >>> a.contains(IoVSet([(0,1,1,23), (5,0,6,23)]))
469  False
470  >>> a.contains((3,0,4,-1))
471  False
472 
473  Parameters:
474  iov (Union[IoVSet, IntervalOfValidity, tuple(int)]): IoV or
475  set of IoVs to be checked
476 
477  Returns:
478  True if the full iov or all the iovs in the given set are fully
479  present in this set
480  """
481  # check if the whole set is in this set: all iovs need to be in here
482  if isinstance(iov, IoVSet):
483  return all(e in self for e in iov)
484  # make sure it's actually an IoV, this will raise an error on failure
485  if not isinstance(iov, IntervalOfValidity):
486  iov = IntervalOfValidity(iov)
487  # and then check all iovs in the set if they cover it
488  for existing in self.__iovs:
489  if iov - existing is None:
490  return True
491  return False
492 
493  def overlaps(self, iov):
494  """Check if the given iov overlaps with this set.
495 
496  In contrast to `contains` this doesn't require the given iov to be fully
497  covered. It's enough if the any run covered by the iov is also covered
498  by this set.
499 
500  >>> a = IoVSet([(0,0,2,-1), (5,0,5,-1)])
501  >>> a.overlaps((0,0,1,-1))
502  True
503  >>> a.overlaps(IntervalOfValidity(0,0,3,2))
504  True
505  >>> a.overlaps(IoVSet([(0,1,1,23), (5,0,5,23)]))
506  True
507  >>> a.overlaps(IoVSet([(0,1,1,23), (5,0,6,23)]))
508  True
509  >>> a.overlaps((3,0,4,-1))
510  False
511 
512  Parameters:
513  iov (Union[IoVSet, IntervalOfValidity, tuple(int)]): IoV or
514  set of IoVs to be checked
515 
516  Returns:
517  True if the iov or any of the iovs in the given set overlap with any
518  iov in this set
519  """
520  if not isinstance(iov, (IoVSet, IntervalOfValidity)):
521  iov = IntervalOfValidity(iov)
522  if isinstance(iov, IntervalOfValidity):
523  iov = IoVSet([iov])
524 
525  for a, b in product(self.iovs, iov.iovs):
526  c = a & b
527  if c:
528  return True
529  return False
530 
531  def copy(self):
532  """Return a copy of this set"""
533  copy = IoVSet(allow_overlaps=self.__allow_overlaps, allow_startone=self.__allow_startone)
534  copy.__iovs = set(self.__iovs)
535  return copy
536 
537  def clear(self):
538  """Clear all iovs from this set"""
539  self.__iovs = {}
540 
541  @property
542  def iovs(self):
543  """Return the set of valid iovs"""
544  return self.__iovs
545 
546  @property
547  def first(self):
548  """Return the first run covered by this iov set
549 
550  >>> a = IoVSet([(3,0,3,10), (10,11,10,23), (0,0,2,-1), (5,0,5,-1)])
551  >>> a.first
552  (0, 0)
553  """
554  if not self.__iovs:
555  return None
556  return min(self.iovs).first
557 
558  @property
559  def final(self):
560  """Return the final run covered by this iov set
561 
562  >>> a = IoVSet([(3,0,3,10), (10,11,10,23), (0,0,2,-1), (5,0,5,-1)])
563  >>> a.final
564  (10, 23)
565  """
566  if not self.__iovs:
567  return None
568  return max(self.iovs).final
569 
570  @property
571  def gaps(self):
572  """Return the gaps in the set: Any area not covered between the first
573  point of validity and the last
574 
575  >>> a = IoVSet([(0,0,2,-1)])
576  >>> a.gaps
577  {}
578  >>> b = IoVSet([(0,0,2,-1), (5,0,5,-1)])
579  >>> b.gaps
580  {(3, 0, 4, inf)}
581  >>> c = IoVSet([(0,0,2,-1), (5,0,5,-1), (10,3,10,6)])
582  >>> c.gaps
583  {(3, 0, 4, inf), (6, 0, 10, 2)}
584  """
585  if len(self.__iovs) < 2:
586  return IoVSet()
587 
588  full_range = IoVSet([self.first + self.final])
589  return full_range - self
590 
591  def __bool__(self):
592  """Return True if the set is not empty
593 
594 
595  >>> a = IoVSet()
596  >>> a.add((0,0,1,-1))
597  >>> bool(a)
598  True
599  >>> a.clear()
600  >>> a
601  {}
602  >>> bool(a)
603  False
604  """
605  return len(self.__iovs) > 0
606 
607  def __contains__(self, iov):
608  """Check if an iov is fully covered by the set"""
609  return self.contains(iov)
610 
611  def __and__(self, other):
612  """Return a new set that is the intersection between two sets
613 
614  >>> a = IoVSet([(0,0,1,-1)])
615  >>> a & (1,0,2,-1)
616  {(1, 0, 1, inf)}
617  """
618  return self.intersect(other)
619 
620  def __or__(self, other):
621  """
622  Return a new set that is the combination of two sets: The new set will
623  be valid everywhere any of the two sets were valid.
624 
625  No check for overlaps will be performed but the result will inherit the
626  settings for further additions from the first set
627 
628  >>> a = IoVSet([(0,0,1,-1)])
629  >>> a | (1,0,2,-1)
630  {(0, 0, 2, inf)}
631  >>> a | (3,0,3,-1)
632  {(0, 0, 1, inf), (3, 0, 3, inf)}
633  """
634  copy = self.copy()
635  copy.add(other, allow_overlaps=True)
636  return copy
637 
638  def __sub__(self, other):
639  """
640  Return a new set which is only valid for where a is valid but not b.
641 
642  See `remove` but this will not modify the set in place
643 
644  >>> a = IoVSet([(0,0,-1,-1)])
645  >>> a - (1,0,2,-1)
646  {(0, 0, 0, inf), (3, 0, inf, inf)}
647  >>> a - (0,0,3,-1) - (10,0,-1,-1)
648  {(4, 0, 9, inf)}
649  >>> IoVSet([(0,0,1,-1)]) - (2,0,2,-1)
650  {(0, 0, 1, inf)}
651  """
652  copy = self.copy()
653  copy.remove(other)
654  return copy
655 
656  def __iter__(self):
657  """Loop over the set of iovs"""
658  return iter(self.__iovs)
659 
660  def __len__(self):
661  """Return the number of validity intervals in this set"""
662  return len(self.__iovs)
663 
664  def __repr__(self):
665  """Return a printable representation"""
666  return '{' + ', '.join(str(e) for e in sorted(self.__iovs)) + '}'
conditions_db.iov.IntervalOfValidity.always
def always()
Definition: iov.py:63
conditions_db.iov.IoVSet.__or__
def __or__(self, other)
Definition: iov.py:620
conditions_db.iov.IoVSet.first
def first(self)
Definition: iov.py:547
conditions_db.iov.IntervalOfValidity.__first
__first
tuple with the first valid exp, run
Definition: iov.py:50
conditions_db.iov.IntervalOfValidity.__final
__final
tuple with the final valid exp, run
Definition: iov.py:52
conditions_db.iov.IntervalOfValidity.final
final
Definition: iov.py:251
conditions_db.iov.IntervalOfValidity.contains
def contains(self, exp, run)
Definition: iov.py:244
conditions_db.iov.IoVSet.__iter__
def __iter__(self)
Definition: iov.py:656
conditions_db.iov.IntervalOfValidity.__init__
def __init__(self, *iov)
Definition: iov.py:39
conditions_db.iov.IoVSet.__bool__
def __bool__(self)
Definition: iov.py:591
conditions_db.iov.IoVSet.__and__
def __and__(self, other)
Definition: iov.py:611
conditions_db.iov.IoVSet.final
def final(self)
Definition: iov.py:559
conditions_db.iov.IoVSet.remove
def remove(self, iov)
Definition: iov.py:385
conditions_db.iov.IoVSet.clear
def clear(self)
Definition: iov.py:537
conditions_db.iov.IoVSet.contains
def contains(self, iov)
Definition: iov.py:457
conditions_db.iov.IntervalOfValidity.final_exp
def final_exp(self)
Definition: iov.py:92
conditions_db.iov.IoVSet.intersect
def intersect(self, iov)
Definition: iov.py:428
conditions_db.iov.IntervalOfValidity.first
def first(self)
Definition: iov.py:72
conditions_db.iov.IoVSet.__contains__
def __contains__(self, iov)
Definition: iov.py:607
conditions_db.iov.IntervalOfValidity.union
def union(self, other, allow_startone=False)
Definition: iov.py:198
conditions_db.iov.IoVSet.overlaps
def overlaps(self, iov)
Definition: iov.py:493
conditions_db.iov.IntervalOfValidity.subtract
def subtract(self, other)
Definition: iov.py:140
conditions_db.iov.IntervalOfValidity
Definition: iov.py:16
conditions_db.iov.IntervalOfValidity.is_open
def is_open(self)
Definition: iov.py:249
conditions_db.iov.IntervalOfValidity.intersect
def intersect(self, other)
Definition: iov.py:178
conditions_db.iov.IntervalOfValidity.__hash__
def __hash__(self)
Definition: iov.py:136
conditions_db.iov.IoVSet.gaps
def gaps(self)
Definition: iov.py:571
conditions_db.iov.IoVSet.__len__
def __len__(self)
Definition: iov.py:660
conditions_db.iov.IoVSet.__iovs
__iovs
The set of iovs.
Definition: iov.py:302
conditions_db.iov.IoVSet.iovs
def iovs(self)
Definition: iov.py:542
conditions_db.iov.IntervalOfValidity.first_run
def first_run(self)
Definition: iov.py:82
conditions_db.iov.IntervalOfValidity.tuple
def tuple(self)
Definition: iov.py:254
conditions_db.iov.IntervalOfValidity.__sub__
def __sub__(self, other)
Definition: iov.py:130
conditions_db.iov.IntervalOfValidity.__eq__
def __eq__(self, other)
Definition: iov.py:105
conditions_db.iov.IntervalOfValidity.__and__
def __and__(self, other)
Definition: iov.py:117
conditions_db.iov.IoVSet.add
def add(self, iov, allow_overlaps=None)
Definition: iov.py:312
conditions_db.iov.IoVSet.__repr__
def __repr__(self)
Definition: iov.py:664
conditions_db.iov.IoVSet.__sub__
def __sub__(self, other)
Definition: iov.py:638
conditions_db.iov.IntervalOfValidity.final_run
def final_run(self)
Definition: iov.py:97
conditions_db.iov.IoVSet.__init__
def __init__(self, iterable=None, *allow_overlaps=False, allow_startone=False)
Definition: iov.py:284
conditions_db.iov.IntervalOfValidity.first_exp
def first_exp(self)
Definition: iov.py:77
conditions_db.iov.IoVSet.__allow_overlaps
__allow_overlaps
Whether or not we raise an error on overlaps.
Definition: iov.py:304
conditions_db.iov.IntervalOfValidity.__lt__
def __lt__(self, other)
Definition: iov.py:111
conditions_db.iov.IoVSet
Definition: iov.py:269
conditions_db.iov.IoVSet.copy
def copy(self)
Definition: iov.py:531
conditions_db.iov.IntervalOfValidity.__repr__
def __repr__(self)
Definition: iov.py:101
conditions_db.iov.IoVSet.__allow_startone
__allow_startone
Whether or not run 1 will be also considered the first run when combining iovs between experiments.
Definition: iov.py:307
conditions_db.iov.IntervalOfValidity.__or__
def __or__(self, other)
Definition: iov.py:123