Changeset ccfe03b in sasview


Ignore:
Timestamp:
Mar 29, 2019 6:52:16 AM (4 months ago)
Author:
ibressler
Branches:
ESS_GUI_bumps_abstraction
Children:
f86343bd
Parents:
fec5842
Message:

FittingOptions?: now with tooltips again

  • extracted from generated FittingOptions? UI file
  • moved to bumps related interface code
    • could be provided by bumps directly instead
    • alternatively, extract the tooltips from the documentation programatically, perhaps?
Location:
src/sas
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/Perspectives/Fitting/FittingOptions.py

    rfec5842 rccfe03b  
    2727    _longName = None 
    2828    _type = None 
     29    _description = None # an optional description for the user, will be shown as UI tooltip 
    2930    _defaultValue = None 
    3031    value = None 
    3132 
    32     def __init__(self, shortName, longName, dtype, defaultValue): 
     33    def __init__(self, shortName, longName, dtype, defaultValue, description = None): 
    3334        self._shortName = shortName 
    3435        self._longName = longName 
    3536        self._type = dtype 
     37        self._description = description 
    3638        self._defaultValue = defaultValue 
    3739        self.value = defaultValue 
     
    4850    def type(self): 
    4951        return self._type 
     52 
     53    @property 
     54    def description(self): 
     55        return self._description 
    5056 
    5157    @property 
     
    136142    def __str__(self): 
    137143        return "\n".join(["{}: {}".format(key, fm) for key, fm in self._methods.items()]) 
     144 
     145from sas.sascalc.fit.BumpsFitting import toolTips as bumpsToolTips 
    138146 
    139147class FittingMethodBumps(FittingMethod): 
     
    162170                longName, dtype = bumps.options.FIT_FIELDS[shortName] 
    163171                dtype = self._convertParamType(dtype) 
    164                 param = FittingMethodParameter(shortName, longName, dtype, defValue) 
     172                key = shortName+"_"+f.id 
     173                descr = bumpsToolTips.get(key, None) 
     174                param = FittingMethodParameter(shortName, longName, dtype, defValue, 
     175                                               description=descr) 
    165176                params.append(param) 
    166177            self.add(FittingMethodBumps(f.id, f.name, params)) 
     
    308319        for param in fm.params.values(): 
    309320            row = layout.rowCount()+1 
    310             layout.addWidget(self._makeLabel(param.longName), row, 0) 
     321            label = self._makeLabel(param.longName) 
     322            layout.addWidget(label, row, 0) 
    311323            widget = self._inputWidgetFromType(param.type, self) 
    312324            if widget is None: 
    313325                continue 
     326            if param.description is not None: 
     327                widget.setToolTip(param.description) 
     328                label.setToolTip(param.description) 
     329            layout.addWidget(widget, row, 1) 
    314330            widgetName = param.shortName+'_'+fm.shortName 
    315             layout.addWidget(widget, row, 1) 
    316331            setattr(self, widgetName, widget) 
    317332        layout.addItem(QtWidgets.QSpacerItem(0, 0, vPolicy=QtWidgets.QSizePolicy.Expanding)) 
  • src/sas/sascalc/fit/BumpsFitting.py

    r1386b2f rccfe03b  
    3232from sas.sascalc.fit.AbstractFitEngine import FResult 
    3333from sas.sascalc.fit.expression import compile_constraints 
     34 
     35# converted from FittingOptionsUI.py file 
     36toolTips = dict( 
     37        samples_dream = "<html><head/><body><p>Number of points to be drawn from the Markov chain.</p></body></html>", 
     38        burn_dream = "<html><head/><body><p>The number of iterations to required for the Markov chain to converge to the equilibrium distribution.</p></body></html>", 
     39        pop_dream = "<html><head/><body><p>The size of the population.</p></body></html>", 
     40        init_dream = "<html><head/><body><p><span style=\" font-style:italic;\">Initializer</span> determines how the population will be initialized. The options are as follows:</p><p><span style=\" font-style:italic;\">eps</span> (epsilon ball), in which the entire initial population is chosen at random from within a tiny hypersphere centered about the initial point</p><p><span style=\" font-style:italic;\">lhs</span> (latin hypersquare), which chops the bounds within each dimension in <span style=\" font-weight:600;\">k</span> equal sized chunks where <span style=\" font-weight:600;\">k</span> is the size of the population and makes sure that each parameter has at least one value within each chunk across the population.</p><p><span style=\" font-style:italic;\">cov</span> (covariance matrix), in which the uncertainty is estimated using the covariance matrix at the initial point, and points are selected at random from the corresponding gaussian ellipsoid</p><p><span style=\" font-style:italic;\">random</span> (uniform random), in which the points are selected at random within the bounds of the parameters</p></body></html>", 
     41        thin_dream = "<html><head/><body><p>The amount of thinning to use when collecting the population.</p></body></html>", 
     42        steps_dream = "<html><head/><body><p>Determines the number of iterations to use for drawing samples after burn in.</p></body></html>", 
     43        steps_lm = "<html><head/><body><p>The number of gradient steps to take.</p></body></html>", 
     44        ftol_lm = "<html><head/><body><p>Used to determine when the fit has reached the point where no significant improvement is expected.</p></body></html>", 
     45        xtol_lm = "<html><head/><body><p>Used to determine when the fit has reached the point where no significant improvement is expected.</p></body></html>", 
     46        steps_newton = "<html><head/><body><p>The number of gradient steps to take.</p></body></html>", 
     47        starts_newton = "<html><head/><body><p>Value thattells the optimizer to restart a given number of times. Each time it restarts it uses a random starting point.</p></body></html>", 
     48        ftol_newton = "<html><head/><body><p>Used to determine when the fit has reached the point where no significant improvement is expected.</p></body></html>", 
     49        xtol_newton = "<html><head/><body><p>Used to determine when the fit has reached the point where no significant improvement is expected.</p></body></html>", 
     50        steps_de = "<html><head/><body><p>The number of iterations.</p></body></html>", 
     51        CR_de = "<html><head/><body><p>The size of the population.</p></body></html>", 
     52        F_de = "<html><head/><body><p>Determines how much to scale each difference vector before adding it to the candidate point.</p></body></html>", 
     53        ftol_de = "<html><head/><body><p>Used to determine when the fit has reached the point where no significant improvement is expected.</p></body></html>", 
     54        xtol_de = "<html><head/><body><p>Used to determine when the fit has reached the point where no significant improvement is expected.</p></body></html>", 
     55        steps_amoeba = "<html><head/><body><p>The number of simplex update iterations to perform.</p></body></html>", 
     56        starts_amoeba = "<html><head/><body><p>Tells the optimizer to restart a given number of times. Each time it restarts it uses a random starting point.</p></body></html>", 
     57        radius_amoeba = "<html><head/><body><p>The initial size of the simplex, as a portion of the bounds defining the parameter space.</p></body></html>", 
     58        ftol_amoeba = "<html><head/><body><p>Used to determine when the fit has reached the point where no significant improvement is expected. </p></body></html>", 
     59        xtol_amoeba = "<html><head/><body><p>Used to determine when the fit has reached the point where no significant improvement is expected. </p></body></html>", 
     60) 
    3461 
    3562class Progress(object): 
Note: See TracChangeset for help on using the changeset viewer.