Changeset fa81e94 in sasview for src/sas/sasgui/perspectives/pr/pr.py
- 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
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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:
Note: See TracChangeset
for help on using the changeset viewer.