Changes in / [edba324:87ac6eb] in sasview
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/perspectives/fitting/fitting.py
ra1b8fee 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.