Changeset 6267876 in sasview for src/sas/sasgui/guiframe


Ignore:
Timestamp:
Apr 10, 2017 10:42:23 AM (7 years ago)
Author:
krzywon
Branches:
master, 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, costrafo411, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
3e5648b
Parents:
37d461c (diff), d26f025 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
Jeff Krzywon <krzywon@…> (04/10/17 10:42:23)
git-committer:
krzywon <krzywon@…> (04/10/17 10:42:23)
Message:

Merge branch 'master' into batch_slicer

# Conflicts:
# src/sas/sascalc/dataloader/manipulations.py
# src/sas/sasgui/guiframe/local_perspectives/plotting/Plotter2D.py
# src/sas/sasgui/guiframe/local_perspectives/plotting/SlicerParameters.py
# src/sas/sasgui/guiframe/local_perspectives/plotting/parameters_panel_boxsum.py

Location:
src/sas/sasgui/guiframe
Files:
1 added
1 deleted
25 edited
1 moved

Legend:

Unmodified
Added
Removed
  • src/sas/sasgui/guiframe/CategoryInstaller.py

    r463e7ffc r235f514  
    132132 
    133133        serialized_file = None 
    134         if homedir == None: 
     134        if homedir is None: 
    135135            serialized_file = CategoryInstaller.get_user_file() 
    136136        else: 
  • src/sas/sasgui/guiframe/config.py

    r64ca561 rea45bfe  
    4949 
    5050_acknowledgement =  \ 
    51 '''This work was originally developed as part of the DANSE project funded by the US NSF under Award DMR-0520547,\n but is currently maintained by a collaboration between UTK, UMD, NIST, ORNL, ISIS, ESS, ILL, ANSTO, TU Delft, DLS, and the scattering community.\n\n SasView also contains code developed with funding from the EU Horizon 2020 programme under the SINE2020 project (Grant No 654000).\nA list of individual contributors can be found at: https://github.com/orgs/SasView/people 
     51'''This work was originally developed as part of the DANSE project funded by the US NSF under Award DMR-0520547,\n but is currently maintained by a collaboration between UTK, UMD, NIST, ORNL, ISIS, ESS, ILL, ANSTO, TU Delft, DLS, and the scattering community.\n\n SasView also contains code developed with funding from the EU Horizon 2020 programme under the SINE2020 project (Grant No 654000).\nA list of individual contributors can be found at: http://www.sasview.org/contact.html 
    5252''' 
    5353 
  • src/sas/sasgui/guiframe/dataFitting.py

    r9a5097c r7432acb  
    7878        result.clone_without_data(length=len(self.x), clone=self) 
    7979        result.copy_from_datainfo(data1d=self) 
    80         if self.dxw == None: 
     80        if self.dxw is None: 
    8181            result.dxw = None 
    8282        else: 
    8383            result.dxw = np.zeros(len(self.x)) 
    84         if self.dxl == None: 
     84        if self.dxl is None: 
    8585            result.dxl = None 
    8686        else: 
     
    125125        tot_length = len(self.x) + len(other.x) 
    126126        result = self.clone_without_data(length=tot_length, clone=result) 
    127         if self.dlam == None or other.dlam is None: 
     127        if self.dlam is None or other.dlam is None: 
    128128            result.dlam = None 
    129129        else: 
    130130            result.dlam = np.zeros(tot_length) 
    131         if self.dy == None or other.dy is None: 
     131        if self.dy is None or other.dy is None: 
    132132            result.dy = None 
    133133        else: 
    134134            result.dy = np.zeros(tot_length) 
    135         if self.dx == None or other.dx is None: 
     135        if self.dx is None or other.dx is None: 
    136136            result.dx = None 
    137137        else: 
    138138            result.dx = np.zeros(tot_length) 
    139         if self.dxw == None or other.dxw is None: 
     139        if self.dxw is None or other.dxw is None: 
    140140            result.dxw = None 
    141141        else: 
    142142            result.dxw = np.zeros(tot_length) 
    143         if self.dxl == None or other.dxl is None: 
     143        if self.dxl is None or other.dxl is None: 
    144144            result.dxl = None 
    145145        else: 
     
    154154        result.lam = np.append(self.lam, other.lam) 
    155155        result.lam = result.lam[ind] 
    156         if result.dlam != None: 
     156        if result.dlam is not None: 
    157157            result.dlam = np.append(self.dlam, other.dlam) 
    158158            result.dlam = result.dlam[ind] 
    159         if result.dy != None: 
     159        if result.dy is not None: 
    160160            result.dy = np.append(self.dy, other.dy) 
    161161            result.dy = result.dy[ind] 
     
    227227        result = self.clone_without_data(len(self.x)) 
    228228        result.copy_from_datainfo(data1d=self) 
    229         if self.dxw == None: 
     229        if self.dxw is None: 
    230230            result.dxw = None 
    231231        else: 
    232232            result.dxw = np.zeros(len(self.x)) 
    233         if self.dxl == None: 
     233        if self.dxl is None: 
    234234            result.dxl = None 
    235235        else: 
     
    279279        tot_length = len(self.x)+len(other.x) 
    280280        result.clone_without_data(length=tot_length, clone=self) 
    281         if self.dlam == None or other.dlam is None: 
     281        if self.dlam is None or other.dlam is None: 
    282282            result.dlam = None 
    283283        else: 
    284284            result.dlam = np.zeros(tot_length) 
    285         if self.dy == None or other.dy is None: 
     285        if self.dy is None or other.dy is None: 
    286286            result.dy = None 
    287287        else: 
    288288            result.dy = np.zeros(tot_length) 
    289         if self.dx == None or other.dx is None: 
     289        if self.dx is None or other.dx is None: 
    290290            result.dx = None 
    291291        else: 
    292292            result.dx = np.zeros(tot_length) 
    293         if self.dxw == None or other.dxw is None: 
     293        if self.dxw is None or other.dxw is None: 
    294294            result.dxw = None 
    295295        else: 
    296296            result.dxw = np.zeros(tot_length) 
    297         if self.dxl == None or other.dxl is None: 
     297        if self.dxl is None or other.dxl is None: 
    298298            result.dxl = None 
    299299        else: 
     
    307307        result.lam = np.append(self.lam, other.lam) 
    308308        result.lam = result.lam[ind] 
    309         if result.dy != None: 
     309        if result.dy is not None: 
    310310            result.dy = np.append(self.dy, other.dy) 
    311311            result.dy = result.dy[ind] 
     
    405405        result.ymin = self.ymin 
    406406        result.ymax = self.ymax 
    407         if self.dqx_data == None or self.dqy_data == None: 
     407        if self.dqx_data is None or self.dqy_data is None: 
    408408            result.dqx_data = None 
    409409            result.dqy_data = None 
     
    468468        result.ymin = self.ymin 
    469469        result.ymax = self.ymax 
    470         if self.dqx_data == None or self.dqy_data == None or \ 
    471                 other.dqx_data == None or other.dqy_data == None : 
     470        if self.dqx_data is None or self.dqy_data is None or \ 
     471                other.dqx_data is None or other.dqy_data is None : 
    472472            result.dqx_data = None 
    473473            result.dqy_data = None 
  • src/sas/sasgui/guiframe/data_processor.py

    r9a5097c r7432acb  
    1818 
    1919""" 
    20 import wx 
    21 import numpy 
    22 import math 
    23 import re 
    2420import os 
    2521import sys 
    2622import copy 
    27 from wx.lib.scrolledpanel import ScrolledPanel 
     23import math 
     24import re 
     25import wx 
     26import numpy as np 
     27 
    2828import wx.aui 
    2929from wx.aui import AuiNotebook as nb 
    3030import wx.lib.sheet as sheet 
     31from wx.lib.scrolledpanel import ScrolledPanel 
     32 
    3133from sas.sasgui.guiframe.panel_base import PanelBase 
    3234from sas.sasgui.guiframe.events import NewPlotEvent 
     
    313315        if row > self.max_row_touse: 
    314316            self.max_row_touse = row 
    315         if self.data == None: 
     317        if self.data is None: 
    316318            self.data = {} 
    317319        event.Skip() 
     
    812814        """ 
    813815 
    814         if self.data == None: 
     816        if self.data is None: 
    815817            self.data = {} 
    816         if self.file_name == None: 
     818        if self.file_name is None: 
    817819            self.file_name = 'copied_data' 
    818820        self.Paste() 
     
    10151017                            if index - 1 >= 0: 
    10161018                                new_row, _ = temp_list[index - 1] 
    1017                                 if not new_row == None and new_row != ' ': 
     1019                                if new_row is not None and new_row != ' ': 
    10181020                                    label += create_label(col_name, None, 
    10191021                                                          int(new_row) + 1) 
     
    10231025                            if index + 1 < len(temp_list): 
    10241026                                new_row, _ = temp_list[index + 1] 
    1025                                 if not new_row == None: 
     1027                                if new_row is not None: 
    10261028                                    label += create_label(col_name, 
    10271029                                                          int(new_row) + 1, None) 
    1028                     if row_min != None and row_max != None: 
     1030                    if row_min is not None and row_max is not None: 
    10291031                        if index == 0: 
    10301032                            label += create_label(col_name, 
     
    10831085 
    10841086        # Let's re-order the data from the keys in 'Data' name. 
    1085         if outputs == None: 
     1087        if outputs is None: 
    10861088            return 
    10871089        try: 
     
    13721374            wx.PostEvent(self.parent.parent, StatusEvent(status=msg, info="error")) 
    13731375            return 
    1374         if dy != None and (len(y) != len(dy)): 
     1376        if dy is not None and (len(y) != len(dy)): 
    13751377            msg = "Need same length for Y and dY axis and both greater than 0" 
    13761378            msg += " to plot.\n" 
     
    13781380            wx.PostEvent(self.parent.parent, StatusEvent(status=msg, info="error")) 
    13791381            return 
    1380         if dy == None: 
     1382        if dy is None: 
    13811383            dy = np.zeros(len(y)) 
    13821384        #plotting 
     
    14391441            col = column_names[col_name] 
    14401442            axis = self.get_plot_axis(col, list) 
    1441             if axis == None: 
     1443            if axis is None: 
    14421444                return None 
    14431445            sentence = sentence.replace(tok, "numpy.array(%s)" % str(axis)) 
     
    15701572        """ 
    15711573 
    1572         if label != None: 
     1574        if label is not None: 
    15731575            tcrtl_label.SetValue(str(label)) 
    1574         if title != None: 
     1576        if title is not None: 
    15751577            tcrtl_title.SetValue(str(title)) 
    15761578 
     
    16831685        # I Believe this is no longer used now that we have removed the  
    16841686        # edit menu from the menubar - PDB July 12, 2015 
    1685         if event != None: 
     1687        if event is not None: 
    16861688            event.Skip() 
    16871689        pos = self.panel.notebook.GetSelection() 
     
    16951697        # I Believe this is no longer used now that we have removed the  
    16961698        # edit menu from the menubar - PDB July 12, 2015 
    1697         if event != None: 
     1699        if event is not None: 
    16981700            event.Skip() 
    16991701        pos = self.panel.notebook.GetSelection() 
     
    17371739            pos = self.panel.notebook.GetSelection() 
    17381740            grid = self.panel.notebook.GetPage(pos) 
    1739             has_data = (grid.data != None and grid.data != {}) 
     1741            has_data = (grid.data is not None and grid.data != {}) 
    17401742            self.open_excel_menu.Enable(has_data) 
    17411743            self.save_menu.Enable(has_data) 
     
    18201822                    path = dlg.GetPath() 
    18211823                dlg.Destroy() 
    1822                 if path != None: 
     1824                if path is not None: 
    18231825                    if self.parent is not None: 
    18241826                        data = grid.get_grid_view() 
     
    20052007                    path = dlg.GetPath() 
    20062008                dlg.Destroy() 
    2007                 if path != None: 
     2009                if path is not None: 
    20082010                    if self.parent is not None and  self.data is not None: 
    20092011                        self.parent.write_batch_tofile(data=self.data, 
  • src/sas/sasgui/guiframe/gui_manager.py

    r64ca561 r49165488  
    21222122        """ 
    21232123        if custom_config is not None: 
    2124             sas_opencl = os.environ.get("SAS_OPENCL",None) 
     2124            sas_opencl = os.environ.get("SAS_OPENCL") 
    21252125            new_config_lines = [] 
    21262126            config_file = open(custom_config.__file__) 
  • src/sas/sasgui/guiframe/local_perspectives/data_loader/data_loader.py

    r463e7ffc r235f514  
    7575        path = None 
    7676        self._default_save_location = self.parent._default_save_location 
    77         if self._default_save_location == None: 
     77        if self._default_save_location is None: 
    7878            self._default_save_location = os.getcwd() 
    7979 
     
    9292        if dlg.ShowModal() == wx.ID_OK: 
    9393            file_list = dlg.GetPaths() 
    94             if len(file_list) >= 0 and not file_list[0] is None: 
     94            if len(file_list) >= 0 and file_list[0] is not None: 
    9595                self._default_save_location = os.path.dirname(file_list[0]) 
    9696                path = self._default_save_location 
     
    116116        path = None 
    117117        self._default_save_location = self.parent._default_save_location 
    118         if self._default_save_location == None: 
     118        if self._default_save_location is None: 
    119119            self._default_save_location = os.getcwd() 
    120120        dlg = wx.DirDialog(self.parent, "Choose a directory", 
  • src/sas/sasgui/guiframe/local_perspectives/plotting/AnnulusSlicer.py

    rd85c194 r7432acb  
    122122        data = self.base.data2D 
    123123        # If we have no data, just return 
    124         if data == None: 
     124        if data is None: 
    125125            return 
    126126 
     
    132132        # if the user does not specify the numbers of points to plot 
    133133        # the default number will be nbins= 36 
    134         if nbins == None: 
     134        if nbins is None: 
    135135            self.nbins = 36 
    136136        else: 
     
    498498        # Update locations 
    499499        self.outer_circle.update() 
    500         # if self.is_inside != None: 
     500        # if self.is_inside is not None: 
    501501        out = self._post_data() 
    502502        return out 
     
    521521 
    522522        # If we have no data, just return 
    523         if data == None: 
     523        if data is None: 
    524524            return 
    525525        mask = data.mask 
  • src/sas/sasgui/guiframe/local_perspectives/plotting/Arc.py

    rd85c194 r7432acb  
    7171        x = [] 
    7272        y = [] 
    73         if theta1 != None: 
     73        if theta1 is not None: 
    7474            self.theta1 = theta1 
    75         if theta2 != None: 
     75        if theta2 is not None: 
    7676            self.theta2 = theta2 
    7777        while self.theta2 < self.theta1: 
     
    8181        npts = int((self.theta2 - self.theta1) / (math.pi / 120)) 
    8282 
    83         if r == None: 
     83        if r is None: 
    8484            self.radius = math.sqrt(math.pow(self._mouse_x, 2) + \ 
    8585                                     math.pow(self._mouse_y, 2)) 
  • src/sas/sasgui/guiframe/local_perspectives/plotting/Edge.py

    rd85c194 r7432acb  
    6363        Draw the new roughness on the graph. 
    6464        """ 
    65         if r1 != None: 
     65        if r1 is not None: 
    6666            self.r1 = r1 
    67         if r2 != None: 
     67        if r2 is not None: 
    6868            self.r2 = r2 
    69         if theta != None: 
     69        if theta is not None: 
    7070            self.theta = theta 
    7171        x1 = self.r1 * math.cos(self.theta) 
  • src/sas/sasgui/guiframe/local_perspectives/plotting/Plotter1D.py

    r9c0f3c17 r7432acb  
    183183        # So manually recode the size (=x_size) and compare here. 
    184184        # Massy code to work around:< 
    185         if self.parent._mgr != None: 
     185        if self.parent._mgr is not None: 
    186186            max_panel = self.parent._mgr.GetPane(self) 
    187187            if max_panel.IsMaximized(): 
    188188                self.parent._mgr.RestorePane(max_panel) 
    189189                max_panel.Maximize() 
    190         if self.x_size != None: 
     190        if self.x_size is not None: 
    191191            if self.x_size == self.GetSize(): 
    192192                self.resizing = False 
     
    212212        On Qmin Qmax vertical line event 
    213213        """ 
    214         if event == None: 
     214        if event is None: 
    215215            return 
    216216        event.Skip() 
    217217        active_ctrl = event.active 
    218         if active_ctrl == None: 
     218        if active_ctrl is None: 
    219219            return 
    220220        if hasattr(event, 'is_corfunc'): 
     
    231231                colors.append('purple') 
    232232                values.append(min(x_data.max(), float(ctrl[2].GetValue()))) 
    233             if self.ly == None: 
     233            if self.ly is None: 
    234234                self.ly = [] 
    235235                for c, v in zip(colors, values): 
     
    241241                xval = float(active_ctrl.GetValue()) 
    242242                position = self.get_data_xy_vals(xval) 
    243                 if position != None and not self.is_corfunc: 
     243                if position is not None and not self.is_corfunc: 
    244244                    wx.PostEvent(self.parent, StatusEvent(status=position)) 
    245245            except: 
     
    336336        if hasattr(event, "action"): 
    337337            dclick = event.action == 'dclick' 
    338             if ax == None or dclick: 
     338            if ax is None or dclick: 
    339339                # remove the vline 
    340340                self._check_zoom_plot() 
     
    342342                self.q_ctrl = None 
    343343                return 
    344         if self.ly != None and event.xdata != None: 
     344        if self.ly is not None and event.xdata is not None: 
    345345            # Selecting a new line if cursor lines are displayed already 
    346346            dqmin = math.fabs(event.xdata - self.ly[0].get_xdata()) 
     
    361361        Move the cursor line to write Q range 
    362362        """ 
    363         if self.q_ctrl == None: 
     363        if self.q_ctrl is None: 
    364364            return 
    365365        # release a q range vline 
    366         if self.ly != None and not self.leftdown: 
     366        if self.ly is not None and not self.leftdown: 
    367367            for ly in self.ly: 
    368368                ly.set_alpha(0.7) 
     
    370370            return 
    371371        ax = event.inaxes 
    372         if ax == None or not hasattr(event, 'action'): 
     372        if ax is None or not hasattr(event, 'action'): 
    373373            return 
    374         end_drag = event.action != 'drag' and event.xdata != None 
     374        end_drag = event.action != 'drag' and event.xdata is not None 
    375375        nop = len(self.plots) 
    376376        pos_x, _ = float(event.xdata), float(event.ydata) 
     
    514514        ax = event.inaxes 
    515515        PlotPanel.onLeftDown(self, event) 
    516         if ax != None: 
     516        if ax is not None: 
    517517            try: 
    518518                pos_x = float(event.xdata)  # / size_x 
     
    618618            # add menu of other plugins 
    619619            item_list = self.parent.get_current_context_menu(self) 
    620             if (not item_list == None) and (not len(item_list) == 0): 
     620            if (item_list is not None) and (len(item_list)): 
    621621                for item, wx_id in zip(item_list, [ids.next() for i in range(len(item_list))]): 
    622  
    623622                    try: 
    624623                        plot_menu.Append(wx_id, item[0], name) 
     
    684683 
    685684 
    686         if self.position != None: 
     685        if self.position is not None: 
    687686            wx_id = ids.next() 
    688687            self._slicerpop.Append(wx_id, '&Add Text') 
     
    761760            default_name = default_name.split('.')[0] 
    762761        default_name += "_out" 
    763         if self.parent != None: 
     762        if self.parent is not None: 
    764763            self.parent.save_data1d(data, default_name) 
    765764 
     
    779778            default_name = default_name.split('.')[0] 
    780779        # default_name += "_out" 
    781         if self.parent != None: 
     780        if self.parent is not None: 
    782781            self.parent.show_data1d(data, default_name) 
    783782 
     
    811810        curr_label = self.appearance_selected_plot.label 
    812811 
    813         if curr_color == None: 
     812        if curr_color is None: 
    814813            curr_color = self._color_labels['Blue'] 
    815814            curr_symbol = 13 
  • src/sas/sasgui/guiframe/local_perspectives/plotting/Plotter2D.py

    r2df1bd1 r7432acb  
    144144        """ 
    145145        # Not implemented 
    146         if event == None: 
     146        if event is None: 
    147147            return 
    148148        event.Skip() 
     
    156156        PlotPanel.onLeftDown(self, event) 
    157157        ax = event.inaxes 
    158         if ax != None: 
     158        if ax is not None: 
    159159            # data coordinate position 
    160160            pos_x = "%8.3g" % event.xdata 
     
    227227        if self._is_changed_legend_label: 
    228228            data.label = self.title_label 
    229         if data.label == None: 
     229        if data.label is None: 
    230230            data.label = data.name 
    231231        if not self.title_font: 
     
    264264        # control axis labels from the panel itself 
    265265        yname, yunits = data.get_yaxis() 
    266         if self.yaxis_label != None: 
     266        if self.yaxis_label is not None: 
    267267            yname = self.yaxis_label 
    268268            yunits = self.yaxis_unit 
     
    271271            self.yaxis_unit = yunits 
    272272        xname, xunits = data.get_xaxis() 
    273         if self.xaxis_label != None: 
     273        if self.xaxis_label is not None: 
    274274            xname = self.xaxis_label 
    275275            xunits = self.xaxis_unit 
     
    320320        if len(self.data2D.detector) <= 1: 
    321321            item_list = self.parent.get_current_context_menu(self) 
    322             if (not item_list == None) and (not len(item_list) == 0) and\ 
    323                 self.data2D.name.split(" ")[0] != 'Residuals': 
     322            if ((item_list is not None) and len(item_list) and 
     323                self.data2D.name.split(" ")[0] != 'Residuals'): 
    324324                for item, wx_id in zip(item_list, [ids.next() for i in range(len(item_list))]): 
    325325                    try: 
     
    355355            slicerpop.Append(wx_id, '&Box Averaging in Qy') 
    356356            wx.EVT_MENU(self, wx_id, self.onBoxavgY) 
    357             if self.slicer != None: 
     357            if self.slicer is not None: 
    358358                wx_id = ids.next() 
    359359                slicerpop.Append(wx_id, '&Clear Slicer') 
     
    361361                if self.slicer.__class__.__name__ != "BoxSum": 
    362362                    wx_id = ids.next() 
    363                     name = '&Edit Slicer Parameters and Batch Slicing' 
    364                     slicerpop.Append(wx_id, name) 
     363                    slicerpop.Append(wx_id, '&Edit Slicer Parameters') 
    365364                    wx.EVT_MENU(self, wx_id, self._onEditSlicer) 
    366365            slicerpop.AppendSeparator() 
     
    436435                msg = "Add Text: Error. Check your property values..." 
    437436                logger.error(msg) 
    438                 if self.parent != None: 
     437                if self.parent is not None: 
    439438                    wx.PostEvent(self.parent, StatusEvent(status=msg)) 
    440439        dial.Destroy() 
     
    533532 
    534533        """ 
    535         # Clear current slicer 
    536         if not self.slicer == None: 
     534        ## Clear current slicer 
     535        if self.slicer is not None: 
    537536            self.slicer.clear() 
    538         # Create a new slicer 
     537        ## Create a new slicer 
    539538        self.slicer_z += 1 
    540539        self.slicer = slicer(self, self.subplot, zorder=self.slicer_z) 
    541540        self.subplot.set_ylim(self.data2D.ymin, self.data2D.ymax) 
    542541        self.subplot.set_xlim(self.data2D.xmin, self.data2D.xmax) 
    543         # Draw slicer 
     542        ## Draw slicer 
    544543        self.update() 
    545544        self.slicer.update() 
     
    573572        npt = math.floor(npt) 
    574573        from sas.sascalc.dataloader.manipulations import CircularAverage 
    575         # compute the maximum radius of data2D 
     574        ## compute the maximum radius of data2D 
    576575        self.qmax = max(math.fabs(self.data2D.xmax), 
    577576                        math.fabs(self.data2D.xmin)) 
     
    579578                        math.fabs(self.data2D.ymin)) 
    580579        self.radius = math.sqrt(math.pow(self.qmax, 2) + math.pow(self.ymax, 2)) 
    581         # Compute beam width 
     580        ##Compute beam width 
    582581        bin_width = (self.qmax + self.qmax) / npt 
    583         # Create data1D circular average of data2D 
     582        ## Create data1D circular average of data2D 
    584583        Circle = CircularAverage(r_min=0, r_max=self.radius, 
    585584                                 bin_width=bin_width) 
     
    600599        new_plot.name = "Circ avg " + self.data2D.name 
    601600        new_plot.source = self.data2D.source 
    602         # new_plot.info = self.data2D.info 
     601        #new_plot.info = self.data2D.info 
    603602        new_plot.interactive = True 
    604603        new_plot.detector = self.data2D.detector 
    605604 
    606         # If the data file does not tell us what the axes are, just assume... 
     605        ## If the data file does not tell us what the axes are, just assume... 
    607606        new_plot.xaxis("\\rm{Q}", "A^{-1}") 
    608607        if hasattr(self.data2D, "scale") and \ 
     
    616615        new_plot.id = "Circ avg " + self.data2D.name 
    617616        new_plot.is_data = True 
    618         self.parent.update_theory(data_id=self.data2D.id, theory=new_plot) 
     617        self.parent.update_theory(data_id=self.data2D.id, \ 
     618                                       theory=new_plot) 
    619619        wx.PostEvent(self.parent, 
    620620                     NewPlotEvent(plot=new_plot, title=new_plot.name)) 
     
    630630        """ 
    631631        if self.slicer is not None: 
    632             from parameters_panel_slicer import SlicerParameterPanel 
     632            from SlicerParameters import SlicerParameterPanel 
    633633            dialog = SlicerParameterPanel(self, -1, "Slicer Parameters") 
    634634            dialog.set_slicer(self.slicer.__class__.__name__, 
     
    668668        params = self.slicer.get_params() 
    669669        ## Create a new panel to display results of summation of Data2D 
    670         from parameters_panel_boxsum import SlicerPanel 
     670        from slicerpanel import SlicerPanel 
    671671        win = MDIFrame(self.parent, None, 'None', (100, 200)) 
    672672        new_panel = SlicerPanel(parent=win, id=-1, 
     
    758758        if default_name.count('.') > 0: 
    759759            default_name = default_name.split('.')[0] 
     760        #default_name += "_out" 
    760761        if self.parent is not None: 
    761762            self.parent.show_data2d(data, default_name) 
    762763 
    763764    def modifyGraphAppearance(self, e): 
    764         self.graphApp = graphAppearance(self, 'Modify graph appearance', 
    765                                         legend=False) 
     765        self.graphApp = graphAppearance(self, 'Modify graph appearance', legend=False) 
    766766        self.graphApp.setDefaults(self.grid_on, self.legend_on, 
    767767                                  self.xaxis_label, self.yaxis_label, 
  • src/sas/sasgui/guiframe/local_perspectives/plotting/SectorSlicer.py

    rd85c194 r7432acb  
    144144        data = self.base.data2D 
    145145        # If we have no data, just return 
    146         if data == None: 
     146        if data is None: 
    147147            return 
    148148        ## Averaging 
     
    151151        phimin = -self.left_line.phi + self.main_line.theta 
    152152        phimax = self.left_line.phi + self.main_line.theta 
    153         if nbins == None: 
     153        if nbins is None: 
    154154            nbins = 20 
    155155        sect = SectorQ(r_min=0.0, r_max=radius, 
     
    362362        self.left_moving = left 
    363363        theta3 = 0 
    364         if phi != None: 
     364        if phi is not None: 
    365365            self.phi = phi 
    366         if delta == None: 
     366        if delta is None: 
    367367            delta = 0 
    368368        if  right: 
     
    374374            self.theta = mline.theta + self.phi 
    375375 
    376         if mline != None: 
     376        if mline is not None: 
    377377            if delta != 0: 
    378378                self.theta2 = mline + delta 
     
    538538        """ 
    539539 
    540         if theta != None: 
     540        if theta is not None: 
    541541            self.theta = theta 
    542542        x1 = self.radius * math.cos(self.theta) 
  • src/sas/sasgui/guiframe/local_perspectives/plotting/SimplePlot.py

    r25b9707a r7432acb  
    8787            pos = (pos_x, pos_y + 5) 
    8888        self.PopupMenu(slicerpop, pos) 
    89         if self.scale != None: 
     89        if self.scale is not None: 
    9090            self.parent.scale2d = self.scale 
    9191 
     
    106106            self.leftdown = True 
    107107            ax = event.inaxes 
    108             if ax != None: 
     108            if ax is not None: 
    109109                self.xInit, self.yInit = event.xdata, event.ydata 
    110110                try: 
     
    123123        """ 
    124124        self.resizing = False 
    125         if self.x_size != None: 
     125        if self.x_size is not None: 
    126126            if self.x_size == self.GetSize(): 
    127127                self.canvas.set_resizing(self.resizing) 
     
    161161        self.plots[plot.name] = plot 
    162162        # Axis scales 
    163         if plot.xtransform != None: 
     163        if plot.xtransform is not None: 
    164164            self.xLabel = plot.xtransform 
    165         if plot.ytransform != None: 
     165        if plot.ytransform is not None: 
    166166            self.yLabel = plot.ytransform 
    167167        # Init graph 
  • src/sas/sasgui/guiframe/local_perspectives/plotting/boxMask.py

    rd85c194 r7432acb  
    123123                                         x2=self.vertical_lines.x2, 
    124124                                         width=self.vertical_lines.half_width) 
    125         # if self.is_inside != None: 
     125        # if self.is_inside is not None: 
    126126        out = self._post_data() 
    127127        return out 
  • src/sas/sasgui/guiframe/local_perspectives/plotting/boxSlicer.py

    r9a5097c r7432acb  
    139139 
    140140        """ 
    141         if self.direction == None: 
     141        if self.direction is None: 
    142142            self.direction = direction 
    143143 
     
    147147        y_max = math.fabs(self.horizontal_lines.y) 
    148148 
    149         if nbins != None: 
     149        if nbins is not None: 
    150150            self.nbins = nbins 
    151         if self.averager == None: 
    152             if new_slab == None: 
     151        if self.averager is None: 
     152            if new_slab is None: 
    153153                msg = "post data:cannot average , averager is empty" 
    154154                raise ValueError, msg 
     
    357357        """ 
    358358        # # Reset x, y- coordinates if send as parameters 
    359         if x != None: 
     359        if x is not None: 
    360360            self.x = np.sign(self.x) * math.fabs(x) 
    361         if y != None: 
     361        if y is not None: 
    362362            self.y = np.sign(self.y) * math.fabs(y) 
    363363        # # Draw lines and markers 
     
    464464        """ 
    465465        # # reset x, y -coordinates if given as parameters 
    466         if x != None: 
     466        if x is not None: 
    467467            self.x = np.sign(self.x) * math.fabs(x) 
    468         if y != None: 
     468        if y is not None: 
    469469            self.y = np.sign(self.y) * math.fabs(y) 
    470470        # # draw lines and markers 
  • src/sas/sasgui/guiframe/local_perspectives/plotting/boxSum.py

    rd85c194 r7432acb  
    353353            Draw the new roughness on the graph. 
    354354        """ 
    355         if center_x != None: 
     355        if center_x is not None: 
    356356            self.x = center_x 
    357         if center_y != None: 
     357        if center_y is not None: 
    358358            self.y = center_y 
    359359        self.center_marker.set(xdata=[self.x], ydata=[self.y]) 
     
    490490        """ 
    491491        # # save the new height, witdh of the rectangle if given as a param 
    492         if width != None: 
     492        if width is not None: 
    493493            self.half_width = width 
    494         if height != None: 
     494        if height is not None: 
    495495            self.half_height = height 
    496496        # # If new  center coordinates are given draw the rectangle 
    497497        # #given these value 
    498         if center != None: 
     498        if center is not None: 
    499499            self.center_x = center.x 
    500500            self.center_y = center.y 
     
    511511            return 
    512512        # # if x1, y1, y2, y3 are given draw the rectangle with this value 
    513         if x1 != None: 
     513        if x1 is not None: 
    514514            self.x1 = x1 
    515         if x2 != None: 
     515        if x2 is not None: 
    516516            self.x2 = x2 
    517         if y1 != None: 
     517        if y1 is not None: 
    518518            self.y1 = y1 
    519         if y2 != None: 
     519        if y2 is not None: 
    520520            self.y2 = y2 
    521521        # # Draw 2 vertical lines and a marker 
     
    657657        """ 
    658658        # # save the new height, witdh of the rectangle if given as a param 
    659         if width != None: 
     659        if width is not None: 
    660660            self.half_width = width 
    661         if height != None: 
     661        if height is not None: 
    662662            self.half_height = height 
    663663        # # If new  center coordinates are given draw the rectangle 
    664664        # #given these value 
    665         if center != None: 
     665        if center is not None: 
    666666            self.center_x = center.x 
    667667            self.center_y = center.y 
     
    679679            return 
    680680        # # if x1, y1, y2, y3 are given draw the rectangle with this value 
    681         if x1 != None: 
     681        if x1 is not None: 
    682682            self.x1 = x1 
    683         if x2 != None: 
     683        if x2 is not None: 
    684684            self.x2 = x2 
    685         if y1 != None: 
     685        if y1 is not None: 
    686686            self.y1 = y1 
    687         if y2 != None: 
     687        if y2 is not None: 
    688688            self.y2 = y2 
    689689        # # Draw 2 vertical lines and a marker 
  • src/sas/sasgui/guiframe/local_perspectives/plotting/detector_dialog.py

    r8416a02 r7432acb  
    9090            zmin = self.reset_zmin_ctl 
    9191            zmax = self.reset_zmax_ctl 
    92             if zmin == None: 
     92            if zmin is None: 
    9393                zmin = "" 
    94             if zmax == None: 
     94            if zmax is None: 
    9595                zmax = "" 
    9696            self.zmin_ctl.SetValue(str(zmin)) 
     
    155155        self.qmax_ctl.SetLabel(str(format_number(qmax))) 
    156156        self.beam_ctl.SetLabel(str(format_number(beam))) 
    157         if zmin != None: 
     157        if zmin is not None: 
    158158            self.zmin_ctl.SetValue(str(format_number(zmin))) 
    159         if zmax != None: 
     159        if zmax is not None: 
    160160            self.zmax_ctl.SetValue(str(format_number(zmax))) 
    161161 
  • src/sas/sasgui/guiframe/local_perspectives/plotting/masking.py

    r9a5097c r45dffa69  
    100100        wx.Dialog.__init__(self, parent, id=id, *args, **kwds) 
    101101 
    102         if data != None: 
     102        if data is not None: 
    103103            # Font size 
    104104            kwds = [] 
     
    235235        event.Skip() 
    236236        # from boxMask import BoxMask 
    237         if event != None: 
     237        if event is not None: 
    238238            self._on_clear_slicer(event) 
    239239        self.slicer_z += 1 
     
    249249        Add new mask to old mask 
    250250        """ 
    251         if not self.slicer == None: 
     251        if self.slicer is not None: 
    252252            data = Data2D() 
    253253            data = self.data 
     
    269269        Erase new mask from old mask 
    270270        """ 
    271         if not self.slicer == None: 
     271        if self.slicer is not None: 
    272272            self.slicer_mask = self.slicer.update() 
    273273            mask = self.data.mask 
     
    307307        Clear the slicer on the plot 
    308308        """ 
    309         if not self.slicer == None: 
     309        if self.slicer is not None: 
    310310            self.slicer.clear() 
    311311            self.subplot.figure.canvas.draw() 
     
    336336        """ 
    337337        # the case of liitle numbers of True points 
    338         if len(mask[mask]) < 10 and self.data != None: 
     338        if len(mask[mask]) < 10 and self.data is not None: 
    339339            self.ShowMessage() 
    340340            mask = copy.deepcopy(self.mask) 
     
    355355        temp_data.data[mask == False] = temp_mask[mask == False] 
    356356        self.plotpanel.clear() 
    357         if self.slicer != None: 
     357        if self.slicer is not None: 
    358358            self.slicer.clear() 
    359359            self.slicer = None 
     
    460460        wx.Dialog.__init__(self, parent, id=id, *args, **kwds) 
    461461 
    462         if data != None: 
     462        if data is not None: 
    463463            # Font size 
    464464            kwds = [] 
     
    710710        Status msg 
    711711        """ 
    712         if self.parent.parent.parent != None: 
     712        if self.parent.parent.parent is not None: 
    713713            wx.PostEvent(self.parent.parent.parent, 
    714714                         StatusEvent(status=msg, type=type)) 
  • src/sas/sasgui/guiframe/local_perspectives/plotting/plotting.py

    rca224b1 r235f514  
    8888        On Qmin Qmax vertical line event 
    8989        """ 
    90         if event == None: 
     90        if event is None: 
    9191            return 
    9292        if event.id in self.plot_panels.keys(): 
     
    9999 
    100100    def _on_plot_lim(self, event=None): 
    101         if event == None: 
     101        if event is None: 
    102102            return 
    103103        if event.id in self.plot_panels.keys(): 
  • src/sas/sasgui/guiframe/local_perspectives/plotting/profile_dialog.py

    rd85c194 r7432acb  
    4444        wx.Dialog.__init__(self, parent, id=id, *args, **kwds) 
    4545 
    46         if data != None: 
     46        if data is not None: 
    4747            #Font size 
    4848            kwds = [] 
     
    284284            default_name = default_name.split('.')[0] 
    285285        default_name += "_out" 
    286         if self.parent != None: 
     286        if self.parent is not None: 
    287287            # What an ancestor! 
    288288            fit_panel = self.parent.parent.parent 
  • src/sas/sasgui/guiframe/local_perspectives/plotting/sector_mask.py

    rd85c194 r7432acb  
    9696            self.left_line.update(phi=self.right_line.phi, delta=None, 
    9797                                  mline=self.main_line, side=True, left=False) 
    98         #if self.is_inside != None: 
     98        #if self.is_inside is not None: 
    9999        out = self._post_data() 
    100100        return out 
     
    117117        data = self.base.data 
    118118        # If we have no data, just return 
    119         if data == None: 
     119        if data is None: 
    120120            return 
    121121        ## Averaging 
  • src/sas/sasgui/guiframe/panel_base.py

    r18b7ecb9 r235f514  
    441441        """ 
    442442        """ 
    443         if self._manager == None: 
     443        if self._manager is None: 
    444444            return None 
    445445        return self._manager.frame 
  • src/sas/sasgui/guiframe/plugin_base.py

    rd85c194 r7432acb  
    161161        Sets default frame config 
    162162        """ 
    163         if self.frame != None: 
     163        if self.frame is not None: 
    164164            self.frame.EnableCloseButton(False) 
    165165            self.frame.Show(False) 
     
    230230        old_frame = None 
    231231        old_persp = self.parent.get_current_perspective() 
    232         if old_persp != None: 
     232        if old_persp is not None: 
    233233            old_frame = old_persp.get_frame() 
    234234        self.parent.check_multimode(self) 
     
    236236        self.parent.set_perspective(self.perspective) 
    237237 
    238         if self.frame != None: 
    239             if old_frame != None: 
     238        if self.frame is not None: 
     239            if old_frame is not None: 
    240240                pos_x, pos_y = old_frame.GetPositionTuple() 
    241241                self.frame.SetPosition((pos_x, pos_y)) 
  • src/sas/sasgui/guiframe/startup_configuration.py

    r73cbeec r7432acb  
    129129                width, _ = panel.frame.GetSizeTuple() 
    130130                if panel.frame.IsShown(): 
    131                     if p_size == None or width > p_size: 
     131                    if p_size is None or width > p_size: 
    132132                        p_size = width 
    133             if p_size == None: 
     133            if p_size is None: 
    134134                p_size = CURRENT_STRINGS['PLOPANEL_WIDTH'] 
    135135            self.current_string['PLOPANEL_WIDTH'] = p_size 
     
    145145                 
    146146            data_pw, _ = self.parent.panels["data_panel"].frame.GetSizeTuple() 
    147             if data_pw == None: 
     147            if data_pw is None: 
    148148                data_pw = CURRENT_STRINGS['DATAPANEL_WIDTH'] 
    149149            self.current_string['DATAPANEL_WIDTH'] = data_pw 
     
    208208        for key, item in strings.iteritems(): 
    209209            if (key == 'DEFAULT_PERSPECTIVE') or \ 
    210                 (key == 'DEFAULT_OPEN_FOLDER' and item != None): 
     210                (key == 'DEFAULT_OPEN_FOLDER' and item is not None): 
    211211                out_f.write("%s = \"%s\"\n" % (key,str(item))) 
    212212            else: 
  • src/sas/sasgui/guiframe/utils.py

    ra0373d5 r7432acb  
    8989    list = [] 
    9090    for item in mylist: 
    91         if re.search(separator,item)!= None: 
     91        if re.search(separator,item)is not None: 
    9292            if n > 0: 
    9393                word = re.split(separator, item, int(n)) 
  • src/sas/sasgui/guiframe/local_perspectives/plotting/parameters_panel_boxsum.py

    r7432acb r37d461c  
    11import wx 
    22import wx.lib.newevent 
    3 #from copy import deepcopy 
     3from parameters_panel_slicer import SlicerParameterPanel 
    44from sas.sasgui.guiframe.utils import format_number 
    5 from sas.sasgui.guiframe.events import SlicerParameterEvent 
    6 from sas.sasgui.guiframe.events import EVT_SLICER_PARS 
    7 from sas.sasgui.guiframe.events import EVT_SLICER 
     5from sas.sasgui.guiframe.panel_base import PanelBase 
     6from sas.sasgui.guiframe.events import (SlicerParameterEvent, EVT_SLICER_PARS, 
     7                                        EVT_SLICER) 
    88 
    9 from sas.sasgui.guiframe.panel_base import PanelBase 
    109 
    1110class SlicerPanel(wx.Panel, PanelBase): 
     
    1312    Panel class to show the slicer parameters 
    1413    """ 
    15     #TODO: show units 
    16     #TODO: order parameters properly 
    17     ## Internal name for the AUI manager 
     14    # Internal name for the AUI manager 
    1815    window_name = "Slicer panel" 
    19     ## Title to appear on top of the window 
     16    # Title to appear on top of the window 
    2017    window_caption = "Slicer Panel" 
    2118    CENTER_PANE = False 
     
    2522        wx.Panel.__init__(self, parent, id, *args, **kwargs) 
    2623        PanelBase.__init__(self) 
    27         ## Initialization of the class 
     24        # Initialization of the class 
    2825        self.base = base 
    2926        if params is None: 
     
    4441        else: 
    4542            self.set_slicer(type, params) 
    46         ## Bindings 
    47         self.parent.Bind(EVT_SLICER, self.onEVT_SLICER) 
    48         self.parent.Bind(EVT_SLICER_PARS, self.onParamChange) 
    49  
    50     def onEVT_SLICER(self, event): 
    51         """ 
    52         Process EVT_SLICER events 
    53         When the slicer changes, update the panel 
    54  
    55         :param event: EVT_SLICER event 
    56  
    57         """ 
    58         event.Skip() 
    59         if event.obj_class is None: 
    60             self.set_slicer(None, None) 
    61         else: 
    62             self.set_slicer(event.type, event.params) 
     43        # Bindings 
     44        self.parent.Bind(EVT_SLICER, SlicerParameterPanel.on_evt_slicer) 
     45        self.parent.Bind(EVT_SLICER_PARS, SlicerParameterPanel.on_param_change) 
    6346 
    6447    def set_slicer(self, type, params): 
     
    8467            keys.sort() 
    8568            for item in keys: 
    86                 if not item.lower() in ["num_points", "avg", "avg_error", "sum", "sum_error"]: 
     69                if not item.lower() in ["num_points", "avg", "avg_error", "sum", 
     70                                        "sum_error"]: 
    8771                    n += 1 
    8872                    text = wx.StaticText(self, -1, item, style=wx.ALIGN_LEFT) 
    8973                    self.bck.Add(text, (n - 1, 0), 
    90                                  flag=wx.LEFT | wx.ALIGN_CENTER_VERTICAL, border=15) 
     74                                 flag=wx.LEFT | wx.ALIGN_CENTER_VERTICAL, 
     75                                 border=15) 
    9176                    ctl = wx.TextCtrl(self, -1, size=(80, 20), 
    9277                                      style=wx.TE_PROCESS_ENTER) 
     
    9580                    ctl.SetToolTipString(hint_msg) 
    9681                    ctl.SetValue(str(format_number(params[item]))) 
    97                     self.Bind(wx.EVT_TEXT_ENTER, self.onTextEnter) 
    98                     ctl.Bind(wx.EVT_SET_FOCUS, self.onSetFocus) 
    99                     ctl.Bind(wx.EVT_KILL_FOCUS, self.onTextEnter) 
     82                    self.Bind(wx.EVT_TEXT_ENTER, self.on_text_enter) 
     83                    ctl.Bind(wx.EVT_SET_FOCUS, self.on_set_focus) 
     84                    ctl.Bind(wx.EVT_KILL_FOCUS, self.on_text_enter) 
    10085                    self.parameters.append([item, ctl]) 
    101                     self.bck.Add(ctl, (n - 1, 1), flag=wx.TOP | wx.BOTTOM, border=0) 
     86                    self.bck.Add(ctl, (n - 1, 1), flag=wx.TOP | wx.BOTTOM, 
     87                                 border=0) 
    10288            for item in keys: 
    103                 if  item.lower() in ["num_points", "avg", "avg_error", "sum", "sum_error"]: 
     89                if item.lower() in ["num_points", "avg", "avg_error", "sum", 
     90                                    "sum_error"]: 
    10491                    n += 1 
    105                     text = wx.StaticText(self, -1, item + ": ", style=wx.ALIGN_LEFT) 
    106                     self.bck.Add(text, (n - 1, 0), flag=wx.LEFT | wx.ALIGN_CENTER_VERTICAL, 
     92                    text = wx.StaticText(self, -1, item + ": ", 
     93                                         style=wx.ALIGN_LEFT) 
     94                    self.bck.Add(text, (n - 1, 0), 
     95                                 flag=wx.LEFT | wx.ALIGN_CENTER_VERTICAL, 
    10796                                 border=15) 
    10897                    ctl = wx.StaticText(self, -1, 
     
    11099                                        style=wx.ALIGN_LEFT) 
    111100                    ctl.SetToolTipString("Result %s" % item) 
    112                     self.bck.Add(ctl, (n - 1, 1), flag=wx.TOP | wx.BOTTOM, border=0) 
     101                    self.bck.Add(ctl, (n - 1, 1), flag=wx.TOP | wx.BOTTOM, 
     102                                 border=0) 
    113103        self.bck.Layout() 
    114104        self.Layout() 
    115         psizer = self.parent.GetSizer() 
    116         if psizer is not None: 
    117             psizer.Layout() 
     105        p_sizer = self.parent.GetSizer() 
     106        if p_sizer is not None: 
     107            p_sizer.Layout() 
    118108 
    119     def onSetFocus(self, evt): 
     109    def on_set_focus(self, evt): 
    120110        """ 
    121111        Highlight the txtcrtl 
     
    126116        # Select the whole control, after this event resolves 
    127117        wx.CallAfter(widget.SetSelection, -1, -1) 
    128         return 
    129118 
    130     def onParamChange(self, evt): 
    131         """ 
    132         Receive and event and reset the text field contained in self.parameters 
    133  
    134         """ 
    135         evt.Skip() 
    136         for item in self.parameters: 
    137             if item[0] in evt.params: 
    138                 item[1].SetValue(format_number(evt.params[item[0]])) 
    139                 item[1].Refresh() 
    140  
    141     def onTextEnter(self, evt): 
     119    def on_text_enter(self, evt): 
    142120        """ 
    143121        Parameters have changed 
     
    149127            try: 
    150128                params[item[0]] = float(item[1].GetValue()) 
    151                 item[1].SetBackgroundColour(wx.SystemSettings_GetColour(wx.SYS_COLOUR_WINDOW)) 
     129                item[1].SetBackgroundColour(wx.SystemSettings_GetColour( 
     130                    wx.SYS_COLOUR_WINDOW)) 
    152131                item[1].Refresh() 
    153132            except: 
     
    155134                item[1].SetBackgroundColour("pink") 
    156135                item[1].Refresh() 
    157  
    158         if has_error == False: 
     136        if not has_error: 
    159137            # Post parameter event 
    160             ## base is guiframe is this case 
     138            # base is guiframe is this case 
    161139            event = SlicerParameterEvent(type=self.type, params=params) 
    162140            wx.PostEvent(self.base, event) 
     
    166144        On Close Event 
    167145        """ 
    168         ID = self.uid 
    169         self.parent.delete_panel(ID) 
     146        uid = self.uid 
     147        self.parent.delete_panel(uid) 
    170148        self.frame.Destroy() 
Note: See TracChangeset for help on using the changeset viewer.