Changeset 7432acb in sasview for src/sas/sascalc
- Timestamp:
- Apr 9, 2017 6:11:31 AM (8 years ago)
- 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
- Location:
- src/sas/sascalc
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sascalc/calculator/resolution_calculator.py
r9c0f3c17 r7432acb 608 608 a_value *= 1.0E-16 609 609 # if lamda is give (broad meanning of A) return 2* lamda^2 * A 610 if lamda !=None:610 if lamda is not None: 611 611 a_value *= (4 * lamda * lamda) 612 612 return a_value -
src/sas/sascalc/calculator/sas_gen.py
r235f514 r7432acb 691 691 output.set_pix_type('pixel') 692 692 output.set_pixel_symbols('pixel') 693 if vol_pix !=None:693 if vol_pix is not None: 694 694 output.set_pixel_volumes(vol_pix) 695 695 return output … … 867 867 self.sld_theta = None 868 868 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: 870 870 self.set_sldms(sld_mx, sld_my, sld_mz) 871 871 self.set_nodes() -
src/sas/sascalc/data_util/calcthread.py
r64ca561 r7432acb 205 205 def update(self, **kwargs): 206 206 """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: 208 208 self._lock.acquire() 209 209 self._time_for_update = clock() + self._delay … … 221 221 def complete(self, **kwargs): 222 222 """Update the GUI with the completed results from a work unit.""" 223 if self.completefn !=None:223 if self.completefn is not None: 224 224 self.completefn(**kwargs) 225 225 sleep(self.yieldtime) -
src/sas/sascalc/dataloader/data_info.py
r235f514 r7432acb 907 907 result.y = np.append(self.y, other.y) 908 908 result.y = result.y[ind] 909 if result.dy !=None:909 if result.dy is not None: 910 910 result.dy = np.append(self.dy, other.dy) 911 911 result.dy = result.dy[ind] -
src/sas/sascalc/dataloader/manipulations.py
r235f514 r7432acb 422 422 423 423 # 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: 425 425 # The pinholes and det. pix contribution present 426 426 # in both direction of the 2D which must be subtracted when … … 508 508 else: 509 509 err_y[i_q] += frac * frac * err_data[npt] * err_data[npt] 510 if dq_data !=None:510 if dq_data is not None: 511 511 # To be consistent with dq calculation in 1d reduction, 512 512 # we need just the averages (not quadratures) because … … 523 523 err_y[n] = -err_y[n] 524 524 err_y[n] = math.sqrt(err_y[n]) 525 #if err_x !=None:525 #if err_x is not None: 526 526 # err_x[n] = math.sqrt(err_x[n]) 527 527 … … 532 532 idx = (numpy.isfinite(y)) & (numpy.isfinite(x)) 533 533 534 if err_x !=None:534 if err_x is not None: 535 535 d_x = err_x[idx] / y_counts[idx] 536 536 else: … … 777 777 778 778 # 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: 780 780 # The pinholes and det. pix contribution present 781 781 # in both direction of the 2D which must be subtracted when … … 895 895 y_err[i_bin] += frac * frac * err_data[n] * err_data[n] 896 896 897 if dq_data !=None:897 if dq_data is not None: 898 898 # To be consistent with dq calculation in 1d reduction, 899 899 # we need just the averages (not quadratures) because … … 925 925 y_err[y_err == 0] = numpy.average(y_err) 926 926 idx = (numpy.isfinite(y) & numpy.isfinite(y_err)) 927 if x_err !=None:927 if x_err is not None: 928 928 d_x = x_err[idx] / y_counts[idx] 929 929 else: -
src/sas/sascalc/dataloader/readers/cansas_reader.py
r235f514 r7432acb 1133 1133 self.write_node(point, "T", spectrum.transmission[i], 1134 1134 {'unit': spectrum.transmission_unit}) 1135 if spectrum.transmission_deviation !=None \1135 if spectrum.transmission_deviation is not None \ 1136 1136 and len(spectrum.transmission_deviation) >= i: 1137 1137 self.write_node(point, "Tdev", … … 1464 1464 local_unit = None 1465 1465 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(): 1467 1467 if HAS_CONVERTER == True: 1468 1468 try: -
src/sas/sascalc/file_converter/cansas_writer.py
r235f514 r7432acb 96 96 self.write_node(point, "I", datainfo.y[i], 97 97 {'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: 99 99 self.write_node(point, "Idev", datainfo.dy[i], 100 100 {'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: 102 102 self.write_node(point, "Qdev", datainfo.dx[i], 103 103 {'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: 105 105 self.write_node(point, "dQw", datainfo.dxw[i], 106 106 {'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: 108 108 self.write_node(point, "dQl", datainfo.dxl[i], 109 109 {'unit': datainfo.x_unit}) -
src/sas/sascalc/fit/AbstractFitEngine.py
r235f514 r7432acb 190 190 if qmin == 0.0 and not np.isfinite(self.y[qmin]): 191 191 self.qmin = min(self.x[self.x != 0]) 192 elif qmin !=None:192 elif qmin is not None: 193 193 self.qmin = qmin 194 if qmax !=None:194 if qmax is not None: 195 195 self.qmax = qmax 196 196 # Determine the range needed in unsmeared-Q to cover … … 202 202 self._last_unsmeared_bin = len(self.x) - 1 203 203 204 if self.smearer !=None:204 if self.smearer is not None: 205 205 self._first_unsmeared_bin, self._last_unsmeared_bin = \ 206 206 self.smearer.get_bin_range(self.qmin, self.qmax) … … 330 330 if qmin == 0.0: 331 331 self.qmin = 1e-16 332 elif qmin !=None:332 elif qmin is not None: 333 333 self.qmin = qmin 334 if qmax !=None:334 if qmax is not None: 335 335 self.qmax = qmax 336 336 self.radius = np.sqrt(self.qx_data**2 + self.qy_data**2) … … 357 357 return the residuals 358 358 """ 359 if self.smearer !=None:359 if self.smearer is not None: 360 360 fn.set_index(self.idx) 361 361 gn = fn.get_value() -
src/sas/sascalc/fit/MultiplicationModel.py
r235f514 r7432acb 178 178 """ 179 179 value = self.params['volfraction'] 180 if value !=None:180 if value is not None: 181 181 factor = self.p_model.calculate_VR() 182 182 if factor is None or factor == NotImplemented or factor == 0.0: … … 195 195 effective_radius = self.p_model.calculate_ER() 196 196 #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: 198 198 self.s_model.setParam('radius_effective', effective_radius) 199 199 -
src/sas/sascalc/invariant/invariant.py
r959eb01 r7432acb 329 329 330 330 ##power is given only for function = power_law 331 if power !=None:331 if power is not None: 332 332 sigma2 = linearized_data.dy * linearized_data.dy 333 333 a = -(power) … … 389 389 self._data = self._get_data(data) 390 390 # 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: 392 392 # assumes constant dxl 393 393 self._smeared = self._data.dxl[0] … … 579 579 580 580 result_data = LoaderData1D(x=q, y=iq, dy=diq) 581 if self._smeared !=None:581 if self._smeared is not None: 582 582 result_data.dxl = self._smeared * np.ones(len(q)) 583 583 return result_data -
src/sas/sascalc/pr/fit/AbstractFitEngine.py
r235f514 r7432acb 190 190 if qmin == 0.0 and not np.isfinite(self.y[qmin]): 191 191 self.qmin = min(self.x[self.x != 0]) 192 elif qmin !=None:192 elif qmin is not None: 193 193 self.qmin = qmin 194 if qmax !=None:194 if qmax is not None: 195 195 self.qmax = qmax 196 196 # Determine the range needed in unsmeared-Q to cover … … 202 202 self._last_unsmeared_bin = len(self.x) - 1 203 203 204 if self.smearer !=None:204 if self.smearer is not None: 205 205 self._first_unsmeared_bin, self._last_unsmeared_bin = \ 206 206 self.smearer.get_bin_range(self.qmin, self.qmax) … … 330 330 if qmin == 0.0: 331 331 self.qmin = 1e-16 332 elif qmin !=None:332 elif qmin is not None: 333 333 self.qmin = qmin 334 if qmax !=None:334 if qmax is not None: 335 335 self.qmax = qmax 336 336 self.radius = np.sqrt(self.qx_data**2 + self.qy_data**2) … … 357 357 return the residuals 358 358 """ 359 if self.smearer !=None:359 if self.smearer is not None: 360 360 fn.set_index(self.idx) 361 361 # Get necessary data from self.data and set the data for smearing -
src/sas/sascalc/pr/num_term.py
rac07a3a r7432acb 67 67 self.alpha_list = [] 68 68 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: 70 70 self.isquit_func() 71 71 best_alpha, message, _ = inver.estimate_alpha(k)
Note: See TracChangeset
for help on using the changeset viewer.