Ignore:
Timestamp:
Nov 15, 2017 4:33:09 AM (6 years ago)
Author:
Piotr Rozyczko <rozyczko@…>
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
Message:

Initial commit of the P(r) inversion perspective.
Code merged from Jeff Krzywon's ESS_GUI_Pr branch.
Also, minor 2to3 mods to sascalc/sasgui to enble error free setup.

Location:
src/sas/sasgui/perspectives/calculator
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sasgui/perspectives/calculator/__init__.py

    • Property mode changed from 100644 to 100755
    r5a405bd rfa81e94  
    22import os 
    33from distutils.filelist import findall 
    4 from calculator import * 
     4from .calculator import * 
    55N_DIR = 12 
    66def get_data_path(media): 
  • src/sas/sasgui/perspectives/calculator/collimation_editor.py

    • Property mode changed from 100644 to 100755
    r959eb01 rfa81e94  
    66from sas.sascalc.dataloader.loader import Loader 
    77from sas.sascalc.dataloader.data_info import Aperture, Collimation 
    8 from aperture_editor import ApertureDialog 
     8from .aperture_editor import ApertureDialog 
    99 
    1010from sas.sasgui.guiframe.utils import check_float 
  • src/sas/sasgui/perspectives/calculator/data_editor.py

    • Property mode changed from 100644 to 100755
    r235f514 rfa81e94  
    77from sas.sascalc.dataloader.loader import Loader 
    88from sas.sascalc.dataloader.data_info import Data2D 
    9 from detector_editor import DetectorDialog 
    10 from collimation_editor import CollimationDialog 
    11 from console import ConsoleDialog 
     9from .detector_editor import DetectorDialog 
     10from .collimation_editor import CollimationDialog 
     11from .console import ConsoleDialog 
    1212 
    1313from sas.sasgui.guiframe.events import StatusEvent 
     
    397397        if data is None: 
    398398            return 
    399         from sample_editor import SampleDialog 
     399        from .sample_editor import SampleDialog 
    400400        dlg = SampleDialog(parent=self, sample=data.sample) 
    401401        dlg.set_manager(self) 
     
    409409        if data is None: 
    410410            return 
    411         from source_editor import SourceDialog 
     411        from .source_editor import SourceDialog 
    412412        dlg = SourceDialog(parent=self, source=data.source) 
    413413        dlg.set_manager(self) 
     
    527527        try: 
    528528            #Load data 
    529             from load_thread import DataReader 
     529            from .load_thread import DataReader 
    530530            ## If a thread is already started, stop it 
    531531            if self.reader is not None and self.reader.isrunning(): 
     
    536536            self.reader.queue() 
    537537        except: 
    538             msg = "Data Editor: %s" % (sys.exc_value) 
     538            msg = "Data Editor: %s" % (sys.exc_info()[1]) 
    539539            load_error(msg) 
    540540            return 
  • src/sas/sasgui/perspectives/calculator/data_operator.py

    • Property mode changed from 100644 to 100755
    r7432acb rfa81e94  
    202202        else: 
    203203            text = name 
    204         state_list = self.get_datalist().values() 
     204        state_list = list(self.get_datalist().values()) 
    205205        name_list = [] 
    206206        for state in state_list: 
    207207            if state.data is None: 
    208208                theory_list = state.get_theory() 
    209                 theory, _ = theory_list.values()[0] 
     209                theory, _ = list(theory_list.values())[0] 
    210210                d_name = str(theory.name) 
    211211            else: 
     
    397397            self._set_textctrl_color(self.data1_cbox, 'pink') 
    398398            self._set_textctrl_color(self.data2_cbox, 'pink') 
    399             msg = "DataOperation: %s" % sys.exc_value 
     399            msg = "DataOperation: %s" % sys.exc_info()[1] 
    400400            self.send_warnings(msg, 'error') 
    401401            self.output = None 
     
    411411        operator = self.operator_cbox.GetClientData(pos) 
    412412        try: 
    413             exec "output = data1 %s data2" % operator 
     413            exec("output = data1 %s data2" % operator) 
    414414        except: 
    415415            raise 
     
    532532        self.data2_cbox.SetClientData(pos3, val) 
    533533        dnames = [] 
    534         ids = self._data.keys() 
     534        ids = list(self._data.keys()) 
    535535        for id in ids: 
    536536            if id is not None: 
     
    539539                else: 
    540540                    theory_list = self._data[id].get_theory() 
    541                     theory, _ = theory_list.values()[0] 
     541                    theory, _ = list(theory_list.values())[0] 
    542542                    dnames.append(theory.name) 
    543543        ind = np.argsort(dnames) 
    544544        if len(ind) > 0: 
    545             val_list = np.array(self._data.values())[ind] 
     545            val_list = np.array(list(self._data.values()))[ind] 
    546546            for datastate in val_list: 
    547547                data = datastate.data 
     
    558558                try: 
    559559                    theory_list = datastate.get_theory() 
    560                     for theory, _ in theory_list.values(): 
     560                    for theory, _ in list(theory_list.values()): 
    561561                        th_name = theory.name 
    562562                        posth1 = self.data1_cbox.Append(str(th_name)) 
     
    588588        self.send_warnings('') 
    589589        self.data_namectr.SetBackgroundColour('white') 
    590         state_list = self.get_datalist().values() 
     590        state_list = list(self.get_datalist().values()) 
    591591        name = self.data_namectr.GetValue().strip() 
    592592        name_list = [] 
     
    594594            if state.data is None: 
    595595                theory_list = state.get_theory() 
    596                 theory, _ = theory_list.values()[0] 
     596                theory, _ = list(theory_list.values())[0] 
    597597                d_name = str(theory.name) 
    598598            else: 
     
    896896        list = [] 
    897897        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] 
    900900            if first_item.x != []: 
    901901                from sas.sasgui.plottools.PropertyDialog import Properties 
  • src/sas/sasgui/perspectives/calculator/density_panel.py

    • Property mode changed from 100644 to 100755
    r7432acb rfa81e94  
    364364        except: 
    365365            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]) 
    367367                wx.PostEvent(self.base, StatusEvent(status=msg)) 
    368368        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 
    22 
    33import wx 
     
    3535            self.set_values() 
    3636        except: 
    37             print("error", sys.exc_value) 
     37            print("error", sys.exc_info()[1]) 
    3838 
    3939    def _define_structure(self): 
  • src/sas/sasgui/perspectives/calculator/gen_scatter_panel.py

    • Property mode changed from 100644 to 100755
    ra1b8fee rfa81e94  
    33This module relies on guiframe manager. 
    44""" 
    5 from __future__ import print_function 
     5 
    66 
    77import wx 
     
    228228        sizer.Add(unit_title, (iy, ix), (1, 1), \ 
    229229                            wx.EXPAND | wx.ADJUST_MINSIZE, 0) 
    230         key_list = params.keys() 
     230        key_list = list(params.keys()) 
    231231        key_list.sort() 
    232232        for param in key_list: 
     
    560560            if self.parent.parent is None: 
    561561                return 
    562             msg = "Generic SAS Calculator: %s" % (sys.exc_value) 
     562            msg = "Generic SAS Calculator: %s" % (sys.exc_info()[1]) 
    563563            wx.PostEvent(self.parent.parent, 
    564564                          StatusEvent(status=msg, type='stop')) 
     
    761761        # II. Plot selective points in color 
    762762        other_color = np.ones(len(pix_symbol), dtype='bool') 
    763         for key in color_dic.keys(): 
     763        for key in list(color_dic.keys()): 
    764764            chosen_color = pix_symbol == key 
    765765            if np.any(chosen_color): 
     
    775775                # Get atom names not in the list 
    776776                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())] 
    778778                a_name = a_names[0] 
    779779                for name in a_names: 
     
    899899 
    900900        except: 
    901             msg = "%s." % sys.exc_value 
     901            msg = "%s." % sys.exc_info()[1] 
    902902            status_type = 'stop' 
    903903            self._status_info(msg, status_type) 
     
    12851285            else: 
    12861286               sld_sets[list[0]] = None 
    1287         for key in sld_sets.keys(): 
     1287        for key in list(sld_sets.keys()): 
    12881288            key_low = key.lower() 
    12891289            if key_low.count('mx') > 0: 
     
    13361336                    return 
    13371337 
    1338             for key in sets.keys(): 
     1338            for key in list(sets.keys()): 
    13391339                setattr(omfdata, key, sets[key]) 
    13401340 
     
    13451345            self.sld_data.filename = "Default SLD Profile" 
    13461346        except: 
    1347             msg = "OMF Panel: %s" % sys.exc_value 
     1347            msg = "OMF Panel: %s" % sys.exc_info()[1] 
    13481348            infor = 'Error' 
    13491349            #logger.error(msg) 
     
    13751375        step_list = self._get_step_key_list(omfdata) 
    13761376        for ctr_list in self.nodes: 
    1377             for key in nodes_list.keys(): 
     1377            for key in list(nodes_list.keys()): 
    13781378                if ctr_list[0] == key: 
    13791379                    ctr_list[1].SetValue(format_number(nodes_list[key], True)) 
     
    13811381                    break 
    13821382        for ctr_list in self.stepsize: 
    1383             for key in step_list.keys(): 
     1383            for key in list(step_list.keys()): 
    13841384                if ctr_list[0] == key: 
    13851385                    ctr_list[1].SetValue(format_number(step_list[key], True)) 
     
    14421442        sld_key_list = self._get_slds_key_list(omfdata) 
    14431443        # 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())] 
    14451445        # Sort here 
    14461446        key_list.sort() 
     
    14851485        ix = 0 
    14861486        iy = -1 
    1487         for key, value in key_list.iteritems(): 
     1487        for key, value in key_list.items(): 
    14881488            iy += 1 
    14891489            ix = 0 
     
    15211521        iy = -1 
    15221522        #key_list.sort() 
    1523         for key, value in key_list.iteritems(): 
     1523        for key, value in key_list.items(): 
    15241524            iy += 1 
    15251525            ix = 0 
     
    16411641        sld_list = self._get_slds_key_list(sld_data) 
    16421642        for ctr_list in self.slds: 
    1643             for key in sld_list.keys(): 
     1643            for key in list(sld_list.keys()): 
    16441644                if ctr_list[0] == key: 
    16451645                    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 
    22 
    33import os 
  • src/sas/sasgui/perspectives/calculator/kiessig_calculator_panel.py

    • Property mode changed from 100644 to 100755
    r7432acb rfa81e94  
    1414from sas.sasgui.guiframe.panel_base import PanelBase 
    1515from sas.sascalc.calculator.kiessig_calculator import KiessigThicknessCalculator 
    16 from calculator_widgets import OutputTextCtrl 
    17 from calculator_widgets import InputTextCtrl 
     16from .calculator_widgets import OutputTextCtrl 
     17from .calculator_widgets import InputTextCtrl 
    1818from sas.sasgui.perspectives.calculator import calculator_widgets as widget 
    1919from sas.sasgui.guiframe.documentation_window import DocumentationWindow 
  • src/sas/sasgui/perspectives/calculator/model_editor.py

    • Property mode changed from 100644 to 100755
    r69363c7 rfa81e94  
    2323#copyright 2009, University of Tennessee 
    2424################################################################################ 
    25 from __future__ import print_function 
     25 
    2626 
    2727import wx 
     
    790790            if item.count("_") < 1: 
    791791                try: 
    792                     exec "float(math.%s)" % item 
     792                    exec("float(math.%s)" % item) 
    793793                    self.math_combo.Append(str(item)) 
    794794                except Exception: 
  • src/sas/sasgui/perspectives/calculator/resolution_calculator_panel.py

    • Property mode changed from 100644 to 100755
    r01cda57 rfa81e94  
    148148        # Custom sorting 
    149149        source_list = [] 
    150         for key, _ in self.source_mass.iteritems(): 
     150        for key, _ in self.source_mass.items(): 
    151151            name_source = str(key) 
    152152            source_list.append(name_source) 
     
    10821082                msg = "The numbers must be one or two (separated by ',')..." 
    10831083                self._status_info(msg, 'stop') 
    1084                 raise RuntimeError, msg 
     1084                raise RuntimeError(msg) 
    10851085 
    10861086        return new_string 
     
    11001100                new_string.append(value) 
    11011101            except: 
    1102                 logger.error(sys.exc_value) 
     1102                logger.error(sys.exc_info()[1]) 
    11031103 
    11041104        return new_string 
     
    11421142                        return out 
    11431143                except: 
    1144                     logger.error(sys.exc_value) 
     1144                    logger.error(sys.exc_info()[1]) 
    11451145 
    11461146    def _on_xy_coordinate(self, event=None): 
     
    12691269            try: 
    12701270                basename = os.path.basename(path) 
    1271                 if basename not in self.spectrum_dic.keys(): 
     1271                if basename not in list(self.spectrum_dic.keys()): 
    12721272                    self.spectrum_cb.Append(basename) 
    12731273                self.spectrum_dic[basename] = self._read_file(path) 
     
    13201320                except: 
    13211321                    # Skip non-data lines 
    1322                     logger.error(sys.exc_value) 
     1322                    logger.error(sys.exc_info()[1]) 
    13231323 
    13241324            return [wavelength, intensity] 
  • src/sas/sasgui/perspectives/calculator/sld_panel.py

    • Property mode changed from 100644 to 100755
    r2d220dd rfa81e94  
    366366        if len(myformula.atoms) != 1: 
    367367            return 
    368         element = myformula.atoms.keys()[0] 
     368        element = list(myformula.atoms.keys())[0] 
    369369        energy = xray_energy(element.K_alpha) 
    370370 
     
    450450        if len(element_formula.atoms) != 1: 
    451451            return 
    452         element = element_formula.atoms.keys()[0] 
     452        element = list(element_formula.atoms.keys())[0] 
    453453        energy = xray_energy(element.K_alpha) 
    454454        atom = molecule_formula.atoms 
     
    507507        except: 
    508508            if self.base is not None: 
    509                 msg = "SLD Calculator: %s" % (sys.exc_value) 
     509                msg = "SLD Calculator: %s" % (sys.exc_info()[1]) 
    510510                wx.PostEvent(self.base, StatusEvent(status=msg)) 
    511511        if event is not None: 
  • src/sas/sasgui/perspectives/calculator/slit_length_calculator_panel.py

    • Property mode changed from 100644 to 100755
    r7432acb rfa81e94  
    1717from sas.sasgui.guiframe.events import StatusEvent 
    1818from sas.sascalc.calculator.slit_length_calculator import SlitlengthCalculator 
    19 from calculator_widgets import OutputTextCtrl 
    20 from calculator_widgets import InterActiveOutputTextCtrl 
     19from .calculator_widgets import OutputTextCtrl 
     20from .calculator_widgets import InterActiveOutputTextCtrl 
    2121from sas.sasgui.perspectives.calculator import calculator_widgets as widget 
    2222from sas.sasgui.guiframe.documentation_window import DocumentationWindow 
     
    210210        try: 
    211211            #Load data 
    212             from load_thread import DataReader 
     212            from .load_thread import DataReader 
    213213            ## If a thread is already started, stop it 
    214214            if self.reader is not None and self.reader.isrunning(): 
     
    226226            if self.parent.parent is None: 
    227227                return 
    228             msg = "Slit Length Calculator: %s" % (sys.exc_value) 
     228            msg = "Slit Length Calculator: %s" % (sys.exc_info()[1]) 
    229229            wx.PostEvent(self.parent.parent, 
    230230                          StatusEvent(status=msg, type='stop')) 
     
    262262            if x == [] or  x is None or y == [] or y is None: 
    263263                msg = "The current data is empty please check x and y" 
    264                 raise ValueError, msg 
     264                raise ValueError(msg) 
    265265            slit_length_calculator = SlitlengthCalculator() 
    266266            slit_length_calculator.set_data(x=x, y=y) 
     
    269269            if self.parent.parent is None: 
    270270                return 
    271             msg = "Slit Size Calculator: %s" % (sys.exc_value) 
     271            msg = "Slit Size Calculator: %s" % (sys.exc_info()[1]) 
    272272            wx.PostEvent(self.parent.parent, 
    273273                          StatusEvent(status=msg, type='stop')) 
Note: See TracChangeset for help on using the changeset viewer.