Changeset fecfe28 in sasview
- Timestamp:
- Dec 8, 2016 9:49:50 AM (8 years ago)
- Branches:
- ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc
- Children:
- 3b7b218
- Parents:
- b4b8589
- Location:
- src/sas/qtgui
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/PlotUtilities.py
r31c5b58 rfecfe28 13 13 """ 14 14 # No qx or qy given in a vector format 15 if qx_data == None or qy_data ==None \15 if qx_data is None or qy_data is None \ 16 16 or qx_data.ndim != 1 or qy_data.ndim != 1: 17 17 return data … … 72 72 """ 73 73 # No qx or qy given in a vector format 74 if qx_data == None or qy_data ==None \74 if qx_data is None or qy_data is None \ 75 75 or qx_data.ndim != 1 or qy_data.ndim != 1: 76 76 return data -
src/sas/qtgui/Plotter.py
rb4b8589 rfecfe28 8 8 9 9 class PlotterWidget(PlotterBase): 10 """ 11 1D Plot widget for use with a QDialog 12 """ 10 13 def __init__(self, parent=None, manager=None, quickplot=False): 11 14 super(PlotterWidget, self).__init__(parent, manager=manager, quickplot=quickplot) -
src/sas/qtgui/Plotter2D.py
rb4b8589 rfecfe28 11 11 from mpl_toolkits.mplot3d import Axes3D 12 12 13 # Minimum value of Z for which we will present data. 14 MIN_Z=-32 15 13 16 class Plotter2DWidget(PlotterBase): 17 """ 18 2D Plot widget for use with a QDialog 19 """ 14 20 def __init__(self, parent=None, manager=None, quickplot=False, dimension=2): 15 21 self.dimension = dimension … … 24 30 """ data setter """ 25 31 self._data = data 26 self.qx_data =data.qx_data27 self.qy_data =data.qy_data28 self.xmin =data.xmin29 self.xmax =data.xmax30 self.ymin =data.ymin31 self.ymax =data.ymax32 self.zmin =data.zmin33 self.zmax =data.zmax34 self.label =data.name35 self.xLabel ="%s(%s)"%(data._xaxis, data._xunit)36 self.yLabel ="%s(%s)"%(data._yaxis, data._yunit)32 self.qx_data = data.qx_data 33 self.qy_data = data.qy_data 34 self.xmin = data.xmin 35 self.xmax = data.xmax 36 self.ymin = data.ymin 37 self.ymax = data.ymax 38 self.zmin = data.zmin 39 self.zmax = data.zmax 40 self.label = data.name 41 self.xLabel = "%s(%s)"%(data._xaxis, data._xunit) 42 self.yLabel = "%s(%s)"%(data._yaxis, data._yunit) 37 43 self.title(title=data.title) 38 44 … … 44 50 zmin_2D_temp = self.zmin 45 51 zmax_2D_temp = self.zmax 52 # self.scale predefined in the baseclass 46 53 if self.scale == 'log_{10}': 47 54 self.scale = 'linear' … … 55 62 # min log value: no log(negative) 56 63 if self.zmin <= 0: 57 zmin_2D_temp = -3264 zmin_2D_temp = MIN_Z 58 65 else: 59 66 zmin_2D_temp = numpy.log10(self.zmin) … … 115 122 self.zmax = zmax 116 123 # If we don't have any data, skip. 117 if data ==None:124 if data is None: 118 125 return 119 126 if data.ndim == 1: … … 132 139 zmin_temp = self.zmin 133 140 output[output > 0] = numpy.zeros(len(output)) 134 output[output <= 0] = -32141 output[output <= 0] = MIN_Z 135 142 else: 136 143 zmin_temp = self.zmin … … 163 170 self.ax.set_title(label=self._title) 164 171 172 if cbax is None: 173 ax.set_frame_on(False) 174 cb = self.figure.colorbar(im, shrink=0.8, aspect=20) 175 else: 176 cb = self.figure.colorbar(im, cax=cbax) 177 178 cb.update_bruteforce(im) 179 cb.set_label('$' + self.scale + '$') 165 180 166 181 else: … … 175 190 176 191 ax = Axes3D(self.figure) 177 cbax = self.figure.add_axes([0.84, 0.1, 0.02, 0.8])192 #cbax = self.figure.add_axes([0.84, 0.1, 0.02, 0.8]) 178 193 179 194 # Disable rotation for large sets. … … 188 203 self.ax.set_axis_off() 189 204 190 if cbax == None:191 ax.set_frame_on(False)192 cb = self.figure.colorbar(im, shrink=0.8, aspect=20)193 else:194 cb = self.figure.colorbar(im, cax=cbax)195 196 cb.update_bruteforce(im)197 cb.set_label('$' + self.scale + '$')198 199 205 if self.dimension != 3: 200 206 self.figure.canvas.draw_idle() -
src/sas/qtgui/UnitTesting/PlotterTest.py
r416fa8f rfecfe28 44 44 self.assertEqual(self.plotter.yLabel, "$()$") 45 45 46 def testPlot (self):47 """ Look at the plotting """46 def testPlotWithErrors(self): 47 """ Look at the plotting with error bars""" 48 48 self.plotter.data = self.data 49 49 self.plotter.show() 50 50 FigureCanvas.draw = MagicMock() 51 51 52 self.plotter.plot( )52 self.plotter.plot(hide_error=False) 53 53 54 self.assertEqual(self.plotter.ax.get_xscale(), 'log') 55 self.assertTrue(FigureCanvas.draw.called) 56 57 def testPlotWithoutErrors(self): 58 """ Look at the plotting without error bars""" 59 self.plotter.data = self.data 60 self.plotter.show() 61 FigureCanvas.draw = MagicMock() 62 63 self.plotter.plot(hide_error=True) 64 65 self.assertEqual(self.plotter.ax.get_yscale(), 'log') 54 66 self.assertTrue(FigureCanvas.draw.called) 55 67
Note: See TracChangeset
for help on using the changeset viewer.