Changeset cad617b in sasview


Ignore:
Timestamp:
Dec 8, 2016 3:46:27 AM (8 years ago)
Author:
Piotr Rozyczko <rozyczko@…>
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:
b4b8589, d1fb22ee
Parents:
416fa8f
Message:

Code review issues, fixing matplotlib behaviour in unit testing, minor fixes.

Location:
src/sas
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/DataExplorer.py

    r416fa8f rcad617b  
    801801    def showEditDataMask(self): 
    802802        """ 
     803        Mask Editor for 2D plots 
    803804        """ 
    804805        index = self.treeView.selectedIndexes()[0] 
     
    807808 
    808809        mask_editor = MaskEditor(self, data) 
    809  
     810        # Modal dialog here. 
    810811        mask_editor.exec_() 
    811812 
  • src/sas/qtgui/Plotter2D.py

    r416fa8f rcad617b  
    4747            self.scale = 'linear' 
    4848            if not self.zmin is None: 
    49                 zmin_2D_temp = numpy.pow(10, self.zmin) 
     49                zmin_2D_temp = numpy.power(10, self.zmin) 
    5050            if not self.zmax is None: 
    51                 zmax_2D_temp = numpy.pow(10, self.zmax) 
     51                zmax_2D_temp = numpy.power(10, self.zmax) 
    5252        else: 
    5353            self.scale = 'log_{10}' 
     
    194194 
    195195        QtGui.QDialog.__init__(self) 
    196         Plotter2DWidget.__init__(self, manager=parent, quickplot=quickplot, dimension=2) 
     196        Plotter2DWidget.__init__(self, manager=parent, quickplot=quickplot, dimension=dimension) 
  • src/sas/qtgui/UI/MaskEditorUI.ui

    r416fa8f rcad617b  
    2626     <layout class="QVBoxLayout" name="verticalLayout"> 
    2727      <item> 
    28        <widget class="QRadioButton" name="radioButton"> 
     28       <widget class="QRadioButton" name="rbWings"> 
    2929        <property name="text"> 
    3030         <string>Double Wings</string> 
     
    3333      </item> 
    3434      <item> 
    35        <widget class="QRadioButton" name="radioButton_3"> 
     35       <widget class="QRadioButton" name="rbCircularDisk"> 
    3636        <property name="text"> 
    3737         <string>Circular Disk</string> 
     
    4040      </item> 
    4141      <item> 
    42        <widget class="QRadioButton" name="radioButton_2"> 
     42       <widget class="QRadioButton" name="rbRectangularDisk"> 
    4343        <property name="text"> 
    4444         <string>Rectangular Disk</string> 
     
    4747      </item> 
    4848      <item> 
    49        <widget class="QRadioButton" name="radioButton_4"> 
     49       <widget class="QRadioButton" name="rbDoubleWingWindow"> 
    5050        <property name="text"> 
    5151         <string>Double Wing Window</string> 
     
    5454      </item> 
    5555      <item> 
    56        <widget class="QRadioButton" name="radioButton_5"> 
     56       <widget class="QRadioButton" name="rbCircularWindow"> 
    5757        <property name="text"> 
    5858         <string>Circular Window</string> 
     
    6161      </item> 
    6262      <item> 
    63        <widget class="QRadioButton" name="radioButton_6"> 
     63       <widget class="QRadioButton" name="rbRectangularWindow"> 
    6464        <property name="text"> 
    6565         <string>Rectangular Window</string> 
     
    9797   </item> 
    9898   <item row="2" column="0"> 
    99     <widget class="QPushButton" name="pushButton"> 
     99    <widget class="QPushButton" name="btnAdd"> 
    100100     <property name="sizePolicy"> 
    101101      <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> 
     
    110110   </item> 
    111111   <item row="3" column="0"> 
    112     <widget class="QPushButton" name="pushButton_2"> 
     112    <widget class="QPushButton" name="btnReset"> 
    113113     <property name="sizePolicy"> 
    114114      <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> 
     
    123123   </item> 
    124124   <item row="4" column="0"> 
    125     <widget class="QPushButton" name="pushButton_3"> 
     125    <widget class="QPushButton" name="btnClear"> 
    126126     <property name="sizePolicy"> 
    127127      <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> 
  • src/sas/qtgui/UnitTesting/DataExplorerTest.py

    r6d05e1d rcad617b  
    77from mock import MagicMock 
    88from mock import patch 
     9from mpl_toolkits.mplot3d import Axes3D 
    910 
    1011# set up import paths 
     
    2122from UnitTesting.TestUtils import QtSignalSpy 
    2223from sas.qtgui.Plotter import Plotter 
     24from sas.qtgui.Plotter2D import Plotter2D 
    2325import sas.qtgui.PlotHelper as PlotHelper 
    2426 
     
    758760        """ 
    759761        Quick data plot generation. 
     762        """ 
     763        # get Data1D 
     764        p_file=["cyl_400_20.txt"] 
     765        # Read in the file 
     766        output, message = self.form.readData(p_file) 
     767        self.form.loadComplete((output, message)) 
     768 
     769        # select the data 
     770        self.form.treeView.selectAll() 
     771 
     772        Plotter.show = MagicMock() # for masking the display 
     773 
     774        self.form.quickDataPlot() 
     775        self.assertTrue(Plotter.show.called) 
     776 
     777    def testQuickData3DPlot(self): 
     778        """ 
     779        Slow(er) 3D data plot generation. 
     780        """ 
     781        # get Data1D 
     782        p_file=["Dec07031.ASC"] 
     783        # Read in the file 
     784        output, message = self.form.readData(p_file) 
     785        self.form.loadComplete((output, message)) 
     786 
     787        # select the data 
     788        self.form.treeView.selectAll() 
     789 
     790        Plotter2D.show = MagicMock() # for masking the display 
     791 
     792        self.form.quickData3DPlot() 
     793 
     794        self.assertTrue(Plotter2D.show.called) 
     795 
     796    def testShowEditMask(self): 
     797        """ 
     798        Edit mask on a 2D plot. 
    760799 
    761800        TODO: add content once plotting finalized 
    762801        """ 
    763802        pass 
     803 
    764804 
    765805if __name__ == "__main__": 
  • src/sas/sasgui/plottools/PlotPanel.py

    rf74bd6e rcad617b  
    1010matplotlib.interactive(False) 
    1111#Use the WxAgg back end. The Wx one takes too long to render 
    12 matplotlib.use('WXAgg') 
     12#matplotlib.use('WXAgg') 
    1313from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg 
    1414from matplotlib.figure import Figure 
  • src/sas/sasgui/plottools/config.py

    r6d05e1d rcad617b  
    3131 
    3232plot_version = "0.98" 
    33 plot_backend = "WXAgg" 
     33#plot_backend = "WXAgg" 
     34plot_backend = "Qt4Agg" 
    3435 
    3536# Sort out matplotlib version 
  • src/sas/sasgui/plottools/plottables.py

    r821c330 rcad617b  
    676676        # Sanity check 
    677677        # Do the transofrmation only when x and y are empty 
    678         has_err_x = not (dx == None or len(dx) == 0) 
    679         has_err_y = not (dy == None or len(dy) == 0) 
    680  
    681         if(x != None) and (y != None): 
    682             if not dx == None and not len(dx) == 0 and not len(x) == len(dx): 
     678        has_err_x = not (dx is None or len(dx) == 0) 
     679        has_err_y = not (dy is None or len(dy) == 0) 
     680 
     681        if(x is not None) and (y is not None): 
     682            if not dx is None and not len(dx) == 0 and not len(x) == len(dx): 
    683683                msg = "Plottable.View: Given x and dx are not" 
    684684                msg += " of the same length" 
     
    690690                raise ValueError, msg 
    691691 
    692             if not dy == None and not len(dy) == 0 and not len(y) == len(dy): 
     692            if not dy is None and not len(dy) == 0 and not len(y) == len(dy): 
    693693                msg = "Plottable.View: Given y and dy are not of the same " 
    694694                msg += "length: len(y)=%s, len(dy)=%s" % (len(y), len(dy)) 
Note: See TracChangeset for help on using the changeset viewer.