Changeset 2d220dd in sasview for src/sas/sasgui/perspectives
- Timestamp:
- Apr 10, 2017 5:14:32 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:
- 7b15990
- Parents:
- fe09e9b (diff), d26f025 (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. - Location:
- src/sas/sasgui/perspectives
- Files:
-
- 26 edited
Legend:
- Unmodified
- Added
- Removed
-
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 r7432acb 182 182 On data name typing 183 183 """ 184 if event !=None:184 if event is not None: 185 185 event.Skip() 186 186 item = event.GetEventObject() … … 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] … … 264 264 self.put_text_pic(self.data2_pic, content=str(val)) 265 265 self.check_data_inputs() 266 if self.output !=None:266 if self.output is not None: 267 267 self.output.name = str(self.data_namectr.GetValue()) 268 268 self.draw_output(self.output) … … 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) … … 284 284 self.data1_pic.add_image(data) 285 285 self.check_data_inputs() 286 if self.output !=None:286 if self.output is not None: 287 287 self.output.name = str(self.data_namectr.GetValue()) 288 288 self.draw_output(self.output) … … 297 297 self.put_text_pic(self.operator_pic, content=text) 298 298 self.check_data_inputs() 299 if self.output !=None:299 if self.output is not None: 300 300 self.output.name = str(self.data_namectr.GetValue()) 301 301 self.draw_output(self.output) … … 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) … … 329 329 data = None 330 330 item.SetClientData(pos, data) 331 if data !=None:331 if data is not None: 332 332 self.check_data_inputs() 333 333 334 334 self.put_text_pic(self.data2_pic, content) 335 335 336 if self.output !=None:336 if self.output is not None: 337 337 self.output.name = str(self.data_namectr.GetValue()) 338 338 self.draw_output(self.output) … … 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) … … 472 472 On Focus at this window 473 473 """ 474 if event !=None:474 if event is not None: 475 475 event.Skip() 476 476 self._data = self.get_datalist() … … 534 534 ids = self._data.keys() 535 535 for id in ids: 536 if id !=None:537 if self._data[id].data !=None:536 if id is not None: 537 if self._data[id].data is not None: 538 538 dnames.append(self._data[id].data.name) 539 539 else: … … 546 546 for datastate in val_list: 547 547 data = datastate.data 548 if data !=None:548 if data is not None: 549 549 name = data.name 550 550 pos1 = self.data1_cbox.Append(str(name)) … … 577 577 """ 578 578 data_manager = self.parent.parent.get_data_manager() 579 if data_manager !=None:579 if data_manager is not None: 580 580 return data_manager.get_all_data() 581 581 else: … … 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') … … 983 983 On close event 984 984 """ 985 if self.manager !=None:985 if self.manager is not None: 986 986 self.manager.data_operator_frame = None 987 987 self.panel.disconnect_panels() -
src/sas/sasgui/perspectives/calculator/density_panel.py
r959eb01 r7432acb 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() … … 438 438 On close event 439 439 """ 440 if self.manager !=None:440 if self.manager is not None: 441 441 self.manager.cal_md_frame = None 442 442 self.Destroy() -
src/sas/sasgui/perspectives/calculator/gen_scatter_panel.py
r959eb01 r7432acb 61 61 Add icon in the frame 62 62 """ 63 if parent !=None:63 if parent is not None: 64 64 if hasattr(frame, "IsIconized"): 65 65 if not frame.IsIconized(): … … 74 74 Set_error dialog 75 75 """ 76 if item !=None:76 if item is not None: 77 77 item.SetBackgroundColour("pink") 78 78 item.Refresh() 79 79 if show_msg: 80 80 msg = "Error: wrong (or out of range) value entered." 81 if panel.parent.parent !=None:81 if panel.parent.parent is not None: 82 82 wx.PostEvent(panel.parent.parent, 83 83 StatusEvent(status=msg, info='Error')) … … 425 425 """ 426 426 unit = 'sec' 427 if self.time_text !=None:427 if self.time_text is not None: 428 428 self.time_text.SetForegroundColour('black') 429 429 etime = self.estimate_ctime() … … 487 487 path = None 488 488 filename = '' 489 if location ==None:489 if location is None: 490 490 location = os.getcwd() 491 491 … … 633 633 self.model.set_sld_data(self.sld_data) 634 634 635 self.draw_button.Enable(self.sld_data !=None)635 self.draw_button.Enable(self.sld_data is not None) 636 636 wx.CallAfter(self.parent.set_sld_data, self.sld_data) 637 637 self._update_model_params() … … 855 855 """ 856 856 flag = self.parent.check_omfpanel_inputs() 857 if not flag and self.parent.parent !=None:857 if not flag and self.parent.parent is not None: 858 858 infor = 'Error' 859 859 msg = 'Error: Wrong inputs in the SLD info panel.' … … 864 864 return 865 865 self.sld_data = self.parent.get_sld_from_omf() 866 if self.sld_data ==None:867 if self.parent.parent !=None:866 if self.sld_data is None: 867 if self.parent.parent is not None: 868 868 infor = 'Error' 869 869 msg = 'Error: No data has been selected.' … … 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)) … … 971 971 self.bt_compute.SetLabel(label) 972 972 self.bt_compute.SetToolTipString(label) 973 if self.parent.parent !=None:973 if self.parent.parent is not None: 974 974 wx.PostEvent(self.parent.parent, 975 975 StatusEvent(status=msg, type=type)) … … 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" … … 995 995 for ind in range(len(input[0])): 996 996 if self.is_avg: 997 if ind % 1 == 0 and update !=None:997 if ind % 1 == 0 and update is not None: 998 998 update() 999 999 time.sleep(0.1) … … 1002 1002 out = np.append(out, outi) 1003 1003 else: 1004 if ind % 50 == 0 and update !=None:1004 if ind % 50 == 0 and update is not None: 1005 1005 update() 1006 1006 time.sleep(0.001) … … 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: … … 1151 1151 new_plot.label = new_plot.id 1152 1152 #theory_data = deepcopy(new_plot) 1153 if self.parent.parent !=None:1153 if self.parent.parent is not None: 1154 1154 self.parent.parent.update_theory(data_id=new_plot.id, 1155 1155 theory=new_plot, … … 1210 1210 new_plot.label = new_plot.id 1211 1211 #theory_data = deepcopy(new_plot) 1212 if self.parent.parent !=None:1212 if self.parent.parent is not None: 1213 1213 self.parent.parent.update_theory(data_id=data.id, 1214 1214 theory=new_plot, … … 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] 1300 1300 else: 1301 if sld_sets[key] !=None:1301 if sld_sets[key] is not None: 1302 1302 self.sld_data.set_sldn(sld_sets[key]) 1303 1303 self.sld_data.set_sldms(mx, my, mz) … … 1347 1347 infor = 'Error' 1348 1348 #logger.error(msg) 1349 if self.parent.parent !=None:1349 if self.parent.parent is not None: 1350 1350 # inform msg to wx 1351 1351 wx.PostEvent(self.parent.parent, … … 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) … … 1690 1690 data = self.parent.get_sld_data() 1691 1691 fName = os.path.splitext(path)[0] + '.' + extension.split('.')[-1] 1692 if data !=None:1692 if data is not None: 1693 1693 try: 1694 1694 reader.write(fName, data) … … 1699 1699 infor = 'Error' 1700 1700 #logger.error(msg) 1701 if self.parent.parent !=None:1701 if self.parent.parent is not None: 1702 1702 # inform msg to wx 1703 1703 wx.PostEvent(self.parent.parent, … … 1708 1708 msg = "Error occurred while saving. " 1709 1709 infor = 'Error' 1710 if self.parent.parent !=None:1710 if self.parent.parent is not None: 1711 1711 # inform msg to wx 1712 1712 wx.PostEvent(self.parent.parent, … … 1718 1718 """ 1719 1719 flag = True 1720 if event !=None:1720 if event is not None: 1721 1721 event.Skip() 1722 1722 ctl = event.GetEventObject() … … 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) … … 1758 1758 """ 1759 1759 flag = True 1760 if event !=None:1760 if event is not None: 1761 1761 event.Skip() 1762 1762 ctl = event.GetEventObject() … … 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 = (data is not None) 1917 1917 self._set_omfpanel_sld_data(self.sld_data) 1918 1918 self.omfpanel.bt_save.Enable(enable) … … 1974 1974 Send full draw to gui frame 1975 1975 """ 1976 if self.parent !=None:1976 if self.parent is not None: 1977 1977 self.parent.set_schedule_full_draw(panel, func) 1978 1978 … … 2050 2050 Close 2051 2051 """ 2052 if self.base !=None:2052 if self.base is not None: 2053 2053 self.base.gen_frame = None 2054 2054 self.Destroy() -
src/sas/sasgui/perspectives/calculator/image_viewer.py
r959eb01 r7432acb 70 70 plot_frame.SetTitle('Picture -- %s --' % basename) 71 71 plot_frame.Show(True) 72 if parent !=None:72 if parent is not None: 73 73 parent.put_icon(plot_frame) 74 74 except: … … 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", … … 403 403 output.is_data = True 404 404 output = reader2D_converter(output) 405 if self.base !=None:405 if self.base is not None: 406 406 data = self.base.create_gui_data(output, self.title) 407 407 self.base.add_data({data.id:data}) -
src/sas/sasgui/perspectives/calculator/kiessig_calculator_panel.py
r959eb01 r7432acb 190 190 """ 191 191 # skip for another event 192 if event !=None:192 if event is not None: 193 193 event.Skip() 194 194 dq = self.dq_name_tcl.GetValue() … … 237 237 Close event 238 238 """ 239 if self.manager !=None:239 if self.manager is not None: 240 240 self.manager.kiessig_frame = None 241 241 self.Destroy() -
src/sas/sasgui/perspectives/calculator/model_editor.py
r959eb01 r7432acb 387 387 self._msg_box.SetLabel(msg) 388 388 self._msg_box.SetForegroundColour(color) 389 if self.parent.parent !=None:389 if self.parent.parent is not None: 390 390 from sas.sasgui.guiframe.events import StatusEvent 391 391 wx.PostEvent(self.parent.parent, StatusEvent(status=msg, … … 478 478 """ 479 479 # For Mac 480 if event !=None:480 if event is not None: 481 481 event.Skip() 482 482 item = event.GetEventObject() … … 979 979 980 980 # Prepare the messagebox 981 if self.base !=None and not msg:981 if self.base is not None and not msg: 982 982 self.base.update_custom_combo() 983 983 # Passed exception in import test as it will fail for sasmodels.sasview_model class … … 1002 1002 self._msg_box.SetForegroundColour(color) 1003 1003 # Send msg to the top window 1004 if self.base !=None:1004 if self.base is not None: 1005 1005 from sas.sasgui.guiframe.events import StatusEvent 1006 1006 wx.PostEvent(self.base.parent, … … 1190 1190 """ 1191 1191 self.Show(False) 1192 #if self.parent !=None:1192 #if self.parent is not None: 1193 1193 # self.parent.new_model_frame = None 1194 1194 #self.Destroy() … … 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/pyconsole.py
rddbac66 r7432acb 118 118 self.panel = panel 119 119 self._add_menu() 120 if filename !=None:120 if filename is not None: 121 121 dataDir = os.path.dirname(filename) 122 elif self.parent !=None:122 elif self.parent is not None: 123 123 dataDir = self.parent._default_save_location 124 124 else: … … 128 128 129 129 # See if there is a corresponding C file 130 if filename !=None:130 if filename is not None: 131 131 c_filename = os.path.splitext(filename)[0] + ".c" 132 132 if os.path.isfile(c_filename): … … 244 244 245 245 # See if there is a corresponding C file 246 if result.path !=None:246 if result.path is not None: 247 247 c_filename = os.path.splitext(result.path)[0] + ".c" 248 248 if os.path.isfile(c_filename): … … 303 303 304 304 # Update plugin model list in fitpage combobox 305 if success and self._manager != None and self.panel !=None:305 if success and self._manager is not None and self.panel is not None: 306 306 self._manager.set_edit_menu_helper(self.parent) 307 307 wx.CallAfter(self._manager.update_custom_combo) … … 337 337 Close event 338 338 """ 339 if self.base !=None:339 if self.base is not None: 340 340 self.base.py_frame = None 341 341 self.Destroy() -
src/sas/sasgui/perspectives/calculator/resolution_calculator_panel.py
r959eb01 r7432acb 656 656 event.Skip() 657 657 # Clear the plot 658 if self.image !=None:658 if self.image is not None: 659 659 self.image.clf() 660 660 # reset image … … 674 674 """ 675 675 # Skip event for next event 676 if event !=None:676 if event is not None: 677 677 event.Skip() 678 678 msg = "Please Check your input values " … … 708 708 # Validate the wave inputs 709 709 wave_input = self._validate_q_input(wavelength, wavelength_spread) 710 if wave_input !=None:710 if wave_input is not None: 711 711 wavelength, wavelength_spread = wave_input 712 712 … … 757 757 # Validate the q inputs 758 758 q_input = self._validate_q_input(self.qx, self.qy) 759 if q_input !=None:759 if q_input is not None: 760 760 self.qx, self.qy = q_input 761 761 … … 769 769 770 770 # Compute the resolution 771 if self.image !=None:771 if self.image is not None: 772 772 #_pylab_helpers.Gcf.set_active(self.fm) 773 773 _pylab_helpers.Gcf.figs = {} … … 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 … … 982 982 """ 983 983 # skip for another event 984 if event !=None:984 if event is not None: 985 985 event.Skip() 986 986 # init resolution_calculator … … 1148 1148 Set the detector coordinate for sigmas to x-y coordinate 1149 1149 """ 1150 if event !=None:1150 if event is not None: 1151 1151 event.Skip() 1152 1152 # Set the coordinate in Cartesian … … 1160 1160 Set the detector coordinate for sigmas to polar coordinate 1161 1161 """ 1162 if event !=None:1162 if event is not None: 1163 1163 event.Skip() 1164 1164 # Set the coordinate in polar … … 1181 1181 self.compute_button.SetLabel(label) 1182 1182 self.compute_button.SetToolTipString(label) 1183 if self.parent.parent !=None:1183 if self.parent.parent is not None: 1184 1184 wx.PostEvent(self.parent.parent, 1185 1185 StatusEvent(status=msg, type=type)) … … 1196 1196 On source combobox selection 1197 1197 """ 1198 if event !=None:1198 if event is not None: 1199 1199 combo = event.GetEventObject() 1200 1200 event.Skip() … … 1215 1215 On source color combobox selection 1216 1216 """ 1217 if event !=None:1217 if event is not None: 1218 1218 #combo = event.GetEventObject() 1219 1219 event.Skip() … … 1253 1253 On spectrum ComboBox event 1254 1254 """ 1255 if event !=None:1255 if event is not None: 1256 1256 #combo = event.GetEventObject() 1257 1257 event.Skip() … … 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)) … … 1348 1348 """ 1349 1349 _pylab_helpers.Gcf.figs = {} 1350 if self.manager !=None:1350 if self.manager is not None: 1351 1351 self.manager.cal_res_frame = None 1352 1352 self.Destroy() -
src/sas/sasgui/perspectives/calculator/sld_panel.py
rfe09e9b r2d220dd 550 550 On close event 551 551 """ 552 if self.manager !=None:552 if self.manager is not None: 553 553 self.manager.sld_frame = None 554 554 self.Destroy() -
src/sas/sasgui/perspectives/calculator/slit_length_calculator_panel.py
rd0248bd r7432acb 157 157 path = None 158 158 filename = '' 159 if location ==None:159 if location is None: 160 160 location = os.getcwd() 161 161 … … 303 303 Close event 304 304 """ 305 if self.manager !=None:305 if self.manager is not None: 306 306 self.manager.cal_slit_frame = None 307 307 self.Destroy() -
src/sas/sasgui/perspectives/corfunc/corfunc_panel.py
r1dc8ec9 r7432acb 320 320 path = None 321 321 default_save_location = os.getcwd() 322 if self._manager.parent !=None:322 if self._manager.parent is not None: 323 323 default_save_location = self._manager.parent.get_save_location() 324 324 … … 329 329 path = dlg.GetPath() 330 330 default_save_location = os.path.dirname(path) 331 if self._manager.parent !=None:331 if self._manager.parent is not None: 332 332 self._manager.parent._default_save_location = default_save_location 333 333 else: -
src/sas/sasgui/perspectives/corfunc/corfunc_state.py
r463e7ffc r7432acb 293 293 corstate = self._parse_state(entry) 294 294 295 if corstate !=None:295 if corstate is not None: 296 296 sas_entry.meta_data['corstate'] = corstate 297 297 sas_entry.filename = corstate.file … … 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/batchfitpage.py
ree4b3cb r7432acb 200 200 # self.state.formfactorcombobox = self.formfactorbox.GetCurrentSelection() 201 201 # 202 # if self.model !=None:202 # if self.model is not None: 203 203 # self._set_copy_flag(True) 204 204 # self._set_paste_flag(True) 205 # if self.data !=None:205 # if self.data is not None: 206 206 # self._set_bookmark_flag(False) 207 207 # self._keep.Enable(False) … … 225 225 # 226 226 # 227 # if event !=None:227 # if event is not None: 228 228 # ## post state to fit panel 229 229 # new_event = PageInfoEvent(page = self) … … 254 254 # is_modified = False 255 255 # 256 # if self.model != None:256 # if self.model is not None: 257 257 # ##Check the values 258 258 # self._check_value_enter( self.fittable_param) … … 291 291 # else: 292 292 # #self.btFit.Enable(True) 293 # if self._is_2D() and self.data !=None:293 # if self._is_2D() and self.data is not None: 294 294 # self.btEditMask.Enable(True) 295 295 # … … 335 335 # self._set_save_flag(False) 336 336 # else: 337 # if self.model !=None:337 # if self.model is not None: 338 338 # self._set_bookmark_flag(False) 339 339 # self._keep.Enable(False) -
src/sas/sasgui/perspectives/fitting/fitting.py
r9c0f3c17 r7432acb 302 302 Make new model 303 303 """ 304 if self.new_model_frame !=None:304 if self.new_model_frame is not None: 305 305 self.new_model_frame.Show(False) 306 306 self.new_model_frame.Show(True) … … 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()) … … 441 441 wx.PostEvent(self.parent, StatusEvent(status=msg)) 442 442 443 if page !=None:443 if page is not None: 444 444 return set_focus_page(page) 445 445 if caption == "Const & Simul Fit": … … 634 634 state = self.temp_state[self.state_index] 635 635 #panel state should have model selection to set_state 636 if state.formfactorcombobox !=None:636 if state.formfactorcombobox is not None: 637 637 #set state 638 638 data = self.parent.create_gui_data(state.data) … … 1016 1016 return False 1017 1017 ## If a thread is already started, stop it 1018 #if self.calc_fit !=None and self.calc_fit.isrunning():1018 #if self.calc_fitis not None and self.calc_fit.isrunning(): 1019 1019 # self.calc_fit.stop() 1020 1020 msg = "Fitting is in progress..." … … 1106 1106 page = self.fit_panel.add_empty_page() 1107 1107 # add data associated to the page created 1108 if page !=None:1108 if page is not None: 1109 1109 evt = StatusEvent(status="Page Created", info="info") 1110 1110 wx.PostEvent(self.parent, evt) … … 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) … … 1216 1216 for item in param: 1217 1217 ## check if constraint 1218 if item[0] != None and item[1] !=None:1218 if item[0] is not None and item[1] is not None: 1219 1219 listOfConstraint.append((item[0], item[1])) 1220 1220 new_model = model … … 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) … … 1457 1457 cell.value = index 1458 1458 1459 if theory_data !=None:1459 if theory_data is not None: 1460 1460 #Suucessful fit 1461 1461 theory_data.id = wx.NewId() … … 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!!!" … … 1544 1544 #(CallAfter is important to MAC) 1545 1545 try: 1546 #if res !=None:1546 #if res is not None: 1547 1547 wx.CallAfter(cpage.onsetValues, res.fitness, 1548 1548 res.param_list, … … 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 if weight !=None:2012 if weight is not None: 2013 2013 data_copy.err_data = weight 2014 2014 # get rid of zero error points … … 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 if weight !=None:2027 if weight is not 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 r7432acb 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:58 if self.data !=None:57 if self.qmax is None: 58 if self.data is not None: 59 59 newx = math.pow(max(math.fabs(self.data.xmax), 60 60 math.fabs(self.data.xmin)), 2) -
src/sas/sasgui/perspectives/fitting/report_dialog.py
r959eb01 r7432acb 39 39 self.nimages = len(self.report_list[2]) 40 40 41 if self.report_list[2] !=None:41 if self.report_list[2] is not None: 42 42 # put image path in the report string 43 43 if len(self.report_list[2]) == 1: -
src/sas/sasgui/perspectives/invariant/invariant.py
r959eb01 r7432acb 331 331 new_plot.title = self.__data.title 332 332 # Save theory_data in a state 333 if data !=None:333 if data is not None: 334 334 name_head = name.split('-') 335 335 if name_head[0] == 'Low': … … 353 353 354 354 # Save data in a state: but seems to never happen 355 if new_plot !=None:355 if new_plot is not None: 356 356 self.invariant_panel.state.data = copy.deepcopy(new_plot) 357 357 wx.PostEvent(self.parent, NewPlotEvent(plot=new_plot, -
src/sas/sasgui/perspectives/invariant/invariant_panel.py
r959eb01 r7432acb 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..." 609 609 wx.PostEvent(self.parent, StatusEvent(status=msg)) 610 610 # set a state for this computation for saving 611 elif event !=None:611 elif event is not None: 612 612 self._set_compute_state(state='compute') 613 613 self._set_bookmark_flag(True) … … 718 718 self._set_preview_flag(True) 719 719 720 if event !=None:720 if event is not None: 721 721 self._set_preview_flag(True) 722 722 self._set_save_flag(True) … … 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) … … 1022 1022 self.state.saved_state['state_num'] = 0 1023 1023 self.state.saved_state['compute_num'] = 0 1024 if self._data !=None:1024 if self._data is not None: 1025 1025 self.state.saved_state['file'] = str(self._data.name) 1026 1026 else: … … 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 … … 1244 1244 # Ask the user the location of the file to write to. 1245 1245 path = None 1246 if self.parent !=None:1246 if self.parent is not 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", … … 1254 1254 path = dlg.GetPath() 1255 1255 self._default_save_location = os.path.dirname(path) 1256 if self.parent !=None:1256 if self.parent is not None: 1257 1257 self.parent._default_save_location = \ 1258 1258 self._default_save_location … … 1393 1393 Enable and disable the power value editing 1394 1394 """ 1395 if event !=None:1395 if event is not None: 1396 1396 self._set_bookmark_flag(True) 1397 1397 self._set_preview_flag(False) … … 1411 1411 Disable or enable some button if the user enable low q extrapolation 1412 1412 """ 1413 if event !=None:1413 if event is not None: 1414 1414 self._set_bookmark_flag(True) 1415 1415 self._set_preview_flag(False) … … 1438 1438 Enable editing power law section at low q range 1439 1439 """ 1440 if event !=None:1440 if event is not None: 1441 1441 self._set_bookmark_flag(True) 1442 1442 self._set_preview_flag(False) … … 1537 1537 Enable and disable the power value editing 1538 1538 """ 1539 if event !=None:1539 if event is not None: 1540 1540 self._set_bookmark_flag(True) 1541 1541 … … 1554 1554 Disable or enable some button if the user enable high q extrapolation 1555 1555 """ 1556 if event !=None:1556 if event is not None: 1557 1557 self._set_bookmark_flag(True) 1558 1558 self._set_preview_flag(False) -
src/sas/sasgui/perspectives/invariant/invariant_state.py
r463e7ffc r7432acb 281 281 # File name 282 282 element = newdoc.createElement("filename") 283 if self.file !=None and self.file != '':283 if self.file is not None and self.file != '': 284 284 element.appendChild(newdoc.createTextNode(str(self.file))) 285 285 else: … … 734 734 # invstate could be None when .svs file is loaded 735 735 # in this case, skip appending to output 736 if invstate !=None:736 if invstate is not None: 737 737 sas_entry.meta_data['invstate'] = invstate 738 738 sas_entry.filename = invstate.file … … 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 r7432acb 271 271 # Ask the user the location of the file to write to. 272 272 path = None 273 if self.parent !=None:273 if self.parent is not None: 274 274 self._default_save_location = self.parent._default_save_location 275 275 dlg = wx.FileDialog(self, "Choose a file", … … 279 279 path = dlg.GetPath() 280 280 self._default_save_location = os.path.dirname(path) 281 if self.parent !=None:281 if self.parent is not None: 282 282 self.parent._default_save_location = self._default_save_location 283 283 else: … … 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/inversion_state.py
r959eb01 r7432acb 473 473 #prstate could be None when .svs file is loaded 474 474 #in this case, skip appending to output 475 if prstate !=None:475 if prstate is not None: 476 476 sas_entry.meta_data['prstate'] = prstate 477 477 sas_entry.filename = prstate.file -
src/sas/sasgui/perspectives/pr/pr.py
r959eb01 r7432acb 291 291 """ 292 292 qtemp = pr.x 293 if not q ==None:293 if q is not 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 pr.q_min is not None: 306 306 minq = pr.q_min 307 if not pr.q_max ==None:307 if pr.q_max is not 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 path is not 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 scale is not 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 path is not 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 scale is not None: 568 568 message = "The loaded file had no error bars, statistical errors are assumed." 569 569 wx.PostEvent(self.parent, StatusEvent(status=message)) … … 721 721 722 722 # If a thread is already started, stop it 723 if self.calc_thread !=None and self.calc_thread.isrunning():723 if self.calc_thread is not None and self.calc_thread.isrunning(): 724 724 self.calc_thread.stop() 725 725 ## stop just raises the flag -- the thread is supposed to … … 761 761 self.elapsed = elapsed 762 762 self.control_panel.alpha_estimate = alpha 763 if not message ==None:763 if message is not 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 message is not 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 pr is not 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 pr is not 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 pr is not 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] … … 1129 1129 1130 1130 # If a thread is already started, stop it 1131 if self.estimation_thread !=None and \1131 if self.estimation_thread is not None and \ 1132 1132 self.estimation_thread.isrunning(): 1133 1133 self.estimation_thread.stop() … … 1159 1159 1160 1160 # If a thread is already started, stop it 1161 if self.estimation_thread !=None and self.estimation_thread.isrunning():1161 if self.estimation_thread is not None and self.estimation_thread.isrunning(): 1162 1162 self.estimation_thread.stop() 1163 1163 ## stop just raises the flag -- the thread is supposed to -
src/sas/sasgui/perspectives/pr/pr_thread.py
r959eb01 rac07a3a 42 42 pass 43 43 except: 44 if not self.error_func ==None:44 if self.error_func is not 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 self.error_func is not 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 self.error_func is not None: 113 113 self.error_func("EstimatePr2.compute: %s" % sys.exc_value) -
src/sas/sasgui/perspectives/simulation/simulation.py
r959eb01 r7432acb 213 213 214 214 # If a computation thread is running, stop it 215 if self.calc_thread_1D !=None and self.calc_thread_1D.isrunning():215 if self.calc_thread_1D is not None and self.calc_thread_1D.isrunning(): 216 216 self.calc_thread_1D.stop() 217 217 ## stop just raises the flag -- the thread is supposed to
Note: See TracChangeset
for help on using the changeset viewer.