Changeset 840ac87 in sasview for src/sas/sascalc/fit


Ignore:
Timestamp:
Sep 20, 2018 12:44:12 PM (6 years ago)
Author:
Paul Kienzle <pkienzle@…>
Branches:
ticket-1094-headless
Children:
1dc134e6
Parents:
a072198 (diff), 912e645 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' into ticket-1094-headless

Location:
src/sas/sascalc/fit
Files:
1 added
2 edited

Legend:

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

    raca687a r840ac87  
    144144################################################################################ 
    145145import time 
     146import re 
    146147import os 
    147148import sys 
     
    773774                    name = value.split(':', 1)[1].strip() 
    774775                    file_value = "File name:" + name 
     776                    #Truncating string so print doesn't complain of being outside margins 
     777                    if sys.platform != "win32": 
     778                        MAX_STRING_LENGHT = 50 
     779                        if len(file_value) > MAX_STRING_LENGHT: 
     780                            file_value = "File name:.."+file_value[-MAX_STRING_LENGHT+10:] 
    775781                    file_name = CENTRE % file_value 
    776782                    if len(title) == 0: 
     
    848854        html_str, text_str, title = self._get_report_string() 
    849855        # Allow 2 figures to append 
    850         image_links = [FEET_2%fig for fig in fig_urls] 
    851  
     856        #Constraining image width for OSX and linux, so print doesn't complain of being outside margins 
     857        if sys.platform == "win32": 
     858            image_links = [FEET_2%fig for fig in fig_urls] 
     859        else: 
     860            image_links = [FEET_2_unix%fig for fig in fig_urls] 
    852861        # final report html strings 
    853862        report_str = html_str + ELINE.join(image_links) 
    854  
     863        report_str += FEET_3 
    855864        return report_str, text_str 
    856865 
     
    10811090        if node.get('version'): 
    10821091            # Get the version for model conversion purposes 
    1083             self.version = tuple(int(e) for e in 
    1084                                  str.split(node.get('version'), ".")) 
     1092            x = re.sub('[^\d.]', '', node.get('version')) 
     1093            self.version = tuple(int(e) for e in str.split(x, ".")) 
    10851094            # The tuple must be at least 3 items long 
    10861095            while len(self.version) < 3: 
     
    14951504""" 
    14961505FEET_2 = \ 
    1497 """<img src="%s" ></img> 
     1506"""<img src="%s"></img> 
     1507""" 
     1508FEET_2_unix = \ 
     1509"""<img src="%s" width="540"></img> 
    14981510""" 
    14991511FEET_3 = \ 
  • 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.