Skip to content

Commit

Permalink
Merge pull request #348 from Kvieta1990/master
Browse files Browse the repository at this point in the history
Fix the issue with boundary display for SofQ
  • Loading branch information
Kvieta1990 authored May 11, 2022
2 parents f5be741 + dedc825 commit f155ea4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion addie/plot/canvas.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ def updateLine(
print('[ERROR] Line (key = %d) is None. Unable to update' % ikey)
return

if wkspname or (vecx and vecy):
if wkspname or (vecx.all() and vecy.all()):
if wkspname:
vecx, vecy, _ = addie.utilities.workspaces.get_ws_data(
wkspname, wkspindex)
Expand Down
16 changes: 13 additions & 3 deletions addie/plot/mplgraphicsview.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from addie.plot import FigureCanvas
from addie.plot.constants import BASIC_COLORS, LINE_MARKERS, LINE_STYLES
import addie.utilities.workspaces
import mantid.simpleapi as simpleapi


class MplGraphicsView(QWidget):
Expand Down Expand Up @@ -62,12 +63,16 @@ def add_line_set(self, vec_set, color, marker, line_style, line_width):
""" Add a set of line and manage together
"""
key_list = list()
bd_tmp_list = []
i = 0
for vec_x, vec_y in vec_set:
temp_key = self._myCanvas.add_plot_1d(vec_x, vec_y, color=color, marker=marker,
bd_tmp_list.append(simpleapi.CreateWorkspace(DataX=vec_x, DataY=vec_y, NSpec=1))
temp_key = self._myCanvas.add_plot_1d(wkspname=bd_tmp_list[i], wkspindex=0, color=color, marker=marker,
line_style=line_style, line_width=line_width)
assert isinstance(temp_key, int)
assert temp_key >= 0
key_list.append(temp_key)
i += 1

return key_list

Expand Down Expand Up @@ -149,7 +154,10 @@ def add_horizontal_indicator(self, y=None, color=None):
my_id = self._myIndicatorsManager.add_horizontal_indicator(y, x_min, x_max, color)
vec_x, vec_y = self._myIndicatorsManager.get_data(my_id)

canvas_line_index = self._myCanvas.add_plot_1d(vec_x=vec_x, vec_y=vec_y,
bd_tmp_h = simpleapi.CreateWorkspace(DataX=vec_x, DataY=vec_y, NSpec=1)


canvas_line_index = self._myCanvas.add_plot_1d(wkspname=bd_tmp_h, wkspindex=0,
color=color, marker=self._myIndicatorsManager.get_marker(),
line_style=self._myIndicatorsManager.get_line_style(),
line_width=1)
Expand Down Expand Up @@ -190,7 +198,9 @@ def add_vertical_indicator(self, x=None, color=None, style=None, line_width=1):
my_id = self._myIndicatorsManager.add_vertical_indicator(x, y_min, y_max, color)
vec_x, vec_y = self._myIndicatorsManager.get_data(my_id)

canvas_line_index = self._myCanvas.add_plot_1d(vec_x=vec_x, vec_y=vec_y,
bd_tmp = simpleapi.CreateWorkspace(DataX=vec_x, DataY=vec_y, NSpec=1)

canvas_line_index = self._myCanvas.add_plot_1d(wkspname=bd_tmp, wkspindex=0,
color=color, marker=self._myIndicatorsManager.get_marker(),
line_style=self._myIndicatorsManager.get_line_style(),
line_width=1)
Expand Down

0 comments on commit f155ea4

Please sign in to comment.