Changeset fa81e94 in sasview for src/sas/sasgui/perspectives/invariant
- 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/invariant
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/perspectives/invariant/__init__.py
- Property mode changed from 100644 to 100755
r5a405bd rfa81e94 3 3 4 4 from distutils.filelist import findall 5 from invariant import *5 from .invariant import * 6 6 7 7 def get_data_path(media): -
src/sas/sasgui/perspectives/invariant/invariant.py
- Property mode changed from 100644 to 100755
r7432acb rfa81e94 133 133 name = data.__class__.__name__ 134 134 msg = "Invariant use only Data1D got: [%s] " % str(name) 135 raise ValueError , msg135 raise ValueError(msg) 136 136 self.compute_helper(data=data) 137 137 … … 169 169 msg += "Please select one.\n" 170 170 if len(data_list) > 1: 171 from invariant_widgets import DataDialog171 from .invariant_widgets import DataDialog 172 172 dlg = DataDialog(data_list=data_1d_list, text=msg) 173 173 if dlg.ShowModal() == wx.ID_OK: … … 191 191 self.compute_helper(data) 192 192 except: 193 msg = "Invariant Set_data: " + str(sys.exc_ value)193 msg = "Invariant Set_data: " + str(sys.exc_info()[1]) 194 194 wx.PostEvent(self.parent, StatusEvent(status=msg, info="error")) 195 195 else: … … 240 240 msg = "invariant.save_file: the data being saved is" 241 241 msg += " not a sas.sascalc.dataloader.data_info.Data1D object" 242 raise RuntimeError , msg242 raise RuntimeError(msg) 243 243 244 244 def set_state(self, state=None, datainfo=None): … … 258 258 msg = "invariant.set_state: datainfo parameter cannot" 259 259 msg += " be None in standalone mode" 260 raise RuntimeError , msg260 raise RuntimeError(msg) 261 261 # Make sure the user sees the invariant panel after loading 262 262 # self.parent.set_perspective(self.perspective) … … 282 282 283 283 except: 284 logger.error("invariant.set_state: %s" % sys.exc_ value)284 logger.error("invariant.set_state: %s" % sys.exc_info()[1]) 285 285 286 286 def on_set_state_helper(self, event=None): … … 320 320 else: 321 321 msg = "Scale can not be zero." 322 raise ValueError , msg322 raise ValueError(msg) 323 323 if len(new_plot.x) == 0: 324 324 return -
src/sas/sasgui/perspectives/invariant/invariant_details.py
- Property mode changed from 100644 to 100755
r959eb01 rfa81e94 6 6 7 7 from sas.sasgui.guiframe.utils import format_number 8 from invariant_widgets import OutputTextCtrl8 from .invariant_widgets import OutputTextCtrl 9 9 # Dimensions related to chart 10 10 RECTANGLE_WIDTH = 400.0 -
src/sas/sasgui/perspectives/invariant/invariant_panel.py
- Property mode changed from 100644 to 100755
r7432acb rfa81e94 318 318 background = self.background_tcl.GetValue().lstrip().rstrip() 319 319 if background == "": 320 raise ValueError , "Need a background"320 raise ValueError("Need a background") 321 321 if check_float(self.background_tcl): 322 322 return float(background) 323 323 else: 324 324 msg = "Receive invalid value for background : %s" % (background) 325 raise ValueError , msg325 raise ValueError(msg) 326 326 327 327 def get_scale(self): … … 331 331 scale = self.scale_tcl.GetValue().lstrip().rstrip() 332 332 if scale == "": 333 raise ValueError , "Need a background"333 raise ValueError("Need a background") 334 334 if check_float(self.scale_tcl): 335 335 if float(scale) <= 0.0: … … 337 337 self.scale_tcl.Refresh() 338 338 msg = "Receive invalid value for scale: %s" % (scale) 339 raise ValueError , msg339 raise ValueError(msg) 340 340 return float(scale) 341 341 else: 342 raise ValueError , "Receive invalid value for scale : %s" % (scale)342 raise ValueError("Receive invalid value for scale : %s" % (scale)) 343 343 344 344 def get_contrast(self): … … 389 389 self.volume_err_tcl.SetValue(format_number(None)) 390 390 msg = "Error occurred computing volume " 391 msg += " fraction: %s" % sys.exc_ value391 msg += " fraction: %s" % sys.exc_info()[1] 392 392 wx.PostEvent(self.parent, StatusEvent(status=msg, 393 393 info="error", … … 409 409 self.surface_err_tcl.SetValue(format_number(None)) 410 410 msg = "Error occurred computing " 411 msg += "specific surface: %s" % sys.exc_ value411 msg += "specific surface: %s" % sys.exc_info()[1] 412 412 wx.PostEvent(self.parent, StatusEvent(status=msg, info="error", 413 413 type="stop")) … … 431 431 self.invariant_total_err_tcl.SetValue(format_number(None)) 432 432 msg = "Error occurred computing invariant using" 433 msg += " extrapolation: %s" % sys.exc_ value433 msg += " extrapolation: %s" % sys.exc_info()[1] 434 434 wx.PostEvent(self.parent, StatusEvent(status=msg, type="stop")) 435 435 … … 454 454 self._manager.plot_theory(name="Low-Q extrapolation") 455 455 msg = "Error occurred computing low-Q " 456 msg += "invariant: %s" % sys.exc_ value456 msg += "invariant: %s" % sys.exc_info()[1] 457 457 wx.PostEvent(self.parent, 458 458 StatusEvent(status=msg, type="stop")) … … 462 462 self._manager.plot_theory(name="Low-Q extrapolation") 463 463 except: 464 logger.error(sys.exc_ value)464 logger.error(sys.exc_info()[1]) 465 465 466 466 def get_high_qstar(self, inv, high_q=False): … … 488 488 self._manager.plot_theory(name="High-Q extrapolation") 489 489 msg = "Error occurred computing high-Q " 490 msg += "invariant: %s" % sys.exc_ value490 msg += "invariant: %s" % sys.exc_info()[1] 491 491 wx.PostEvent(self.parent, StatusEvent(status=msg, 492 492 type="stop")) … … 496 496 self._manager.plot_theory(name="High-Q extrapolation") 497 497 except: 498 logger.error(sys.exc_ value)498 logger.error(sys.exc_info()[1]) 499 499 500 500 def get_qstar(self, inv): … … 625 625 scale = self.get_scale() 626 626 except: 627 msg = "Invariant Error: %s" % (sys.exc_ value)627 msg = "Invariant Error: %s" % (sys.exc_info()[1]) 628 628 wx.PostEvent(self.parent, StatusEvent(status=msg, type="stop")) 629 629 return … … 641 641 inv, npts_high = self.set_extrapolation_high(inv=inv, high_q=high_q) 642 642 except: 643 msg = "Error occurred computing invariant: %s" % sys.exc_ value643 msg = "Error occurred computing invariant: %s" % sys.exc_info()[1] 644 644 wx.PostEvent(self.parent, StatusEvent(status=msg, 645 645 info="warning", type="stop")) … … 652 652 self.get_qstar(inv=inv) 653 653 except: 654 msg = "Error occurred computing invariant: %s" % sys.exc_ value654 msg = "Error occurred computing invariant: %s" % sys.exc_info()[1] 655 655 wx.PostEvent(self.parent, StatusEvent(status=msg, 656 656 info="warning", … … 675 675 except: 676 676 msg = r_msg + "Error occurred computing invariant: %s" % \ 677 sys.exc_ value677 sys.exc_info()[1] 678 678 wx.PostEvent(self.parent, StatusEvent(status=msg, 679 679 info="error", … … 685 685 #compute surface and set value to txtcrtl 686 686 except: 687 msg = "Error occurred computing invariant: %s" % sys.exc_ value687 msg = "Error occurred computing invariant: %s" % sys.exc_info()[1] 688 688 wx.PostEvent(self.parent, StatusEvent(status=msg, 689 689 info="warning", … … 695 695 696 696 except: 697 msg = "Error occurred computing invariant: %s" % sys.exc_ value697 msg = "Error occurred computing invariant: %s" % sys.exc_info()[1] 698 698 wx.PostEvent(self.parent, StatusEvent(status=msg, 699 699 info="warning", … … 847 847 attr.SetValue(value) 848 848 except: 849 logger.error("Invariant state: %s", sys.exc_ value)849 logger.error("Invariant state: %s", sys.exc_info()[1]) 850 850 851 851 def get_bookmark_by_num(self, num=None): … … 864 864 _, _, current_state, comp_state = self.state.bookmark_list[int(num)] 865 865 except: 866 logger.error(sys.exc_ value)867 raise ValueError , "No such bookmark exists"866 logger.error(sys.exc_info()[1]) 867 raise ValueError("No such bookmark exists") 868 868 869 869 # set the parameters … … 959 959 self.state.clone_state() 960 960 except: 961 logger.error(sys.exc_ value)961 logger.error(sys.exc_info()[1]) 962 962 963 963 self._set_undo_flag(True) … … 1003 1003 del self.state.state_list[str(i)] 1004 1004 except: 1005 logger.error(sys.exc_ value)1005 logger.error(sys.exc_info()[1]) 1006 1006 # Enable the undo button if it was not 1007 1007 self._set_undo_flag(True) … … 1068 1068 del self.state.state_list[str(i)] 1069 1069 except: 1070 logger.error(sys.exc_ value)1070 logger.error(sys.exc_info()[1]) 1071 1071 1072 1072 # try to add new state of the text changes in the state_list … … 1083 1083 self.state.state_list[str(self.state.state_num)] = self.state.clone_state() 1084 1084 except: 1085 logger.error(sys.exc_ value)1085 logger.error(sys.exc_info()[1]) 1086 1086 1087 1087 self._set_undo_flag(True) … … 1105 1105 self.state.state_list[str(self.state.state_num)] = self.state.clone_state() 1106 1106 except: 1107 logger.error(sys.exc_ value)1107 logger.error(sys.exc_info()[1]) 1108 1108 1109 1109 def _get_input_list(self): … … 1114 1114 compute_num = self.state.saved_state['compute_num'] 1115 1115 # find values and put into the input list 1116 for key1, value1 in self.state.state_list[str(compute_num)].ite ritems():1117 for key, _ in self.state.input_list.ite ritems():1116 for key1, value1 in self.state.state_list[str(compute_num)].items(): 1117 for key, _ in self.state.input_list.items(): 1118 1118 if key == key1: 1119 1119 self.state.input_list[key] = value1 -
src/sas/sasgui/perspectives/invariant/invariant_state.py
- Property mode changed from 100644 to 100755
r1fa4f736 rfa81e94 137 137 138 138 # text ctl general inputs ( excluding extrapolation text ctl) 139 for key, value in self.input_list.ite ritems():139 for key, value in self.input_list.items(): 140 140 if value == '': 141 141 continue … … 163 163 low_off = False 164 164 high_off = False 165 for key, value in self.input_list.ite ritems():165 for key, value in self.input_list.items(): 166 166 key_split = key.split('_') 167 167 max_ind = len(key_split) - 1 … … 213 213 # other outputs than Q* 214 214 name = item[0] + "_tcl" 215 if name in self.saved_state.keys():215 if name in list(self.saved_state.keys()): 216 216 value = self.saved_state[name] 217 217 … … 298 298 top_element.appendChild(state) 299 299 300 for name, value in self.saved_state.ite ritems():300 for name, value in self.saved_state.items(): 301 301 element = newdoc.createElement(str(name)) 302 302 element.appendChild(newdoc.createTextNode(str(value))) … … 307 307 top_element.appendChild(history) 308 308 309 for name, value in self.state_list.ite ritems():309 for name, value in self.state_list.items(): 310 310 history_element = newdoc.createElement('state_' + str(name)) 311 for state_name, state_value in value.ite ritems():311 for state_name, state_value in value.items(): 312 312 state_element = newdoc.createElement(str(state_name)) 313 313 child = newdoc.createTextNode(str(state_value)) … … 322 322 top_element.appendChild(bookmark) 323 323 item_list = ['time', 'date', 'state', 'comp_state'] 324 for name, value_list in self.bookmark_list.ite ritems():324 for name, value_list in self.bookmark_list.items(): 325 325 element = newdoc.createElement('mark_' + str(name)) 326 326 _, date, state, comp_state = value_list … … 331 331 state_list_element = newdoc.createElement('state') 332 332 comp_state_list_element = newdoc.createElement('comp_state') 333 for state_name, state_value in value_list[2].ite ritems():333 for state_name, state_value in value_list[2].items(): 334 334 state_element = newdoc.createElement(str(state_name)) 335 335 child = newdoc.createTextNode(str(state_value)) 336 336 state_element.appendChild(child) 337 337 state_list_element.appendChild(state_element) 338 for comp_name, comp_value in value_list[3].ite ritems():338 for comp_name, comp_value in value_list[3].items(): 339 339 comp_element = newdoc.createElement(str(comp_name)) 340 340 comp_element.appendChild(newdoc.createTextNode(str(comp_value))) … … 365 365 msg = "InvariantSate no longer supports non-CanSAS" 366 366 msg += " format for invariant files" 367 raise RuntimeError , msg367 raise RuntimeError(msg) 368 368 369 369 if node.get('version')\ … … 382 382 except: 383 383 msg = "InvariantSate.fromXML: Could not read" 384 msg += " timestamp\n %s" % sys.exc_ value384 msg += " timestamp\n %s" % sys.exc_info()[1] 385 385 logger.error(msg) 386 386 … … 454 454 # default string values 455 455 for num in range(1, 19): 456 exec "s_%s = 'NA'" % str(num)456 exec("s_%s = 'NA'" % str(num)) 457 457 lines = strings.split('\n') 458 458 # get all string values from __str__() … … 695 695 except: 696 696 msg = "XML document does not contain invariant" 697 msg += " information.\n %s" % sys.exc_ value697 msg += " information.\n %s" % sys.exc_info()[1] 698 698 logger.info(msg) 699 699 return state … … 737 737 output.append(sas_entry) 738 738 else: 739 raise RuntimeError , "%s is not a file" % path739 raise RuntimeError("%s is not a file" % path) 740 740 741 741 # Return output consistent with the loader's api … … 783 783 msg = "The cansas writer expects a Data1D" 784 784 msg += " instance: %s" % str(datainfo.__class__.__name__) 785 raise RuntimeError , msg785 raise RuntimeError(msg) 786 786 # make sure title and data run is filled up. 787 787 if datainfo.title is None or datainfo.title == '': -
src/sas/sasgui/perspectives/invariant/report_dialog.py
- Property mode changed from 100644 to 100755
r959eb01 rfa81e94 94 94 except: 95 95 # DO not open 96 logger.error("Could not open file: %s" % sys.exc_ value)96 logger.error("Could not open file: %s" % sys.exc_info()[1]) 97 97 # delete image file 98 98 os.remove(pic_fname)
Note: See TracChangeset
for help on using the changeset viewer.