Changes in src/sas/sasgui/perspectives/fitting/fitting.py [7432acb:82373f5] in sasview
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/perspectives/fitting/fitting.py
r7432acb r82373f5 302 302 Make new model 303 303 """ 304 if self.new_model_frame is notNone:304 if self.new_model_frame != 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 isNone:388 if menu == 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 is notNone:443 if page != 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 is notNone:636 if state.formfactorcombobox != 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 is notNone and self.calc_fit.isrunning():1018 #if self.calc_fit!= 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 is notNone:1108 if page != 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 isNone:1127 if page == 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 isNone:1195 if uid == 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] is not None and item[1] is notNone:1218 if item[0] != None and item[1] != 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 isNone:1233 if panel == 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 isNone) or not \1337 np.any(res.pvec == 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 is notNone:1459 if theory_data != 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 isNone) or \1528 np.any(res.pvec == 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 is notNone:1546 #if res != None: 1547 1547 wx.CallAfter(cpage.onsetValues, res.fitness, 1548 1548 res.param_list, … … 1587 1587 """ 1588 1588 event.Skip() 1589 if self.menu1 isNone:1589 if self.menu1 == 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 isNone:1648 if model == 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 isNone:1700 if new_plot.group_id == None: 1701 1701 new_plot.group_id = data.group_id 1702 1702 new_plot.id = data_id … … 1733 1733 """ 1734 1734 try: 1735 number_finite = np.count_nonzero(np.isfinite(y)) 1736 if not number_finite: 1737 logger.error("Using the present parameters the model does not return any finite value. ") 1738 wx.PostEvent(self.parent, StatusEvent(status = "Computing Error: %s" % 1739 str("Model did not return any finite value."), info="error")) 1740 return 1735 1741 np.nan_to_num(y) 1736 1742 new_plot = self.create_theory_1D(x, y, page_id, model, data, state, … … 1789 1795 index=index, weight=weight) 1790 1796 1791 msg = "Computation completed!" 1797 msg = "Computation completed!" 1798 if number_finite != y.size: 1799 msg += ' PROBLEM: For some Q values the model returns non finite intensities!' 1800 logger.error("For some Q values the model returns non finite intensities.") 1801 1792 1802 wx.PostEvent(self.parent, StatusEvent(status=msg, type="stop")) 1803 1793 1804 except: 1794 1805 raise … … 1817 1828 that can be plot. 1818 1829 """ 1830 number_finite = np.count_nonzero(np.isfinite(image)) 1831 if not number_finite: 1832 logger.error("Using the present parameters the model does not return any finite value. ") 1833 wx.PostEvent(self.parent, StatusEvent(status = "Computing Error: %s" % 1834 str("Model did not return any finite value."), info="error")) 1835 return 1819 1836 np.nan_to_num(image) 1820 1837 new_plot = Data2D(image=image, err_image=data.err_data) … … 1876 1893 index=index, weight=weight) 1877 1894 msg = "Computation completed!" 1895 if number_finite != image.size: 1896 msg += ' PROBLEM: For some Qx,Qy values the model returns non finite intensities!' 1897 logger.error("For some Qx,Qy values the model returns non finite intensities.") 1878 1898 wx.PostEvent(self.parent, StatusEvent(status=msg, type="stop")) 1879 1899 … … 2002 2022 chisqr = None 2003 2023 #to compute chisq make sure data has valid data 2004 # return None if data isNone2005 if not check_data_validity(data_copy) or data_copy isNone:2024 # return None if data == None 2025 if not check_data_validity(data_copy) or data_copy == None: 2006 2026 return chisqr 2007 2027 2008 2028 # Get data: data I, theory I, and data dI in order 2009 2029 if data_copy.__class__.__name__ == "Data2D": 2010 if index isNone:2030 if index == None: 2011 2031 index = np.ones(len(data_copy.data), dtype=bool) 2012 if weight is notNone:2032 if weight != None: 2013 2033 data_copy.err_data = weight 2014 2034 # get rid of zero error points … … 2017 2037 fn = data_copy.data[index] 2018 2038 theory_data = self.page_finder[page_id].get_theory_data(fid=data_copy.id) 2019 if theory_data isNone:2039 if theory_data == None: 2020 2040 return chisqr 2021 2041 gn = theory_data.data[index] … … 2023 2043 else: 2024 2044 # 1 d theory from model_thread is only in the range of index 2025 if index isNone:2045 if index == None: 2026 2046 index = np.ones(len(data_copy.y), dtype=bool) 2027 if weight is notNone:2047 if weight != None: 2028 2048 data_copy.dy = weight 2029 if data_copy.dy isNone or data_copy.dy == []:2049 if data_copy.dy == None or data_copy.dy == []: 2030 2050 dy = np.ones(len(data_copy.y)) 2031 2051 else: … … 2037 2057 2038 2058 theory_data = self.page_finder[page_id].get_theory_data(fid=data_copy.id) 2039 if theory_data isNone:2059 if theory_data == None: 2040 2060 return chisqr 2041 2061 gn = theory_data.y … … 2080 2100 theory_data = self.page_finder[page_id].get_theory_data(fid=data_copy.id) 2081 2101 gn = theory_data.data 2082 if weight isNone:2102 if weight == None: 2083 2103 en = data_copy.err_data 2084 2104 else: … … 2101 2121 else: 2102 2122 # 1 d theory from model_thread is only in the range of index 2103 if data_copy.dy isNone or data_copy.dy == []:2123 if data_copy.dy == None or data_copy.dy == []: 2104 2124 dy = np.ones(len(data_copy.y)) 2105 2125 else: 2106 if weight isNone:2126 if weight == None: 2107 2127 dy = np.ones(len(data_copy.y)) 2108 2128 ## Set consitently w/AbstractFitengine: … … 2142 2162 ##group_id specify on which panel to plot this data 2143 2163 group_id = self.page_finder[page_id].get_graph_id() 2144 if group_id isNone:2164 if group_id == None: 2145 2165 group_id = data.group_id 2146 2166 new_plot.group_id = "res" + str(group_id)
Note: See TracChangeset
for help on using the changeset viewer.