Changeset fa81e94 in sasview
- 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
- Files:
-
- 9 added
- 66 edited
Legend:
- Unmodified
- Added
- Removed
-
setup.py
r7fb471d rfa81e94 380 380 "src", "sas", "qtgui", "Perspectives", "Fitting", "UI") 381 381 packages.extend(["sas.qtgui.Perspectives.Fitting", "sas.qtgui.Perspectives.Fitting.UI"]) 382 383 package_dir["sas.qtgui.Perspectives.Inversion"] = os.path.join( 384 "src", "sas", "qtgui", "Perspectives", "Inversion") 385 package_dir["sas.qtgui.Perspectives.Inversion.UI"] = os.path.join( 386 "src", "sas", "qtgui", "Perspectives", "Inversion", "UI") 387 packages.extend(["sas.qtgui.Perspectives.Inversion", "sas.qtgui.Perspectives.Inversion.UI"]) 382 388 383 389 ## Plotting -
src/sas/qtgui/Perspectives/__init__.py
rb3e8629 rfa81e94 4 4 from .Fitting.FittingPerspective import FittingWindow 5 5 from .Invariant.InvariantPerspective import InvariantWindow 6 from .Inversion.InversionPerspective import InversionWindow 6 7 7 8 PERSPECTIVES = { 8 9 FittingWindow.name: FittingWindow, 9 10 InvariantWindow.name: InvariantWindow, 11 InversionWindow.name: InversionWindow 10 12 } -
src/sas/sascalc/fit/models.py
rb963b20 rfa81e94 139 139 if type is not None and issubclass(type, py_compile.PyCompileError): 140 140 print("Problem with", repr(value)) 141 raise type, value, tb141 raise (type, value, tb) 142 142 return 1 143 143 -
src/sas/sasgui/guiframe/data_processor.py
ra1b8fee rfa81e94 909 909 msg = "Edit axis doesn't understand this selection.\n" 910 910 msg += "Please select only one column" 911 raise ValueError, msg911 raise (ValueError, msg) 912 912 for (_, cell_col) in grid.selected_cells: 913 913 if cell_col != col: … … 915 915 msg += "this operation.\n" 916 916 msg += "Please select elements of the same col.\n" 917 raise ValueError, msg917 raise (ValueError, msg) 918 918 919 919 # Finally check the highlighted cell if any cells missing … … 922 922 msg = "No item selected.\n" 923 923 msg += "Please select only one column or one cell" 924 raise ValueError, msg924 raise (ValueError, msg) 925 925 return grid.selected_cells 926 926 … … 1326 1326 if sentence.strip() == "": 1327 1327 msg = "Select column values for x axis" 1328 raise ValueError, msg1328 raise (ValueError, msg) 1329 1329 except: 1330 1330 msg = "X axis value error." … … 1345 1345 if sentence.strip() == "": 1346 1346 msg = "select value for y axis" 1347 raise ValueError, msg1347 raise (ValueError, msg) 1348 1348 except: 1349 1349 msg = "Y axis value error." … … 1631 1631 1632 1632 # We need to grab a WxMenu handle here, otherwise the next one to grab 1633 # the handle will be treated as the Edi t Menu handle when checking in1633 # the handle will be treated as the Edi)t Menu handle when checking in 1634 1634 # on_menu_open event handler and thus raise an exception when it hits an 1635 1635 # unitialized object. Alternative is to comment out that whole section -
src/sas/sasgui/guiframe/gui_manager.py
rb963b20 rfa81e94 2519 2519 wx.PostEvent(self, StatusEvent(status=msg, 2520 2520 info="error")) 2521 raise ValueError, msg2521 raise (ValueError, msg) 2522 2522 # text = str(data) 2523 2523 text = data.__str__() -
src/sas/sasgui/guiframe/local_perspectives/plotting/Plotter1D.py
rc416a17 rfa81e94 475 475 try: 476 476 self._onEVT_FUNC_PROPERTY() 477 except Exception, exc:477 except (Exception, exc): 478 478 wx.PostEvent(self.parent, 479 479 StatusEvent(status="Plotting Error: %s" % str(exc), info="error")) … … 492 492 # MAC: forcing to plot 2D avg 493 493 self.canvas._onDrawIdle() 494 except Exception, exc:494 except (Exception, exc): 495 495 wx.PostEvent(self.parent, StatusEvent(status=\ 496 496 "Plotting Error: %s" % str(exc), info="error")) -
src/sas/sasgui/guiframe/local_perspectives/plotting/SectorSlicer.py
rcee5c78 rfa81e94 232 232 msg = "Phi left and phi right are different" 233 233 msg += " %f, %f" % (self.left_line.phi, self.right_line.phi) 234 raise ValueError, msg234 raise (ValueError, msg) 235 235 params["Phi [deg]"] = self.main_line.theta * 180 / numpy.pi 236 236 params["Delta_Phi [deg]"] = numpy.fabs(self.left_line.phi * 180 / numpy.pi) -
src/sas/sasgui/guiframe/local_perspectives/plotting/binder.py
r463e7ffc rfa81e94 187 187 # Check that the trigger is valid 188 188 if trigger not in self._actions: 189 raise ValueError, "%s invalid --- valid triggers are %s" \190 % (trigger, ", ".join(self.events)) 189 raise (ValueError, "%s invalid --- valid triggers are %s" \ 190 % (trigger, ", ".join(self.events))) 191 191 # Register the trigger callback 192 192 self._actions[trigger][artist] = action … … 203 203 """ 204 204 if action not in self.events: 205 raise ValueError, "Trigger expects " + ", ".join(self.events)205 raise (ValueError, "Trigger expects " + ", ".join(self.events)) 206 206 # Tag the event with modifiers 207 207 for mod in ('alt', 'control', 'shift', 'meta'): -
src/sas/sasgui/guiframe/local_perspectives/plotting/boxSlicer.py
rcee5c78 rfa81e94 136 136 if new_slab is None: 137 137 msg = "post data:cannot average , averager is empty" 138 raise ValueError, msg138 raise (ValueError, msg) 139 139 self.averager = new_slab 140 140 if self.direction == "X": … … 152 152 else: 153 153 msg = "post data:no Box Average direction was supplied" 154 raise ValueError, msg154 raise (ValueError, msg) 155 155 # # Average data2D given Qx or Qy 156 156 box = self.averager(x_min=x_min, x_max=x_max, y_min=y_min, y_max=y_max, -
src/sas/sasgui/guiframe/local_perspectives/plotting/plotting.py
r2d9526d rfa81e94 200 200 201 201 msg = "1D Panel of group ID %s could not be created" % str(group_id) 202 raise ValueError, msg202 raise (ValueError, msg) 203 203 204 204 def create_2d_panel(self, data, group_id): … … 218 218 return new_panel 219 219 msg = "2D Panel of group ID %s could not be created" % str(group_id) 220 raise ValueError, msg220 raise (ValueError, msg) 221 221 222 222 def update_panel(self, data, panel): … … 238 238 msg += " to panel %s\n" % str(panel.window_caption) 239 239 msg += "Please edit %s's units, labels" % str(data.name) 240 raise ValueError, msg240 raise (ValueError, msg) 241 241 else: 242 242 if panel.group_id not in data.list_group_id: -
src/sas/sasgui/guiframe/local_perspectives/plotting/sector_mask.py
r7432acb rfa81e94 175 175 msg += "different %f, %f" % (self.left_line.phi, 176 176 self.right_line.phi) 177 raise ValueError, msg177 raise (ValueError, msg) 178 178 params["Phi"] = self.main_line.theta 179 179 params["Delta_Phi"] = math.fabs(self.left_line.phi) -
src/sas/sasgui/guiframe/plugin_base.py
r7432acb rfa81e94 277 277 """ 278 278 msg = "%s plugin: does not support import theory" % str(self.sub_menu) 279 raise ValueError, msg279 raise (ValueError, msg) 280 280 281 281 def on_set_state_helper(self, event): -
src/sas/sasgui/guiframe/proxy.py
ra1b8fee rfa81e94 127 127 logger.debug("Trying Direct connection to %s..."%self.url) 128 128 response = urllib2.urlopen(req, timeout=self.timeout) 129 except Exception, e:129 except (Exception, e): 130 130 logger.debug("Failed!") 131 131 logger.debug(e) … … 134 134 self._set_proxy() 135 135 response = urllib2.urlopen(req, timeout=self.timeout) 136 except Exception, e:136 except (Exception, e): 137 137 logger.debug("Failed!") 138 138 logger.debug(e) … … 144 144 self._set_proxy(proxy) 145 145 response = urllib2.urlopen(req, timeout=self.timeout) 146 except Exception, e:146 except (Exception, e): 147 147 logger.debug("Failed!") 148 148 logger.debug(e) -
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]) -
src/sas/sasgui/plottools/LineModel.py
- Property mode changed from 100644 to 100755
ra26f67f rfa81e94 83 83 elif x.__class__.__name__ == 'tuple': 84 84 msg = "Tuples are not allowed as input to BaseComponent models" 85 raise ValueError , msg85 raise ValueError(msg) 86 86 else: 87 87 return self._line(x) … … 105 105 elif x.__class__.__name__ == 'tuple': 106 106 msg = "Tuples are not allowed as input to BaseComponent models" 107 raise ValueError , msg107 raise ValueError(msg) 108 108 else: 109 109 return self._line(x) -
src/sas/sasgui/plottools/PlotPanel.py
- Property mode changed from 100644 to 100755
ra1b8fee rfa81e94 2 2 Plot panel. 3 3 """ 4 from __future__ import print_function 4 5 5 6 6 import logging … … 16 16 from matplotlib.figure import Figure 17 17 import os 18 import transform18 from . import transform 19 19 #TODO: make the plottables interactive 20 from binder import BindArtist20 from .binder import BindArtist 21 21 from matplotlib.font_manager import FontProperties 22 22 DEBUG = False 23 23 24 from plottables import Graph25 from TextDialog import TextDialog26 from LabelDialog import LabelDialog24 from .plottables import Graph 25 from .TextDialog import TextDialog 26 from .LabelDialog import LabelDialog 27 27 import operator 28 28 … … 44 44 for a in obj.get_children(): show_tree(a, d + 1) 45 45 46 from convert_units import convert_unit46 from .convert_units import convert_unit 47 47 48 48 … … 116 116 self.figure = Figure(None, dpi, linewidth=2.0) 117 117 self.color = '#b3b3b3' 118 from canvas import FigureCanvas118 from .canvas import FigureCanvas 119 119 self.canvas = FigureCanvas(self, -1, self.figure) 120 120 self.SetColor(color) … … 657 657 else: 658 658 plot_dict = plotlist 659 from fitDialog import LinearFit660 661 if len( plot_dict.keys()) > 0:662 first_item = plot_dict.keys()[0]659 from .fitDialog import LinearFit 660 661 if len(list(plot_dict.keys())) > 0: 662 first_item = list(plot_dict.keys())[0] 663 663 dlg = LinearFit(parent=None, plottable=first_item, 664 664 push_data=self.onFitDisplay, … … 691 691 return 692 692 name = menu.GetHelpString(id) 693 for plot in self.plots.values():693 for plot in list(self.plots.values()): 694 694 if plot.name == name: 695 695 self.graph.selected_plottable = plot.id … … 703 703 704 704 """ 705 from fitDialog import LinearFit705 from .fitDialog import LinearFit 706 706 if self._fit_dialog is not None: 707 707 return … … 733 733 self._fit_dialog = None 734 734 plot_list = self.graph.returnPlottable() 735 if len( plot_list.keys()) > 0:736 first_item = plot_list.keys()[0]735 if len(list(plot_list.keys())) > 0: 736 first_item = list(plot_list.keys())[0] 737 737 if first_item.x != []: 738 from PropertyDialog import Properties738 from .PropertyDialog import Properties 739 739 dial = Properties(self, -1, 'Properties') 740 740 dial.setValues(self.prevXtrans, self.prevYtrans, self.viewModel) … … 956 956 hl = sorted(zip(handles, labels), 957 957 key=operator.itemgetter(1)) 958 handles2, labels2 = zip(*hl)958 handles2, labels2 = list(zip(*hl)) 959 959 self.line_collections_list = handles2 960 960 self.legend = self.subplot.legend(handles2, labels2, … … 986 986 hl = sorted(zip(handles, labels), 987 987 key=operator.itemgetter(1)) 988 handles2, labels2 = zip(*hl)988 handles2, labels2 = list(zip(*hl)) 989 989 self.line_collections_list = handles2 990 990 self.legend = self.subplot.legend(handles2, labels2, … … 1247 1247 hl = sorted(zip(handles, labels), 1248 1248 key=operator.itemgetter(1)) 1249 handles2, labels2 = zip(*hl)1249 handles2, labels2 = list(zip(*hl)) 1250 1250 self.line_collections_list = handles2 1251 1251 self.legend = ax.legend(handles2, labels2, … … 1327 1327 if id is None: 1328 1328 id = name 1329 from plottable_interactor import PointInteractor1329 from .plottable_interactor import PointInteractor 1330 1330 p = PointInteractor(self, self.subplot, zorder=zorder, id=id) 1331 1331 if p.markersize is not None: … … 1344 1344 if id is None: 1345 1345 id = name 1346 from plottable_interactor import PointInteractor1346 from .plottable_interactor import PointInteractor 1347 1347 p = PointInteractor(self, self.subplot, zorder=zorder, id=id) 1348 1348 p.curve(x, y, dy=dy, color=color, symbol=symbol, zorder=zorder, … … 1754 1754 self.graph.delete(self.fit_result) 1755 1755 if hasattr(self, 'plots'): 1756 if 'fit' in self.plots.keys():1756 if 'fit' in list(self.plots.keys()): 1757 1757 del self.plots['fit'] 1758 1758 self.ly = None -
src/sas/sasgui/plottools/__init__.py
- Property mode changed from 100644 to 100755
refe730d rfa81e94 1 from PlotPanel import PlotPanel2 from plottables import Data1D, Theory1D1 from .PlotPanel import PlotPanel 2 from .plottables import Data1D, Theory1D -
src/sas/sasgui/plottools/arrow3d.py
- Property mode changed from 100644 to 100755
r7432acb rfa81e94 59 59 return 60 60 xs3d, ys3d, zs3d = self._verts3d 61 for i in xrange(len(xs3d)):61 for i in range(len(xs3d)): 62 62 xs, ys, _ = proj3d.proj_transform(xs3d[i], ys3d[i], zs3d[i], renderer.M) 63 63 self.set_positions((xs[0], ys[0]), (xs[1], ys[1])) -
src/sas/sasgui/plottools/binder.py
- Property mode changed from 100644 to 100755
ra1b8fee rfa81e94 2 2 Extension to MPL to support the binding of artists to key/mouse events. 3 3 """ 4 from __future__ import print_function 4 5 5 6 6 import sys … … 28 28 return self.artist is not other.artist 29 29 30 def __ nonzero__(self):30 def __bool__(self): 31 31 return self.artist is not None 32 32 … … 125 125 for cid in self._connections: self.canvas.mpl_disconnect(cid) 126 126 except: 127 logger.error("Error disconnection canvas: %s" % sys.exc_ value)127 logger.error("Error disconnection canvas: %s" % sys.exc_info()[1]) 128 128 self._connections = [] 129 129 … … 189 189 # Check that the trigger is valid 190 190 if trigger not in self._actions: 191 raise ValueError ,"%s invalid --- valid triggers are %s"\192 % (trigger, ", ".join(self.events)) 191 raise ValueError("%s invalid --- valid triggers are %s"\ 192 % (trigger, ", ".join(self.events))) 193 193 194 194 # Register the trigger callback … … 205 205 """ 206 206 if action not in self.events: 207 raise ValueError , "Trigger expects " + ", ".join(self.events)207 raise ValueError("Trigger expects " + ", ".join(self.events)) 208 208 209 209 # Tag the event with modifiers -
src/sas/sasgui/plottools/canvas.py
- Property mode changed from 100644 to 100755
r7432acb rfa81e94 98 98 dc.DrawBitmap(self.canvas.bitmap, (0, 0)) 99 99 except: 100 logger.error(sys.exc_ value)100 logger.error(sys.exc_info()[1]) 101 101 102 102 # restore original figure resolution … … 209 209 fig.draw(self) 210 210 except ValueError: 211 logger.error(sys.exc_ value)211 logger.error(sys.exc_info()[1]) 212 212 else: 213 213 self._isRendered = False -
src/sas/sasgui/plottools/convert_units.py
- Property mode changed from 100644 to 100755
ra1b8fee rfa81e94 3 3 This is a cleaned up version of unitConverter.py 4 4 """ 5 from __future__ import print_function 5 6 6 7 7 import re … … 44 44 unit = toks[0] + "^{" + str(powerer) + "}" 45 45 else: 46 raise ValueError , "missing } in unit expression"46 raise ValueError("missing } in unit expression") 47 47 else: # no powerer 48 48 if power != 1: 49 49 unit = "(" + unit + ")" + "^{" + str(power) + "}" 50 50 else: 51 raise ValueError , "empty unit ,enter a powerer different from zero"51 raise ValueError("empty unit ,enter a powerer different from zero") 52 52 return unit 53 53 -
src/sas/sasgui/plottools/fitDialog.py
- Property mode changed from 100644 to 100755
r7432acb rfa81e94 1 1 import wx 2 from plottables import Theory1D2 from .plottables import Theory1D 3 3 import math 4 4 import numpy as np 5 import fittings6 import transform5 from . import fittings 6 from . import transform 7 7 import sys 8 8 … … 86 86 self.layout() 87 87 # Receives the type of model for the fitting 88 from LineModel import LineModel88 from .LineModel import LineModel 89 89 self.model = LineModel() 90 90 # Display the fittings values … … 671 671 return x 672 672 else: 673 raise ValueError , "cannot compute log of a negative number"673 raise ValueError("cannot compute log of a negative number") 674 674 675 675 def floatInvTransform(self, x): … … 734 734 except: 735 735 msg = "LinearFit.set_fit_region: fit range must be floats" 736 raise ValueError , msg736 raise ValueError(msg) 737 737 self.xminFit.SetValue(format_number(xmin)) 738 738 self.xmaxFit.SetValue(format_number(xmax)) -
src/sas/sasgui/plottools/fittings.py
- Property mode changed from 100644 to 100755
ra1b8fee rfa81e94 14 14 15 15 """ 16 from __future__ import print_function 16 17 17 18 18 from scipy import optimize … … 101 101 # Testing implementation 102 102 # Fit a Line model 103 from LineModel import LineModel103 from .LineModel import LineModel 104 104 line = LineModel() 105 105 cstA = Parameter(line, 'A', event.cstA) -
src/sas/sasgui/plottools/plottable_interactor.py
- Property mode changed from 100644 to 100755
ra1b8fee rfa81e94 2 2 This module allows more interaction with the plot 3 3 """ 4 from __future__ import print_function 5 6 from BaseInteractor import _BaseInteractor4 5 6 from .BaseInteractor import _BaseInteractor 7 7 8 8 -
src/sas/sasgui/plottools/plottables.py
- Property mode changed from 100644 to 100755
r2d9526d rfa81e94 242 242 selected_color = plottable.custom_color 243 243 selected_plottable = None 244 for p in self.plottables.keys():244 for p in list(self.plottables.keys()): 245 245 if plottable.id == p.id: 246 246 selected_plottable = p … … 389 389 390 390 """ 391 raise NotImplemented , "Not a valid transform"391 raise NotImplemented("Not a valid transform") 392 392 393 393 # Related issues … … 517 517 label_dict[collection[0]] = basename 518 518 else: 519 for i in xrange(len(collection)):519 for i in range(len(collection)): 520 520 label_dict[collection[i]] = "%s %d" % (basename, i) 521 521 return label_dict … … 689 689 msg = "Plottable.View: Given x and dx are not" 690 690 msg += " of the same length" 691 raise ValueError , msg691 raise ValueError(msg) 692 692 # Check length of y array 693 693 if not len(y) == len(x): 694 694 msg = "Plottable.View: Given y " 695 695 msg += "and x are not of the same length" 696 raise ValueError , msg696 raise ValueError(msg) 697 697 698 698 if dy is not None and not len(dy) == 0 and not len(y) == len(dy): 699 699 msg = "Plottable.View: Given y and dy are not of the same " 700 700 msg += "length: len(y)=%s, len(dy)=%s" % (len(y), len(dy)) 701 raise ValueError , msg701 raise ValueError(msg) 702 702 self.x = [] 703 703 self.y = [] … … 734 734 msg = "Plottable.View: transformed x " 735 735 msg += "and y are not of the same length" 736 raise ValueError , msg736 raise ValueError(msg) 737 737 if has_err_x and not (len(self.x) == len(self.dx)): 738 738 msg = "Plottable.View: transformed x and dx" 739 739 msg += " are not of the same length" 740 raise ValueError , msg740 raise ValueError(msg) 741 741 if has_err_y and not (len(self.y) == len(self.dy)): 742 742 msg = "Plottable.View: transformed y" 743 743 msg += " and dy are not of the same length" 744 raise ValueError , msg744 raise ValueError(msg) 745 745 # Check that negative values are not plot on x and y axis for 746 746 # log10 transformation … … 814 814 except: 815 815 logger.error("check_data_logX: skipping point x %g", self.x[i]) 816 logger.error(sys.exc_ value)816 logger.error(sys.exc_info()[1]) 817 817 self.x = tempx 818 818 self.y = tempy … … 844 844 except: 845 845 logger.error("check_data_logY: skipping point %g", self.y[i]) 846 logger.error(sys.exc_ value)846 logger.error(sys.exc_info()[1]) 847 847 848 848 self.x = tempx … … 1108 1108 Plottable.__init__(self) 1109 1109 msg = "Theory1D is no longer supported, please use Data1D and change symbol.\n" 1110 raise DeprecationWarning , msg1110 raise DeprecationWarning(msg) 1111 1111 1112 1112 class Fit1D(Plottable): -
src/sas/sasgui/plottools/transform.py
- Property mode changed from 100644 to 100755
r7432acb rfa81e94 24 24 """ 25 25 if not x > 0: 26 raise ValueError , "Transformation only accepts positive values."26 raise ValueError("Transformation only accepts positive values.") 27 27 else: 28 28 return x … … 50 50 """ 51 51 if not x >= 0: 52 raise ValueError , "square root of a negative value "52 raise ValueError("square root of a negative value ") 53 53 else: 54 54 return math.sqrt(x) … … 76 76 """ 77 77 if not x >= 0: 78 raise ValueError , "double square root of a negative value "78 raise ValueError("double square root of a negative value ") 79 79 else: 80 80 return math.sqrt(math.sqrt(x)) … … 90 90 """ 91 91 if not x > 0: 92 raise ValueError , "Log(x)of a negative value "92 raise ValueError("Log(x)of a negative value ") 93 93 else: 94 94 return math.log(x) … … 100 100 return 1 / x 101 101 else: 102 raise ValueError , "cannot divide by zero"102 raise ValueError("cannot divide by zero") 103 103 104 104 … … 109 109 return 1 / math.sqrt(y) 110 110 else: 111 raise ValueError , "transform.toOneOverSqrtX: cannot be computed"111 raise ValueError("transform.toOneOverSqrtX: cannot be computed") 112 112 113 113 … … 118 118 return math.log(y * (x ** 2)) 119 119 else: 120 raise ValueError , "transform.toLogYX2: cannot be computed"120 raise ValueError("transform.toLogYX2: cannot be computed") 121 121 122 122 … … 127 127 return math.log(math.pow(x, 4) * y) 128 128 else: 129 raise ValueError , "transform.toLogYX4: input error"129 raise ValueError("transform.toLogYX4: input error") 130 130 131 131 … … 149 149 """ 150 150 if not (x * y) > 0: 151 raise ValueError , "Log(X*Y)of a negative value "151 raise ValueError("Log(X*Y)of a negative value ") 152 152 else: 153 153 return math.log(x * y) … … 211 211 else: 212 212 msg = "transform.errFromX2: can't compute error of negative x" 213 raise ValueError , msg213 raise ValueError(msg) 214 214 215 215 … … 245 245 else: 246 246 msg = "transform.errFromX4: can't compute error of negative x" 247 raise ValueError , msg247 raise ValueError(msg) 248 248 249 249 … … 264 264 msg = "Transformation does not accept" 265 265 msg += " point that are consistent with zero." 266 raise ValueError , msg266 raise ValueError(msg) 267 267 if x != 0: 268 268 dx = dx / (x * math.log(10)) 269 269 else: 270 raise ValueError , "errToLogX: divide by zero"270 raise ValueError("errToLogX: divide by zero") 271 271 return dx 272 272 … … 287 287 dx = dx / x 288 288 else: 289 raise ValueError , "errToLogX: divide by zero"289 raise ValueError("errToLogX: divide by zero") 290 290 return dx 291 291 … … 312 312 msg = "Transformation does not accept point " 313 313 msg += " that are consistent with zero." 314 raise ValueError , msg314 raise ValueError(msg) 315 315 if x != 0 and y != 0: 316 316 if dx is None: … … 320 320 err = (dx / x) ** 2 + (dy / y) ** 2 321 321 else: 322 raise ValueError , "cannot compute this error"322 raise ValueError("cannot compute this error") 323 323 324 324 return math.sqrt(math.fabs(err)) … … 335 335 msg = "Transformation does not accept point" 336 336 msg += " that are consistent with zero." 337 raise ValueError , msg337 raise ValueError(msg) 338 338 if x > 0 and y > 0: 339 339 if dx is None: … … 343 343 err = (2.0 * dx / x) ** 2 + (dy / y) ** 2 344 344 else: 345 raise ValueError , "cannot compute this error"345 raise ValueError("cannot compute this error") 346 346 return math.sqrt(math.fabs(err)) 347 347 … … 357 357 err = dx / x ** 2 358 358 else: 359 raise ValueError , "Cannot compute this error"359 raise ValueError("Cannot compute this error") 360 360 return math.fabs(err) 361 361 … … 371 371 err = -1 / 2 * math.pow(x, -3.0 / 2.0) * dx 372 372 else: 373 raise ValueError , "Cannot compute this error"373 raise ValueError("Cannot compute this error") 374 374 return math.fabs(err) 375 375 … … 387 387 msg = "Transformation does not accept point " 388 388 msg += " that are consistent with zero." 389 raise ValueError , msg389 raise ValueError(msg) 390 390 if dx is None: 391 391 dx = 0
Note: See TracChangeset
for help on using the changeset viewer.