![]() |
Belle II Software development
|
Public Member Functions | |
__init__ (self, *iov) | |
first (self) | |
first_exp (self) | |
first_run (self) | |
final (self) | |
final_exp (self) | |
final_run (self) | |
__repr__ (self) | |
__eq__ (self, other) | |
__lt__ (self, other) | |
__and__ (self, other) | |
__or__ (self, other) | |
__sub__ (self, other) | |
__hash__ (self) | |
subtract (self, other) | |
intersect (self, other) | |
union (self, other, allow_startone=False) | |
contains (self, exp, run) | |
is_open (self) | |
tuple (self) | |
Static Public Member Functions | |
always () | |
Public Attributes | |
tuple | final = 0 |
Doxygen complains without this string. | |
first | |
Private Attributes | |
__first = tuple(iov[:2]) | |
tuple with the first valid exp, run | |
__final = tuple(math.inf if x == -1 else x for x in iov[2:]) | |
tuple with the final valid exp, run | |
Interval of validity class to support set operations like union and intersection. An interval of validity is a set of runs for which something is valid. An IntervalOfValidity consists of a `first` valid run and a `final` valid run. Warning: The `final` run is inclusive so the the validity is including the final run. Each run is identified by a experiment number and a run number. Accessing `first` or `final` will return a tuple ``(experiment, run)`` but the elements can also be accessed separately with `first_exp`, `first_exp`, `final_exp` and `final_run`. For `final` there's a special case where either the run or both, the run and the experiment number are infinite. This means the validity extends to all values. If only the run number is infinite then it's valid for all further runs in this experiment. If both are infinite the validity extends to everything. For simplicity ``-1`` can be passed in instead of infinity when creating objects.
__init__ | ( | self, | |
* | iov ) |
Create a new object. It can be either instantiated by providing four values or one tuple/list with four values for first_exp, first_run, final_exp, final_run
Definition at line 48 of file iov.py.
__and__ | ( | self, | |
other ) |
Intersection between iovs. Will return None if the payloads don't overlap
Definition at line 126 of file iov.py.
__eq__ | ( | self, | |
other ) |
__hash__ | ( | self | ) |
__lt__ | ( | self, | |
other ) |
__or__ | ( | self, | |
other ) |
Union between iovs. Will return None if the iovs don't overlap or connect to each other
Definition at line 132 of file iov.py.
__repr__ | ( | self | ) |
__sub__ | ( | self, | |
other ) |
Difference between iovs. Will return None if nothing is left over
Definition at line 139 of file iov.py.
|
static |
contains | ( | self, | |
exp, | |||
run ) |
final | ( | self | ) |
final_exp | ( | self | ) |
final_run | ( | self | ) |
first | ( | self | ) |
first_exp | ( | self | ) |
first_run | ( | self | ) |
intersect | ( | self, | |
other ) |
Intersection with another iov. Will return None if the payloads don't overlap >>> iov1 = IntervalOfValidity(1,0,2,5) >>> iov2 = IntervalOfValidity(2,0,2,-1) >>> iov3 = IntervalOfValidity(2,10,5,-1) >>> iov1.intersect(iov2) (2, 0, 2, 5) >>> iov2.intersect(iov3) (2, 10, 2, inf) >>> iov3.intersect(iov1) is None True
Definition at line 187 of file iov.py.
is_open | ( | self | ) |
subtract | ( | self, | |
other ) |
Return a new iov with the validity of the other removed. Will return None if everything is removed. Warning: If the other iov is in the middle of the validity we will return a tuple of two new iovs >>> iov1 = IntervalOfValidity(0,0,10,-1) >>> iov2 = IntervalOfValidity(5,0,5,-1) >>> iov1 - iov2 ((0, 0, 4, inf), (6, 0, 10, inf))
Definition at line 149 of file iov.py.
tuple | ( | self | ) |
Return the iov as a tuple with experiment/run numbers replaced with -1 This is mostly helpful where infinity is not supported and is how the intervals are represented in the database. >>> a = IntervalOfValidity.always() >>> a (0, 0, inf, inf) >>> a.tuple (0, 0, -1, -1)
Definition at line 264 of file iov.py.
union | ( | self, | |
other, | |||
allow_startone = False ) |
Return the union with another iov. >>> iov1 = IntervalOfValidity(1,0,1,-1) >>> iov2 = IntervalOfValidity(2,0,2,-1) >>> iov3 = IntervalOfValidity(2,10,5,-1) >>> iov1.union(iov2) (1, 0, 2, inf) >>> iov2.union(iov3) (2, 0, 5, inf) >>> iov3.union(iov1) is None True Warning: This method will return None if the iovs don't overlap or connect to each other as no union can be formed. Parameters: other (IntervalOfValidity): IoV to calculate the union with allow_startone (bool): If True we will consider run 0 and run 1 the first run in an experiment. This means that if one of the iovs has un unlimited final run it can be joined with the other iov if the experiment number increases and the iov starts at run 0 and 1. If this is False just run 0 is considered the next run. >>> iov1 = IntervalOfValidity(0,0,0,-1) >>> iov2 = IntervalOfValidity(1,1,1,-1) >>> iov1.union(iov2, False) is None True >>> iov1.union(iov2, True) (0, 0, 1, inf)
Definition at line 207 of file iov.py.
|
private |
|
private |