Changeset 5a8cdbb in sasview for src/sas/sasgui/perspectives
- Timestamp:
- Aug 1, 2017 12:02:35 PM (7 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:
- 511ccb2d
- Parents:
- 248ff73 (diff), bc04647 (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:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/perspectives/calculator/detector_editor.py
r959eb01 ra1b8fee 1 from __future__ import print_function 1 2 2 3 import wx … … 34 35 self.set_values() 35 36 except: 36 print "error", sys.exc_value37 print("error", sys.exc_value) 37 38 38 39 def _define_structure(self): -
src/sas/sasgui/perspectives/calculator/gen_scatter_panel.py
r7432acb ra1b8fee 3 3 This module relies on guiframe manager. 4 4 """ 5 from __future__ import print_function 5 6 6 7 import wx … … 1998 1999 self.panel.set_volume_ctl_val(str(val)) 1999 2000 except: 2000 print "self.panel is not initialized yet"2001 print("self.panel is not initialized yet") 2001 2002 2002 2003 def set_omfpanel_default_shap(self, shape): -
src/sas/sasgui/perspectives/calculator/image_viewer.py
r7432acb ra1b8fee 1 from __future__ import print_function 2 1 3 import os 2 4 import sys … … 78 80 wx.PostEvent(parent, StatusEvent(status=err_msg, info="error")) 79 81 else: 80 print err_msg82 print(err_msg) 81 83 82 84 def choose_data_file(self, location=None): … … 301 303 info="error")) 302 304 else: 303 print err_msg305 print(err_msg) 304 306 return flag 305 307 … … 332 334 info="error")) 333 335 else: 334 print err_msg336 print(err_msg) 335 337 return flag 336 338 … … 361 363 info="error")) 362 364 else: 363 print err_msg365 print(err_msg) 364 366 365 367 self.OnClose(event) -
src/sas/sasgui/perspectives/calculator/model_editor.py
r7432acb ra1b8fee 23 23 #copyright 2009, University of Tennessee 24 24 ################################################################################ 25 from __future__ import print_function 26 25 27 import wx 26 28 import sys … … 871 873 # Put the cursor at appropriate position 872 874 length = len(label) 873 print length875 print(length) 874 876 if label[length-1] == ')': 875 877 length -= 1 -
src/sas/sasgui/perspectives/fitting/basepage.py
r9c0f3c17 r914c49d5 2 2 Base Page for fitting 3 3 """ 4 from __future__ import print_function 5 4 6 import sys 5 7 import os … … 252 254 if not hasattr(self, "model_view"): 253 255 return 254 toggle_mode_on = self.model_view.IsEnabled() 256 toggle_mode_on = self.model_view.IsEnabled() or self.data is None 255 257 if toggle_mode_on: 256 258 if self.enable2D and not check_data_validity(self.data): … … 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/fitting.py
r7432acb ra534432 11 11 #copyright 2009, University of Tennessee 12 12 ################################################################################ 13 from __future__ import print_function 14 13 15 import re 14 16 import sys … … 1253 1255 """ 1254 1256 """ 1255 print "update_fit result", result1257 print("update_fit result", result) 1256 1258 1257 1259 def _batch_fit_complete(self, result, pars, page_id, … … 1732 1734 @param unsmeared_error: data error, rescaled to unsmeared model 1733 1735 """ 1734 try: 1735 np.nan_to_num(y) 1736 new_plot = self.create_theory_1D(x, y, page_id, model, data, state, 1737 data_description=model.name, 1738 data_id=str(page_id) + " " + data.name) 1739 if unsmeared_model is not None: 1740 self.create_theory_1D(x, unsmeared_model, page_id, model, data, state, 1741 data_description=model.name + " unsmeared", 1742 data_id=str(page_id) + " " + data.name + " unsmeared") 1743 1744 if unsmeared_data is not None and unsmeared_error is not None: 1745 self.create_theory_1D(x, unsmeared_data, page_id, model, data, state, 1746 data_description="Data unsmeared", 1747 data_id="Data " + data.name + " unsmeared", 1748 dy=unsmeared_error) 1749 # Comment this out until we can get P*S models with correctly populated parameters 1750 #if sq_model is not None and pq_model is not None: 1751 # self.create_theory_1D(x, sq_model, page_id, model, data, state, 1752 # data_description=model.name + " S(q)", 1753 # data_id=str(page_id) + " " + data.name + " S(q)") 1754 # self.create_theory_1D(x, pq_model, page_id, model, data, state, 1755 # data_description=model.name + " P(q)", 1756 # data_id=str(page_id) + " " + data.name + " P(q)") 1757 1758 current_pg = self.fit_panel.get_page_by_id(page_id) 1759 title = new_plot.title 1760 batch_on = self.fit_panel.get_page_by_id(page_id).batch_on 1761 if not batch_on: 1762 wx.PostEvent(self.parent, NewPlotEvent(plot=new_plot, 1763 title=str(title))) 1764 elif plot_result: 1765 top_data_id = self.fit_panel.get_page_by_id(page_id).data.id 1766 if data.id == top_data_id: 1767 wx.PostEvent(self.parent, NewPlotEvent(plot=new_plot, 1768 title=str(title))) 1769 caption = current_pg.window_caption 1770 self.page_finder[page_id].set_fit_tab_caption(caption=caption) 1771 1772 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, 1773 1774 fid=data.id) 1774 1775 1776 1775 if toggle_mode_on: 1776 wx.PostEvent(self.parent, 1777 NewPlotEvent(group_id=str(page_id) + " Model2D", 1777 1778 action="Hide")) 1778 1779 1780 1781 1779 else: 1780 if update_chisqr: 1781 wx.PostEvent(current_pg, 1782 Chi2UpdateEvent(output=self._cal_chisqr( 1782 1783 data=data, 1783 1784 fid=fid, 1784 1785 weight=weight, 1785 page_id=page_id, 1786 index=index))) 1787 else: 1788 self._plot_residuals(page_id=page_id, data=data, fid=fid, 1789 index=index, weight=weight) 1790 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: 1791 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.") 1792 1801 wx.PostEvent(self.parent, StatusEvent(status=msg, type="stop")) 1793 except:1794 raise1795 1802 1796 1803 def _calc_exception(self, etype, value, tb): … … 1817 1824 that can be plot. 1818 1825 """ 1826 number_finite = np.count_nonzero(np.isfinite(image)) 1819 1827 np.nan_to_num(image) 1820 1828 new_plot = Data2D(image=image, err_image=data.err_data) … … 1875 1883 self._plot_residuals(page_id=page_id, data=data, fid=fid, 1876 1884 index=index, weight=weight) 1877 msg = "Computation completed!" 1878 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")) 1879 1896 1880 1897 def _draw_model2D(self, model, page_id, qmin, … … 2046 2063 res = (fn - gn) / en 2047 2064 except ValueError: 2048 print "Unmatch lengths %s, %s, %s" % (len(fn), len(gn), len(en))2065 print("Unmatch lengths %s, %s, %s" % (len(fn), len(gn), len(en))) 2049 2066 return 2050 2067 -
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/models.py
r463e7ffc r8cec26b 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 … … 154 156 try: 155 157 import compileall 156 compileall.compile_dir(dir=dir, ddir=dir, force= 1,158 compileall.compile_dir(dir=dir, ddir=dir, force=0, 157 159 quiet=report_problem) 158 160 except: … … 161 163 162 164 163 def _find Models(dir):165 def _find_models(): 164 166 """ 165 167 Find custom models 166 168 """ 167 169 # List of plugin objects 168 dir = find_plugins_dir()170 directory = find_plugins_dir() 169 171 # Go through files in plug-in directory 170 if not os.path.isdir(dir ):171 msg = "SasView couldn't locate Model plugin folder %r." % dir 172 if not os.path.isdir(directory): 173 msg = "SasView couldn't locate Model plugin folder %r." % directory 172 174 logger.warning(msg) 173 175 return {} 174 176 175 plugin_log("looking for models in: %s" % str(dir ))176 # compile_file(dir) #always recompile the folder plugin177 logger.info("plugin model dir: %s" % str(dir ))177 plugin_log("looking for models in: %s" % str(directory)) 178 # compile_file(directory) #always recompile the folder plugin 179 logger.info("plugin model dir: %s" % str(directory)) 178 180 179 181 plugins = {} 180 for filename in os.listdir(dir ):182 for filename in os.listdir(directory): 181 183 name, ext = os.path.splitext(filename) 182 184 if ext == '.py' and not name == '__init__': 183 path = os.path.abspath(os.path.join(dir , filename))185 path = os.path.abspath(os.path.join(directory, filename)) 184 186 try: 185 187 model = load_custom_model(path) … … 191 193 plugin_log(msg) 192 194 logger.warning("Failed to load plugin %r. See %s for details" 193 194 195 % (path, PLUGIN_LOG)) 196 195 197 return plugins 196 198 … … 262 264 temp = {} 263 265 if self.is_changed(): 264 return _find Models(dir)266 return _find_models() 265 267 logger.info("plugin model : %s" % str(temp)) 266 268 return temp … … 337 339 """ 338 340 self.plugins = [] 339 new_plugins = _find Models(dir)341 new_plugins = _find_models() 340 342 for name, plug in new_plugins.iteritems(): 341 343 for stored_name, stored_plug in self.stored_plugins.iteritems(): -
src/sas/sasgui/perspectives/pr/pr.py
r7432acb ra1b8fee 15 15 # Make sure the option of saving each curve is available 16 16 # Use the I(q) curve as input and compare the output to P(r) 17 from __future__ import print_function 17 18 18 19 import sys … … 230 231 out, cov = pr.pr_fit() 231 232 for i in range(len(out)): 232 print "%g +- %g" % (out[i], math.sqrt(cov[i][i]))233 print("%g +- %g" % (out[i], math.sqrt(cov[i][i]))) 233 234 234 235 # Show input P(r) … … 318 319 except: 319 320 err[i] = 1.0 320 print "Error getting error", value, x[i]321 print("Error getting error", value, x[i]) 321 322 322 323 new_plot = Data1D(x, y) -
src/sas/sasgui/perspectives/simulation/ShapeParameters.py
rd85c194 ra1b8fee 8 8 copyright 2009, University of Tennessee 9 9 """ 10 from __future__ import print_function 11 10 12 import wx 11 13 import sys … … 312 314 self.parent.GetSizer().Layout() 313 315 except: 314 print "TODO: move the Layout call of editShape up to the caller"316 print("TODO: move the Layout call of editShape up to the caller") 315 317 316 318 def _readCtrlFloat(self, ctrl): … … 392 394 self.current_shape.params[item[0]] = tmp 393 395 except: 394 print "Could not create"395 print sys.exc_value396 print("Could not create") 397 print(sys.exc_value) 396 398 397 399 def _onCreate(self, evt): … … 485 487 indices = self.shape_listbox.GetSelections() 486 488 if len(indices)>0: 487 print "NOT YET IMPLMENTED"488 print "renaming", self.shape_listbox.GetString(indices[0])489 489 print("NOT YET IMPLMENTED") 490 print("renaming", self.shape_listbox.GetString(indices[0])) 491
Note: See TracChangeset
for help on using the changeset viewer.