Skip to content

Commit 8d18cfe

Browse files
committed
Handle thick elements in Knl plot
1 parent 798d155 commit 8d18cfe

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

xplt/line.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -118,15 +118,15 @@ def update(self, line, autoscale=False):
118118
orders = {p: order(p) for p in self.on_y_unique}
119119
Smax = line.get_length()
120120
for name, el, s0, s1 in iter_elements(line):
121-
if hasattr(el, "knl"):
122-
if 0 <= s0 <= Smax:
123-
mask = (self.S >= s0) & (self.S < s1)
124-
else:
125-
# handle wrap around
126-
mask = (self.S >= s0 % Smax) | (self.S < s1 % Smax)
127-
for knl, n in orders.items():
128-
if n <= el.order:
129-
values[knl][mask] += el.knl[n]
121+
if 0 <= s0 <= Smax:
122+
mask = (self.S >= s0) & (self.S < s1)
123+
else: # handle wrap around
124+
mask = (self.S >= s0 % Smax) | (self.S < s1 % Smax)
125+
for knl, n in orders.items():
126+
if hasattr(el, f"k{n}") and hasattr(el, "length"):
127+
values[knl][mask] += getattr(el, f"k{n}") * el.length
128+
elif hasattr(el, "knl") and n <= el.order:
129+
values[knl][mask] += el.knl[n]
130130

131131
# plot
132132
s = self.S * self.factor_for("s")

0 commit comments

Comments
 (0)