1.1 --- a/imiptools/period.py Thu Nov 27 16:29:21 2014 +0100
1.2 +++ b/imiptools/period.py Mon Dec 08 19:12:13 2014 +0100
1.3 @@ -144,4 +144,21 @@
1.4
1.5 return slots
1.6
1.7 +def get_spans(slots):
1.8 +
1.9 + "Inspect the given 'slots', returning a mapping of event uids to spans."
1.10 +
1.11 + points = [point for point, active in slots]
1.12 + spans = {}
1.13 +
1.14 + for point, active in slots:
1.15 + for t in active:
1.16 + if t:
1.17 + start, end, uid, transp = t
1.18 + start_slot = points.index(start)
1.19 + end_slot = points.index(end)
1.20 + spans[uid] = end_slot - start_slot
1.21 +
1.22 + return spans
1.23 +
1.24 # vim: tabstop=4 expandtab shiftwidth=4