Changeset 0aeba4e in sasview for src/sas


Ignore:
Timestamp:
Apr 16, 2018 4:33:06 PM (7 years ago)
Author:
Paul Kienzle <pkienzle@…>
Branches:
ticket-1094-headless
Children:
f6f3fb4
Parents:
e870702
Message:

code cleanup for bumps fitting wrapper

File:
1 edited

Legend:

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

    r1386b2f r0aeba4e  
    22BumpsFitting module runs the bumps optimizer. 
    33""" 
     4from __future__ import print_function 
     5 
    46import os 
    57from datetime import timedelta, datetime 
     
    911 
    1012from bumps import fitters 
     13 
    1114try: 
    1215    from bumps.options import FIT_CONFIG 
     16    # Preserve bumps default fitter in case someone wants it later 
     17    BUMPS_DEFAULT_FITTER = FIT_CONFIG.selected_id 
    1318    # Default bumps to use the Levenberg-Marquardt optimizer 
    1419    FIT_CONFIG.selected_id = fitters.LevenbergMarquardtFit.id 
     
    1722except ImportError: 
    1823    # CRUFT: Bumps changed its handling of fit options around 0.7.5.6 
     24    # Preserve bumps default fitter in case someone wants it later 
     25    BUMPS_DEFAULT_FITTER = fitters.FIT_DEFAULT 
    1926    # Default bumps to use the Levenberg-Marquardt optimizer 
    2027    fitters.FIT_DEFAULT = 'lm' 
     
    126133        if initial_values is not None: 
    127134            self._reset_pars(fitted, initial_values) 
     135        #print("constraints", constraints) 
    128136        self.constraints = dict(constraints) 
    129137        self.set_fitted(fitted) 
     
    222230    def _setup(self): 
    223231        exprs = {} 
    224         for M in self.models: 
    225             exprs.update((".".join((M.name, k)), v) for k, v in M.constraints.items()) 
     232        for model in self.models: 
     233            exprs.update((".".join((model.name, k)), v) 
     234                         for k, v in model.constraints.items()) 
    226235        if exprs: 
    227             symtab = dict((".".join((M.name, k)), p) 
    228                           for M in self.models 
    229                           for k, p in M.parameters().items()) 
     236            symtab = dict((".".join((model.name, k)), p) 
     237                          for model in self.models 
     238                          for k, p in model.parameters().items()) 
    230239            self.update = compile_constraints(symtab, exprs) 
    231240        else: 
Note: See TracChangeset for help on using the changeset viewer.