Changeset 87ac6eb in sasview for src/sas/sasgui/perspectives/fitting
- Timestamp:
- May 15, 2017 10:22:05 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:
- a534432 (diff), edba324 (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/fitting
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/perspectives/fitting/basepage.py
r9c0f3c17 ra1b8fee 2 2 Base Page for fitting 3 3 """ 4 from __future__ import print_function 5 4 6 import sys 5 7 import os … … 657 659 # It seems MAC needs wxCallAfter 658 660 if event.GetId() == GUIFRAME_ID.COPYEX_ID: 659 print "copy excel"661 print("copy excel") 660 662 wx.CallAfter(self.get_copy_excel) 661 663 elif event.GetId() == GUIFRAME_ID.COPYLAT_ID: 662 print "copy latex"664 print("copy latex") 663 665 wx.CallAfter(self.get_copy_latex) 664 666 else: … … 3368 3370 except Exception: 3369 3371 logger.error(traceback.format_exc()) 3370 print 3371 sys.exc_info()[1] 3372 print("Error in BasePage._paste_poly_help: %s" % \ 3373 sys.exc_info()[1]) 3372 3374 3373 3375 def _set_disp_cb(self, isarray, item): … … 3398 3400 Moveit; This method doesn't belong here 3399 3401 """ 3400 print "BasicPage.update_pinhole_smear was called: skipping"3402 print("BasicPage.update_pinhole_smear was called: skipping") 3401 3403 return 3402 3404 … … 3574 3576 # check model type to show sizer 3575 3577 if self.model is not None: 3576 print "_set_model_sizer_selection: disabled."3578 print("_set_model_sizer_selection: disabled.") 3577 3579 # self._set_model_sizer_selection(self.model) 3578 3580 -
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/media/plugin.rst
r984f3fc r72100ee 538 538 sin, cos, tan, asin, acos, atan: 539 539 Trigonometry functions and inverses, operating on radians. 540 sinh, cos , tanh, asinh, acosh, atanh:540 sinh, cosh, tanh, asinh, acosh, atanh: 541 541 Hyperbolic trigonometry functions. 542 542 atan2(y,x): -
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/models.py
r80a49c2 redba324 2 2 Utilities to manage models 3 3 """ 4 from __future__ import print_function 5 4 6 import traceback 5 7 import os … … 141 143 type, value, tb = sys.exc_info() 142 144 if type is not None and issubclass(type, py_compile.PyCompileError): 143 print "Problem with", repr(value)145 print("Problem with", repr(value)) 144 146 raise type, value, tb 145 147 return 1 -
src/sas/sasgui/perspectives/fitting/report_dialog.py
rd85c194 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/fitting/fitting.py
redba324 ra534432 1734 1734 @param unsmeared_error: data error, rescaled to unsmeared model 1735 1735 """ 1736 try: 1737 number_finite = np.count_nonzero(np.isfinite(y)) 1738 if not number_finite: 1739 logger.error("Using the present parameters the model does not return any finite value. ") 1740 wx.PostEvent(self.parent, StatusEvent(status = "Computing Error: %s" % 1741 str("Model did not return any finite value."), info="error")) 1742 return 1743 np.nan_to_num(y) 1744 new_plot = self.create_theory_1D(x, y, page_id, model, data, state, 1745 data_description=model.name, 1746 data_id=str(page_id) + " " + data.name) 1747 if unsmeared_model is not None: 1748 self.create_theory_1D(x, unsmeared_model, page_id, model, data, state, 1749 data_description=model.name + " unsmeared", 1750 data_id=str(page_id) + " " + data.name + " unsmeared") 1751 1752 if unsmeared_data is not None and unsmeared_error is not None: 1753 self.create_theory_1D(x, unsmeared_data, page_id, model, data, state, 1754 data_description="Data unsmeared", 1755 data_id="Data " + data.name + " unsmeared", 1756 dy=unsmeared_error) 1757 # Comment this out until we can get P*S models with correctly populated parameters 1758 #if sq_model is not None and pq_model is not None: 1759 # self.create_theory_1D(x, sq_model, page_id, model, data, state, 1760 # data_description=model.name + " S(q)", 1761 # data_id=str(page_id) + " " + data.name + " S(q)") 1762 # self.create_theory_1D(x, pq_model, page_id, model, data, state, 1763 # data_description=model.name + " P(q)", 1764 # data_id=str(page_id) + " " + data.name + " P(q)") 1765 1766 current_pg = self.fit_panel.get_page_by_id(page_id) 1767 title = new_plot.title 1768 batch_on = self.fit_panel.get_page_by_id(page_id).batch_on 1769 if not batch_on: 1770 wx.PostEvent(self.parent, NewPlotEvent(plot=new_plot, 1771 title=str(title))) 1772 elif plot_result: 1773 top_data_id = self.fit_panel.get_page_by_id(page_id).data.id 1774 if data.id == top_data_id: 1775 wx.PostEvent(self.parent, NewPlotEvent(plot=new_plot, 1776 title=str(title))) 1777 caption = current_pg.window_caption 1778 self.page_finder[page_id].set_fit_tab_caption(caption=caption) 1779 1780 self.page_finder[page_id].set_theory_data(data=new_plot, 1736 1737 number_finite = np.count_nonzero(np.isfinite(y)) 1738 np.nan_to_num(y) 1739 new_plot = self.create_theory_1D(x, y, page_id, model, data, state, 1740 data_description=model.name, 1741 data_id=str(page_id) + " " + data.name) 1742 if unsmeared_model is not None: 1743 self.create_theory_1D(x, unsmeared_model, page_id, model, data, state, 1744 data_description=model.name + " unsmeared", 1745 data_id=str(page_id) + " " + data.name + " unsmeared") 1746 1747 if unsmeared_data is not None and unsmeared_error is not None: 1748 self.create_theory_1D(x, unsmeared_data, page_id, model, data, state, 1749 data_description="Data unsmeared", 1750 data_id="Data " + data.name + " unsmeared", 1751 dy=unsmeared_error) 1752 # Comment this out until we can get P*S models with correctly populated parameters 1753 #if sq_model is not None and pq_model is not None: 1754 # self.create_theory_1D(x, sq_model, page_id, model, data, state, 1755 # data_description=model.name + " S(q)", 1756 # data_id=str(page_id) + " " + data.name + " S(q)") 1757 # self.create_theory_1D(x, pq_model, page_id, model, data, state, 1758 # data_description=model.name + " P(q)", 1759 # data_id=str(page_id) + " " + data.name + " P(q)") 1760 1761 current_pg = self.fit_panel.get_page_by_id(page_id) 1762 title = new_plot.title 1763 batch_on = self.fit_panel.get_page_by_id(page_id).batch_on 1764 if not batch_on: 1765 wx.PostEvent(self.parent, NewPlotEvent(plot=new_plot, title=str(title))) 1766 elif plot_result: 1767 top_data_id = self.fit_panel.get_page_by_id(page_id).data.id 1768 if data.id == top_data_id: 1769 wx.PostEvent(self.parent, NewPlotEvent(plot=new_plot, title=str(title))) 1770 caption = current_pg.window_caption 1771 self.page_finder[page_id].set_fit_tab_caption(caption=caption) 1772 1773 self.page_finder[page_id].set_theory_data(data=new_plot, 1781 1774 fid=data.id) 1782 1783 1784 1775 if toggle_mode_on: 1776 wx.PostEvent(self.parent, 1777 NewPlotEvent(group_id=str(page_id) + " Model2D", 1785 1778 action="Hide")) 1786 1787 1788 1789 1779 else: 1780 if update_chisqr: 1781 wx.PostEvent(current_pg, 1782 Chi2UpdateEvent(output=self._cal_chisqr( 1790 1783 data=data, 1791 1784 fid=fid, 1792 1785 weight=weight, 1793 page_id=page_id, 1794 index=index))) 1795 else: 1796 self._plot_residuals(page_id=page_id, data=data, fid=fid, 1797 index=index, weight=weight) 1798 1799 msg = "Computation completed!" 1786 page_id=page_id, 1787 index=index))) 1788 else: 1789 self._plot_residuals(page_id=page_id, data=data, fid=fid, 1790 index=index, weight=weight) 1791 1792 if not number_finite: 1793 logger.error("Using the present parameters the model does not return any finite value. ") 1794 msg = "Computing Error: Model did not return any finite value." 1795 wx.PostEvent(self.parent, StatusEvent(status = msg, info="error")) 1796 else: 1797 msg = "Computation completed!" 1800 1798 if number_finite != y.size: 1801 1799 msg += ' PROBLEM: For some Q values the model returns non finite intensities!' 1802 1800 logger.error("For some Q values the model returns non finite intensities.") 1803 1804 1801 wx.PostEvent(self.parent, StatusEvent(status=msg, type="stop")) 1805 1806 except:1807 raise1808 1802 1809 1803 def _calc_exception(self, etype, value, tb): … … 1830 1824 that can be plot. 1831 1825 """ 1832 number_finite = np.count_nonzero(np.isfinite(image)) 1833 if not number_finite: 1834 logger.error("Using the present parameters the model does not return any finite value. ") 1835 wx.PostEvent(self.parent, StatusEvent(status = "Computing Error: %s" % 1836 str("Model did not return any finite value."), info="error")) 1837 return 1826 number_finite = np.count_nonzero(np.isfinite(image)) 1838 1827 np.nan_to_num(image) 1839 1828 new_plot = Data2D(image=image, err_image=data.err_data) … … 1894 1883 self._plot_residuals(page_id=page_id, data=data, fid=fid, 1895 1884 index=index, weight=weight) 1896 msg = "Computation completed!" 1897 if number_finite != image.size: 1898 msg += ' PROBLEM: For some Qx,Qy values the model returns non finite intensities!' 1899 logger.error("For some Qx,Qy values the model returns non finite intensities.") 1900 wx.PostEvent(self.parent, StatusEvent(status=msg, type="stop")) 1885 1886 if not number_finite: 1887 logger.error("Using the present parameters the model does not return any finite value. ") 1888 msg = "Computing Error: Model did not return any finite value." 1889 wx.PostEvent(self.parent, StatusEvent(status = msg, info="error")) 1890 else: 1891 msg = "Computation completed!" 1892 if number_finite != image.size: 1893 msg += ' PROBLEM: For some Qx,Qy values the model returns non finite intensities!' 1894 logger.error("For some Qx,Qy values the model returns non finite intensities.") 1895 wx.PostEvent(self.parent, StatusEvent(status=msg, type="stop")) 1901 1896 1902 1897 def _draw_model2D(self, model, page_id, qmin,
Note: See TracChangeset
for help on using the changeset viewer.