- Timestamp:
- Apr 9, 2017 5:46:10 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:
- ac07a3a
- Parents:
- 5b2b04d
- Location:
- src/sas
- Files:
-
- 59 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sascalc/calculator/kiessig_calculator.py
rb699768 r235f514 49 49 return None 50 50 # check if delta_q is zero 51 if dq == 0.0 or dq ==None:51 if dq == 0.0 or dq is None: 52 52 return None 53 53 else: -
src/sas/sascalc/calculator/sas_gen.py
r9c0f3c17 r235f514 97 97 :Param volume: pixel volume [float] 98 98 """ 99 if self.data_vol ==None:99 if self.data_vol is None: 100 100 raise 101 101 self.data_vol = volume … … 119 119 pos_z = self.data_z 120 120 len_x = len(pos_x) 121 if self.is_avg ==None:121 if self.is_avg is None: 122 122 len_x *= -1 123 123 pos_x, pos_y, pos_z = transform_center(pos_x, pos_y, pos_z) … … 257 257 self.sld_n = np.zeros(length) 258 258 259 if omfdata.mx ==None:259 if omfdata.mx is None: 260 260 self.mx = np.zeros(length) 261 if omfdata.my ==None:261 if omfdata.my is None: 262 262 self.my = np.zeros(length) 263 if omfdata.mz ==None:263 if omfdata.mz is None: 264 264 self.mz = np.zeros(length) 265 265 … … 703 703 :Param data: MagSLD data object 704 704 """ 705 if path ==None:705 if path is None: 706 706 raise ValueError, "Missing the file path." 707 if data ==None:707 if data is None: 708 708 raise ValueError, "Missing the data to save." 709 709 x_val = data.pos_x … … 713 713 length = len(x_val) 714 714 sld_n = data.sld_n 715 if sld_n ==None:715 if sld_n is None: 716 716 sld_n = np.zeros(length) 717 717 sld_mx = data.sld_mx 718 if sld_mx ==None:718 if sld_mx is None: 719 719 sld_mx = np.zeros(length) 720 720 sld_my = np.zeros(length) … … 935 935 :Params pixel: str; pixel or atomic symbol, or array of strings 936 936 """ 937 if self.sld_n ==None:937 if self.sld_n is None: 938 938 return 939 939 if symbol.__class__.__name__ == 'str': … … 947 947 :Params pixel: str; pixel or atomic symbol, or array of strings 948 948 """ 949 if self.sld_n ==None:949 if self.sld_n is None: 950 950 return 951 951 if vol.__class__.__name__ == 'ndarray': -
src/sas/sascalc/data_util/qsmearing.py
r9a5097c r235f514 42 42 # This checks for 2D data (does not throw exception because fail is common) 43 43 if data.__class__.__name__ not in ['Data1D', 'Theory1D']: 44 if data ==None:44 if data is None: 45 45 return None 46 elif data.dqx_data == None or data.dqy_data ==None:46 elif data.dqx_data is None or data.dqy_data is None: 47 47 return None 48 48 return PySmear2D(data) -
src/sas/sascalc/dataloader/data_info.py
r959eb01 r235f514 806 806 # create zero vector 807 807 dy_other = other.dy 808 if other.dy ==None or (len(other.dy) != len(other.y)):808 if other.dy is None or (len(other.dy) != len(other.y)): 809 809 dy_other = np.zeros(len(other.y)) 810 810 811 811 # Check that we have errors, otherwise create zero vector 812 812 dy = self.dy 813 if self.dy ==None or (len(self.dy) != len(self.y)):813 if self.dy is None or (len(self.dy) != len(self.y)): 814 814 dy = np.zeros(len(self.y)) 815 815 … … 822 822 dy, dy_other = self._validity_check(other) 823 823 result = self.clone_without_data(len(self.x)) 824 if self.dxw ==None:824 if self.dxw is None: 825 825 result.dxw = None 826 826 else: 827 827 result.dxw = np.zeros(len(self.x)) 828 if self.dxl ==None:828 if self.dxl is None: 829 829 result.dxl = None 830 830 else: … … 884 884 self._validity_check_union(other) 885 885 result = self.clone_without_data(len(self.x) + len(other.x)) 886 if self.dy ==None or other.dy is None:886 if self.dy is None or other.dy is None: 887 887 result.dy = None 888 888 else: 889 889 result.dy = np.zeros(len(self.x) + len(other.x)) 890 if self.dx ==None or other.dx is None:890 if self.dx is None or other.dx is None: 891 891 result.dx = None 892 892 else: 893 893 result.dx = np.zeros(len(self.x) + len(other.x)) 894 if self.dxw ==None or other.dxw is None:894 if self.dxw is None or other.dxw is None: 895 895 result.dxw = None 896 896 else: 897 897 result.dxw = np.zeros(len(self.x) + len(other.x)) 898 if self.dxl ==None or other.dxl is None:898 if self.dxl is None or other.dxl is None: 899 899 result.dxl = None 900 900 else: … … 1030 1030 # Check that the scales match 1031 1031 err_other = other.err_data 1032 if other.err_data ==None or \1032 if other.err_data is None or \ 1033 1033 (len(other.err_data) != len(other.data)): 1034 1034 err_other = np.zeros(len(other.data)) … … 1036 1036 # Check that we have errors, otherwise create zero vector 1037 1037 err = self.err_data 1038 if self.err_data ==None or \1038 if self.err_data is None or \ 1039 1039 (len(self.err_data) != len(self.data)): 1040 1040 err = np.zeros(len(other.data)) … … 1051 1051 dy, dy_other = self._validity_check(other) 1052 1052 result = self.clone_without_data(np.size(self.data)) 1053 if self.dqx_data == None or self.dqy_data ==None:1053 if self.dqx_data is None or self.dqy_data is None: 1054 1054 result.dqx_data = None 1055 1055 result.dqy_data = None … … 1125 1125 result.ymin = self.ymin 1126 1126 result.ymax = self.ymax 1127 if self.dqx_data == None or self.dqy_data ==None or \1128 other.dqx_data == None or other.dqy_data ==None:1127 if self.dqx_data is None or self.dqy_data is None or \ 1128 other.dqx_data is None or other.dqy_data is None: 1129 1129 result.dqx_data = None 1130 1130 result.dqy_data = None -
src/sas/sascalc/dataloader/manipulations.py
r959eb01 r235f514 210 210 y[i_q] += frac * data[npts] 211 211 212 if err_data ==None or err_data[npts] == 0.0:212 if err_data is None or err_data[npts] == 0.0: 213 213 if data[npts] < 0: 214 214 data[npts] = -data[npts] … … 333 333 continue 334 334 y += frac * data[npts] 335 if err_data ==None or err_data[npts] == 0.0:335 if err_data is None or err_data[npts] == 0.0: 336 336 if data[npts] < 0: 337 337 data[npts] = -data[npts] … … 462 462 463 463 #q_data_max = numpy.max(q_data) 464 if len(data2D.q_data) ==None:464 if len(data2D.q_data) is None: 465 465 msg = "Circular averaging: invalid q_data: %g" % data2D.q_data 466 466 raise RuntimeError, msg … … 502 502 # Take dqs from data to get the q_average 503 503 x[i_q] += frac * q_value 504 if err_data ==None or err_data[npt] == 0.0:504 if err_data is None or err_data[npt] == 0.0: 505 505 if data_n < 0: 506 506 data_n = -data_n … … 623 623 phi_bins[i_phi] += frac * data[npt] 624 624 625 if err_data ==None or err_data[npt] == 0.0:625 if err_data is None or err_data[npt] == 0.0: 626 626 if data_n < 0: 627 627 data_n = -data_n … … 888 888 y[i_bin] += frac * data_n 889 889 x[i_bin] += frac * q_value 890 if err_data[n] ==None or err_data[n] == 0.0:890 if err_data[n] is None or err_data[n] == 0.0: 891 891 if data_n < 0: 892 892 data_n = -data_n -
src/sas/sascalc/dataloader/readers/ascii_reader.py
r959eb01 r235f514 128 128 if new_lentoks > 2: 129 129 _dy = float(toks[2]) 130 has_error_dy = False if _dy ==None else True130 has_error_dy = False if _dy is None else True 131 131 132 132 # If a 4th row is present, consider it dx 133 133 if new_lentoks > 3: 134 134 _dx = float(toks[3]) 135 has_error_dx = False if _dx ==None else True135 has_error_dx = False if _dx is None else True 136 136 137 137 # Delete the previously stored lines of data candidates if -
src/sas/sascalc/dataloader/readers/cansas_reader.py
r63d773c r235f514 807 807 :param data1d: presumably a Data1D object 808 808 """ 809 if self.current_dataset ==None:809 if self.current_dataset is None: 810 810 x_vals = np.empty(0) 811 811 y_vals = np.empty(0) … … 895 895 # Write the file 896 896 file_ref = open(filename, 'w') 897 if self.encoding ==None:897 if self.encoding is None: 898 898 self.encoding = "UTF-8" 899 899 doc.write(file_ref, encoding=self.encoding, … … 1015 1015 :param entry_node: lxml node ElementTree object to be appended to 1016 1016 """ 1017 if datainfo.run ==None or datainfo.run == []:1017 if datainfo.run is None or datainfo.run == []: 1018 1018 datainfo.run.append(RUN_NAME_DEFAULT) 1019 1019 datainfo.run_name[RUN_NAME_DEFAULT] = RUN_NAME_DEFAULT … … 1213 1213 str(datainfo.source.name)) 1214 1214 self.append(source, instr) 1215 if datainfo.source.radiation ==None or datainfo.source.radiation == '':1215 if datainfo.source.radiation is None or datainfo.source.radiation == '': 1216 1216 datainfo.source.radiation = "neutron" 1217 1217 self.write_node(source, "radiation", datainfo.source.radiation) … … 1254 1254 :param instr: lxml node ElementTree object to be appended to 1255 1255 """ 1256 if datainfo.collimation == [] or datainfo.collimation ==None:1256 if datainfo.collimation == [] or datainfo.collimation is None: 1257 1257 coll = Collimation() 1258 1258 datainfo.collimation.append(coll) … … 1299 1299 :param inst: lxml instrument node to be appended to 1300 1300 """ 1301 if datainfo.detector ==None or datainfo.detector == []:1301 if datainfo.detector is None or datainfo.detector == []: 1302 1302 det = Detector() 1303 1303 det.name = "" -
src/sas/sascalc/dataloader/readers/danse_reader.py
r959eb01 r235f514 166 166 167 167 x_vals.append(qx) 168 if xmin ==None or qx < xmin:168 if xmin is None or qx < xmin: 169 169 xmin = qx 170 if xmax ==None or qx > xmax:170 if xmax is None or qx > xmax: 171 171 xmax = qx 172 172 … … 181 181 182 182 y_vals.append(qy) 183 if ymin ==None or qy < ymin:183 if ymin is None or qy < ymin: 184 184 ymin = qy 185 if ymax ==None or qy > ymax:185 if ymax is None or qy > ymax: 186 186 ymax = qy 187 187 -
src/sas/sascalc/dataloader/readers/xml_reader.py
r463e7ffc r235f514 240 240 :param name: The name of the element to be created 241 241 """ 242 if attrib ==None:242 if attrib is None: 243 243 attrib = {} 244 244 return etree.Element(name, attrib, nsmap) … … 299 299 """ 300 300 text = str(text) 301 if attrib ==None:301 if attrib is None: 302 302 attrib = {} 303 303 elem = E(elementname, attrib, text) -
src/sas/sascalc/file_converter/cansas_writer.py
r0b1a677 r235f514 17 17 # Write the file 18 18 file_ref = open(filename, 'w') 19 if self.encoding ==None:19 if self.encoding is None: 20 20 self.encoding = "UTF-8" 21 21 doc.write(file_ref, encoding=self.encoding, -
src/sas/sascalc/fit/AbstractFitEngine.py
r9a5097c r235f514 294 294 295 295 ## fitting range 296 if qmin ==None:296 if qmin is None: 297 297 self.qmin = 1e-16 298 if qmax ==None:298 if qmax is None: 299 299 self.qmax = math.sqrt(x_max * x_max + y_max * y_max) 300 300 ## 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 == []: 302 302 self.res_err_data = np.ones(len(self.data)) 303 303 else: … … 318 318 Set smearer 319 319 """ 320 if smearer ==None:320 if smearer is None: 321 321 return 322 322 self.smearer = smearer … … 612 612 """ 613 613 """ 614 if self.pvec ==None and self.model is None and self.param_list is None:614 if self.pvec is None and self.model is None and self.param_list is None: 615 615 return "No results" 616 616 -
src/sas/sascalc/fit/Loader.py
r959eb01 r235f514 34 34 def set_values(self): 35 35 """ Store the values loaded from file in local variables""" 36 if not self.filename ==None:36 if not self.filename is None: 37 37 input_f = open(self.filename, 'r') 38 38 buff = input_f.read() -
src/sas/sascalc/fit/MultiplicationModel.py
r9a5097c r235f514 180 180 if value != None: 181 181 factor = self.p_model.calculate_VR() 182 if factor ==None or factor == NotImplemented or factor == 0.0:182 if factor is None or factor == NotImplemented or factor == 0.0: 183 183 val = value 184 184 else: -
src/sas/sascalc/pr/fit/AbstractFitEngine.py
r9a5097c r235f514 294 294 295 295 ## fitting range 296 if qmin ==None:296 if qmin is None: 297 297 self.qmin = 1e-16 298 if qmax ==None:298 if qmax is None: 299 299 self.qmax = math.sqrt(x_max * x_max + y_max * y_max) 300 300 ## 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 == []: 302 302 self.res_err_data = np.ones(len(self.data)) 303 303 else: … … 318 318 Set smearer 319 319 """ 320 if smearer ==None:320 if smearer is None: 321 321 return 322 322 self.smearer = smearer … … 615 615 """ 616 616 """ 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: 618 618 return "No results" 619 619 -
src/sas/sascalc/pr/fit/Loader.py
r959eb01 r235f514 34 34 def set_values(self): 35 35 """ Store the values loaded from file in local variables""" 36 if not self.filename ==None:36 if not self.filename is None: 37 37 input_f = open(self.filename, 'r') 38 38 buff = input_f.read() -
src/sas/sascalc/pr/invertor.py
r9c0f3c17 r235f514 162 162 return self.set_dmax(value) 163 163 elif name == 'q_min': 164 if value ==None:164 if value is None: 165 165 return self.set_qmin(-1.0) 166 166 return self.set_qmin(value) 167 167 elif name == 'q_max': 168 if value ==None:168 if value is None: 169 169 return self.set_qmax(-1.0) 170 170 return self.set_qmax(value) … … 395 395 Check q-value against user-defined range 396 396 """ 397 if not self.q_min ==None and q < self.q_min:397 if not self.q_min is None and q < self.q_min: 398 398 return False 399 if not self.q_max ==None and q > self.q_max:399 if not self.q_max is None and q > self.q_max: 400 400 return False 401 401 return True … … 658 658 file.write("#has_bck=0\n") 659 659 file.write("#alpha_estimate=%g\n" % self.suggested_alpha) 660 if not self.out ==None:660 if not self.out is None: 661 661 if len(self.out) == len(self.cov): 662 662 for i in range(len(self.out)): -
src/sas/sascalc/pr/num_term.py
r959eb01 r235f514 159 159 scale = None 160 160 min_err = 0.0 161 if not path ==None:161 if not path is None: 162 162 input_f = open(path, 'r') 163 163 buff = input_f.read() … … 171 171 err = float(toks[2]) 172 172 else: 173 if scale ==None:173 if scale is None: 174 174 scale = 0.05 * math.sqrt(test_y) 175 175 #scale = 0.05/math.sqrt(y) -
src/sas/sascalc/realspace/VolumeCanvas.py
r959eb01 r235f514 293 293 """ 294 294 # If the handle is not provided, create one 295 if id ==None:295 if id is None: 296 296 id = shapeDesc.params["type"]+str(self.shapecount) 297 297 … … 325 325 """ 326 326 # If the handle is not provided, create one 327 if id ==None:327 if id is None: 328 328 id = "shape"+str(self.shapecount) 329 329 … … 663 663 # If this is the first simulation call, we need to generate the 664 664 # space points 665 if self.points ==None:665 if self.points is None: 666 666 self._create_modelObject() 667 667 668 668 # Protect against empty model 669 if self.points ==None:669 if self.points is None: 670 670 return 0 671 671 -
src/sas/sasgui/guiframe/CategoryInstaller.py
r959eb01 r235f514 132 132 133 133 serialized_file = None 134 if homedir ==None:134 if homedir is None: 135 135 serialized_file = CategoryInstaller.get_user_file() 136 136 else: -
src/sas/sasgui/guiframe/dataFitting.py
r959eb01 r235f514 78 78 result.clone_without_data(length=len(self.x), clone=self) 79 79 result.copy_from_datainfo(data1d=self) 80 if self.dxw ==None:80 if self.dxw is None: 81 81 result.dxw = None 82 82 else: 83 83 result.dxw = np.zeros(len(self.x)) 84 if self.dxl ==None:84 if self.dxl is None: 85 85 result.dxl = None 86 86 else: … … 125 125 tot_length = len(self.x) + len(other.x) 126 126 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: 128 128 result.dlam = None 129 129 else: 130 130 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: 132 132 result.dy = None 133 133 else: 134 134 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: 136 136 result.dx = None 137 137 else: 138 138 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: 140 140 result.dxw = None 141 141 else: 142 142 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: 144 144 result.dxl = None 145 145 else: … … 227 227 result = self.clone_without_data(len(self.x)) 228 228 result.copy_from_datainfo(data1d=self) 229 if self.dxw ==None:229 if self.dxw is None: 230 230 result.dxw = None 231 231 else: 232 232 result.dxw = np.zeros(len(self.x)) 233 if self.dxl ==None:233 if self.dxl is None: 234 234 result.dxl = None 235 235 else: … … 279 279 tot_length = len(self.x)+len(other.x) 280 280 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: 282 282 result.dlam = None 283 283 else: 284 284 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: 286 286 result.dy = None 287 287 else: 288 288 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: 290 290 result.dx = None 291 291 else: 292 292 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: 294 294 result.dxw = None 295 295 else: 296 296 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: 298 298 result.dxl = None 299 299 else: … … 405 405 result.ymin = self.ymin 406 406 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: 408 408 result.dqx_data = None 409 409 result.dqy_data = None … … 468 468 result.ymin = self.ymin 469 469 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 : 472 472 result.dqx_data = None 473 473 result.dqy_data = None -
src/sas/sasgui/guiframe/data_processor.py
re645bbb r235f514 315 315 if row > self.max_row_touse: 316 316 self.max_row_touse = row 317 if self.data ==None:317 if self.data is None: 318 318 self.data = {} 319 319 event.Skip() … … 814 814 """ 815 815 816 if self.data ==None:816 if self.data is None: 817 817 self.data = {} 818 if self.file_name ==None:818 if self.file_name is None: 819 819 self.file_name = 'copied_data' 820 820 self.Paste() … … 1017 1017 if index - 1 >= 0: 1018 1018 new_row, _ = temp_list[index - 1] 1019 if not new_row ==None and new_row != ' ':1019 if not new_row is None and new_row != ' ': 1020 1020 label += create_label(col_name, None, 1021 1021 int(new_row) + 1) … … 1025 1025 if index + 1 < len(temp_list): 1026 1026 new_row, _ = temp_list[index + 1] 1027 if not new_row ==None:1027 if not new_row is None: 1028 1028 label += create_label(col_name, 1029 1029 int(new_row) + 1, None) … … 1085 1085 1086 1086 # Let's re-order the data from the keys in 'Data' name. 1087 if outputs ==None:1087 if outputs is None: 1088 1088 return 1089 1089 try: … … 1380 1380 wx.PostEvent(self.parent.parent, StatusEvent(status=msg, info="error")) 1381 1381 return 1382 if dy ==None:1382 if dy is None: 1383 1383 dy = np.zeros(len(y)) 1384 1384 #plotting … … 1441 1441 col = column_names[col_name] 1442 1442 axis = self.get_plot_axis(col, list) 1443 if axis ==None:1443 if axis is None: 1444 1444 return None 1445 1445 sentence = sentence.replace(tok, "numpy.array(%s)" % str(axis)) -
src/sas/sasgui/guiframe/local_perspectives/data_loader/data_loader.py
rc1d5aea r235f514 75 75 path = None 76 76 self._default_save_location = self.parent._default_save_location 77 if self._default_save_location ==None:77 if self._default_save_location is None: 78 78 self._default_save_location = os.getcwd() 79 79 … … 116 116 path = None 117 117 self._default_save_location = self.parent._default_save_location 118 if self._default_save_location ==None:118 if self._default_save_location is None: 119 119 self._default_save_location = os.getcwd() 120 120 dlg = wx.DirDialog(self.parent, "Choose a directory", -
src/sas/sasgui/guiframe/local_perspectives/plotting/AnnulusSlicer.py
rd85c194 r235f514 122 122 data = self.base.data2D 123 123 # If we have no data, just return 124 if data ==None:124 if data is None: 125 125 return 126 126 … … 132 132 # if the user does not specify the numbers of points to plot 133 133 # the default number will be nbins= 36 134 if nbins ==None:134 if nbins is None: 135 135 self.nbins = 36 136 136 else: … … 521 521 522 522 # If we have no data, just return 523 if data ==None:523 if data is None: 524 524 return 525 525 mask = data.mask -
src/sas/sasgui/guiframe/local_perspectives/plotting/Arc.py
r959eb01 r235f514 81 81 npts = int((self.theta2 - self.theta1) / (math.pi / 120)) 82 82 83 if r ==None:83 if r is None: 84 84 self.radius = math.sqrt(math.pow(self._mouse_x, 2) + \ 85 85 math.pow(self._mouse_y, 2)) -
src/sas/sasgui/guiframe/local_perspectives/plotting/Plotter1D.py
r959eb01 r235f514 212 212 On Qmin Qmax vertical line event 213 213 """ 214 if event ==None:214 if event is None: 215 215 return 216 216 event.Skip() 217 217 active_ctrl = event.active 218 if active_ctrl ==None:218 if active_ctrl is None: 219 219 return 220 220 if hasattr(event, 'is_corfunc'): … … 231 231 colors.append('purple') 232 232 values.append(min(x_data.max(), float(ctrl[2].GetValue()))) 233 if self.ly ==None:233 if self.ly is None: 234 234 self.ly = [] 235 235 for c, v in zip(colors, values): … … 336 336 if hasattr(event, "action"): 337 337 dclick = event.action == 'dclick' 338 if ax ==None or dclick:338 if ax is None or dclick: 339 339 # remove the vline 340 340 self._check_zoom_plot() … … 361 361 Move the cursor line to write Q range 362 362 """ 363 if self.q_ctrl ==None:363 if self.q_ctrl is None: 364 364 return 365 365 # release a q range vline … … 370 370 return 371 371 ax = event.inaxes 372 if ax ==None or not hasattr(event, 'action'):372 if ax is None or not hasattr(event, 'action'): 373 373 return 374 374 end_drag = event.action != 'drag' and event.xdata != None … … 618 618 # add menu of other plugins 619 619 item_list = self.parent.get_current_context_menu(self) 620 if (not item_list ==None) and (not len(item_list) == 0):620 if (not item_list is None) and (not len(item_list) == 0): 621 621 for item, wx_id in zip(item_list, [ids.next() for i in range(len(item_list))]): 622 622 … … 811 811 curr_label = self.appearance_selected_plot.label 812 812 813 if curr_color ==None:813 if curr_color is None: 814 814 curr_color = self._color_labels['Blue'] 815 815 curr_symbol = 13 -
src/sas/sasgui/guiframe/local_perspectives/plotting/Plotter2D.py
r959eb01 r235f514 144 144 """ 145 145 # Not implemented 146 if event ==None:146 if event is None: 147 147 return 148 148 event.Skip() … … 227 227 if self._is_changed_legend_label: 228 228 data.label = self.title_label 229 if data.label ==None:229 if data.label is None: 230 230 data.label = data.name 231 231 if not self.title_font: … … 320 320 if len(self.data2D.detector) <= 1: 321 321 item_list = self.parent.get_current_context_menu(self) 322 if (not item_list ==None) and (not len(item_list) == 0) and\322 if (not item_list is None) and (not len(item_list) == 0) and\ 323 323 self.data2D.name.split(" ")[0] != 'Residuals': 324 324 for item, wx_id in zip(item_list, [ids.next() for i in range(len(item_list))]): … … 533 533 """ 534 534 ## Clear current slicer 535 if not self.slicer ==None:535 if not self.slicer is None: 536 536 self.slicer.clear() 537 537 ## Create a new slicer … … 719 719 Clear the slicer on the plot 720 720 """ 721 if not self.slicer ==None:721 if not self.slicer is None: 722 722 self.slicer.clear() 723 723 self.subplot.figure.canvas.draw() -
src/sas/sasgui/guiframe/local_perspectives/plotting/SectorSlicer.py
r959eb01 r235f514 144 144 data = self.base.data2D 145 145 # If we have no data, just return 146 if data ==None:146 if data is None: 147 147 return 148 148 ## Averaging … … 151 151 phimin = -self.left_line.phi + self.main_line.theta 152 152 phimax = self.left_line.phi + self.main_line.theta 153 if nbins ==None:153 if nbins is None: 154 154 nbins = 20 155 155 sect = SectorQ(r_min=0.0, r_max=radius, … … 364 364 if phi != None: 365 365 self.phi = phi 366 if delta ==None:366 if delta is None: 367 367 delta = 0 368 368 if right: -
src/sas/sasgui/guiframe/local_perspectives/plotting/SlicerParameters.py
rd85c194 r235f514 46 46 """ 47 47 event.Skip() 48 if event.obj_class ==None:48 if event.obj_class is None: 49 49 self.set_slicer(None, None) 50 50 else: … … 57 57 self.bck.Clear(True) 58 58 self.type = type 59 if type ==None:59 if type is None: 60 60 label = "Right-click on 2D plot for slicer options" 61 61 title = wx.StaticText(self, -1, label, style=wx.ALIGN_LEFT) -
src/sas/sasgui/guiframe/local_perspectives/plotting/boxSlicer.py
r959eb01 r235f514 139 139 140 140 """ 141 if self.direction ==None:141 if self.direction is None: 142 142 self.direction = direction 143 143 … … 149 149 if nbins != None: 150 150 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: 153 153 msg = "post data:cannot average , averager is empty" 154 154 raise ValueError, msg -
src/sas/sasgui/guiframe/local_perspectives/plotting/detector_dialog.py
r959eb01 r235f514 90 90 zmin = self.reset_zmin_ctl 91 91 zmax = self.reset_zmax_ctl 92 if zmin ==None:92 if zmin is None: 93 93 zmin = "" 94 if zmax ==None:94 if zmax is None: 95 95 zmax = "" 96 96 self.zmin_ctl.SetValue(str(zmin)) -
src/sas/sasgui/guiframe/local_perspectives/plotting/masking.py
r959eb01 r235f514 249 249 Add new mask to old mask 250 250 """ 251 if not self.slicer ==None:251 if not self.slicer is None: 252 252 data = Data2D() 253 253 data = self.data … … 269 269 Erase new mask from old mask 270 270 """ 271 if not self.slicer ==None:271 if not self.slicer is None: 272 272 self.slicer_mask = self.slicer.update() 273 273 mask = self.data.mask … … 307 307 Clear the slicer on the plot 308 308 """ 309 if not self.slicer ==None:309 if not self.slicer is None: 310 310 self.slicer.clear() 311 311 self.subplot.figure.canvas.draw() -
src/sas/sasgui/guiframe/local_perspectives/plotting/plotting.py
r959eb01 r235f514 88 88 On Qmin Qmax vertical line event 89 89 """ 90 if event ==None:90 if event is None: 91 91 return 92 92 if event.id in self.plot_panels.keys(): … … 99 99 100 100 def _on_plot_lim(self, event=None): 101 if event ==None:101 if event is None: 102 102 return 103 103 if event.id in self.plot_panels.keys(): -
src/sas/sasgui/guiframe/local_perspectives/plotting/sector_mask.py
r959eb01 r235f514 117 117 data = self.base.data 118 118 # If we have no data, just return 119 if data ==None:119 if data is None: 120 120 return 121 121 ## Averaging -
src/sas/sasgui/guiframe/local_perspectives/plotting/slicerpanel.py
rd85c194 r235f514 37 37 self.bck = wx.GridBagSizer(5, 5) 38 38 self.SetSizer(self.bck) 39 if type == None and params ==None:39 if type is None and params is None: 40 40 label = "Right-click on 2D plot for slicer options" 41 41 title = wx.StaticText(self, -1, label, style=wx.ALIGN_LEFT) … … 57 57 """ 58 58 event.Skip() 59 if event.obj_class ==None:59 if event.obj_class is None: 60 60 self.set_slicer(None, None) 61 61 else: … … 68 68 self.bck.Clear(True) 69 69 self.type = type 70 if type ==None:70 if type is None: 71 71 label = "Right-click on 2D plot for slicer options" 72 72 title = wx.StaticText(self, -1, label, style=wx.ALIGN_LEFT) -
src/sas/sasgui/guiframe/panel_base.py
r959eb01 r235f514 441 441 """ 442 442 """ 443 if self._manager ==None:443 if self._manager is None: 444 444 return None 445 445 return self._manager.frame -
src/sas/sasgui/guiframe/startup_configuration.py
r959eb01 r235f514 129 129 width, _ = panel.frame.GetSizeTuple() 130 130 if panel.frame.IsShown(): 131 if p_size ==None or width > p_size:131 if p_size is None or width > p_size: 132 132 p_size = width 133 if p_size ==None:133 if p_size is None: 134 134 p_size = CURRENT_STRINGS['PLOPANEL_WIDTH'] 135 135 self.current_string['PLOPANEL_WIDTH'] = p_size … … 145 145 146 146 data_pw, _ = self.parent.panels["data_panel"].frame.GetSizeTuple() 147 if data_pw ==None:147 if data_pw is None: 148 148 data_pw = CURRENT_STRINGS['DATAPANEL_WIDTH'] 149 149 self.current_string['DATAPANEL_WIDTH'] = data_pw -
src/sas/sasgui/perspectives/calculator/calculator.py
r959eb01 r235f514 93 93 Edit meta data 94 94 """ 95 if self.data_edit_frame ==None:95 if self.data_edit_frame is None: 96 96 self.data_edit_frame = DataEditorWindow(parent=self.parent, 97 97 manager=self, data=[], … … 106 106 Data operation 107 107 """ 108 if self.data_operator_frame ==None:108 if self.data_operator_frame is None: 109 109 # Use one frame all the time 110 110 self.data_operator_frame = DataOperatorWindow(parent=self.parent, … … 121 121 Compute the Kiessig thickness 122 122 """ 123 if self.kiessig_frame ==None:123 if self.kiessig_frame is None: 124 124 frame = KiessigWindow(parent=self.parent, manager=self) 125 125 self.put_icon(frame) … … 133 133 Compute the scattering length density of molecula 134 134 """ 135 if self.sld_frame ==None:135 if self.sld_frame is None: 136 136 frame = SldWindow(parent=self.parent, 137 137 base=self.parent, manager=self) … … 146 146 Compute the mass density or molar voulme 147 147 """ 148 if self.cal_md_frame ==None:148 if self.cal_md_frame is None: 149 149 frame = DensityWindow(parent=self.parent, 150 150 base=self.parent, manager=self) … … 159 159 Compute the slit size a given data 160 160 """ 161 if self.cal_slit_frame ==None:161 if self.cal_slit_frame is None: 162 162 frame = SlitLengthCalculatorWindow(parent=self.parent, manager=self) 163 163 self.put_icon(frame) … … 171 171 Estimate the instrumental resolution 172 172 """ 173 if self.cal_res_frame ==None:173 if self.cal_res_frame is None: 174 174 frame = ResolutionWindow(parent=self.parent, manager=self) 175 175 self.put_icon(frame) … … 183 183 On Generic model menu event 184 184 """ 185 if self.gen_frame ==None:185 if self.gen_frame is None: 186 186 frame = SasGenWindow(parent=self.parent, manager=self) 187 187 self.put_icon(frame) … … 214 214 :param filename: file name to open in editor 215 215 """ 216 if self.py_frame ==None:216 if self.py_frame is None: 217 217 frame = PyConsole(parent=self.parent, base=self, 218 218 filename=filename) -
src/sas/sasgui/perspectives/calculator/data_editor.py
r959eb01 r235f514 419 419 """ 420 420 path = None 421 if location ==None:421 if location is None: 422 422 location = os.getcwd() 423 423 -
src/sas/sasgui/perspectives/calculator/data_operator.py
r959eb01 r235f514 198 198 self.send_warnings('') 199 199 msg = '' 200 if name ==None:200 if name is None: 201 201 text = self.data_namectr.GetValue().strip() 202 202 else: … … 205 205 name_list = [] 206 206 for state in state_list: 207 if state.data ==None:207 if state.data is None: 208 208 theory_list = state.get_theory() 209 209 theory, _ = theory_list.values()[0] … … 278 278 pos = item.GetCurrentSelection() 279 279 data = item.GetClientData(pos) 280 if data ==None:280 if data is None: 281 281 content = "?" 282 282 self.put_text_pic(self.data1_pic, content) … … 313 313 content = "?" 314 314 if not (self.numberctr.IsShown() and self.numberctr.IsEnabled()): 315 if data ==None:315 if data is None: 316 316 content = "?" 317 317 self.put_text_pic(self.data2_pic, content) … … 355 355 pos1 = self.data1_cbox.GetCurrentSelection() 356 356 data1 = self.data1_cbox.GetClientData(pos1) 357 if data1 ==None:357 if data1 is None: 358 358 self.output = None 359 359 return flag … … 361 361 data2 = self.data2_cbox.GetClientData(pos2) 362 362 363 if data2 ==None:363 if data2 is None: 364 364 self.output = None 365 365 return flag … … 422 422 """ 423 423 out = self.out_pic 424 if output ==None:424 if output is None: 425 425 content = "?" 426 426 self.put_text_pic(out, content) … … 592 592 name_list = [] 593 593 for state in state_list: 594 if state.data ==None:594 if state.data is None: 595 595 theory_list = state.get_theory() 596 596 theory, _ = theory_list.values()[0] … … 609 609 wx.MessageBox(msg, 'Error') 610 610 return 611 if self.output ==None:611 if self.output is None: 612 612 msg = "No Output Data has been generated... " 613 613 wx.MessageBox(msg, 'Error') -
src/sas/sasgui/perspectives/calculator/density_panel.py
r959eb01 r235f514 239 239 update units and output combobox 240 240 """ 241 if event ==None:241 if event is None: 242 242 return 243 243 event.Skip() … … 257 257 update units and input combobox 258 258 """ 259 if event ==None:259 if event is None: 260 260 return 261 261 event.Skip() -
src/sas/sasgui/perspectives/calculator/gen_scatter_panel.py
r959eb01 r235f514 487 487 path = None 488 488 filename = '' 489 if location ==None:489 if location is None: 490 490 location = os.getcwd() 491 491 … … 864 864 return 865 865 self.sld_data = self.parent.get_sld_from_omf() 866 if self.sld_data ==None:866 if self.sld_data is None: 867 867 if self.parent.parent != None: 868 868 infor = 'Error' … … 880 880 self.model.set_sld_data(self.sld_data) 881 881 self.set_input_params() 882 if self.is_avg or self.is_avg ==None:882 if self.is_avg or self.is_avg is None: 883 883 self._create_default_1d_data() 884 884 i_out = np.zeros(len(self.data.y)) … … 979 979 Update the progress bar 980 980 """ 981 if self.parent.parent ==None:981 if self.parent.parent is None: 982 982 return 983 983 type = "progress" … … 1010 1010 out = np.append(out, outi) 1011 1011 #print time.time() - s 1012 if self.is_avg or self.is_avg ==None:1012 if self.is_avg or self.is_avg is None: 1013 1013 self._draw1D(out) 1014 1014 else: … … 1287 1287 key_low = key.lower() 1288 1288 if key_low.count('mx') > 0: 1289 if sld_sets[key] ==None:1289 if sld_sets[key] is None: 1290 1290 sld_sets[key] = self.sld_data.sld_mx 1291 1291 mx = sld_sets[key] 1292 1292 elif key_low.count('my') > 0: 1293 if sld_sets[key] ==None:1293 if sld_sets[key] is None: 1294 1294 sld_sets[key] = self.sld_data.sld_my 1295 1295 my = sld_sets[key] 1296 1296 elif key_low.count('mz') > 0: 1297 if sld_sets[key] ==None:1297 if sld_sets[key] is None: 1298 1298 sld_sets[key] = self.sld_data.sld_mz 1299 1299 mz = sld_sets[key] … … 1368 1368 """ 1369 1369 1370 if omfdata ==None:1370 if omfdata is None: 1371 1371 self._set_none_text() 1372 1372 return … … 1437 1437 self.slds = [] 1438 1438 omfdata = self.sld_data 1439 if omfdata ==None:1439 if omfdata is None: 1440 1440 raise 1441 1441 sld_key_list = self._get_slds_key_list(omfdata) … … 1477 1477 self.nodes = [] 1478 1478 omfdata = self.sld_data 1479 if omfdata ==None:1479 if omfdata is None: 1480 1480 raise 1481 1481 key_list = self._get_nodes_key_list(omfdata) … … 1512 1512 self.stepsize = [] 1513 1513 omfdata = self.sld_data 1514 if omfdata ==None:1514 if omfdata is None: 1515 1515 raise 1516 1516 key_list = self._get_step_key_list(omfdata) … … 1631 1631 Set sld textctrls 1632 1632 """ 1633 if sld_data ==None:1633 if sld_data is None: 1634 1634 for ctr_list in self.slds: 1635 1635 ctr_list[1].Enable(False) … … 1739 1739 if npts > 0: 1740 1740 nop = self.set_npts_from_slddata() 1741 if nop ==None:1741 if nop is None: 1742 1742 nop = npts 1743 1743 self.display_npts(nop) … … 1911 1911 Set omfdata 1912 1912 """ 1913 if data ==None:1913 if data is None: 1914 1914 return 1915 1915 self.sld_data = data 1916 enable = (not data ==None)1916 enable = (not data is None) 1917 1917 self._set_omfpanel_sld_data(self.sld_data) 1918 1918 self.omfpanel.bt_save.Enable(enable) -
src/sas/sasgui/perspectives/calculator/image_viewer.py
r959eb01 r235f514 85 85 """ 86 86 path = None 87 if location ==None:87 if location is None: 88 88 location = os.getcwd() 89 89 dlg = wx.FileDialog(self.parent, "Image Viewer: Choose a image file", -
src/sas/sasgui/perspectives/calculator/model_editor.py
r959eb01 r235f514 1388 1388 1389 1389 def _get_upper_name(self, name=None): 1390 if name ==None:1390 if name is None: 1391 1391 return "" 1392 1392 upper_name = "" -
src/sas/sasgui/perspectives/calculator/resolution_calculator_panel.py
r959eb01 r235f514 839 839 : Param image: pylab object 840 840 """ 841 if image ==None:841 if image is None: 842 842 return 843 843 if color == 'g': … … 973 973 if len(qx) != len(qy): 974 974 return None 975 if qx == None or qy ==None:975 if qx is None or qy is None: 976 976 return None 977 977 return qx, qy … … 1261 1261 if selection == 'Add new': 1262 1262 path = self._selectDlg() 1263 if path ==None:1263 if path is None: 1264 1264 self.spectrum_cb.SetValue('Flat') 1265 1265 self.resolution.set_spectrum(self.spectrum_dic['Flat']) … … 1301 1301 """ 1302 1302 try: 1303 if path ==None:1303 if path is None: 1304 1304 wx.PostEvent(self.parent.parent, StatusEvent(status=\ 1305 1305 " Selected Distribution was not loaded: %s" % path)) -
src/sas/sasgui/perspectives/calculator/slit_length_calculator_panel.py
rd0248bd r235f514 157 157 path = None 158 158 filename = '' 159 if location ==None:159 if location is None: 160 160 location = os.getcwd() 161 161 -
src/sas/sasgui/perspectives/corfunc/corfunc_state.py
r463e7ffc r235f514 327 327 if datainfo.title is None or datainfo.title == '': 328 328 datainfo.title = datainfo.name 329 if datainfo.run_name ==None or datainfo.run_name == '':329 if datainfo.run_name is None or datainfo.run_name == '': 330 330 datainfo.run = [str(datainfo.name)] 331 331 datainfo.run_name[0] = datainfo.name -
src/sas/sasgui/perspectives/fitting/fitting.py
r9c0f3c17 r235f514 386 386 help for setting list of the edit model menu labels 387 387 """ 388 if menu ==None:388 if menu is None: 389 389 menu = self.edit_custom_model 390 390 list_fnames = os.listdir(models.find_plugins_dir()) … … 1125 1125 page = self.fit_panel.set_data(data) 1126 1126 # page could be None when loading state files 1127 if page ==None:1127 if page is None: 1128 1128 return page 1129 1129 #append Data1D to the panel containing its theory … … 1193 1193 """ 1194 1194 # case that uid is not specified 1195 if uid ==None:1195 if uid is None: 1196 1196 for page_id in self.page_finder.keys(): 1197 1197 self.page_finder[page_id].schedule_tofit(value) … … 1231 1231 """ 1232 1232 panel = self.plot_panel 1233 if panel ==None:1233 if panel is None: 1234 1234 raise ValueError, "Fitting:_onSelect: NonType panel" 1235 1235 Plugin.on_perspective(self, event=event) … … 1335 1335 if not correct_result or res.fitness is None or \ 1336 1336 not np.isfinite(res.fitness) or \ 1337 np.any(res.pvec ==None) or not \1337 np.any(res.pvec is None) or not \ 1338 1338 np.all(np.isfinite(res.pvec)): 1339 1339 data_name = str(None) … … 1526 1526 if res.fitness is None or \ 1527 1527 not np.isfinite(res.fitness) or \ 1528 np.any(res.pvec ==None) or \1528 np.any(res.pvec is None) or \ 1529 1529 not np.all(np.isfinite(res.pvec)): 1530 1530 fit_msg += "\nFitting did not converge!!!" … … 1587 1587 """ 1588 1588 event.Skip() 1589 if self.menu1 ==None:1589 if self.menu1 is None: 1590 1590 return 1591 1591 menu_item = self.menu1.FindItemById(self.id_reset_flag) … … 1646 1646 caption = evt.caption 1647 1647 enable_smearer = evt.enable_smearer 1648 if model ==None:1648 if model is None: 1649 1649 return 1650 1650 if uid not in self.page_finder.keys(): … … 1698 1698 new_plot.title = data.name 1699 1699 new_plot.group_id = data.group_id 1700 if new_plot.group_id ==None:1700 if new_plot.group_id is None: 1701 1701 new_plot.group_id = data.group_id 1702 1702 new_plot.id = data_id … … 2002 2002 chisqr = None 2003 2003 #to compute chisq make sure data has valid data 2004 # return None if data ==None2005 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: 2006 2006 return chisqr 2007 2007 2008 2008 # Get data: data I, theory I, and data dI in order 2009 2009 if data_copy.__class__.__name__ == "Data2D": 2010 if index ==None:2010 if index is None: 2011 2011 index = np.ones(len(data_copy.data), dtype=bool) 2012 2012 if weight != None: … … 2017 2017 fn = data_copy.data[index] 2018 2018 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: 2020 2020 return chisqr 2021 2021 gn = theory_data.data[index] … … 2023 2023 else: 2024 2024 # 1 d theory from model_thread is only in the range of index 2025 if index ==None:2025 if index is None: 2026 2026 index = np.ones(len(data_copy.y), dtype=bool) 2027 2027 if weight != None: 2028 2028 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 == []: 2030 2030 dy = np.ones(len(data_copy.y)) 2031 2031 else: … … 2037 2037 2038 2038 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: 2040 2040 return chisqr 2041 2041 gn = theory_data.y … … 2080 2080 theory_data = self.page_finder[page_id].get_theory_data(fid=data_copy.id) 2081 2081 gn = theory_data.data 2082 if weight ==None:2082 if weight is None: 2083 2083 en = data_copy.err_data 2084 2084 else: … … 2101 2101 else: 2102 2102 # 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 == []: 2104 2104 dy = np.ones(len(data_copy.y)) 2105 2105 else: 2106 if weight ==None:2106 if weight is None: 2107 2107 dy = np.ones(len(data_copy.y)) 2108 2108 ## Set consitently w/AbstractFitengine: … … 2142 2142 ##group_id specify on which panel to plot this data 2143 2143 group_id = self.page_finder[page_id].get_graph_id() 2144 if group_id ==None:2144 if group_id is None: 2145 2145 group_id = data.group_id 2146 2146 new_plot.group_id = "res" + str(group_id) -
src/sas/sasgui/perspectives/fitting/model_thread.py
r9a5097c r235f514 53 53 self.starttime = time.time() 54 54 # Determine appropriate q range 55 if self.qmin ==None:55 if self.qmin is None: 56 56 self.qmin = 0 57 if self.qmax ==None:57 if self.qmax is None: 58 58 if self.data != None: 59 59 newx = math.pow(max(math.fabs(self.data.xmax), -
src/sas/sasgui/perspectives/invariant/invariant_panel.py
r959eb01 r235f514 240 240 """ 241 241 242 if state == None and data ==None:242 if state is None and data is None: 243 243 self.state = IState() 244 elif state == None or data ==None:244 elif state is None or data is None: 245 245 return 246 246 else: … … 604 604 compute invariant 605 605 """ 606 if self._data ==None:606 if self._data is None: 607 607 msg = "\n\nData must be loaded first in order" 608 608 msg += " to perform a compution..." … … 792 792 : param state_num: the given state number 793 793 """ 794 if state_num ==None:794 if state_num is None: 795 795 return 796 796 … … 924 924 :param event: rb/cb event 925 925 """ 926 if event ==None:926 if event is None: 927 927 return 928 928 obj = event.GetEventObject() … … 934 934 935 935 try: 936 if value ==None or value.lstrip().rstrip() == '':936 if value is None or value.lstrip().rstrip() == '': 937 937 value = 'None' 938 938 setattr(self.state, name, str(value)) … … 1013 1013 Used in 'set_current_data()' 1014 1014 """ 1015 #if data ==None: return1015 #if data is None: return 1016 1016 #temp_state = self.state.clone_state() 1017 1017 #copy.deepcopy(self.state.saved_state) … … 1049 1049 1050 1050 """ 1051 if self._data ==None:1051 if self._data is None: 1052 1052 return 1053 1053 # check if this event is from do/undo button … … 1072 1072 # try to add new state of the text changes in the state_list 1073 1073 try: 1074 if value.strip() ==None:1074 if value.strip() is None: 1075 1075 value = '' 1076 1076 setattr(self.state, name, str(value)) … … 1140 1140 the popup menu on bookmark context menu event 1141 1141 """ 1142 if self._data ==None:1142 if self._data is None: 1143 1143 return 1144 if event ==None:1144 if event is None: 1145 1145 return 1146 1146 self.bookmark_num += 1 … … 1206 1206 : event: popUpMenu event 1207 1207 """ 1208 if event ==None:1208 if event is None: 1209 1209 return 1210 1210 # get the object … … 1246 1246 if self.parent != None: 1247 1247 self._default_save_location = self.parent.get_save_location() 1248 if self._default_save_location ==None:1248 if self._default_save_location is None: 1249 1249 self._default_save_location = os.getcwd() 1250 1250 dlg = wx.FileDialog(self, "Choose a file", -
src/sas/sasgui/perspectives/invariant/invariant_state.py
r463e7ffc r235f514 787 787 raise RuntimeError, msg 788 788 # make sure title and data run is filled up. 789 if datainfo.title ==None or datainfo.title == '':789 if datainfo.title is None or datainfo.title == '': 790 790 datainfo.title = datainfo.name 791 if datainfo.run_name ==None or datainfo.run_name == {}:791 if datainfo.run_name is None or datainfo.run_name == {}: 792 792 datainfo.run = [str(datainfo.name)] 793 793 datainfo.run_name[0] = datainfo.name -
src/sas/sasgui/perspectives/pr/inversion_panel.py
rc1d5aea r235f514 920 920 if flag: 921 921 dataset = self.plot_data.GetValue() 922 if dataset ==None or len(dataset.strip()) == 0:922 if dataset is None or len(dataset.strip()) == 0: 923 923 message = "No data to invert. Select a data set before" 924 924 message += " proceeding with P(r) inversion." -
src/sas/sasgui/perspectives/pr/pr.py
r959eb01 r235f514 291 291 """ 292 292 qtemp = pr.x 293 if not q ==None:293 if not q is None: 294 294 qtemp = q 295 295 … … 303 303 304 304 # Check for user min/max 305 if not pr.q_min ==None:305 if not pr.q_min is None: 306 306 minq = pr.q_min 307 if not pr.q_max ==None:307 if not pr.q_max is None: 308 308 maxq = pr.q_max 309 309 … … 393 393 394 394 for i in range(len(x)): 395 if cov2 ==None:395 if cov2 is None: 396 396 value = pr.pr(out, x[i]) 397 397 else: … … 412 412 dy = dy / pmax 413 413 414 if cov2 ==None:414 if cov2 is None: 415 415 new_plot = Data1D(x, y) 416 416 new_plot.symbol = GUIFRAME_ID.CURVE_SYMBOL_NUM … … 487 487 scale = None 488 488 min_err = 0.0 489 if not path ==None:489 if not path is None: 490 490 input_f = open(path, 'r') 491 491 buff = input_f.read() … … 499 499 err = float(toks[2]) 500 500 else: 501 if scale ==None:501 if scale is None: 502 502 scale = 0.05 * math.sqrt(y) 503 503 #scale = 0.05/math.sqrt(y) … … 512 512 logger.error(sys.exc_value) 513 513 514 if not scale ==None:514 if not scale is None: 515 515 message = "The loaded file had no error bars, statistical errors are assumed." 516 516 wx.PostEvent(self.parent, StatusEvent(status=message)) … … 537 537 538 538 data_started = False 539 if not path ==None:539 if not path is None: 540 540 input_f = open(path, 'r') 541 541 buff = input_f.read() … … 550 550 err = float(toks[2]) 551 551 else: 552 if scale ==None:552 if scale is None: 553 553 scale = 0.05 * math.sqrt(y) 554 554 #scale = 0.05/math.sqrt(y) … … 565 565 data_started = True 566 566 567 if not scale ==None:567 if not scale is None: 568 568 message = "The loaded file had no error bars, statistical errors are assumed." 569 569 wx.PostEvent(self.parent, StatusEvent(status=message)) … … 761 761 self.elapsed = elapsed 762 762 self.control_panel.alpha_estimate = alpha 763 if not message ==None:763 if not message is None: 764 764 wx.PostEvent(self.parent, StatusEvent(status=str(message))) 765 765 self.perform_estimateNT() … … 779 779 self.control_panel.nterms_estimate = nterms 780 780 self.control_panel.alpha_estimate = alpha 781 if not message ==None:781 if not message is None: 782 782 wx.PostEvent(self.parent, StatusEvent(status=str(message))) 783 783 … … 858 858 859 859 # Make a plot of I(q) data 860 if self.pr.err ==None:860 if self.pr.err is None: 861 861 new_plot = Data1D(self.pr.x, self.pr.y) 862 862 new_plot.symbol = GUIFRAME_ID.CURVE_SYMBOL_NUM … … 921 921 try: 922 922 pr = self._create_plot_pr() 923 if not pr ==None:923 if not pr is None: 924 924 self.pr = pr 925 925 self.perform_inversion() … … 944 944 try: 945 945 pr = self._create_plot_pr() 946 if not pr ==None:946 if not pr is None: 947 947 self.pr = pr 948 948 self.perform_estimate() … … 983 983 err = self.current_plottable.dy 984 984 all_zeros = True 985 if err ==None:985 if err is None: 986 986 err = np.zeros(len(pr.y)) 987 987 else: … … 995 995 for i in range(len(pr.y)): 996 996 # Scale the error so that we can fit over several decades of Q 997 if scale ==None:997 if scale is None: 998 998 scale = 0.05 * math.sqrt(pr.y[i]) 999 999 min_err = 0.01 * pr.y[i] … … 1024 1024 try: 1025 1025 pr = self._create_file_pr(data) 1026 if not pr ==None:1026 if not pr is None: 1027 1027 self.pr = pr 1028 1028 self.perform_inversion() … … 1090 1090 # If we have not errors, add statistical errors 1091 1091 if y is not None: 1092 if err ==None or np.all(err) == 0:1092 if err is None or np.all(err) == 0: 1093 1093 err = np.zeros(len(y)) 1094 1094 scale = None … … 1096 1096 for i in range(len(y)): 1097 1097 # Scale the error so that we can fit over several decades of Q 1098 if scale ==None:1098 if scale is None: 1099 1099 scale = 0.05 * math.sqrt(y[i]) 1100 1100 min_err = 0.01 * y[i] -
src/sas/sasgui/perspectives/pr/pr_thread.py
r959eb01 r235f514 42 42 pass 43 43 except: 44 if not self.error_func ==None:44 if not self.error_func is None: 45 45 self.error_func("CalcPr.compute: %s" % sys.exc_value) 46 46 … … 70 70 pass 71 71 except: 72 if not self.error_func ==None:72 if not self.error_func is None: 73 73 self.error_func("EstimatePr.compute: %s" % sys.exc_value) 74 74 … … 110 110 pass 111 111 except: 112 if not self.error_func ==None:112 if not self.error_func is None: 113 113 self.error_func("EstimatePr2.compute: %s" % sys.exc_value) -
src/sas/sasgui/plottools/PlotPanel.py
r959eb01 r235f514 418 418 """ 419 419 ax = event.inaxes 420 if ax ==None:420 if ax is None: 421 421 return 422 422 # Event occurred inside a plotting area … … 479 479 self.xFinal, self.yFinal = event.xdata, event.ydata 480 480 # Check whether this is the first point 481 if self.xInit ==None:481 if self.xInit is None: 482 482 self.xInit = self.xFinal 483 483 self.yInit = self.yFinal … … 1367 1367 if dy != None and type(dy) == type(()): 1368 1368 dy = nx.vstack((y - dy[0], dy[1] - y)).transpose() 1369 if dx == None and dy ==None:1369 if dx is None and dy is None: 1370 1370 self.subplot.plot(x, y, color=self._color(color), 1371 1371 marker=self._symbol(symbol), … … 1443 1443 c = self._color(color) 1444 1444 # If we don't have any data, skip. 1445 if self.data ==None:1445 if self.data is None: 1446 1446 return 1447 1447 if self.data.ndim == 1: … … 1519 1519 self.subplot.set_axis_off() 1520 1520 1521 if cbax ==None:1521 if cbax is None: 1522 1522 ax.set_frame_on(False) 1523 1523 cb = self.subplot.figure.colorbar(im, shrink=0.8, aspect=20) … … 1541 1541 """ 1542 1542 # No qx or qy given in a vector format 1543 if self.qx_data == None or self.qy_data ==None \1543 if self.qx_data is None or self.qy_data is None \ 1544 1544 or self.qx_data.ndim != 1 or self.qy_data.ndim != 1: 1545 1545 # do we need deepcopy here? … … 1601 1601 """ 1602 1602 # No qx or qy given in a vector format 1603 if self.qx_data == None or self.qy_data ==None \1603 if self.qx_data is None or self.qy_data is None \ 1604 1604 or self.qx_data.ndim != 1 or self.qy_data.ndim != 1: 1605 1605 # do we need deepcopy here? … … 1652 1652 """ 1653 1653 # No image matrix given 1654 if image ==None or np.ndim(image) != 2 \1654 if image is None or np.ndim(image) != 2 \ 1655 1655 or np.isfinite(image).all() \ 1656 or weights ==None:1656 or weights is None: 1657 1657 return image 1658 1658 # Get bin size in y and x directions … … 1940 1940 """ 1941 1941 """ 1942 if self.parent ==None:1942 if self.parent is None: 1943 1943 return 1944 1944 # get current caption -
src/sas/sasgui/plottools/fitDialog.py
r959eb01 r235f514 95 95 96 96 # Set default value of parameter in the dialog panel 97 if self.Avalue ==None:97 if self.Avalue is None: 98 98 self.tcA.SetValue(format_number(self.default_A)) 99 99 else: 100 100 self.tcA.SetLabel(format_number(self.Avalue)) 101 if self.Bvalue ==None:101 if self.Bvalue is None: 102 102 self.tcB.SetValue(format_number(self.default_B)) 103 103 else: 104 104 self.tcB.SetLabel(format_number(self.Bvalue)) 105 if self.ErrAvalue ==None:105 if self.ErrAvalue is None: 106 106 self.tcErrA.SetLabel(format_number(0.0)) 107 107 else: 108 108 self.tcErrA.SetLabel(format_number(self.ErrAvalue)) 109 if self.ErrBvalue ==None:109 if self.ErrBvalue is None: 110 110 self.tcErrB.SetLabel(format_number(0.0)) 111 111 else: 112 112 self.tcErrB.SetLabel(format_number(self.ErrBvalue)) 113 if self.Chivalue ==None:113 if self.Chivalue is None: 114 114 self.tcChi.SetLabel(format_number(0.0)) 115 115 else: … … 502 502 503 503 # Check that cov and out are iterable before displaying them 504 if cov ==None:504 if cov is None: 505 505 errA = 0.0 506 506 errB = 0.0 … … 508 508 errA = math.sqrt(cov[0][0]) 509 509 errB = math.sqrt(cov[1][1]) 510 if out ==None:510 if out is None: 511 511 cstA = 0.0 512 512 cstB = 0.0 -
src/sas/sasgui/plottools/fittings.py
r959eb01 r235f514 25 25 self.model = model 26 26 self.name = name 27 if not value ==None:27 if not value is None: 28 28 self.model.setParam(self.name, value) 29 29 -
src/sas/sasgui/plottools/plottable_interactor.py
r959eb01 r235f514 50 50 l_width = markersize * 0.4 51 51 return self.step(x=x, y=y, color=color, label=label, width=l_width) 52 if not self.marker ==None:52 if not self.marker is None: 53 53 self.base.connect.clear([self.marker]) 54 54 self.color = self._color(color) … … 61 61 dy = nx.vstack((y - dy[0], dy[1] - y)).transpose() 62 62 63 if dx == None and dy ==None:63 if dx is None and dy is None: 64 64 # zorder = 1 65 65 self.marker = self.axes.plot(x, y, color=self.color, … … 100 100 """ 101 101 """ 102 if not self.marker ==None:102 if not self.marker is None: 103 103 self.base.connect.clear([self.marker]) 104 104 self.color = self._color(color) … … 115 115 """ 116 116 """ 117 if not self.marker ==None:117 if not self.marker is None: 118 118 self.base.connect.clear([self.marker]) 119 119 self.color = self._color(color) … … 133 133 """ 134 134 """ 135 if not self.marker ==None:135 if not self.marker is None: 136 136 self.base.connect.clear([self.marker]) 137 137 self.color = self._color(color) -
src/sas/sasgui/plottools/plottables.py
r9c0f3c17 r235f514 229 229 if p.hidden == True: 230 230 continue 231 if not p.x ==None:231 if not p.x is None: 232 232 for x_i in p.x: 233 if min_value ==None or x_i < min_value:233 if min_value is None or x_i < min_value: 234 234 min_value = x_i 235 if max_value ==None or x_i > max_value:235 if max_value is None or x_i > max_value: 236 236 max_value = x_i 237 237 return min_value, max_value … … 562 562 Returns True if there is no data stored in the plottable 563 563 """ 564 if not self.x ==None and len(self.x) == 0 \565 and not self.y ==None and len(self.y) == 0:564 if not self.x is None and len(self.x) == 0 \ 565 and not self.y is None and len(self.y) == 0: 566 566 return True 567 567 return False … … 679 679 # Sanity check 680 680 # Do the transofrmation only when x and y are empty 681 has_err_x = not (dx ==None or len(dx) == 0)682 has_err_y = not (dy ==None or len(dy) == 0)681 has_err_x = not (dx is None or len(dx) == 0) 682 has_err_y = not (dy is None or len(dy) == 0) 683 683 684 684 if(x != None) and (y != None): 685 if not dx ==None and not len(dx) == 0 and not len(x) == len(dx):685 if not dx is None and not len(dx) == 0 and not len(x) == len(dx): 686 686 msg = "Plottable.View: Given x and dx are not" 687 687 msg += " of the same length" … … 693 693 raise ValueError, msg 694 694 695 if not dy ==None and not len(dy) == 0 and not len(y) == len(dy):695 if not dy is None and not len(dy) == 0 and not len(y) == len(dy): 696 696 msg = "Plottable.View: Given y and dy are not of the same " 697 697 msg += "length: len(y)=%s, len(dy)=%s" % (len(y), len(dy)) … … 797 797 tempy = [] 798 798 tempdy = [] 799 if self.dx ==None:799 if self.dx is None: 800 800 self.dx = np.zeros(len(self.x)) 801 if self.dy ==None:801 if self.dy is None: 802 802 self.dy = np.zeros(len(self.y)) 803 803 if self.xLabel == "log10(x)": … … 827 827 tempy = [] 828 828 tempdy = [] 829 if self.dx ==None:829 if self.dx is None: 830 830 self.dx = np.zeros(len(self.x)) 831 if self.dy ==None:831 if self.dy is None: 832 832 self.dy = np.zeros(len(self.y)) 833 833 if self.yLabel == "log10(y)": … … 860 860 tempy = [] 861 861 tempdy = [] 862 if self.dx ==None:862 if self.dx is None: 863 863 self.dx = np.zeros(len(self.x)) 864 if self.dy ==None:864 if self.dy is None: 865 865 self.dy = np.zeros(len(self.y)) 866 866 if xmin != None and xmax != None: … … 1206 1206 """ 1207 1207 """ 1208 if self._chisq ==None:1208 if self._chisq is None: 1209 1209 chisqTxt = r'$\chi^2=$' 1210 1210 else: -
src/sas/sasgui/plottools/transform.py
r959eb01 r235f514 162 162 163 163 """ 164 if dx ==None:164 if dx is None: 165 165 dx = 0 166 166 return dx … … 175 175 176 176 """ 177 if dx ==None:177 if dx is None: 178 178 dx = 0 179 179 return dx … … 256 256 257 257 """ 258 if dx ==None:258 if dx is None: 259 259 dx = 0 260 260 … … 280 280 281 281 """ 282 if dx ==None:282 if dx is None: 283 283 dx = 0 284 284 … … 294 294 """ 295 295 """ 296 if dx ==None:297 dx = 0 298 if dy ==None:296 if dx is None: 297 dx = 0 298 if dy is None: 299 299 dy = 0 300 300 err = math.sqrt((2 * x * y * dx) ** 2 + ((x ** 2) * dy) ** 2) … … 314 314 raise ValueError, msg 315 315 if x != 0 and y != 0: 316 if dx ==None:316 if dx is None: 317 317 dx = 0 318 if dy ==None:318 if dy is None: 319 319 dy = 0 320 320 err = (dx / x) ** 2 + (dy / y) ** 2 … … 337 337 raise ValueError, msg 338 338 if x > 0 and y > 0: 339 if dx ==None:339 if dx is None: 340 340 dx = 0 341 if dy ==None:341 if dy is None: 342 342 dy = 0 343 343 err = (2.0 * dx / x) ** 2 + (dy / y) ** 2 … … 353 353 """ 354 354 if x != 0: 355 if dx ==None:355 if dx is None: 356 356 dx = 0 357 357 err = dx / x ** 2 … … 367 367 """ 368 368 if x > 0: 369 if dx ==None:369 if dx is None: 370 370 dx = 0 371 371 err = -1 / 2 * math.pow(x, -3.0 / 2.0) * dx … … 388 388 msg += " that are consistent with zero." 389 389 raise ValueError, msg 390 if dx ==None:391 dx = 0 392 if dy ==None:390 if dx is None: 391 dx = 0 392 if dy is None: 393 393 dy = 0 394 394 err = math.sqrt((4.0 * dx / x) ** 2 + (dy / y) ** 2) … … 406 406 # within errors 407 407 408 if dx ==None:409 dx = 0 410 if dy ==None:408 if dx is None: 409 dx = 0 410 if dy is None: 411 411 dy = 0 412 412 err = math.sqrt((dy * pow(x, 4)) ** 2 + (4 * y * dx * math.pow(x, 3)) ** 2)
Note: See TracChangeset
for help on using the changeset viewer.