Skip to content

Commit 4d3b4d7

Browse files
committed
Merge branch 'master' of https://github.com/Eomys/swat-em
2 parents 230c9aa + e1b81b8 commit 4d3b4d7

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

swat_em/plots.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from qtpy.QtWidgets import QTableWidgetItem, QApplication
77
from qtpy.QtGui import QFont, QSyntaxHighlighter, QTextCursor, QTextCharFormat, QColor
88
from qtpy import QtCore
9+
import string
910

1011

1112
from swat_em.config import get_phase_color, get_line_color, config
@@ -30,6 +31,9 @@
3031
pg.setConfigOptions(antialias=True)
3132

3233

34+
Alpha = string.ascii_uppercase
35+
36+
3337
def gen_coil_lines(w, h1=0.75, h2=1.5, db1=0.1, Np1=21):
3438
"""
3539
Create lines of a coil for plotting.
@@ -50,7 +54,7 @@ def gen_coil_lines(w, h1=0.75, h2=1.5, db1=0.1, Np1=21):
5054
5155
Returns
5256
-------
53-
x : list
57+
x : list
5458
x values of the coil for plotting
5559
y : list
5660
y values of the coil for plotting
@@ -92,7 +96,7 @@ def gen_slot_lines(Q, bz, hz):
9296
9397
Returns
9498
-------
95-
x : list
99+
x : list
96100
x values of the slots for plotting
97101
y : list
98102
y values of the slots for plotting
@@ -134,7 +138,7 @@ def gen_slot_filling(Q, bz, hz):
134138
135139
Returns
136140
-------
137-
x : list
141+
x : list
138142
x values of the slots for plotting
139143
y : list
140144
y values (upper lines) of the slots for plotting
@@ -475,7 +479,7 @@ def get_pos(num, r=1):
475479

476480
i_name = 0
477481
for xtmp, ytmp in zip(*group_on_nan(x, y)):
478-
name = "Phase " + str(km + 1) if i_name == 0 else None
482+
name = "Phase " + Alpha[km] if i_name == 0 else None
479483
curve = pg.PlotCurveItem(
480484
xtmp, ytmp, pen=pen, name=name, connect="finite"
481485
)
@@ -663,7 +667,7 @@ def plot(self, data=None, show=False, optimize_overhang=False):
663667

664668
i_name = 0
665669
for xtmp, ytmp in zip(*group_on_nan(x, y)):
666-
name = "Phase " + str(i) if i_name == 0 else None
670+
name = "Phase " + Alpha[i - 1] if i_name == 0 else None
667671
curve = pg.PlotCurveItem(
668672
xtmp, ytmp, pen=pen, connect="finite", name=name
669673
)
@@ -675,7 +679,7 @@ def plot(self, data=None, show=False, optimize_overhang=False):
675679
# plot slot number
676680
for k in range(Q):
677681
text = pg.TextItem(anchor=(0.5, 0.5))
678-
text.setPlainText(str(k + 1))
682+
text.setPlainText(str(k))
679683
text.setPos(k, -self.h1 / 2)
680684
text.setColor("k")
681685
self.fig.addItem(

0 commit comments

Comments
 (0)