tkwant.manybody.combine_intervals

tkwant.manybody.combine_intervals(intervals, atol=1e-10, rtol=1e-10)[source]

Group leads for similar intervals together.

As an example int_1 = (lead=0, kmin=0, kmax=1..) int_2 = (lead=1, kmin=0, kmax=1..) are two intervals, which are similar except the lead index. If the sequence intervals = [int_1, int_2] is passed to this routine the lead indices are combined and the returnd result is [(lead=(0, 1), kmin=0, kmax=1...)]. To test for similarity between the intervals, we compare the attributes, (exept the ones with two leading underscores). For attributes with numerical values a and b, we require abs(a - b) < (atol + rtol * abs(b)) for similarity. Other attributes must match exactly: a == b if a, b != lead.

Parameters
Returns

new_intervals – Combined intervals. Lead indices in the combined intervals are grouped in a tuple.

Return type

list of tkwant.manybody.Interval