1.1 --- a/imiptools/period.py Thu Jan 22 18:41:32 2015 +0100
1.2 +++ b/imiptools/period.py Thu Jan 22 20:13:06 2015 +0100
1.3 @@ -148,11 +148,15 @@
1.4 for point, (starting, ending) in get_scale(l):
1.5
1.6 # Discard all active events ending at or before this start time.
1.7 + # Free up the position in the active list.
1.8
1.9 for t in ending:
1.10 i = active.index(t)
1.11 active[i] = None
1.12
1.13 + # For each event starting at the current point, fill any newly-vacated
1.14 + # position or add to the end of the active list.
1.15 +
1.16 for t in starting:
1.17 try:
1.18 i = active.index(None)
1.19 @@ -160,6 +164,8 @@
1.20 except ValueError:
1.21 active.append(t)
1.22
1.23 + # Discard vacant positions from the end of the active list.
1.24 +
1.25 while active and active[-1] is None:
1.26 active.pop()
1.27