def test_plotSpectrum_calls_plot_with_spectrum_numbers(self, plot_mock): ws_name = 'test_plotSpectrum_calls_plot_with_spectrum_numbers-1' wksp_indices = 0 plotSpectrum(ws_name, spectrum_nums=wksp_indices) plot_mock.assert_called_once_with([ws_name], spectrum_nums=[wksp_indices], errors=False, wksp_indices=None, waterfall=None, fig=None, overplot=False, plot_kwargs={})
def test_plotSpectrum_calls_plot_with_waterfall(self, plot_mock): ws_name = 'test_plotSpectrum_calls_plot_with_waterfall-1' wksp_indices = list(range(10)) plotSpectrum(ws_name, wksp_indices, waterfall=True) plot_mock.assert_called_once_with([ws_name], wksp_indices=wksp_indices, errors=False, spectrum_nums=None, waterfall=True, fig=None, overplot=False, plot_kwargs={})
def test_plotSpectrum_calls_plot_with_overplot(self, plot_mock): ws_name = 'test_plotSpectrum_calls_plot_with_overplot-1' wksp_indices = list(range(10)) fake_window = "this is a string representing a fake plotting window" plotSpectrum(ws_name, wksp_indices, window=fake_window) plot_mock.assert_called_once_with([ws_name], wksp_indices=wksp_indices, errors=False, spectrum_nums=None, waterfall=None, fig=fake_window, overplot=True, plot_kwargs={})
def test_plotSpectrum_calls_plot_with_no_line(self, plot_mock): ws_name = 'test_plotSpectrum_calls_plot_with_no_line-1' wksp_indices = list(range(10)) plotSpectrum(ws_name, wksp_indices, type=1) plot_mock.assert_called_once_with([ws_name], wksp_indices=wksp_indices, errors=False, spectrum_nums=None, waterfall=None, fig=None, overplot=False, plot_kwargs={ 'linestyle': 'None', 'marker': '.' })
def test_plotSpectrum_calls_plot_with_a_list(self, plot_mock): ws_name = [ 'test_plotSpectrum_calls_plot_with_a_list-1', 'test_plotSpectrum_calls_plot_with_a_list' ] wksp_indices = list(range(10)) plotSpectrum(ws_name, wksp_indices) plot_mock.assert_called_once_with(ws_name, wksp_indices=wksp_indices, errors=False, spectrum_nums=None, waterfall=None, fig=None, overplot=False, plot_kwargs={})
def plot_result(self): """ Plot the scaled data sets """ low_xmin = util._check_and_get_float_line_edit(self._content.low_min_edit) low_xmax = util._check_and_get_float_line_edit(self._content.low_max_edit) med_xmin = util._check_and_get_float_line_edit(self._content.medium_min_edit) med_xmax = util._check_and_get_float_line_edit(self._content.medium_max_edit) ws_list = [] if self._low_q_data is not None: xmin, _ = self._low_q_data.get_skipped_range() self._low_q_data.apply_scale(xmin, low_xmax) ws_list.append(self._low_q_data.get_scaled_ws()) if self._medium_q_data is not None: _, xmax = self._medium_q_data.get_skipped_range() if self._high_q_data is not None: xmax = med_xmax self._medium_q_data.apply_scale(low_xmin, xmax) ws_list.append(self._medium_q_data.get_scaled_ws()) if self._high_q_data is not None: _, xmax = self._high_q_data.get_skipped_range() self._high_q_data.apply_scale(med_xmin, xmax) ws_list.append(self._high_q_data.get_scaled_ws()) if len(ws_list) > 0: g = plotSpectrum(ws_list, [0], error_bars=True) g.suptitle(self._graph)
def connect(self, ws, call_back, xmin=None, xmax=None, range_min=None, range_max=None, x_title=None, log_scale=False, ws_output_base=None): if not IS_IN_MANTIDGUI: print("RangeSelector cannot be used output MantidPlot") return self._call_back = call_back self._ws_output_base = ws_output_base g = plotSpectrum(ws, [0], True) self.canvas = g.canvas g.suptitle(self._graph) l = g.axes[0] try: title = ws[0].replace("_", " ") title.strip() except: title = " " l.set_title(title) if log_scale: l.yscale('log') l.xscale('linear') if x_title is not None: l.set_xlabel(x_title) if xmin is not None and xmax is not None: l.set_xlim(xmin, xmax) if range_min is None or range_max is None: range_min, range_max = l.get_xlim() range_min = range_min + (range_max-range_min)/100.0 range_max = range_max - (range_max-range_min)/100.0 self.marker = RangeMarker(l.figure.canvas, 'green', range_min, range_max, line_style='--') self.marker.min_marker.set_name('Min Q') self.marker.max_marker.set_name('Max Q') def add_range(event): #self.marker.min_marker.add_name() #self.marker.max_marker.add_name() self.marker.redraw() self.marker.range_changed.connect(self._call_back) self._cids.append(g.canvas.mpl_connect('draw_event', add_range)) self._cids.append(g.canvas.mpl_connect('button_press_event', self.on_mouse_button_press)) self._cids.append(g.canvas.mpl_connect('motion_notify_event',self.motion_event)) self._cids.append(g.canvas.mpl_connect('button_release_event', self.on_mouse_button_release))