def runTest(self): HelperTestingClass.__init__(self) xmin = 5000 xmax = 10000 ws = CreateSampleWorkspace(NumBanks=1, NumMonitors=1, BankPixelWidth=1, XMin=xmin, XMax=xmax) ws.setX(0, 2 * ws.readX(0)) # change x limits of monitor spectrum pres = SliceViewer(ws) pres.view.data_view.plot_matrix(ws) self.assertEqual(pres.view.data_view.get_axes_limits()[0], (xmin, xmax))
def runTest(self, mock_update_slider): HelperTestingClass.__init__(self) xmin = 5000 xmax = 10000 ws = CreateSampleWorkspace(NumBanks=2, BankPixelWidth=2, XMin=xmin, XMax=xmax) # two non-monitor spectra ws.setX(0, hstack([2 * ws.readX(0)[0:-1], inf])) # change x limits of spectrum and put inf in last element pres = SliceViewer(ws) pres.view.data_view.plot_matrix(ws) self.assertEqual(pres.view.data_view.get_axes_limits()[0], (xmin, xmax))
def test_plot_matrix_xlimits_ignores_nans(self, mock_update_slider): # need to mock update slider as doesn't handle inf when initialising SliceViewer in this manner xmin = 5000 xmax = 10000 ws = CreateSampleWorkspace(NumBanks=2, BankPixelWidth=2, XMin=xmin, XMax=xmax) # two non-monitor spectra ws.setX(0, hstack( [2 * ws.readX(0)[0:-1], inf])) # change x limits of spectrum and put inf in last element pres = SliceViewer(ws) pres.view.data_view.plot_matrix(ws) self.assertEqual(pres.view.data_view.get_axes_limits()[0], (xmin, xmax))