Textual result output in Eq. level computation. Bugfix in bar colors when adding more bars than number of colors in color list.

This commit is contained in:
Anne de Jong 2018-09-13 15:34:11 +02:00 committed by J.A. de Jong - ASCEE
parent 185d4734d8
commit f82ff68b70
2 changed files with 11 additions and 5 deletions

View File

@ -179,6 +179,13 @@ class Measurement:
self._time = f.attrs['time'] self._time = f.attrs['time']
@property
def name(self):
"""
Returns filename base without extension
"""
return os.path.splitext(self.fn_base)[0]
@contextmanager @contextmanager
def file(self, mode='r'): def file(self, mode='r'):
""" """

View File

@ -33,7 +33,7 @@ ticklength = 10
# Distance between two bar groups in units of bar thicknesses # Distance between two bar groups in units of bar thicknesses
dxbars = 2 dxbars = 2
DEFAULT_COLORS = [ASCEEColors.blue, ASCEEColors.green, Qt.red] DEFAULT_COLORS = [ASCEEColors.blue, ASCEEColors.green, Qt.red, Qt.yellow]
class BarScene(QGraphicsScene): class BarScene(QGraphicsScene):
@ -121,7 +121,7 @@ class BarScene(QGraphicsScene):
# Main frame added after grid lines, to get the color right # Main frame added after grid lines, to get the color right
self.addItem(mainframe) self.addItem(mainframe)
# # Create the bars # Create the bars
for g in range(G): for g in range(G):
bg = [] bg = []
for n in range(N): for n in range(N):
@ -130,7 +130,6 @@ class BarScene(QGraphicsScene):
self.addItem(baritem) self.addItem(baritem)
bg.append(baritem) bg.append(baritem)
self.bgs.append(bg) self.bgs.append(bg)
# Add x ticks and ticklabels # Add x ticks and ticklabels
@ -195,7 +194,7 @@ class BarScene(QGraphicsScene):
# The position of the legend, in screen coordinates # The position of the legend, in screen coordinates
pos = (legpos[0], legpos[1] - i*dyleg) pos = (legpos[0], legpos[1] - i*dyleg)
color = self.colors[i] color = self.colors[i%len(self.colors)]
legrect = self.createRect(*pos, Lxlegrect, Lylegrect) legrect = self.createRect(*pos, Lxlegrect, Lylegrect)
@ -355,7 +354,7 @@ class BarScene(QGraphicsScene):
yvals = np.clip(yvals, 0, 1) yvals = np.clip(yvals, 0, 1)
for g in range(G): for g in range(G):
color = self.colors[g] color = self.colors[g%len(self.colors)]
for n in range(N): for n in range(N):
bar = self.bgs[g][n] bar = self.bgs[g][n]
bar.setRect(self.getBarRect(n, g, yvals[n, g])) bar.setRect(self.getBarRect(n, g, yvals[n, g]))