Changeset fa81e94 in sasview for src/sas/sasgui/perspectives
- Timestamp:
- Nov 15, 2017 2: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
- Files:
-
- 41 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/perspectives/calculator/__init__.py
- Property mode changed from 100644 to 100755
r5a405bd rfa81e94 2 2 import os 3 3 from distutils.filelist import findall 4 from calculator import *4 from .calculator import * 5 5 N_DIR = 12 6 6 def get_data_path(media): -
src/sas/sasgui/perspectives/calculator/collimation_editor.py
- Property mode changed from 100644 to 100755
r959eb01 rfa81e94 6 6 from sas.sascalc.dataloader.loader import Loader 7 7 from sas.sascalc.dataloader.data_info import Aperture, Collimation 8 from aperture_editor import ApertureDialog8 from .aperture_editor import ApertureDialog 9 9 10 10 from sas.sasgui.guiframe.utils import check_float -
src/sas/sasgui/perspectives/calculator/data_editor.py
- Property mode changed from 100644 to 100755
r235f514 rfa81e94 7 7 from sas.sascalc.dataloader.loader import Loader 8 8 from sas.sascalc.dataloader.data_info import Data2D 9 from detector_editor import DetectorDialog10 from collimation_editor import CollimationDialog11 from console import ConsoleDialog9 from .detector_editor import DetectorDialog 10 from .collimation_editor import CollimationDialog 11 from .console import ConsoleDialog 12 12 13 13 from sas.sasgui.guiframe.events import StatusEvent … … 397 397 if data is None: 398 398 return 399 from sample_editor import SampleDialog399 from .sample_editor import SampleDialog 400 400 dlg = SampleDialog(parent=self, sample=data.sample) 401 401 dlg.set_manager(self) … … 409 409 if data is None: 410 410 return 411 from source_editor import SourceDialog411 from .source_editor import SourceDialog 412 412 dlg = SourceDialog(parent=self, source=data.source) 413 413 dlg.set_manager(self) … … 527 527 try: 528 528 #Load data 529 from load_thread import DataReader529 from .load_thread import DataReader 530 530 ## If a thread is already started, stop it 531 531 if self.reader is not None and self.reader.isrunning(): … … 536 536 self.reader.queue() 537 537 except: 538 msg = "Data Editor: %s" % (sys.exc_ value)538 msg = "Data Editor: %s" % (sys.exc_info()[1]) 539 539 load_error(msg) 540 540 return -
src/sas/sasgui/perspectives/calculator/data_operator.py
- Property mode changed from 100644 to 100755
r7432acb rfa81e94 202 202 else: 203 203 text = name 204 state_list = self.get_datalist().values()204 state_list = list(self.get_datalist().values()) 205 205 name_list = [] 206 206 for state in state_list: 207 207 if state.data is None: 208 208 theory_list = state.get_theory() 209 theory, _ = theory_list.values()[0]209 theory, _ = list(theory_list.values())[0] 210 210 d_name = str(theory.name) 211 211 else: … … 397 397 self._set_textctrl_color(self.data1_cbox, 'pink') 398 398 self._set_textctrl_color(self.data2_cbox, 'pink') 399 msg = "DataOperation: %s" % sys.exc_ value399 msg = "DataOperation: %s" % sys.exc_info()[1] 400 400 self.send_warnings(msg, 'error') 401 401 self.output = None … … 411 411 operator = self.operator_cbox.GetClientData(pos) 412 412 try: 413 exec "output = data1 %s data2" % operator413 exec("output = data1 %s data2" % operator) 414 414 except: 415 415 raise … … 532 532 self.data2_cbox.SetClientData(pos3, val) 533 533 dnames = [] 534 ids = self._data.keys()534 ids = list(self._data.keys()) 535 535 for id in ids: 536 536 if id is not None: … … 539 539 else: 540 540 theory_list = self._data[id].get_theory() 541 theory, _ = theory_list.values()[0]541 theory, _ = list(theory_list.values())[0] 542 542 dnames.append(theory.name) 543 543 ind = np.argsort(dnames) 544 544 if len(ind) > 0: 545 val_list = np.array( self._data.values())[ind]545 val_list = np.array(list(self._data.values()))[ind] 546 546 for datastate in val_list: 547 547 data = datastate.data … … 558 558 try: 559 559 theory_list = datastate.get_theory() 560 for theory, _ in theory_list.values():560 for theory, _ in list(theory_list.values()): 561 561 th_name = theory.name 562 562 posth1 = self.data1_cbox.Append(str(th_name)) … … 588 588 self.send_warnings('') 589 589 self.data_namectr.SetBackgroundColour('white') 590 state_list = self.get_datalist().values()590 state_list = list(self.get_datalist().values()) 591 591 name = self.data_namectr.GetValue().strip() 592 592 name_list = [] … … 594 594 if state.data is None: 595 595 theory_list = state.get_theory() 596 theory, _ = theory_list.values()[0]596 theory, _ = list(theory_list.values())[0] 597 597 d_name = str(theory.name) 598 598 else: … … 896 896 list = [] 897 897 list = self.graph.returnPlottable() 898 if len(list .keys()) > 0:899 first_item = list .keys()[0]898 if len(list(list.keys())) > 0: 899 first_item = list(list.keys())[0] 900 900 if first_item.x != []: 901 901 from sas.sasgui.plottools.PropertyDialog import Properties -
src/sas/sasgui/perspectives/calculator/density_panel.py
- Property mode changed from 100644 to 100755
r7432acb rfa81e94 364 364 except: 365 365 if self.base is not None: 366 msg = "Density/Volume Calculator: %s" % (sys.exc_ value)366 msg = "Density/Volume Calculator: %s" % (sys.exc_info()[1]) 367 367 wx.PostEvent(self.base, StatusEvent(status=msg)) 368 368 if event is not None: -
src/sas/sasgui/perspectives/calculator/detector_editor.py
- Property mode changed from 100644 to 100755
ra1b8fee rfa81e94 1 from __future__ import print_function 1 2 2 3 3 import wx … … 35 35 self.set_values() 36 36 except: 37 print("error", sys.exc_ value)37 print("error", sys.exc_info()[1]) 38 38 39 39 def _define_structure(self): -
src/sas/sasgui/perspectives/calculator/gen_scatter_panel.py
- Property mode changed from 100644 to 100755
ra1b8fee rfa81e94 3 3 This module relies on guiframe manager. 4 4 """ 5 from __future__ import print_function 5 6 6 7 7 import wx … … 228 228 sizer.Add(unit_title, (iy, ix), (1, 1), \ 229 229 wx.EXPAND | wx.ADJUST_MINSIZE, 0) 230 key_list = params.keys()230 key_list = list(params.keys()) 231 231 key_list.sort() 232 232 for param in key_list: … … 560 560 if self.parent.parent is None: 561 561 return 562 msg = "Generic SAS Calculator: %s" % (sys.exc_ value)562 msg = "Generic SAS Calculator: %s" % (sys.exc_info()[1]) 563 563 wx.PostEvent(self.parent.parent, 564 564 StatusEvent(status=msg, type='stop')) … … 761 761 # II. Plot selective points in color 762 762 other_color = np.ones(len(pix_symbol), dtype='bool') 763 for key in color_dic.keys():763 for key in list(color_dic.keys()): 764 764 chosen_color = pix_symbol == key 765 765 if np.any(chosen_color): … … 775 775 # Get atom names not in the list 776 776 a_names = [symb for symb in pix_symbol \ 777 if symb not in color_dic.keys()]777 if symb not in list(color_dic.keys())] 778 778 a_name = a_names[0] 779 779 for name in a_names: … … 899 899 900 900 except: 901 msg = "%s." % sys.exc_ value901 msg = "%s." % sys.exc_info()[1] 902 902 status_type = 'stop' 903 903 self._status_info(msg, status_type) … … 1285 1285 else: 1286 1286 sld_sets[list[0]] = None 1287 for key in sld_sets.keys():1287 for key in list(sld_sets.keys()): 1288 1288 key_low = key.lower() 1289 1289 if key_low.count('mx') > 0: … … 1336 1336 return 1337 1337 1338 for key in sets.keys():1338 for key in list(sets.keys()): 1339 1339 setattr(omfdata, key, sets[key]) 1340 1340 … … 1345 1345 self.sld_data.filename = "Default SLD Profile" 1346 1346 except: 1347 msg = "OMF Panel: %s" % sys.exc_ value1347 msg = "OMF Panel: %s" % sys.exc_info()[1] 1348 1348 infor = 'Error' 1349 1349 #logger.error(msg) … … 1375 1375 step_list = self._get_step_key_list(omfdata) 1376 1376 for ctr_list in self.nodes: 1377 for key in nodes_list.keys():1377 for key in list(nodes_list.keys()): 1378 1378 if ctr_list[0] == key: 1379 1379 ctr_list[1].SetValue(format_number(nodes_list[key], True)) … … 1381 1381 break 1382 1382 for ctr_list in self.stepsize: 1383 for key in step_list.keys():1383 for key in list(step_list.keys()): 1384 1384 if ctr_list[0] == key: 1385 1385 ctr_list[1].SetValue(format_number(step_list[key], True)) … … 1442 1442 sld_key_list = self._get_slds_key_list(omfdata) 1443 1443 # Dic is not sorted 1444 key_list = [key for key in sld_key_list.keys()]1444 key_list = [key for key in list(sld_key_list.keys())] 1445 1445 # Sort here 1446 1446 key_list.sort() … … 1485 1485 ix = 0 1486 1486 iy = -1 1487 for key, value in key_list.ite ritems():1487 for key, value in key_list.items(): 1488 1488 iy += 1 1489 1489 ix = 0 … … 1521 1521 iy = -1 1522 1522 #key_list.sort() 1523 for key, value in key_list.ite ritems():1523 for key, value in key_list.items(): 1524 1524 iy += 1 1525 1525 ix = 0 … … 1641 1641 sld_list = self._get_slds_key_list(sld_data) 1642 1642 for ctr_list in self.slds: 1643 for key in sld_list.keys():1643 for key in list(sld_list.keys()): 1644 1644 if ctr_list[0] == key: 1645 1645 min_val = np.min(sld_list[key]) -
src/sas/sasgui/perspectives/calculator/image_viewer.py
- Property mode changed from 100644 to 100755
r412e9e8b rfa81e94 1 from __future__ import print_function 1 2 2 3 3 import os -
src/sas/sasgui/perspectives/calculator/kiessig_calculator_panel.py
- Property mode changed from 100644 to 100755
r7432acb rfa81e94 14 14 from sas.sasgui.guiframe.panel_base import PanelBase 15 15 from sas.sascalc.calculator.kiessig_calculator import KiessigThicknessCalculator 16 from calculator_widgets import OutputTextCtrl17 from calculator_widgets import InputTextCtrl16 from .calculator_widgets import OutputTextCtrl 17 from .calculator_widgets import InputTextCtrl 18 18 from sas.sasgui.perspectives.calculator import calculator_widgets as widget 19 19 from sas.sasgui.guiframe.documentation_window import DocumentationWindow -
src/sas/sasgui/perspectives/calculator/model_editor.py
- Property mode changed from 100644 to 100755
r69363c7 rfa81e94 23 23 #copyright 2009, University of Tennessee 24 24 ################################################################################ 25 from __future__ import print_function 25 26 26 27 27 import wx … … 790 790 if item.count("_") < 1: 791 791 try: 792 exec "float(math.%s)" % item792 exec("float(math.%s)" % item) 793 793 self.math_combo.Append(str(item)) 794 794 except Exception: -
src/sas/sasgui/perspectives/calculator/resolution_calculator_panel.py
- Property mode changed from 100644 to 100755
r01cda57 rfa81e94 148 148 # Custom sorting 149 149 source_list = [] 150 for key, _ in self.source_mass.ite ritems():150 for key, _ in self.source_mass.items(): 151 151 name_source = str(key) 152 152 source_list.append(name_source) … … 1082 1082 msg = "The numbers must be one or two (separated by ',')..." 1083 1083 self._status_info(msg, 'stop') 1084 raise RuntimeError , msg1084 raise RuntimeError(msg) 1085 1085 1086 1086 return new_string … … 1100 1100 new_string.append(value) 1101 1101 except: 1102 logger.error(sys.exc_ value)1102 logger.error(sys.exc_info()[1]) 1103 1103 1104 1104 return new_string … … 1142 1142 return out 1143 1143 except: 1144 logger.error(sys.exc_ value)1144 logger.error(sys.exc_info()[1]) 1145 1145 1146 1146 def _on_xy_coordinate(self, event=None): … … 1269 1269 try: 1270 1270 basename = os.path.basename(path) 1271 if basename not in self.spectrum_dic.keys():1271 if basename not in list(self.spectrum_dic.keys()): 1272 1272 self.spectrum_cb.Append(basename) 1273 1273 self.spectrum_dic[basename] = self._read_file(path) … … 1320 1320 except: 1321 1321 # Skip non-data lines 1322 logger.error(sys.exc_ value)1322 logger.error(sys.exc_info()[1]) 1323 1323 1324 1324 return [wavelength, intensity] -
src/sas/sasgui/perspectives/calculator/sld_panel.py
- Property mode changed from 100644 to 100755
r2d220dd rfa81e94 366 366 if len(myformula.atoms) != 1: 367 367 return 368 element = myformula.atoms.keys()[0]368 element = list(myformula.atoms.keys())[0] 369 369 energy = xray_energy(element.K_alpha) 370 370 … … 450 450 if len(element_formula.atoms) != 1: 451 451 return 452 element = element_formula.atoms.keys()[0]452 element = list(element_formula.atoms.keys())[0] 453 453 energy = xray_energy(element.K_alpha) 454 454 atom = molecule_formula.atoms … … 507 507 except: 508 508 if self.base is not None: 509 msg = "SLD Calculator: %s" % (sys.exc_ value)509 msg = "SLD Calculator: %s" % (sys.exc_info()[1]) 510 510 wx.PostEvent(self.base, StatusEvent(status=msg)) 511 511 if event is not None: -
src/sas/sasgui/perspectives/calculator/slit_length_calculator_panel.py
- Property mode changed from 100644 to 100755
r7432acb rfa81e94 17 17 from sas.sasgui.guiframe.events import StatusEvent 18 18 from sas.sascalc.calculator.slit_length_calculator import SlitlengthCalculator 19 from calculator_widgets import OutputTextCtrl20 from calculator_widgets import InterActiveOutputTextCtrl19 from .calculator_widgets import OutputTextCtrl 20 from .calculator_widgets import InterActiveOutputTextCtrl 21 21 from sas.sasgui.perspectives.calculator import calculator_widgets as widget 22 22 from sas.sasgui.guiframe.documentation_window import DocumentationWindow … … 210 210 try: 211 211 #Load data 212 from load_thread import DataReader212 from .load_thread import DataReader 213 213 ## If a thread is already started, stop it 214 214 if self.reader is not None and self.reader.isrunning(): … … 226 226 if self.parent.parent is None: 227 227 return 228 msg = "Slit Length Calculator: %s" % (sys.exc_ value)228 msg = "Slit Length Calculator: %s" % (sys.exc_info()[1]) 229 229 wx.PostEvent(self.parent.parent, 230 230 StatusEvent(status=msg, type='stop')) … … 262 262 if x == [] or x is None or y == [] or y is None: 263 263 msg = "The current data is empty please check x and y" 264 raise ValueError , msg264 raise ValueError(msg) 265 265 slit_length_calculator = SlitlengthCalculator() 266 266 slit_length_calculator.set_data(x=x, y=y) … … 269 269 if self.parent.parent is None: 270 270 return 271 msg = "Slit Size Calculator: %s" % (sys.exc_ value)271 msg = "Slit Size Calculator: %s" % (sys.exc_info()[1]) 272 272 wx.PostEvent(self.parent.parent, 273 273 StatusEvent(status=msg, type='stop')) -
src/sas/sasgui/perspectives/corfunc/__init__.py
- Property mode changed from 100644 to 100755
rc23f303 rfa81e94 1 1 PLUGIN_ID = "Corfunc Plug-In 0.1" 2 from corfunc import *2 from .corfunc import * -
src/sas/sasgui/perspectives/corfunc/corfunc.py
- Property mode changed from 100644 to 100755
r9b90bf8 rfa81e94 18 18 from sas.sascalc.dataloader.loader import Loader 19 19 import sas.sascalc.dataloader 20 from plot_labels import *20 from .plot_labels import * 21 21 22 22 logger = logging.getLogger(__name__) … … 149 149 self.corfunc_panel.set_data(data) 150 150 except: 151 msg = "Corfunc set_data: " + str(sys.exc_ value)151 msg = "Corfunc set_data: " + str(sys.exc_info()[1]) 152 152 wx.PostEvent(self.parent, StatusEvent(status=msg, 153 153 info='error')) -
src/sas/sasgui/perspectives/corfunc/corfunc_panel.py
- Property mode changed from 100644 to 100755
r2a399ca rfa81e94 17 17 from sas.sascalc.corfunc.corfunc_calculator import CorfuncCalculator 18 18 from sas.sasgui.guiframe.documentation_window import DocumentationWindow 19 from plot_labels import *19 from .plot_labels import * 20 20 21 21 OUTPUT_STRINGS = { … … 393 393 if params is None: 394 394 # Reset outputs 395 for output in self._extrapolation_outputs.values():395 for output in list(self._extrapolation_outputs.values()): 396 396 output.SetValue('-') 397 397 return 398 for key, value in params.ite ritems():398 for key, value in params.items(): 399 399 output = self._extrapolation_outputs[key] 400 400 rounded = self._round_sig_figs(value, 6) … … 411 411 if params is None: 412 412 if not reset: error = True 413 for output in self._output_boxes.values():413 for output in list(self._output_boxes.values()): 414 414 output.SetValue('-') 415 415 else: … … 417 417 # Not all parameters were calculated 418 418 error = True 419 for key, value in params.ite ritems():419 for key, value in params.items(): 420 420 rounded = self._round_sig_figs(value, 6) 421 421 self._output_boxes[key].SetValue(rounded) … … 656 656 self._extrapolation_outputs['K'] = k_output 657 657 658 sigma_label = wx.StaticText(self, -1, u'\u03C3: ')658 sigma_label = wx.StaticText(self, -1, '\u03C3: ') 659 659 params_sizer.Add(sigma_label, (2, 2), (1, 1), wx.LEFT | wx.EXPAND, 15) 660 660 … … 713 713 self._output_boxes = dict() 714 714 i = 0 715 for key, value in OUTPUT_STRINGS.ite ritems():715 for key, value in OUTPUT_STRINGS.items(): 716 716 # Create a label and a text box for each poperty 717 717 label = wx.StaticText(self, -1, value) -
src/sas/sasgui/perspectives/corfunc/corfunc_state.py
- Property mode changed from 100644 to 100755
r1fa4f736 rfa81e94 74 74 if self.outputs != {} and self.outputs is not None: 75 75 state += "\nOutputs:\n" 76 for key, value in self.outputs.ite ritems():76 for key, value in self.outputs.items(): 77 77 name = output_list[key][1] 78 78 state += "{}: {}\n".format(name, str(value)) … … 158 158 state = new_doc.createElement("state") 159 159 top_element.appendChild(state) 160 for name, value in self.saved_state.ite ritems():160 for name, value in self.saved_state.items(): 161 161 element = new_doc.createElement(name) 162 162 element.appendChild(new_doc.createTextNode(str(value))) … … 181 181 output = new_doc.createElement("output") 182 182 top_element.appendChild(output) 183 for key, value in self.outputs.ite ritems():183 for key, value in self.outputs.items(): 184 184 element = new_doc.createElement(key) 185 185 element.appendChild(new_doc.createTextNode(str(value))) … … 216 216 except: 217 217 msg = ("CorfuncState.fromXML: Could not read timestamp", 218 "\n{}").format(sys.exc_ value)218 "\n{}").format(sys.exc_info()[1]) 219 219 logger.error(msg) 220 220 … … 222 222 entry = get_content('ns:state', node) 223 223 if entry is not None: 224 for item in DEFAULT_STATE. iterkeys():224 for item in DEFAULT_STATE.keys(): 225 225 input_field = get_content("ns:{}".format(item), entry) 226 226 if input_field is not None: … … 283 283 root, ext = os.path.splitext(basename) 284 284 if not ext.lower() in self.ext: 285 raise IOError , "{} is not a supported file type".format(ext)285 raise IOError("{} is not a supported file type".format(ext)) 286 286 tree = etree.parse(path, parser=etree.ETCompatXMLParser()) 287 287 root = tree.getroot() … … 299 299 # File not found 300 300 msg = "{} is not a valid file path or doesn't exist".format(path) 301 raise IOError , msg301 raise IOError(msg) 302 302 303 303 if len(output) == 0: … … 323 323 msg = ("The CanSAS writer expects a Data1D instance. {} was " 324 324 "provided").format(datainfo.__class__.__name__) 325 raise RuntimeError , msg325 raise RuntimeError(msg) 326 326 if datainfo.title is None or datainfo.title == '': 327 327 datainfo.title = datainfo.name … … 360 360 except: 361 361 msg = "XML document does not contain CorfuncState information\n{}" 362 msg.format(sys.exc_ value)362 msg.format(sys.exc_info()[1]) 363 363 logger.info(msg) 364 364 return state -
src/sas/sasgui/perspectives/file_converter/__init__.py
- Property mode changed from 100644 to 100755
r77d92cd rfa81e94 1 1 PLUGIN_ID = "File-Converter Plug-In 1.0" 2 from file_converter import *2 from .file_converter import * -
src/sas/sasgui/perspectives/file_converter/converter_panel.py
- Property mode changed from 100644 to 100755
ra26f67f rfa81e94 112 112 [group_path, group_name] = os.path.split(filepath) 113 113 ext = "." + group_name.split('.')[-1] # File extension 114 for frame_number, frame_data in frame_data.ite ritems():114 for frame_number, frame_data in frame_data.items(): 115 115 # Append frame number to base filename 116 116 filename = group_name.replace(ext, str(frame_number)+ext) … … 155 155 # If lines end with comma or semi-colon, trim the last character 156 156 if end_char == ',' or end_char == ';': 157 data = map(lambda s: s[0:-1], data)157 data = [s[0:-1] for s in data] 158 158 else: 159 159 msg = ("Error reading {}: Lines must end with a digit, comma " … … 275 275 else: 276 276 return { 'frames': [], 'inc': None, 'file': single_file } 277 frames = range(first_frame, last_frame + 1, increment)277 frames = list(range(first_frame, last_frame + 1, increment)) 278 278 return { 'frames': frames, 'inc': increment, 'file': single_file } 279 279 … … 335 335 if single_file: 336 336 # Only need to set metadata on first Data1D object 337 frame_data = frame_data.values() # Don't need to know frame numbers337 frame_data = list(frame_data.values()) # Don't need to know frame numbers 338 338 frame_data[0].filename = output_path.split('\\')[-1] 339 for key, value in metadata.ite ritems():339 for key, value in metadata.items(): 340 340 setattr(frame_data[0], key, value) 341 341 else: 342 342 # Need to set metadata for all Data1D objects 343 for datainfo in frame_data.values():343 for datainfo in list(frame_data.values()): 344 344 datainfo.filename = output_path.split('\\')[-1] 345 for key, value in metadata.ite ritems():345 for key, value in metadata.items(): 346 346 setattr(datainfo, key, value) 347 347 … … 355 355 def convert_2d_data(self, dataset): 356 356 metadata = self.get_metadata() 357 for key, value in metadata.ite ritems():357 for key, value in metadata.items(): 358 358 setattr(dataset[0], key, value) 359 359 -
src/sas/sasgui/perspectives/file_converter/converter_widgets.py
- Property mode changed from 100644 to 100755
r0e11ec7 rfa81e94 54 54 v = Vector() 55 55 if not self.Validate(): return v 56 for direction, control in self._inputs.ite ritems():56 for direction, control in self._inputs.items(): 57 57 try: 58 58 value = float(control.GetValue()) … … 86 86 all_valid = True 87 87 invalid_ctrl = None 88 for control in self._inputs.values():88 for control in list(self._inputs.values()): 89 89 if control.GetValue() == '': continue 90 90 control.SetBackgroundColour(wx.WHITE) -
src/sas/sasgui/perspectives/fitting/__init__.py
- Property mode changed from 100644 to 100755
r12d3e0e rfa81e94 1 1 PLUGIN_ID = "Fitting plug-in 1.0" 2 2 import os 3 from fitting import *3 from .fitting import * 4 4 from distutils.filelist import findall 5 5 def get_data_path(media): -
src/sas/sasgui/perspectives/fitting/basepage.py
- Property mode changed from 100644 to 100755
rf4a1433 rfa81e94 2 2 Base Page for fitting 3 3 """ 4 from __future__ import print_function 4 5 5 6 6 import sys … … 12 12 import logging 13 13 import traceback 14 from Queue import Queue14 from queue import Queue 15 15 from threading import Thread 16 16 from collections import defaultdict … … 223 223 self.popUpMenu = wx.Menu() 224 224 225 wx_id = self._ids.next()225 wx_id = next(self._ids) 226 226 self._keep = wx.MenuItem(self.popUpMenu, wx_id, "Add bookmark", 227 227 " Keep the panel status to recall it later") … … 623 623 if self.model is not None: 624 624 self.m_name = self.model.name 625 if name in self.saved_states.keys():625 if name in list(self.saved_states.keys()): 626 626 previous_state = self.saved_states[name] 627 627 # reset state of checkbox,textcrtl and regular parameters value … … 918 918 919 919 if len(self._disp_obj_dict) > 0: 920 for k, v in self._disp_obj_dict.ite ritems():920 for k, v in self._disp_obj_dict.items(): 921 921 self.state.disp_obj_dict[k] = v.type 922 922 … … 985 985 986 986 if len(self.disp_cb_dict) > 0: 987 for k, v in self.disp_cb_dict.ite ritems():987 for k, v in self.disp_cb_dict.items(): 988 988 if v is None: 989 989 self.state.disp_cb_dict[k] = v … … 994 994 self.state.disp_cb_dict[k] = None 995 995 if len(self._disp_obj_dict) > 0: 996 for k, v in self._disp_obj_dict.ite ritems():996 for k, v in self._disp_obj_dict.items(): 997 997 self.state.disp_obj_dict[k] = v.type 998 998 … … 1096 1096 if name == "ArrayDispersion": 1097 1097 1098 for item in self.disp_cb_dict.keys():1098 for item in list(self.disp_cb_dict.keys()): 1099 1099 1100 1100 if hasattr(self.disp_cb_dict[item], "SetValue"): … … 1167 1167 :return: combo_box_position 1168 1168 """ 1169 for key, value in self.master_category_dict.ite ritems():1169 for key, value in self.master_category_dict.items(): 1170 1170 formfactor = state.formfactorcombobox.split(":") 1171 1171 if isinstance(formfactor, list): … … 1219 1219 # select the current model 1220 1220 state._convert_to_sasmodels() 1221 state.categorycombobox = unicode(state.categorycombobox)1221 state.categorycombobox = str(state.categorycombobox) 1222 1222 if state.categorycombobox in self.categorybox.Items: 1223 1223 category_pos = self.categorybox.Items.index( … … 1244 1244 structfactor_pos = 0 1245 1245 if state.structurecombobox is not None: 1246 state.structurecombobox = unicode(state.structurecombobox)1246 state.structurecombobox = str(state.structurecombobox) 1247 1247 for ind_struct in range(self.structurebox.GetCount()): 1248 1248 if (self.structurebox.GetString(ind_struct) … … 1354 1354 self.weights = copy.deepcopy(state.weights) 1355 1355 1356 for key, disp_type in state.disp_obj_dict.ite ritems():1356 for key, disp_type in state.disp_obj_dict.items(): 1357 1357 # disp_model = disp 1358 1358 disp_model = POLYDISPERSITY_MODELS[disp_type]() … … 1415 1415 """ 1416 1416 ids = iter(self._id_pool) # Reusing ids for context menu 1417 for name, _ in self.state.saved_states.ite ritems():1417 for name, _ in self.state.saved_states.items(): 1418 1418 self.number_saved_state += 1 1419 1419 # Add item in the context menu 1420 wx_id = ids.next()1420 wx_id = next(ids) 1421 1421 msg = 'Save model and state %g' % self.number_saved_state 1422 1422 self.popUpMenu.Append(wx_id, name, msg) … … 2314 2314 value_ctrl.SetValue(format_number(value)) 2315 2315 2316 if name not in self.model.details.keys():2316 if name not in list(self.model.details.keys()): 2317 2317 self.model.details[name] = ["", None, None] 2318 2318 old_low, old_high = self.model.details[name][1:3] … … 2675 2675 if disp_func is not None: 2676 2676 try: 2677 return POLYDISPERSITY_MODELS.values().index(disp_func.__class__)2677 return list(POLYDISPERSITY_MODELS.values()).index(disp_func.__class__) 2678 2678 except ValueError: 2679 2679 pass # Fall through to default class 2680 return POLYDISPERSITY_MODELS.keys().index('gaussian')2680 return list(POLYDISPERSITY_MODELS.keys()).index('gaussian') 2681 2681 2682 2682 def on_reset_clicked(self, event): … … 2770 2770 gui_manager = self._manager.parent 2771 2771 # loops through the panels [dic] 2772 for _, item2 in gui_manager.plot_panels.ite ritems():2772 for _, item2 in gui_manager.plot_panels.items(): 2773 2773 data_title = self.data.group_id 2774 2774 # try to get all plots belonging to this control panel … … 3340 3340 if self.data.__class__.__name__ == "Data2D": 3341 3341 name = item[1] 3342 if name in content.keys():3342 if name in list(content.keys()): 3343 3343 values = content[name] 3344 3344 check = values[0] … … 3389 3389 if not item[1] in orient_param: 3390 3390 name = item[1] 3391 if name in content.keys():3391 if name in list(content.keys()): 3392 3392 check = content[name][0] 3393 3393 # Avoid changing combox content … … 3615 3615 sizer_cat = wx.BoxSizer(wx.HORIZONTAL) 3616 3616 self.mbox_description.SetForegroundColour(wx.RED) 3617 wx_id = self._ids.next()3617 wx_id = next(self._ids) 3618 3618 self.model_func = wx.Button(self, wx_id, 'Help', size=(80, 23)) 3619 3619 self.model_func.Bind(wx.EVT_BUTTON, self.on_function_help_clicked, 3620 3620 id=wx_id) 3621 3621 self.model_func.SetToolTipString("Full Model Function Help") 3622 wx_id = self._ids.next()3622 wx_id = next(self._ids) 3623 3623 self.model_help = wx.Button(self, wx_id, 'Description', size=(80, 23)) 3624 3624 self.model_help.Bind(wx.EVT_BUTTON, self.on_model_help_clicked, 3625 3625 id=wx_id) 3626 3626 self.model_help.SetToolTipString("Short Model Function Description") 3627 wx_id = self._ids.next()3627 wx_id = next(self._ids) 3628 3628 self.model_view = wx.Button(self, wx_id, "Show 2D", size=(80, 23)) 3629 3629 self.model_view.Bind(wx.EVT_BUTTON, self._onModel2D, id=wx_id) -
src/sas/sasgui/perspectives/fitting/fit_thread.py
- Property mode changed from 100644 to 100755
rf4a1433 rfa81e94 11 11 12 12 def map_apply(arguments): 13 return a pply(arguments[0],arguments[1:])13 return arguments[0](*arguments[1:]) 14 14 15 15 class FitThread(CalcThread): … … 49 49 except KeyboardInterrupt: 50 50 msg = "Fitting: terminated by the user." 51 raise KeyboardInterrupt , msg51 raise KeyboardInterrupt(msg) 52 52 53 53 def compute(self): … … 72 72 list_map_get_attr.append(map_getattr) 73 73 #from multiprocessing import Pool 74 inputs = zip(list_map_get_attr, self.fitter, list_fit_function,74 inputs = list(zip(list_map_get_attr, self.fitter, list_fit_function, 75 75 list_q, list_q, list_handler, list_curr_thread, 76 list_reset_flag) 77 result = map(map_apply, inputs)76 list_reset_flag)) 77 result = list(map(map_apply, inputs)) 78 78 79 79 self.complete(result=result, … … 84 84 elapsed=time.time() - self.starttime) 85 85 86 except KeyboardInterrupt ,msg:86 except KeyboardInterrupt as msg: 87 87 # Thread was interrupted, just proceed and re-raise. 88 88 # Real code should not print, but this is an example... -
src/sas/sasgui/perspectives/fitting/fitpage.py
- Property mode changed from 100644 to 100755
r3bd677b rfa81e94 281 281 282 282 # Fit button 283 self.btFit = wx.Button(self, self._ids.next(), 'Fit')283 self.btFit = wx.Button(self, next(self._ids), 'Fit') 284 284 self.default_bt_colour = self.btFit.GetDefaultAttributes() 285 285 self.btFit.Bind(wx.EVT_BUTTON, self._onFit, id=self.btFit.GetId()) … … 377 377 378 378 # Update and Draw button 379 self.draw_button = wx.Button(self, self._ids.next(), 'Compute')379 self.draw_button = wx.Button(self, next(self._ids), 'Compute') 380 380 self.draw_button.Bind(wx.EVT_BUTTON, 381 381 self._onDraw, id=self.draw_button.GetId()) … … 532 532 self.qmin.Bind(wx.EVT_TEXT, self.on_qrange_text) 533 533 self.qmax.Bind(wx.EVT_TEXT, self.on_qrange_text) 534 wx_id = self._ids.next()534 wx_id = next(self._ids) 535 535 self.reset_qrange = wx.Button(self, wx_id, 'Reset') 536 536 … … 540 540 sizer = wx.GridSizer(5, 5, 2, 6) 541 541 542 self.btEditMask = wx.Button(self, self._ids.next(), 'Editor')542 self.btEditMask = wx.Button(self, next(self._ids), 'Editor') 543 543 self.btEditMask.Bind(wx.EVT_BUTTON, self._onMask, 544 544 id=self.btEditMask.GetId()) … … 660 660 self.text_disp_min.Show(True) 661 661 662 for item in self.model.dispersion.keys():662 for item in list(self.model.dispersion.keys()): 663 663 if not self.magnetic_on: 664 664 if item in self.model.magnetic_params: … … 675 675 676 676 iy += 1 677 for p in self.model.dispersion[item].keys():677 for p in list(self.model.dispersion[item].keys()): 678 678 679 679 if p == "width": … … 765 765 disp_box = wx.ComboBox(self, wx.ID_ANY, size=(65, -1), 766 766 style=wx.CB_READONLY, name='%s' % name1) 767 for key, value in POLYDISPERSITY_MODELS.ite ritems():767 for key, value in POLYDISPERSITY_MODELS.items(): 768 768 name_disp = str(key) 769 769 disp_box.Append(name_disp, value) … … 779 779 wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15) 780 780 first_orient = True 781 for item in self.model.dispersion.keys():781 for item in list(self.model.dispersion.keys()): 782 782 if not self.magnetic_on: 783 783 if item in self.model.magnetic_params: … … 795 795 796 796 iy += 1 797 for p in self.model.dispersion[item].keys():797 for p in list(self.model.dispersion[item].keys()): 798 798 799 799 if p == "width": … … 929 929 disp_box = wx.ComboBox(self, wx.ID_ANY, size=(65, -1), 930 930 style=wx.CB_READONLY, name='%s' % name1) 931 for key, value in POLYDISPERSITY_MODELS.ite ritems():931 for key, value in POLYDISPERSITY_MODELS.items(): 932 932 name_disp = str(key) 933 933 disp_box.Append(name_disp, value) … … 1370 1370 except: 1371 1371 tcrtl.SetBackgroundColour("pink") 1372 msg = "Model Error:wrong value entered : %s" % sys.exc_ value1372 msg = "Model Error:wrong value entered : %s" % sys.exc_info()[1] 1373 1373 wx.PostEvent(self._manager.parent, StatusEvent(status=msg)) 1374 1374 return … … 1482 1482 else: 1483 1483 tcrtl.SetBackgroundColour("pink") 1484 msg = "Model Error:wrong value entered : %s" % sys.exc_ value1484 msg = "Model Error:wrong value entered : %s" % sys.exc_info()[1] 1485 1485 wx.PostEvent(self._manager.parent, StatusEvent(status=msg)) 1486 1486 return 1487 1487 except: 1488 1488 tcrtl.SetBackgroundColour("pink") 1489 msg = "Model Error:wrong value entered : %s" % sys.exc_ value1489 msg = "Model Error:wrong value entered : %s" % sys.exc_info()[1] 1490 1490 wx.PostEvent(self._manager.parent, StatusEvent(status=msg)) 1491 1491 return … … 1733 1733 ind = 0 1734 1734 while(ind < len(list)): 1735 for key, val in list .items():1735 for key, val in list(list.items()): 1736 1736 if val == ind: 1737 1737 fun_box.Append(key, val) … … 1865 1865 wx.PostEvent(self._manager.parent, StatusEvent(status=msg, 1866 1866 info="error")) 1867 raise ValueError , msg1867 raise ValueError(msg) 1868 1868 1869 1869 else: … … 1877 1877 wx.PostEvent(self._manager.parent, StatusEvent(status=msg, 1878 1878 info="error")) 1879 raise ValueError , msg1879 raise ValueError(msg) 1880 1880 # Maximum value of data 1881 1881 qmax = math.sqrt(x * x + y * y) … … 2118 2118 self._on_fit_complete() 2119 2119 if out is None or not np.isfinite(chisqr): 2120 raise ValueError , "Fit error occured..."2120 raise ValueError("Fit error occured...") 2121 2121 2122 2122 is_modified = False … … 2193 2193 i += 1 2194 2194 else: 2195 raise ValueError , "onsetValues: Invalid parameters..."2195 raise ValueError("onsetValues: Invalid parameters...") 2196 2196 # Show error title when any errors displayed 2197 2197 if has_error: … … 2951 2951 2952 2952 # type can be either Guassian or Array 2953 if len( self.model.dispersion.values()) > 0:2954 type = self.model.dispersion.values()[0]["type"]2953 if len(list(self.model.dispersion.values())) > 0: 2954 type = list(self.model.dispersion.values())[0]["type"] 2955 2955 else: 2956 2956 type = "Gaussian" -
src/sas/sasgui/perspectives/fitting/fitpanel.py
- Property mode changed from 100644 to 100755
r69363c7 rfa81e94 94 94 batch_state = self.sim_page.set_state() 95 95 96 for uid, page in self.opened_pages.ite ritems():96 for uid, page in self.opened_pages.items(): 97 97 data = page.get_data() 98 98 # state must be cloned … … 135 135 if uid not in self.opened_pages: 136 136 msg = "Fitpanel cannot find ID: %s in self.opened_pages" % str(uid) 137 raise ValueError , msg137 raise ValueError(msg) 138 138 else: 139 139 return self.opened_pages[uid] … … 217 217 page_is_opened = False 218 218 if state is not None: 219 for uid, panel in self.opened_pages.ite ritems():219 for uid, panel in self.opened_pages.items(): 220 220 # Don't return any panel is the exact same page is created 221 221 if uid == panel.uid and panel.data == state.data: … … 396 396 """ 397 397 if data.__class__.__name__ != "list": 398 raise ValueError , "Fitpanel delete_data expect list of id"398 raise ValueError("Fitpanel delete_data expect list of id") 399 399 else: 400 for page in self.opened_pages.values():400 for page in list(self.opened_pages.values()): 401 401 pos = self.GetPageIndex(page) 402 402 temp_data = page.get_data() … … 433 433 data_2d_list.append(data) 434 434 page = None 435 for p in self.opened_pages.values():435 for p in list(self.opened_pages.values()): 436 436 # check if there is an empty page to fill up 437 437 if not check_data_validity(p.get_data()) and p.batch_on: … … 503 503 return None 504 504 focused_page = self.GetPage(self.GetSelection()) 505 for page in self.opened_pages.values():505 for page in list(self.opened_pages.values()): 506 506 # check if the selected data existing in the fitpanel 507 507 pos = self.GetPageIndex(page) … … 592 592 if selected_page in page_finder: 593 593 # Delete the name of the page into the list of open page 594 for uid, list in self.opened_pages.ite ritems():594 for uid, list in self.opened_pages.items(): 595 595 # Don't return any panel is the exact same page is created 596 596 if flag and selected_page.uid == uid: … … 600 600 601 601 # Delete the name of the page into the list of open page 602 for uid, list in self.opened_pages.ite ritems():602 for uid, list in self.opened_pages.items(): 603 603 # Don't return any panel is the exact same page is created 604 604 if selected_page.uid == uid: -
src/sas/sasgui/perspectives/fitting/fitproblem.py
- Property mode changed from 100644 to 100755
r251ef684 rfa81e94 309 309 self._smear_on = flag 310 310 if fid is None: 311 for value in self.values():311 for value in list(self.values()): 312 312 value.enable_smearing(flag) 313 313 elif fid in self: … … 320 320 """ 321 321 if fid is None: 322 for value in self.values():322 for value in list(self.values()): 323 323 value.set_smearer(smearer) 324 324 elif fid in self: … … 336 336 """ 337 337 if fid is None: 338 for value in self.values():338 for value in list(self.values()): 339 339 value.save_model_name(name) 340 340 elif fid in self: … … 346 346 result = [] 347 347 if fid is None: 348 for value in self.values():348 for value in list(self.values()): 349 349 result.append(value.get_name()) 350 350 elif fid in self: … … 360 360 self.model = model 361 361 if fid is None: 362 for value in self.values():362 for value in list(self.values()): 363 363 value.set_model(self.model) 364 364 elif fid in self: … … 456 456 """ 457 457 if fid is None: 458 for value in self.values():458 for value in list(self.values()): 459 459 value.set_model_param(name, value) 460 460 elif fid in self: … … 486 486 """ 487 487 self.scheduled = schedule 488 for value in self.values():488 for value in list(self.values()): 489 489 value.schedule_tofit(schedule) 490 490 … … 502 502 self.qmax = qmax 503 503 if fid is None: 504 for value in self.values():504 for value in list(self.values()): 505 505 value.set_range(self.qmin, self.qmax) 506 506 elif fid in self: … … 519 519 """ 520 520 if fid is None: 521 for value in self.values():521 for value in list(self.values()): 522 522 value.set_weight(flag=flag, is2d=is2d) 523 523 elif fid in self: … … 536 536 """ 537 537 if fid is None: 538 for value in self.values():538 for value in list(self.values()): 539 539 value.clear_model_param() 540 540 elif fid in self: … … 545 545 return fitproblem contained in this dictionary 546 546 """ 547 return self.values()547 return list(self.values()) 548 548 549 549 def set_result(self, result, fid): -
src/sas/sasgui/perspectives/fitting/fitting.py
- Property mode changed from 100644 to 100755
rc416a17 rfa81e94 11 11 #copyright 2009, University of Tennessee 12 12 ################################################################################ 13 from __future__ import print_function 13 14 14 15 15 import re … … 142 142 Given an ID create a fitproblem container 143 143 """ 144 if page_id in self.page_finder.iterkeys():144 if page_id in iter(self.page_finder.keys()): 145 145 del self.page_finder[page_id] 146 146 … … 335 335 if temp: 336 336 # Set the new plugin model list for all fit pages 337 for uid, page in self.fit_panel.opened_pages.ite ritems():337 for uid, page in self.fit_panel.opened_pages.items(): 338 338 if hasattr(page, "formfactorbox"): 339 339 page.model_list_box = temp … … 350 350 page.formfactorbox.SetLabel(current_val) 351 351 except: 352 logger.error("update_custom_combo: %s", sys.exc_ value)352 logger.error("update_custom_combo: %s", sys.exc_info()[1]) 353 353 354 354 def set_edit_menu(self, owner): … … 556 556 else: 557 557 if len(data_list) > MAX_NBR_DATA: 558 from fitting_widgets import DataDialog558 from .fitting_widgets import DataDialog 559 559 dlg = DataDialog(data_list=data_list, nb_data=MAX_NBR_DATA) 560 560 if dlg.ShowModal() == wx.ID_OK: … … 576 576 self.add_fit_page(data=[data]) 577 577 except: 578 msg = "Fitting set_data: " + str(sys.exc_ value)578 msg = "Fitting set_data: " + str(sys.exc_info()[1]) 579 579 wx.PostEvent(self.parent, StatusEvent(status=msg, info="error")) 580 580 … … 590 590 msg = "Fitting: cannot deal with the theory received" 591 591 evt = StatusEvent(status=msg, info="error") 592 logger.error("set_theory " + msg + "\n" + str(sys.exc_ value))592 logger.error("set_theory " + msg + "\n" + str(sys.exc_info()[1])) 593 593 wx.PostEvent(self.parent, evt) 594 594 … … 602 602 """ 603 603 from pagestate import PageState 604 from simfitpage import SimFitPageState604 from .simfitpage import SimFitPageState 605 605 if isinstance(state, PageState): 606 606 state = state.clone() … … 713 713 if fid is None: 714 714 return 715 if uid in self.page_finder.keys():715 if uid in list(self.page_finder.keys()): 716 716 self.page_finder[uid].set_weight(flag=flag, is2d=is2d) 717 717 … … 726 726 :param qmax: maximum value of the fit range 727 727 """ 728 if uid in self.page_finder.keys():728 if uid in list(self.page_finder.keys()): 729 729 self.page_finder[uid].set_range(qmin=qmin, qmax=qmax, fid=fid) 730 730 … … 737 737 :param uid: the id related to a page contaning fitting information 738 738 """ 739 if uid in self.page_finder.keys():739 if uid in list(self.page_finder.keys()): 740 740 self.page_finder[uid].schedule_tofit(value) 741 741 … … 756 756 """ 757 757 sim_page_id = self.sim_page.uid 758 for uid, value in self.page_finder.ite ritems():758 for uid, value in self.page_finder.items(): 759 759 if uid != sim_page_id and uid != self.batch_page.uid: 760 760 model_list = value.get_model() … … 821 821 Stop the fit 822 822 """ 823 if uid in self.fit_thread_list.keys():823 if uid in list(self.fit_thread_list.keys()): 824 824 calc_fit = self.fit_thread_list[uid] 825 825 if calc_fit is not None and calc_fit.isrunning(): … … 833 833 batch_flag = self.batch_page is not None and uid == self.batch_page.uid 834 834 if sim_flag or batch_flag: 835 for uid, value in self.page_finder.ite ritems():835 for uid, value in self.page_finder.items(): 836 836 if value.get_scheduled() == 1: 837 if uid in self.fit_panel.opened_pages.keys():837 if uid in list(self.fit_panel.opened_pages.keys()): 838 838 panel = self.fit_panel.opened_pages[uid] 839 839 panel._on_fit_complete() … … 852 852 :param draw: Determine if the theory needs to be plot 853 853 """ 854 if uid not in self.page_finder.keys():854 if uid not in list(self.page_finder.keys()): 855 855 return 856 856 self.page_finder[uid].enable_smearing(flag=enable_smearer) … … 964 964 list_page_id = [] 965 965 fit_id = 0 966 for page_id, page_info in self.page_finder.ite ritems():966 for page_id, page_info in self.page_finder.items(): 967 967 # For simulfit (uid give with None), do for-loop 968 968 # if uid is specified (singlefit), do it only on the page. … … 991 991 992 992 pars = [str(element[1]) for element in page.param_toFit] 993 fitproblem_list = page_info.values()993 fitproblem_list = list(page_info.values()) 994 994 for fitproblem in fitproblem_list: 995 995 if sim_fitter is None: … … 1013 1013 except: 1014 1014 raise 1015 msg = "Fitting error: %s" % str(sys.exc_ value)1015 msg = "Fitting error: %s" % str(sys.exc_info()[1]) 1016 1016 evt = StatusEvent(status=msg, info="error", type="stop") 1017 1017 wx.PostEvent(self.parent, evt) … … 1070 1070 :param fid: the id of the fitproblem(data, model, range,etc) 1071 1071 """ 1072 if uid not in self.page_finder.keys():1072 if uid not in list(self.page_finder.keys()): 1073 1073 return 1074 1074 fitproblemList = self.page_finder[uid].get_fit_problem(fid) … … 1116 1116 wx.PostEvent(self.parent, evt) 1117 1117 except: 1118 msg = "Creating Fit page: %s" % sys.exc_ value1118 msg = "Creating Fit page: %s" % sys.exc_info()[1] 1119 1119 wx.PostEvent(self.parent, StatusEvent(status=msg, info="error")) 1120 1120 … … 1196 1196 # case that uid is not specified 1197 1197 if uid is None: 1198 for page_id in self.page_finder.keys():1198 for page_id in list(self.page_finder.keys()): 1199 1199 self.page_finder[page_id].schedule_tofit(value) 1200 1200 # when uid is given 1201 1201 else: 1202 if uid in self.page_finder.keys():1202 if uid in list(self.page_finder.keys()): 1203 1203 self.page_finder[uid].schedule_tofit(value) 1204 1204 … … 1234 1234 panel = self.plot_panel 1235 1235 if panel is None: 1236 raise ValueError , "Fitting:_onSelect: NonType panel"1236 raise ValueError("Fitting:_onSelect: NonType panel") 1237 1237 Plugin.on_perspective(self, event=event) 1238 1238 self.select_data(panel) … … 1267 1267 """ 1268 1268 uid = page_id[0] 1269 if uid in self.fit_thread_list.keys():1269 if uid in list(self.fit_thread_list.keys()): 1270 1270 del self.fit_thread_list[uid] 1271 1271 … … 1293 1293 #get all fittable parameters of the current model 1294 1294 for param in model.getParamList(): 1295 if param not in batch_outputs.keys():1295 if param not in list(batch_outputs.keys()): 1296 1296 batch_outputs[param] = [] 1297 1297 for param in model.getDispParamList(): 1298 1298 if not model.is_fittable(param) and \ 1299 param in batch_outputs.keys():1299 param in list(batch_outputs.keys()): 1300 1300 del batch_outputs[param] 1301 1301 # Add fitted parameters and their error 1302 1302 for param in res.param_list: 1303 if param not in batch_outputs.keys():1303 if param not in list(batch_outputs.keys()): 1304 1304 batch_outputs[param] = [] 1305 1305 err_param = "error on %s" % str(param) 1306 if err_param not in batch_inputs.keys():1306 if err_param not in list(batch_inputs.keys()): 1307 1307 batch_inputs[err_param] = [] 1308 1308 msg = "" … … 1389 1389 #model 1390 1390 EMPTY = "-" 1391 for key in batch_outputs.keys():1391 for key in list(batch_outputs.keys()): 1392 1392 if key not in param_list and key not in ["Chi2", "Data"]: 1393 1393 batch_outputs[key].append(EMPTY) … … 1432 1432 tbatch_outputs = {} 1433 1433 shownkeystr = cpage.get_copy_params() 1434 for key in batch_outputs.keys():1434 for key in list(batch_outputs.keys()): 1435 1435 if key in ["Chi2", "Data"] or shownkeystr.count(key) > 0: 1436 1436 tbatch_outputs[key] = batch_outputs[key] … … 1452 1452 model = fitproblem.get_model() 1453 1453 #fill batch result information 1454 if "Data" not in batch_outputs.keys():1454 if "Data" not in list(batch_outputs.keys()): 1455 1455 batch_outputs["Data"] = [] 1456 1456 from sas.sasgui.guiframe.data_processor import BatchCell … … 1482 1482 cell.object = [data, theory_data] 1483 1483 batch_outputs["Data"].append(cell) 1484 for key, value in data.meta_data.ite ritems():1485 if key not in batch_inputs.keys():1484 for key, value in data.meta_data.items(): 1485 if key not in list(batch_inputs.keys()): 1486 1486 batch_inputs[key] = [] 1487 1487 #if key.lower().strip() != "loader": … … 1489 1489 param = "temperature" 1490 1490 if hasattr(data.sample, param): 1491 if param not in batch_inputs.keys():1491 if param not in list(batch_inputs.keys()): 1492 1492 batch_inputs[param] = [] 1493 1493 batch_inputs[param].append(data.sample.temperature) … … 1562 1562 except: 1563 1563 msg = ("Fit completed but the following error occurred: %s" 1564 % sys.exc_ value)1564 % sys.exc_info()[1]) 1565 1565 #import traceback; msg = "\n".join((traceback.format_exc(), msg)) 1566 1566 evt = StatusEvent(status=msg, info="warning", type="stop") … … 1650 1650 if model is None: 1651 1651 return 1652 if uid not in self.page_finder.keys():1652 if uid not in list(self.page_finder.keys()): 1653 1653 return 1654 1654 # save the name containing the data name with the appropriate model … … 1903 1903 return None 1904 1904 try: 1905 from model_thread import Calc2D1905 from .model_thread import Calc2D 1906 1906 ## If a thread is already started, stop it 1907 1907 if (self.calc_2D is not None) and self.calc_2D.isrunning(): … … 1950 1950 return 1951 1951 try: 1952 from model_thread import Calc1D1952 from .model_thread import Calc1D 1953 1953 ## If a thread is already started, stop it 1954 1954 if (self.calc_1D is not None) and self.calc_1D.isrunning(): … … 1989 1989 except: 1990 1990 msg = " Error occurred when drawing %s Model 1D: " % model.name 1991 msg += " %s" % sys.exc_ value1991 msg += " %s" % sys.exc_info()[1] 1992 1992 wx.PostEvent(self.parent, StatusEvent(status=msg)) 1993 1993 -
src/sas/sasgui/perspectives/fitting/model_thread.py
- Property mode changed from 100644 to 100755
rc416a17 rfa81e94 65 65 if self.data is None: 66 66 msg = "Compute Calc2D receive data = %s.\n" % str(self.data) 67 raise ValueError , msg67 raise ValueError(msg) 68 68 69 69 # Define matrix where data will be plotted -
src/sas/sasgui/perspectives/fitting/simfitpage.py
- Property mode changed from 100644 to 100755
r0a3c740 rfa81e94 168 168 i = 0 169 169 for model in self.model_list: 170 model_id = self._format_id( model[1].keys()[0])170 model_id = self._format_id(list(model[1].keys())[0]) 171 171 for saved_model in sim_state.model_list: 172 172 save_id = saved_model.pop('name') … … 195 195 param = item.pop('param_cbox') 196 196 equality = item.pop('egal_txt') 197 for key, value in init_map.items():197 for key, value in list(init_map.items()): 198 198 model_cbox = model_cbox.replace(key, value) 199 199 constraint_value = constraint_value.replace(key, value) 200 for key, value in final_map.items():200 for key, value in list(final_map.items()): 201 201 model_cbox = model_cbox.replace(key, value) 202 202 constraint_value = constraint_value.replace(key, value) … … 328 328 sizer.Add(tab_used, (iy, ix), (1, 1), 329 329 wx.EXPAND | wx.ADJUST_MINSIZE, 0) 330 for id, value in self.page_finder.ite ritems():330 for id, value in self.page_finder.items(): 331 331 if id not in self.parent.opened_pages: 332 332 continue … … 757 757 self.set_button.Disable() 758 758 759 for id, model in self.constraint_dict.ite ritems():759 for id, model in self.constraint_dict.items(): 760 760 # check if all parameters have been selected for constraint 761 761 # then do not allow add constraint on parameters 762 762 self.model_cbox_left.Append(str(model.name), model) 763 763 self.model_cbox_left.Select(0) 764 for id, model in self.constraint_dict.ite ritems():764 for id, model in self.constraint_dict.items(): 765 765 # check if all parameters have been selected for constraint 766 766 # then do not allow add constraint on parameters … … 814 814 model_right = self.model_cbox_right.GetValue() 815 815 model_b = self.model_cbox_right.GetClientData(selection_b) 816 for id, dic_model in self.constraint_dict.ite ritems():816 for id, dic_model in self.constraint_dict.items(): 817 817 if model == dic_model: 818 818 param_list = self.page_finder[id].get_param2fit() … … 857 857 if len(self.constraints_list) != 0: 858 858 nb_fit_param = 0 859 for id, model in self.constraint_dict.ite ritems():859 for id, model in self.constraint_dict.items(): 860 860 nb_fit_param += len(self.page_finder[id].get_param2fit()) 861 861 # Don't add anymore … … 879 879 model_cbox = wx.ComboBox(self, wx.ID_ANY, style=wx.CB_READONLY) 880 880 model_cbox.Clear() 881 for id, model in self.constraint_dict.ite ritems():881 for id, model in self.constraint_dict.items(): 882 882 # check if all parameters have been selected for constraint 883 883 # then do not allow add constraint on parameters … … 898 898 # Remove button 899 899 #btRemove = wx.Button(self, self.ID_REMOVE, 'Remove') 900 bt_remove = wx.Button(self, self._ids.next(), 'Remove')900 bt_remove = wx.Button(self, next(self._ids), 'Remove') 901 901 bt_remove.Bind(wx.EVT_BUTTON, self.on_remove, 902 902 id=bt_remove.GetId()) … … 931 931 hide buttons related constraint 932 932 """ 933 for id in self.page_finder. iterkeys():933 for id in self.page_finder.keys(): 934 934 self.page_finder[id].clear_model_param() 935 935 … … 969 969 model = model_cbox.GetClientData(n) 970 970 param_list = [] 971 for id, dic_model in self.constraint_dict.ite ritems():971 for id, dic_model in self.constraint_dict.items(): 972 972 if model == dic_model: 973 973 param_list = self.page_finder[id].get_param2fit() … … 1056 1056 msg += " in combobox to set constraint! " 1057 1057 wx.PostEvent(self.parent.parent, StatusEvent(status=msg)) 1058 for id, value in self.constraint_dict.ite ritems():1058 for id, value in self.constraint_dict.items(): 1059 1059 if model == value: 1060 1060 if constraint == "": … … 1080 1080 return False 1081 1081 1082 for fid in self.page_finder[id]. iterkeys():1082 for fid in self.page_finder[id].keys(): 1083 1083 # wrap in param/constraint in str() to remove unicode 1084 1084 self.page_finder[id].set_model_param(str(param), -
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) -
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.