Ignore:
Timestamp:
Apr 9, 2017 3:46:10 AM (7 years ago)
Author:
andyfaff
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:
ac07a3a
Parents:
5b2b04d
Message:

MAINT: replace '== None' by 'is None'

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sasgui/perspectives/fitting/fitting.py

    r9c0f3c17 r235f514  
    386386        help for setting list of the edit model menu labels 
    387387        """ 
    388         if menu == None: 
     388        if menu is None: 
    389389            menu = self.edit_custom_model 
    390390        list_fnames = os.listdir(models.find_plugins_dir()) 
     
    11251125        page = self.fit_panel.set_data(data) 
    11261126        # page could be None when loading state files 
    1127         if page == None: 
     1127        if page is None: 
    11281128            return page 
    11291129        #append Data1D to the panel containing its theory 
     
    11931193        """ 
    11941194        # case that uid is not specified 
    1195         if uid == None: 
     1195        if uid is None: 
    11961196            for page_id in self.page_finder.keys(): 
    11971197                self.page_finder[page_id].schedule_tofit(value) 
     
    12311231        """ 
    12321232        panel = self.plot_panel 
    1233         if panel == None: 
     1233        if panel is None: 
    12341234            raise ValueError, "Fitting:_onSelect: NonType panel" 
    12351235        Plugin.on_perspective(self, event=event) 
     
    13351335                if not correct_result or res.fitness is None or \ 
    13361336                    not np.isfinite(res.fitness) or \ 
    1337                         np.any(res.pvec == None) or not \ 
     1337                        np.any(res.pvec is None) or not \ 
    13381338                        np.all(np.isfinite(res.pvec)): 
    13391339                    data_name = str(None) 
     
    15261526                if res.fitness is None or \ 
    15271527                    not np.isfinite(res.fitness) or \ 
    1528                         np.any(res.pvec == None) or \ 
     1528                        np.any(res.pvec is None) or \ 
    15291529                    not np.all(np.isfinite(res.pvec)): 
    15301530                    fit_msg += "\nFitting did not converge!!!" 
     
    15871587        """ 
    15881588        event.Skip() 
    1589         if self.menu1 == None: 
     1589        if self.menu1 is None: 
    15901590            return 
    15911591        menu_item = self.menu1.FindItemById(self.id_reset_flag) 
     
    16461646        caption = evt.caption 
    16471647        enable_smearer = evt.enable_smearer 
    1648         if model == None: 
     1648        if model is None: 
    16491649            return 
    16501650        if uid not in self.page_finder.keys(): 
     
    16981698        new_plot.title = data.name 
    16991699        new_plot.group_id = data.group_id 
    1700         if new_plot.group_id == None: 
     1700        if new_plot.group_id is None: 
    17011701            new_plot.group_id = data.group_id 
    17021702        new_plot.id = data_id 
     
    20022002        chisqr = None 
    20032003        #to compute chisq make sure data has valid data 
    2004         # return None if data == None 
    2005         if not check_data_validity(data_copy) or data_copy == None: 
     2004        # return None if data is None 
     2005        if not check_data_validity(data_copy) or data_copy is None: 
    20062006            return chisqr 
    20072007 
    20082008        # Get data: data I, theory I, and data dI in order 
    20092009        if data_copy.__class__.__name__ == "Data2D": 
    2010             if index == None: 
     2010            if index is None: 
    20112011                index = np.ones(len(data_copy.data), dtype=bool) 
    20122012            if weight != None: 
     
    20172017            fn = data_copy.data[index] 
    20182018            theory_data = self.page_finder[page_id].get_theory_data(fid=data_copy.id) 
    2019             if theory_data == None: 
     2019            if theory_data is None: 
    20202020                return chisqr 
    20212021            gn = theory_data.data[index] 
     
    20232023        else: 
    20242024            # 1 d theory from model_thread is only in the range of index 
    2025             if index == None: 
     2025            if index is None: 
    20262026                index = np.ones(len(data_copy.y), dtype=bool) 
    20272027            if weight != None: 
    20282028                data_copy.dy = weight 
    2029             if data_copy.dy == None or data_copy.dy == []: 
     2029            if data_copy.dy is None or data_copy.dy == []: 
    20302030                dy = np.ones(len(data_copy.y)) 
    20312031            else: 
     
    20372037 
    20382038            theory_data = self.page_finder[page_id].get_theory_data(fid=data_copy.id) 
    2039             if theory_data == None: 
     2039            if theory_data is None: 
    20402040                return chisqr 
    20412041            gn = theory_data.y 
     
    20802080            theory_data = self.page_finder[page_id].get_theory_data(fid=data_copy.id) 
    20812081            gn = theory_data.data 
    2082             if weight == None: 
     2082            if weight is None: 
    20832083                en = data_copy.err_data 
    20842084            else: 
     
    21012101        else: 
    21022102            # 1 d theory from model_thread is only in the range of index 
    2103             if data_copy.dy == None or data_copy.dy == []: 
     2103            if data_copy.dy is None or data_copy.dy == []: 
    21042104                dy = np.ones(len(data_copy.y)) 
    21052105            else: 
    2106                 if weight == None: 
     2106                if weight is None: 
    21072107                    dy = np.ones(len(data_copy.y)) 
    21082108                ## Set consitently w/AbstractFitengine: 
     
    21422142        ##group_id specify on which panel to plot this data 
    21432143        group_id = self.page_finder[page_id].get_graph_id() 
    2144         if group_id == None: 
     2144        if group_id is None: 
    21452145            group_id = data.group_id 
    21462146        new_plot.group_id = "res" + str(group_id) 
Note: See TracChangeset for help on using the changeset viewer.