Skip to content

Commit

Permalink
fix Bragg tab plot issues
Browse files Browse the repository at this point in the history
  • Loading branch information
y8z committed Oct 7, 2024
1 parent bf7f74f commit efe1829
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
1 change: 0 additions & 1 deletion addie/calculate_gr/event_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,6 @@ def plot_gr(main_window, ws_name, line_color, line_style,

# check whether the workspace is on the figure
graphicsView_gr = main_window.calculategr_ui.graphicsView_gr
has_gr = graphicsView_gr.has_gr(ws_name)

if graphicsView_gr.has_gr(ws_name):
# update G(r) value of an existing plot
Expand Down
10 changes: 8 additions & 2 deletions addie/plot/canvas.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,8 +447,14 @@ def remove_plot_1d(self, plot_key):
"""
if plot_key in self._lineDict:
try:
line = self.axes.lines[0]
line.remove()
i = 0
for key in self._lineDict:
if plot_key == key:
line = self.axes.lines[i]
line.remove()
break
else:
i += 1
except ValueError as r_error:
error_message = 'Unable to remove to 1D line %s (ID=%d) due to %s.' % (
str(self._lineDict[plot_key]), plot_key, str(r_error))
Expand Down
6 changes: 2 additions & 4 deletions addie/rietveld/braggview.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,9 @@ def evt_toolbar_home(self):
if self._unitX == 'TOF':
self.setXYLimit(xmin=0, xmax=20000, ymin=None, ymax=None)
elif self._unitX == 'MomentumTransfer':
self.setXYLimit(xmin=0, xmax=20, ymin=None, ymax=None)
self.setXYLimit(xmin=0, xmax=50, ymin=None, ymax=None)
elif self._unitX == 'dSpacing':
self.setXYLimit(xmin=0, xmax=7, ymin=None, ymax=None)
self.setXYLimit(xmin=0, xmax=10, ymin=None, ymax=None)
else:
raise RuntimeError('Unit %s unknown' % self._unitX)

Expand Down Expand Up @@ -333,8 +333,6 @@ def plot_banks(self, plot_bank_dict, unit):
self._plotScaleDict[plot_id] = addie.utilities.workspaces.get_y_range(
ws_name, bank_id - 1) # is this needed?

# self.scale_auto()

def plot_general_ws(self, ws_name):
"""
Plot a workspace that does not belong to any workspace group
Expand Down
8 changes: 6 additions & 2 deletions addie/rietveld/event_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,10 @@ def switch_bragg_unit(main_window=None):
for ws_group in ws_group_list:
plot_data_dict[ws_group] = main_window._myController.get_bank_numbers(
ws_group)
if len(bank_list) > 0:
plot_data_dict[ws_group] = [
item for item in plot_data_dict[ws_group] if item in bank_list
]

# plot
main_window.rietveld_ui.graphicsView_bragg.plot_banks(
Expand Down Expand Up @@ -420,12 +424,12 @@ def reset_bragg_data_range(main_window, x_unit):
ymax=None)
elif x_unit == 'MomentumTransfer':
main_window.rietveld_ui.graphicsView_bragg.setXYLimit(xmin=0,
xmax=20,
xmax=50,
ymin=None,
ymax=None)
elif x_unit == 'dSpacing':
main_window.rietveld_ui.graphicsView_bragg.setXYLimit(xmin=0,
xmax=7,
xmax=10,
ymin=None,
ymax=None)
else:
Expand Down

0 comments on commit efe1829

Please sign in to comment.