Skip to content
Snippets Groups Projects
Commit ddd28c54 authored by whuie2's avatar whuie2
Browse files

typos

parent 91e2809f
No related branches found
No related tags found
No related merge requests found
......@@ -100,8 +100,8 @@ class SuperSequence:
t1_last = dict()
Tmin = 0
Tmax = 0
for i, (s, S) in enumerate(self.items()):
tmin, tmax = S.when()
for i, (label, seq) in enumerate(self.items()):
tmin, tmax = seq.when()
Tmin = min(Tmin, tmin)
Tmax = max(Tmax, tmax)
k = 0
......@@ -111,14 +111,21 @@ class SuperSequence:
tl_max = max(tl_max, tl_level)
P.ax.add_patch(
pp.Rectangle(
(tmin, tl_level * H), tmax - tmin, H / 2,
edgecolor="k", facecolor=f"C{c}",
(
tmin,
tl_level * H if seq.stack_idx is None else seq.stack_idx
),
tmax - tmin,
H / 2,
edgecolor="k",
facecolor=f"C{c}" if seq.color is None else seq.color,
zorder=100
)
)
P.ax.text(tmin, tl_level * H - H / 15, _titlecase(s),
P.ax.text(tmin, tl_level * H - H / 15, _titlecase(label),
horizontalalignment="left", verticalalignment="top")
c = (c + 1) % 10
if seq.color is None:
c = (c + 1) % 10
t1_last[tl_level] = tmax
P.set_xlim(Tmin - (Tmax - Tmin) / 20, Tmax + (Tmax - Tmin) / 20)
P.set_ylim(-H / 2, (tl_max + 1) * H)
......
......@@ -241,7 +241,8 @@ class Sequence:
sequence : list[Event]
"""
def __init__(self, events: list[Event]=None):
def __init__(self, events: list[Event]=None, color: str=None,
stack_idx: float=None):
"""
Constructor.
......@@ -250,6 +251,8 @@ class Sequence:
events : list[Event] (optional)
"""
self.events = list() if events is None else events
self.color = color
self.stack_idx = stack_idx
@staticmethod
def from_digital_data(T: list[float], S: list[int], board: int,
......@@ -326,7 +329,7 @@ class Sequence:
Concatenate two Sequences.
"""
assert isinstance(other, Sequence)
return Sequence(self.events + other.sequence)
return Sequence(self.events + other.events)
def __iter__(self):
return iter(self.events)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment