Changeset 4342fed0 in sasview for src/sas/sascalc/pr


Ignore:
Timestamp:
Apr 9, 2017 8:09:12 AM (8 years ago)
Author:
GitHub <noreply@…>
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:
fca1f50
Parents:
5b2b04d (diff), 45dffa69 (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:
Paul Butler <butlerpd@…> (04/09/17 08:09:12)
git-committer:
GitHub <noreply@…> (04/09/17 08:09:12)
Message:

Merge pull request #67 from andyfaff/is_none

MAINT: use 'is None' instead of '== None'

Location:
src/sas/sascalc/pr
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sascalc/pr/fit/AbstractFitEngine.py

    r9a5097c r7432acb  
    190190        if qmin == 0.0 and not np.isfinite(self.y[qmin]): 
    191191            self.qmin = min(self.x[self.x != 0]) 
    192         elif qmin != None: 
     192        elif qmin is not None: 
    193193            self.qmin = qmin 
    194         if qmax != None: 
     194        if qmax is not None: 
    195195            self.qmax = qmax 
    196196        # Determine the range needed in unsmeared-Q to cover 
     
    202202        self._last_unsmeared_bin = len(self.x) - 1 
    203203         
    204         if self.smearer != None: 
     204        if self.smearer is not None: 
    205205            self._first_unsmeared_bin, self._last_unsmeared_bin = \ 
    206206                    self.smearer.get_bin_range(self.qmin, self.qmax) 
     
    294294         
    295295        ## fitting range 
    296         if qmin == None: 
     296        if qmin is None: 
    297297            self.qmin = 1e-16 
    298         if qmax == None: 
     298        if qmax is None: 
    299299            self.qmax = math.sqrt(x_max * x_max + y_max * y_max) 
    300300        ## new error image for fitting purpose 
    301         if self.err_data == None or self.err_data == []: 
     301        if self.err_data is None or self.err_data == []: 
    302302            self.res_err_data = np.ones(len(self.data)) 
    303303        else: 
     
    318318            Set smearer 
    319319        """ 
    320         if smearer == None: 
     320        if smearer is None: 
    321321            return 
    322322        self.smearer = smearer 
     
    330330        if qmin == 0.0: 
    331331            self.qmin = 1e-16 
    332         elif qmin != None: 
     332        elif qmin is not None: 
    333333            self.qmin = qmin 
    334         if qmax != None: 
     334        if qmax is not None: 
    335335            self.qmax = qmax 
    336336        self.radius = np.sqrt(self.qx_data**2 + self.qy_data**2) 
     
    357357        return the residuals 
    358358        """ 
    359         if self.smearer != None: 
     359        if self.smearer is not None: 
    360360            fn.set_index(self.idx) 
    361361            # Get necessary data from self.data and set the data for smearing 
     
    615615        """ 
    616616        """ 
    617         if self.pvec == None and self.model is None and self.param_list is None: 
     617        if self.pvec is None and self.model is None and self.param_list is None: 
    618618            return "No results" 
    619619 
  • src/sas/sascalc/pr/fit/Loader.py

    r959eb01 rac07a3a  
    3434    def set_values(self): 
    3535        """ Store the values loaded from file in local variables""" 
    36         if not self.filename == None: 
     36        if self.filename is not None: 
    3737            input_f =  open(self.filename, 'r') 
    3838            buff = input_f.read() 
  • src/sas/sascalc/pr/invertor.py

    r9c0f3c17 r45dffa69  
    162162            return self.set_dmax(value) 
    163163        elif name == 'q_min': 
    164             if value == None: 
     164            if value is None: 
    165165                return self.set_qmin(-1.0) 
    166166            return self.set_qmin(value) 
    167167        elif name == 'q_max': 
    168             if value == None: 
     168            if value is None: 
    169169                return self.set_qmax(-1.0) 
    170170            return self.set_qmax(value) 
     
    395395        Check q-value against user-defined range 
    396396        """ 
    397         if not self.q_min == None and q < self.q_min: 
     397        if self.q_min is not None and q < self.q_min: 
    398398            return False 
    399         if not self.q_max == None and q > self.q_max: 
     399        if self.q_max is not None and q > self.q_max: 
    400400            return False 
    401401        return True 
     
    658658            file.write("#has_bck=0\n") 
    659659        file.write("#alpha_estimate=%g\n" % self.suggested_alpha) 
    660         if not self.out == None: 
     660        if self.out is not None: 
    661661            if len(self.out) == len(self.cov): 
    662662                for i in range(len(self.out)): 
  • src/sas/sascalc/pr/num_term.py

    r959eb01 r7432acb  
    6767        self.alpha_list = [] 
    6868        for k in range(self.nterm_min, self.nterm_max, 1): 
    69             if self.isquit_func != None: 
     69            if self.isquit_func is not None: 
    7070                self.isquit_func() 
    7171            best_alpha, message, _ = inver.estimate_alpha(k) 
     
    159159    scale = None 
    160160    min_err = 0.0 
    161     if not path == None: 
     161    if path is not None: 
    162162        input_f = open(path, 'r') 
    163163        buff = input_f.read() 
     
    171171                    err = float(toks[2]) 
    172172                else: 
    173                     if scale == None: 
     173                    if scale is None: 
    174174                        scale = 0.05 * math.sqrt(test_y) 
    175175                        #scale = 0.05/math.sqrt(y) 
Note: See TracChangeset for help on using the changeset viewer.