Changeset fa81e94 in sasview for src/sas/sasgui/perspectives/corfunc


Ignore:
Timestamp:
Nov 15, 2017 4:33:09 AM (7 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/corfunc
Files:
4 edited

Legend:

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

    • Property mode changed from 100644 to 100755
    rc23f303 rfa81e94  
    11PLUGIN_ID = "Corfunc Plug-In 0.1" 
    2 from corfunc import * 
     2from .corfunc import * 
  • src/sas/sasgui/perspectives/corfunc/corfunc.py

    • Property mode changed from 100644 to 100755
    r9b90bf8 rfa81e94  
    1818from sas.sascalc.dataloader.loader import Loader 
    1919import sas.sascalc.dataloader 
    20 from plot_labels import * 
     20from .plot_labels import * 
    2121 
    2222logger = logging.getLogger(__name__) 
     
    149149                    self.corfunc_panel.set_data(data) 
    150150                except: 
    151                     msg = "Corfunc set_data: " + str(sys.exc_value) 
     151                    msg = "Corfunc set_data: " + str(sys.exc_info()[1]) 
    152152                    wx.PostEvent(self.parent, StatusEvent(status=msg, 
    153153                        info='error')) 
  • src/sas/sasgui/perspectives/corfunc/corfunc_panel.py

    • Property mode changed from 100644 to 100755
    r2a399ca rfa81e94  
    1717from sas.sascalc.corfunc.corfunc_calculator import CorfuncCalculator 
    1818from sas.sasgui.guiframe.documentation_window import DocumentationWindow 
    19 from plot_labels import * 
     19from .plot_labels import * 
    2020 
    2121OUTPUT_STRINGS = { 
     
    393393        if params is None: 
    394394            # Reset outputs 
    395             for output in self._extrapolation_outputs.values(): 
     395            for output in list(self._extrapolation_outputs.values()): 
    396396                output.SetValue('-') 
    397397            return 
    398         for key, value in params.iteritems(): 
     398        for key, value in params.items(): 
    399399            output = self._extrapolation_outputs[key] 
    400400            rounded = self._round_sig_figs(value, 6) 
     
    411411        if params is None: 
    412412            if not reset: error = True 
    413             for output in self._output_boxes.values(): 
     413            for output in list(self._output_boxes.values()): 
    414414                output.SetValue('-') 
    415415        else: 
     
    417417                # Not all parameters were calculated 
    418418                error = True 
    419             for key, value in params.iteritems(): 
     419            for key, value in params.items(): 
    420420                rounded = self._round_sig_figs(value, 6) 
    421421                self._output_boxes[key].SetValue(rounded) 
     
    656656        self._extrapolation_outputs['K'] = k_output 
    657657 
    658         sigma_label = wx.StaticText(self, -1, u'\u03C3: ') 
     658        sigma_label = wx.StaticText(self, -1, '\u03C3: ') 
    659659        params_sizer.Add(sigma_label, (2, 2), (1, 1), wx.LEFT | wx.EXPAND, 15) 
    660660 
     
    713713        self._output_boxes = dict() 
    714714        i = 0 
    715         for key, value in OUTPUT_STRINGS.iteritems(): 
     715        for key, value in OUTPUT_STRINGS.items(): 
    716716            # Create a label and a text box for each poperty 
    717717            label = wx.StaticText(self, -1, value) 
  • src/sas/sasgui/perspectives/corfunc/corfunc_state.py

    • Property mode changed from 100644 to 100755
    r1fa4f736 rfa81e94  
    7474        if self.outputs != {} and self.outputs is not None: 
    7575            state += "\nOutputs:\n" 
    76             for key, value in self.outputs.iteritems(): 
     76            for key, value in self.outputs.items(): 
    7777                name = output_list[key][1] 
    7878                state += "{}: {}\n".format(name, str(value)) 
     
    158158        state = new_doc.createElement("state") 
    159159        top_element.appendChild(state) 
    160         for name, value in self.saved_state.iteritems(): 
     160        for name, value in self.saved_state.items(): 
    161161            element = new_doc.createElement(name) 
    162162            element.appendChild(new_doc.createTextNode(str(value))) 
     
    181181            output = new_doc.createElement("output") 
    182182            top_element.appendChild(output) 
    183             for key, value in self.outputs.iteritems(): 
     183            for key, value in self.outputs.items(): 
    184184                element = new_doc.createElement(key) 
    185185                element.appendChild(new_doc.createTextNode(str(value))) 
     
    216216                except: 
    217217                    msg = ("CorfuncState.fromXML: Could not read timestamp", 
    218                         "\n{}").format(sys.exc_value) 
     218                        "\n{}").format(sys.exc_info()[1]) 
    219219                    logger.error(msg) 
    220220 
     
    222222            entry = get_content('ns:state', node) 
    223223            if entry is not None: 
    224                 for item in DEFAULT_STATE.iterkeys(): 
     224                for item in DEFAULT_STATE.keys(): 
    225225                    input_field = get_content("ns:{}".format(item), entry) 
    226226                    if input_field is not None: 
     
    283283            root, ext = os.path.splitext(basename) 
    284284            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)) 
    286286            tree = etree.parse(path, parser=etree.ETCompatXMLParser()) 
    287287            root = tree.getroot() 
     
    299299            # File not found 
    300300            msg = "{} is not a valid file path or doesn't exist".format(path) 
    301             raise IOError, msg 
     301            raise IOError(msg) 
    302302 
    303303        if len(output) == 0: 
     
    323323            msg = ("The CanSAS writer expects a Data1D instance. {} was " 
    324324                "provided").format(datainfo.__class__.__name__) 
    325             raise RuntimeError, msg 
     325            raise RuntimeError(msg) 
    326326        if datainfo.title is None or datainfo.title == '': 
    327327            datainfo.title = datainfo.name 
     
    360360        except: 
    361361            msg = "XML document does not contain CorfuncState information\n{}" 
    362             msg.format(sys.exc_value) 
     362            msg.format(sys.exc_info()[1]) 
    363363            logger.info(msg) 
    364364        return state 
Note: See TracChangeset for help on using the changeset viewer.