Belle II Software development
|
Public Member Functions | |
def | __init__ (self, *iov) |
def | first (self) |
def | first_exp (self) |
def | first_run (self) |
def | final (self) |
def | final_exp (self) |
def | final_run (self) |
def | __repr__ (self) |
def | __eq__ (self, other) |
def | __lt__ (self, other) |
def | __and__ (self, other) |
def | __or__ (self, other) |
def | __sub__ (self, other) |
def | __hash__ (self) |
def | subtract (self, other) |
def | intersect (self, other) |
def | union (self, other, allow_startone=False) |
def | contains (self, exp, run) |
def | is_open (self) |
def | tuple (self) |
Static Public Member Functions | |
def | always () |
Public Attributes | |
final | |
Doxygen complains without this string. | |
Private Attributes | |
__first | |
tuple with the first valid exp, run | |
__final | |
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.
def __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.
def __and__ | ( | self, | |
other | |||
) |
Intersection between iovs. Will return None if the payloads don't overlap
Definition at line 126 of file iov.py.
def __eq__ | ( | self, | |
other | |||
) |
def __hash__ | ( | self | ) |
def __lt__ | ( | self, | |
other | |||
) |
def __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.
def __repr__ | ( | self | ) |
def __sub__ | ( | self, | |
other | |||
) |
Difference between iovs. Will return None if nothing is left over
Definition at line 139 of file iov.py.
|
static |
def contains | ( | self, | |
exp, | |||
run | |||
) |
def final | ( | self | ) |
def final_exp | ( | self | ) |
def final_run | ( | self | ) |
def first | ( | self | ) |
def first_exp | ( | self | ) |
def first_run | ( | self | ) |
def 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.
def is_open | ( | self | ) |
def 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.
def 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.
def 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.