Changeset fa81e94 in sasview for src/sas/sasgui/perspectives/pr
- Timestamp:
- Nov 15, 2017 4:33:09 AM (7 years ago)
- Branches:
- 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
- Children:
- d4881f6a
- Parents:
- 7c487846
- Location:
- src/sas/sasgui/perspectives/pr
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/perspectives/pr/__init__.py
- Property mode changed from 100644 to 100755
r959eb01 rfa81e94 1 1 PLUGIN_ID = "P(r) plug-in 1.0" 2 from pr import *2 from .pr import * -
src/sas/sasgui/perspectives/pr/explore_dialog.py
- Property mode changed from 100644 to 100755
r959eb01 rfa81e94 35 35 from sas.sasgui.plottools.plottables import Graph 36 36 37 from pr_widgets import PrTextCtrl37 from .pr_widgets import PrTextCtrl 38 38 39 39 # Default number of points on the output plot … … 331 331 selection_msg = wx.StaticText(self, -1, "Select a dependent variable:") 332 332 self.output_box = wx.ComboBox(self, -1, style=wx.CB_READONLY) 333 for item in self.results.outputs.keys():333 for item in list(self.results.outputs.keys()): 334 334 self.output_box.Append(item, "") 335 335 self.output_box.SetStringSelection(DEFAULT_OUTPUT) … … 419 419 # This inversion failed, skip this D_max value 420 420 msg = "ExploreDialog: inversion failed " 421 msg += "for D_max=%s\n%s" % (str(d), sys.exc_ value)421 msg += "for D_max=%s\n%s" % (str(d), sys.exc_info()[1]) 422 422 logger.error(msg) 423 423 -
src/sas/sasgui/perspectives/pr/inversion_panel.py
- Property mode changed from 100644 to 100755
rcb62bd5 rfa81e94 12 12 from sas.sasgui.guiframe.events import StatusEvent 13 13 from sas.sasgui.guiframe.panel_base import PanelBase 14 from inversion_state import InversionState15 from pr_widgets import PrTextCtrl16 from pr_widgets import DataFileTextCtrl17 from pr_widgets import OutputTextCtrl14 from .inversion_state import InversionState 15 from .pr_widgets import PrTextCtrl 16 from .pr_widgets import DataFileTextCtrl 17 from .pr_widgets import OutputTextCtrl 18 18 from sas.sasgui.guiframe.documentation_window import DocumentationWindow 19 19 … … 754 754 except: 755 755 # No estimate or bad estimate, either do nothing 756 logger.error("InversionControl._on_accept_alpha: %s" % sys.exc_ value)756 logger.error("InversionControl._on_accept_alpha: %s" % sys.exc_info()[1]) 757 757 758 758 def _on_accept_nterms(self, evt): … … 770 770 except: 771 771 # No estimate or bad estimate, either do nothing 772 logger.error("InversionControl._on_accept_nterms: %s" % sys.exc_ value)772 logger.error("InversionControl._on_accept_nterms: %s" % sys.exc_info()[1]) 773 773 774 774 def clear_panel(self): … … 901 901 message += "than the number of points" 902 902 wx.PostEvent(self._manager.parent, StatusEvent(status=message)) 903 raise ValueError , message903 raise ValueError(message) 904 904 self.nfunc_ctl.SetBackgroundColour(wx.WHITE) 905 905 self.nfunc_ctl.Refresh() … … 957 957 Invoke the d_max exploration dialog 958 958 """ 959 from explore_dialog import ExploreDialog959 from .explore_dialog import ExploreDialog 960 960 if self._manager._last_pr is not None: 961 961 pr = self._manager._create_plot_pr() … … 1009 1009 self._set_analysis(True) 1010 1010 except: 1011 msg = "InversionControl._change_file: %s" % sys.exc_ value1011 msg = "InversionControl._change_file: %s" % sys.exc_info()[1] 1012 1012 logger.error(msg) 1013 1013 -
src/sas/sasgui/perspectives/pr/inversion_state.py
- Property mode changed from 100644 to 100755
r1fa4f736 rfa81e94 238 238 msg = "InversionState no longer supports non-CanSAS" 239 239 msg += " format for P(r) files" 240 raise RuntimeError , msg240 raise RuntimeError(msg) 241 241 242 242 if node.get('version') and node.get('version') == '1.0': … … 254 254 except: 255 255 msg = "InversionState.fromXML: Could not read " 256 msg += "timestamp\n %s" % sys.exc_ value256 msg += "timestamp\n %s" % sys.exc_info()[1] 257 257 logger.error(msg) 258 258 … … 434 434 except: 435 435 msg = "XML document does not contain P(r) " 436 msg += "information.\n %s" % sys.exc_ value436 msg += "information.\n %s" % sys.exc_info()[1] 437 437 logger.info(msg) 438 438 … … 481 481 output.append(sas_entry) 482 482 else: 483 raise RuntimeError , "%s is not a file" % path483 raise RuntimeError("%s is not a file" % path) 484 484 485 485 # Return output consistent with the loader's api … … 525 525 msg = "The cansas writer expects a Data1D " 526 526 msg += "instance: %s" % str(datainfo.__class__.__name__) 527 raise RuntimeError , msg527 raise RuntimeError(msg) 528 528 529 529 # Create basic XML document -
src/sas/sasgui/perspectives/pr/pr.py
- Property mode changed from 100644 to 100755
rcb62bd5 rfa81e94 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 19 import sys … … 33 33 import sas.sascalc.dataloader 34 34 35 from pr_widgets import load_error35 from .pr_widgets import load_error 36 36 from sas.sasgui.guiframe.plugin_base import PluginBase 37 37 … … 107 107 108 108 # Associate the inversion state reader with .prv files 109 from inversion_state import Reader109 from .inversion_state import Reader 110 110 111 111 # Create a CanSAS/Pr reader … … 151 151 msg = "Pr.set_state: datainfo parameter cannot " 152 152 msg += "be None in standalone mode" 153 raise RuntimeError , msg153 raise RuntimeError(msg) 154 154 155 155 # Ensuring that plots are coordinated correctly … … 185 185 self.control_panel.set_state(state) 186 186 except: 187 logger.error("prview.set_state: %s" % sys.exc_ value)187 logger.error("prview.set_state: %s" % sys.exc_info()[1]) 188 188 189 189 … … 195 195 196 196 """ 197 from inversion_panel import HelpDialog197 from .inversion_panel import HelpDialog 198 198 dialog = HelpDialog(None, -1) 199 199 if dialog.ShowModal() == wx.ID_OK: … … 369 369 Redisplay P(r) with a different number of points 370 370 """ 371 from inversion_panel import PrDistDialog371 from .inversion_panel import PrDistDialog 372 372 dialog = PrDistDialog(None, -1) 373 373 dialog.set_content(self._pr_npts) … … 452 452 # Notify the user if we could not read the file 453 453 if dataread is None: 454 raise RuntimeError , "Invalid data"454 raise RuntimeError("Invalid data") 455 455 456 456 x = None … … 472 472 if dataread is None: 473 473 return x, y, err 474 raise RuntimeError , "This tool can only read 1D data"474 raise RuntimeError("This tool can only read 1D data") 475 475 476 476 self._current_file_data.x = x … … 512 512 data_err = np.append(data_err, err) 513 513 except: 514 logger.error(sys.exc_ value)514 logger.error(sys.exc_info()[1]) 515 515 516 516 if scale is not None: … … 563 563 data_err = np.append(data_err, err) 564 564 except: 565 logger.error(sys.exc_ value)565 logger.error(sys.exc_info()[1]) 566 566 elif line.find("The 6 columns") >= 0: 567 567 data_started = True … … 720 720 Start a calculation thread 721 721 """ 722 from pr_thread import CalcPr722 from .pr_thread import CalcPr 723 723 724 724 # If a thread is already started, stop it … … 850 850 pr = self._create_file_pr(data) 851 851 except: 852 status = "Problem reading data: %s" % sys.exc_ value852 status = "Problem reading data: %s" % sys.exc_info()[1] 853 853 wx.PostEvent(self.parent, StatusEvent(status=status)) 854 raise RuntimeError , status854 raise RuntimeError(status) 855 855 856 856 # If the file contains nothing, just return 857 857 if pr is None: 858 raise RuntimeError , "Loaded data is invalid"858 raise RuntimeError("Loaded data is invalid") 859 859 860 860 self.pr = pr … … 906 906 msg = "pr.save_data: the data being saved is not a" 907 907 msg += " sas.data_info.Data1D object" 908 raise RuntimeError , msg908 raise RuntimeError(msg) 909 909 910 910 def setup_plot_inversion(self, alpha, nfunc, d_max, q_min=None, q_max=None, … … 929 929 self.perform_inversion() 930 930 except: 931 wx.PostEvent(self.parent, StatusEvent(status=sys.exc_ value))931 wx.PostEvent(self.parent, StatusEvent(status=sys.exc_info()[1])) 932 932 933 933 def estimate_plot_inversion(self, alpha, nfunc, d_max, … … 953 953 self.perform_estimate() 954 954 except: 955 wx.PostEvent(self.parent, StatusEvent(status=sys.exc_ value))955 wx.PostEvent(self.parent, StatusEvent(status=sys.exc_info()[1])) 956 956 957 957 def _create_plot_pr(self, estimate=False): … … 1034 1034 self.perform_inversion() 1035 1035 except: 1036 wx.PostEvent(self.parent, StatusEvent(status=sys.exc_ value))1036 wx.PostEvent(self.parent, StatusEvent(status=sys.exc_info()[1])) 1037 1037 1038 1038 def estimate_file_inversion(self, alpha, nfunc, d_max, data, … … 1057 1057 self.perform_estimate() 1058 1058 except: 1059 wx.PostEvent(self.parent, StatusEvent(status=sys.exc_ value))1059 wx.PostEvent(self.parent, StatusEvent(status=sys.exc_info()[1])) 1060 1060 1061 1061 def _create_file_pr(self, data): … … 1086 1086 x, y, err = data.x, data.y, data.dy 1087 1087 except: 1088 load_error(sys.exc_ value)1088 load_error(sys.exc_info()[1]) 1089 1089 return None 1090 1090 … … 1125 1125 return pr 1126 1126 except: 1127 load_error(sys.exc_ value)1127 load_error(sys.exc_info()[1]) 1128 1128 return None 1129 1129 … … 1132 1132 Perform parameter estimation 1133 1133 """ 1134 from pr_thread import EstimatePr1134 from .pr_thread import EstimatePr 1135 1135 1136 1136 # If a thread is already started, stop it … … 1162 1162 Perform parameter estimation 1163 1163 """ 1164 from pr_thread import EstimateNT1164 from .pr_thread import EstimateNT 1165 1165 1166 1166 # If a thread is already started, stop it … … 1239 1239 Create and return a list of panel objects 1240 1240 """ 1241 from inversion_panel import InversionControl1241 from .inversion_panel import InversionControl 1242 1242 1243 1243 self.parent = parent … … 1287 1287 msg += "Please select one.\n" 1288 1288 if len(data_list) > 1: 1289 from pr_widgets import DataDialog1289 from .pr_widgets import DataDialog 1290 1290 dlg = DataDialog(data_list=data_1d_list, text=msg) 1291 1291 if dlg.ShowModal() == wx.ID_OK: … … 1307 1307 self.control_panel._change_file(evt=None, data=data) 1308 1308 except: 1309 msg = "Prview Set_data: " + str(sys.exc_ value)1309 msg = "Prview Set_data: " + str(sys.exc_info()[1]) 1310 1310 wx.PostEvent(self.parent, StatusEvent(status=msg, info="error")) 1311 1311 else: -
src/sas/sasgui/perspectives/pr/pr_thread.py
- Property mode changed from 100644 to 100755
rac07a3a rfa81e94 43 43 except: 44 44 if self.error_func is not None: 45 self.error_func("CalcPr.compute: %s" % sys.exc_ value)45 self.error_func("CalcPr.compute: %s" % sys.exc_info()[1]) 46 46 47 47 class EstimatePr(CalcThread): … … 71 71 except: 72 72 if self.error_func is not None: 73 self.error_func("EstimatePr.compute: %s" % sys.exc_ value)73 self.error_func("EstimatePr.compute: %s" % sys.exc_info()[1]) 74 74 75 75 class EstimateNT(CalcThread): … … 111 111 except: 112 112 if self.error_func is not None: 113 self.error_func("EstimatePr2.compute: %s" % sys.exc_ value)113 self.error_func("EstimatePr2.compute: %s" % sys.exc_info()[1])
Note: See TracChangeset
for help on using the changeset viewer.