Changeset 7432acb in sasview for src/sas/sascalc


Ignore:
Timestamp:
Apr 9, 2017 6:11:31 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:
45dffa69
Parents:
ac07a3a
Message:

MAINT: search+replace '!= None' by 'is not None'

Location:
src/sas/sascalc
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sascalc/calculator/resolution_calculator.py

    r9c0f3c17 r7432acb  
    608608        a_value *= 1.0E-16 
    609609        # if lamda is give (broad meanning of A)  return 2* lamda^2 * A 
    610         if lamda != None: 
     610        if lamda is not None: 
    611611            a_value *= (4 * lamda * lamda) 
    612612        return a_value 
  • src/sas/sascalc/calculator/sas_gen.py

    r235f514 r7432acb  
    691691            output.set_pix_type('pixel') 
    692692            output.set_pixel_symbols('pixel') 
    693             if vol_pix != None: 
     693            if vol_pix is not None: 
    694694                output.set_pixel_volumes(vol_pix) 
    695695            return output 
     
    867867        self.sld_theta = None 
    868868        self.pix_symbol = None 
    869         if sld_mx != None and sld_my != None and sld_mz != None: 
     869        if sld_mx is not None and sld_my is not None and sld_mz is not None: 
    870870            self.set_sldms(sld_mx, sld_my, sld_mz) 
    871871        self.set_nodes() 
  • src/sas/sascalc/data_util/calcthread.py

    r64ca561 r7432acb  
    205205    def update(self, **kwargs): 
    206206        """Update GUI with the lastest results from the current work unit.""" 
    207         if self.updatefn != None and clock() > self._time_for_update: 
     207        if self.updatefn is not None and clock() > self._time_for_update: 
    208208            self._lock.acquire() 
    209209            self._time_for_update = clock() + self._delay 
     
    221221    def complete(self, **kwargs): 
    222222        """Update the GUI with the completed results from a work unit.""" 
    223         if self.completefn != None: 
     223        if self.completefn is not None: 
    224224            self.completefn(**kwargs) 
    225225            sleep(self.yieldtime) 
  • src/sas/sascalc/dataloader/data_info.py

    r235f514 r7432acb  
    907907        result.y = np.append(self.y, other.y) 
    908908        result.y = result.y[ind] 
    909         if result.dy != None: 
     909        if result.dy is not None: 
    910910            result.dy = np.append(self.dy, other.dy) 
    911911            result.dy = result.dy[ind] 
  • src/sas/sascalc/dataloader/manipulations.py

    r235f514 r7432acb  
    422422 
    423423        # Get the dq for resolution averaging 
    424         if data2D.dqx_data != None and data2D.dqy_data != None: 
     424        if data2D.dqx_data is not None and data2D.dqy_data is not None: 
    425425            # The pinholes and det. pix contribution present 
    426426            # in both direction of the 2D which must be subtracted when 
     
    508508            else: 
    509509                err_y[i_q] += frac * frac * err_data[npt] * err_data[npt] 
    510             if dq_data != None: 
     510            if dq_data is not None: 
    511511                # To be consistent with dq calculation in 1d reduction, 
    512512                # we need just the averages (not quadratures) because 
     
    523523                err_y[n] = -err_y[n] 
    524524            err_y[n] = math.sqrt(err_y[n]) 
    525             #if err_x != None: 
     525            #if err_x is not None: 
    526526            #    err_x[n] = math.sqrt(err_x[n]) 
    527527 
     
    532532        idx = (numpy.isfinite(y)) & (numpy.isfinite(x)) 
    533533 
    534         if err_x != None: 
     534        if err_x is not None: 
    535535            d_x = err_x[idx] / y_counts[idx] 
    536536        else: 
     
    777777 
    778778        # Get the dq for resolution averaging 
    779         if data2D.dqx_data != None and data2D.dqy_data != None: 
     779        if data2D.dqx_data is not None and data2D.dqy_data is not None: 
    780780            # The pinholes and det. pix contribution present 
    781781            # in both direction of the 2D which must be subtracted when 
     
    895895                y_err[i_bin] += frac * frac * err_data[n] * err_data[n] 
    896896 
    897             if dq_data != None: 
     897            if dq_data is not None: 
    898898                # To be consistent with dq calculation in 1d reduction, 
    899899                # we need just the averages (not quadratures) because 
     
    925925        y_err[y_err == 0] = numpy.average(y_err) 
    926926        idx = (numpy.isfinite(y) & numpy.isfinite(y_err)) 
    927         if x_err != None: 
     927        if x_err is not None: 
    928928            d_x = x_err[idx] / y_counts[idx] 
    929929        else: 
  • src/sas/sascalc/dataloader/readers/cansas_reader.py

    r235f514 r7432acb  
    11331133                self.write_node(point, "T", spectrum.transmission[i], 
    11341134                                {'unit': spectrum.transmission_unit}) 
    1135                 if spectrum.transmission_deviation != None \ 
     1135                if spectrum.transmission_deviation is not None \ 
    11361136                and len(spectrum.transmission_deviation) >= i: 
    11371137                    self.write_node(point, "Tdev", 
     
    14641464                local_unit = None 
    14651465                exec "local_unit = storage.%s_unit" % toks[0] 
    1466                 if local_unit != None and units.lower() != local_unit.lower(): 
     1466                if local_unit is not None and units.lower() != local_unit.lower(): 
    14671467                    if HAS_CONVERTER == True: 
    14681468                        try: 
  • src/sas/sascalc/file_converter/cansas_writer.py

    r235f514 r7432acb  
    9696                self.write_node(point, "I", datainfo.y[i], 
    9797                                {'unit': datainfo.y_unit}) 
    98             if datainfo.dy != None and len(datainfo.dy) > i: 
     98            if datainfo.dy is not None and len(datainfo.dy) > i: 
    9999                self.write_node(point, "Idev", datainfo.dy[i], 
    100100                                {'unit': datainfo.y_unit}) 
    101             if datainfo.dx != None and len(datainfo.dx) > i: 
     101            if datainfo.dx is not None and len(datainfo.dx) > i: 
    102102                self.write_node(point, "Qdev", datainfo.dx[i], 
    103103                                {'unit': datainfo.x_unit}) 
    104             if datainfo.dxw != None and len(datainfo.dxw) > i: 
     104            if datainfo.dxw is not None and len(datainfo.dxw) > i: 
    105105                self.write_node(point, "dQw", datainfo.dxw[i], 
    106106                                {'unit': datainfo.x_unit}) 
    107             if datainfo.dxl != None and len(datainfo.dxl) > i: 
     107            if datainfo.dxl is not None and len(datainfo.dxl) > i: 
    108108                self.write_node(point, "dQl", datainfo.dxl[i], 
    109109                                {'unit': datainfo.x_unit}) 
  • src/sas/sascalc/fit/AbstractFitEngine.py

    r235f514 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) 
     
    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            gn = fn.get_value() 
  • src/sas/sascalc/fit/MultiplicationModel.py

    r235f514 r7432acb  
    178178        """ 
    179179        value = self.params['volfraction'] 
    180         if value != None: 
     180        if value is not None: 
    181181            factor = self.p_model.calculate_VR() 
    182182            if factor is None or factor == NotImplemented or factor == 0.0: 
     
    195195        effective_radius = self.p_model.calculate_ER() 
    196196        #Reset the effective_radius of s_model just before the run 
    197         if effective_radius != None and effective_radius != NotImplemented: 
     197        if effective_radius is not None and effective_radius != NotImplemented: 
    198198            self.s_model.setParam('radius_effective', effective_radius) 
    199199 
  • src/sas/sascalc/invariant/invariant.py

    r959eb01 r7432acb  
    329329 
    330330        ##power is given only for function = power_law 
    331         if power != None: 
     331        if power is not None: 
    332332            sigma2 = linearized_data.dy * linearized_data.dy 
    333333            a = -(power) 
     
    389389        self._data = self._get_data(data) 
    390390        # get the dxl if the data is smeared: This is done only once on init. 
    391         if self._data.dxl != None and self._data.dxl.all() > 0: 
     391        if self._data.dxl is not None and self._data.dxl.all() > 0: 
    392392            # assumes constant dxl 
    393393            self._smeared = self._data.dxl[0] 
     
    579579 
    580580        result_data = LoaderData1D(x=q, y=iq, dy=diq) 
    581         if self._smeared != None: 
     581        if self._smeared is not None: 
    582582            result_data.dxl = self._smeared * np.ones(len(q)) 
    583583        return result_data 
  • src/sas/sascalc/pr/fit/AbstractFitEngine.py

    r235f514 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) 
     
    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 
  • src/sas/sascalc/pr/num_term.py

    rac07a3a 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) 
Note: See TracChangeset for help on using the changeset viewer.