Changeset eddb6ec in sasview


Ignore:
Timestamp:
Apr 2, 2014 7:25:09 AM (10 years ago)
Author:
Tobias Richter <tobias.richter@…>
Branches:
master, 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, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
6771d94
Parents:
8817d07
Message:

refs #57 Clean up warnings in Python code

Location:
src/sans
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/sans/perspectives/fitting/basepage.py

    rf468791 reddb6ec  
    496496        self.model_list_box = page_info.model_list_box 
    497497        ## Data member to store the dispersion object created 
    498         self.populate_box(dict=self.model_list_box) 
     498        self.populate_box(model_dict=self.model_list_box) 
    499499         
    500500    def onContextMenu(self, event): 
     
    599599        self.state.manager = manager 
    600600         
    601     def populate_box(self, dict): 
     601    def populate_box(self, model_dict): 
    602602        """ 
    603603        Store list of model 
    604604         
    605         :param dict: dictionary containing list of models 
    606          
    607         """ 
    608         self.model_list_box = dict 
     605        :param model_dict: dictionary containing list of models 
     606         
     607        """ 
     608        self.model_list_box = model_dict 
    609609        self.state.model_list_box = self.model_list_box 
    610610        self.initialize_combox() 
     
    928928                f_select = self.formfactorbox.GetSelection() 
    929929                if f_select > 0: 
    930                         self.state.formfactorcombobox = self.formfactorbox.\ 
    931                         GetString(f_select) 
     930                    self.state.formfactorcombobox = self.formfactorbox.\ 
     931                    GetString(f_select) 
    932932        if self.categorybox != None: 
    933                 cb_select = self.categorybox.GetSelection() 
    934                 if cb_select > 0: 
    935                         self.state.categorycombobox = self.categorybox.\ 
    936                         GetString(cb_select)                 
    937         #save radiobutton state for model selection 
    938         #self.state.shape_rbutton = self.shape_rbutton.GetValue() 
    939         #self.state.shape_indep_rbutton = self.shape_indep_rbutton.GetValue() 
    940         #self.state.struct_rbutton = self.struct_rbutton.GetValue() 
    941         #self.state.plugin_rbutton = self.plugin_rbutton.GetValue() 
     933            cb_select = self.categorybox.GetSelection() 
     934            if cb_select > 0: 
     935                self.state.categorycombobox = self.categorybox.\ 
     936                GetString(cb_select) 
    942937         
    943938        self.state.enable2D = copy.deepcopy(self.enable2D) 
     
    10451040            if len(self.disp_cb_dict) > 0: 
    10461041                for k, v in self.disp_cb_dict.iteritems(): 
    1047           
    10481042                    if v == None: 
    10491043                        self.state.disp_cb_dict[k] = v 
     
    10531047                        except: 
    10541048                            self.state.disp_cb_dict[k] = None 
    1055             
    10561049            if len(self._disp_obj_dict) > 0: 
    10571050                for k, v in self._disp_obj_dict.iteritems(): 
  • src/sans/perspectives/fitting/fitpanel.py

    r5777106 reddb6ec  
    384384        panel._set_save_flag(not panel.batch_on) 
    385385        panel.set_model_dictionary(self.model_dictionary) 
    386         panel.populate_box(dict=self.model_list_box) 
     386        panel.populate_box(model_dict=self.model_list_box) 
    387387        panel.formfactor_combo_init() 
    388388        panel.set_manager(self._manager) 
  • src/sans/perspectives/fitting/pagestate.py

    r44f7c1b reddb6ec  
    1717import logging 
    1818import numpy 
     19import string 
    1920 
    2021import xml.dom.minidom 
    21 from xml.dom.minidom import parse 
    2222from lxml import etree 
    2323 
     
    193193        ##page name 
    194194        self.page_name = "" 
    195         # Contains link between  model ,all its parameters, and panel organization 
     195        # Contains link between model, all its parameters, and panel organization 
    196196        self.parameters = [] 
    197197        # String parameter list that can not be fitted 
     
    205205        ## orientation parameters 
    206206        self.orientation_params = [] 
    207         ## orientation parmaters for gaussian dispersity 
     207        ## orientation parameters for gaussian dispersity 
    208208        self.orientation_params_disp = [] 
    209209        ## smearer info 
     
    216216        self.dxl = None 
    217217        self.dxw = None 
    218         #list of dispersion paramaters 
     218        #list of dispersion parameters 
    219219        self.disp_list = [] 
    220220        if self.model is not None: 
     
    600600        : param figs: list of pylab figures [list] 
    601601        """ 
    602         from report_dialog import ReportDialog 
     602        from sans.perspectives.fitting.report_dialog import ReportDialog 
    603603        # get the strings for report 
    604604        html_str, text_str, title = self.set_report_string() 
     
    630630        dialog.ShowModal() 
    631631         
    632     def _toXML_helper(self, list, element, newdoc): 
     632    def _toXML_helper(self, thelist, element, newdoc): 
    633633        """ 
    634634        Helper method to create xml file for saving state 
    635635        """ 
    636         for item in list: 
     636        for item in thelist: 
    637637            sub_element = newdoc.createElement('parameter') 
    638638            sub_element.setAttribute('name', str(item[1])) 
  • src/sans/plottools/PlotPanel.py

    r8817d07 reddb6ec  
    33import logging 
    44import wx 
     5import os 
    56# Try a normal import first 
    67# If it fails, try specifying a version 
     
    1112from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg 
    1213from matplotlib.figure import Figure 
    13 import os 
    14 import transform 
    15 from plottables import Data1D 
    16 #TODO: make the plottables interactive 
    17 from binder import BindArtist 
     14from sans.plottools import transform 
     15from sans.plottools.plottables import Data1D 
     16from sans.plottools.binder import BindArtist 
    1817from matplotlib.font_manager import FontProperties 
    1918DEBUG = False 
    2019 
    21 from plottables import Graph 
    22 from plottables import Text 
    23 from TextDialog import TextDialog 
    24 from LabelDialog import LabelDialog 
     20from sans.plottools.plottables import Graph 
     21from sans.plottools.TextDialog import TextDialog 
     22from sans.plottools.LabelDialog import LabelDialog 
    2523import operator 
    2624 
     
    3836        for a in obj.get_children(): show_tree(a, d+1) 
    3937      
    40 from unitConverter import UnitConvertion as convertUnit 
     38from sans.plottools.unitConverter import UnitConvertion as convertUnit 
    4139 
    4240 
    4341def _rescale(lo, hi, step, pt=None, bal=None, scale='linear'): 
    44         """ 
    45         Rescale (lo,hi) by step, returning the new (lo,hi) 
    46         The scaling is centered on pt, with positive values of step 
    47         driving lo/hi away from pt and negative values pulling them in. 
    48         If bal is given instead of point, it is already in [0,1] coordinates. 
     42    """ 
     43    Rescale (lo,hi) by step, returning the new (lo,hi) 
     44    The scaling is centered on pt, with positive values of step 
     45    driving lo/hi away from pt and negative values pulling them in. 
     46    If bal is given instead of point, it is already in [0,1] coordinates. 
    4947     
    50         This is a helper function for step-based zooming. 
    51          
    52         """ 
    53         # Convert values into the correct scale for a linear transformation 
    54         # TODO: use proper scale transformers 
    55         loprev = lo 
    56         hiprev = hi 
    57         if scale == 'log': 
    58             assert lo > 0 
    59             if lo > 0: 
    60                 lo = math.log10(lo) 
    61             if hi > 0: 
    62                 hi = math.log10(hi) 
    63             if pt is not None: 
    64                 pt = math.log10(pt) 
    65          
    66         # Compute delta from axis range * %, or 1-% if persent is negative 
    67         if step > 0: 
    68             delta = float(hi - lo) * step / 100 
     48    This is a helper function for step-based zooming. 
     49    """ 
     50    # Convert values into the correct scale for a linear transformation 
     51    # TODO: use proper scale transformers 
     52    loprev = lo 
     53    hiprev = hi 
     54    if scale == 'log': 
     55        assert lo > 0 
     56        if lo > 0: 
     57            lo = math.log10(lo) 
     58        if hi > 0: 
     59            hi = math.log10(hi) 
     60        if pt is not None: 
     61            pt = math.log10(pt) 
     62     
     63    # Compute delta from axis range * %, or 1-% if present is negative 
     64    if step > 0: 
     65        delta = float(hi - lo) * step / 100 
     66    else: 
     67        delta = float(hi - lo) * step / (100 - step) 
     68 
     69    # Add scale factor proportionally to the lo and hi values, 
     70    # preserving the 
     71    # point under the mouse 
     72    if bal is None: 
     73        bal = float(pt - lo) / (hi - lo) 
     74    lo = lo - (bal * delta) 
     75    hi = hi + (1 - bal) * delta 
     76 
     77    # Convert transformed values back to the original scale 
     78    if scale == 'log': 
     79        if (lo <= -250) or (hi >= 250): 
     80            lo = loprev 
     81            hi = hiprev 
    6982        else: 
    70             delta = float(hi - lo) * step / (100 - step) 
    71      
    72         # Add scale factor proportionally to the lo and hi values, 
    73         # preserving the 
    74         # point under the mouse 
    75         if bal is None: 
    76             bal = float(pt - lo) / (hi - lo) 
    77         lo = lo - (bal * delta) 
    78         hi = hi + (1 - bal) * delta 
    79      
    80         # Convert transformed values back to the original scale 
    81         if scale == 'log': 
    82             if (lo <= -250) or (hi >= 250): 
    83                 lo = loprev 
    84                 hi = hiprev 
    85             else: 
    86                 lo, hi = math.pow(10., lo), math.pow(10., hi) 
    87         return (lo, hi) 
     83            lo, hi = math.pow(10., lo), math.pow(10., hi) 
     84    return (lo, hi) 
    8885 
    8986 
     
    125122        self.figure = Figure(None, dpi, linewidth=2.0) 
    126123        self.color = '#b3b3b3' 
    127         from canvas import FigureCanvas 
     124        from sans.plottools.canvas import FigureCanvas 
    128125        self.canvas = FigureCanvas(self, -1, self.figure) 
    129126        self.SetColor(color) 
     
    158155         
    159156        # Define some constants 
    160         self.colorlist = ['b','g','r','c','m','y','k'] 
    161         self.symbollist = ['o','x','^','v','<','>','+', 
    162                            's','d','D','h','H','p', '-'] 
     157        self.colorlist = ['b', 'g', 'r', 'c', 'm', 'y', 'k'] 
     158        self.symbollist = ['o', 'x', '^', 'v', '<', '>', '+', 
     159                           's', 'd', 'D', 'h', 'H', 'p', '-'] 
    163160         
    164161        #List of texts currently on the plot 
Note: See TracChangeset for help on using the changeset viewer.