Changeset 7945367 in sasview for src/sas


Ignore:
Timestamp:
Aug 21, 2015 6:17:40 PM (9 years ago)
Author:
Paul Kienzle <pkienzle@…>
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:
600bea1
Parents:
a342928
Message:

make Fit Options dialog persistent and add Help button [NB: awaiting new bumps release]

Location:
src/sas
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/sas/fit/BumpsFitting.py

    re1442d4 r7945367  
    88 
    99from bumps import fitters 
     10try: 
     11    from bumps.options import FIT_CONFIG 
     12    # Default bumps to use the Levenberg-Marquardt optimizer 
     13    FIT_CONFIG.selected_id = fitters.LevenbergMarquardtFit.id 
     14    def get_fitter(): 
     15        return FIT_CONFIG.selected_fitter, FIT_CONFIG.selected_values 
     16except: 
     17    # CRUFT: Bumps changed its handling of fit options around 0.7.5.6 
     18    # Default bumps to use the Levenberg-Marquardt optimizer 
     19    fitters.FIT_DEFAULT = 'lm' 
     20    def get_fitter(): 
     21        fitopts = fitters.FIT_OPTIONS[fitters.FIT_DEFAULT] 
     22        return fitopts.fitclass, fitopts.options.copy() 
     23 
     24 
    1025from bumps.mapper import SerialMapper, MPMapper 
    1126from bumps import parameter 
    12  
    13 # TODO: remove globals from interface to bumps options! 
    14 # Default bumps to use the levenberg-marquardt optimizer 
    1527from bumps.fitproblem import FitProblem 
    16 fitters.FIT_DEFAULT = 'lm' 
     28 
    1729 
    1830from sas.fit.AbstractFitEngine import FitEngine 
     
    311323        return False 
    312324 
    313     fitopts = fitters.FIT_OPTIONS[fitters.FIT_DEFAULT] 
    314     fitclass = fitopts.fitclass 
    315     options = fitopts.options.copy() 
    316     max_step = fitopts.options.get('steps', 0) + fitopts.options.get('burn', 0) 
     325    fitclass, options = get_fitter() 
     326    steps = options.get('steps', 0) 
     327    if steps == 0: 
     328        pop = options.get('pop',0)*len(problem._parameters) 
     329        samples = options.get('samples', 0) 
     330        steps = (samples+pop-1)/pop if pop != 0 else samples 
     331    max_step = steps + options.get('burn', 0) 
    317332    pars = [p.name for p in problem._parameters] 
    318333    #x0 = numpy.asarray([p.value for p in problem._parameters]) 
  • src/sas/perspectives/fitting/fitting.py

    r225aca8 r7945367  
    4444from sas.perspectives.calculator.model_editor import EditorWindow 
    4545from sas.guiframe.gui_manager import MDIFrame 
     46from sas.guiframe.documentation_window import DocumentationWindow 
    4647 
    4748MAX_NBR_DATA = 4 
     
    748749        Open the bumps options panel. 
    749750        """ 
    750         from bumps.gui.fit_dialog import OpenFitOptions 
    751         OpenFitOptions() 
     751        try: 
     752            from bumps.gui.fit_dialog import show_fit_config 
     753            show_fit_config(self.parent, help=self.on_help) 
     754        except ImportError: 
     755            # CRUFT: Bumps 0.7.5.6 and earlier do not have the help button 
     756            from bumps.gui.fit_dialog import OpenFitOptions 
     757            OpenFitOptions() 
     758 
     759    def on_help(self, algorithm_id): 
     760        _TreeLocation = "user/perspectives/fitting/optimizer.html" 
     761        _anchor = "#fit-"+algorithm_id 
     762        DocumentationWindow(self.parent, -1, _TreeLocation, _anchor, "Optimizer Help") 
     763 
    752764 
    753765    def on_fit_results(self, event=None): 
Note: See TracChangeset for help on using the changeset viewer.