Changeset 840ac87 in sasview for src/sas/sascalc/fit
- Timestamp:
- Sep 20, 2018 12:44:12 PM (6 years ago)
- 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. - Location:
- src/sas/sascalc/fit
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sascalc/fit/pagestate.py
raca687a r840ac87 144 144 ################################################################################ 145 145 import time 146 import re 146 147 import os 147 148 import sys … … 773 774 name = value.split(':', 1)[1].strip() 774 775 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:] 775 781 file_name = CENTRE % file_value 776 782 if len(title) == 0: … … 848 854 html_str, text_str, title = self._get_report_string() 849 855 # 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] 852 861 # final report html strings 853 862 report_str = html_str + ELINE.join(image_links) 854 863 report_str += FEET_3 855 864 return report_str, text_str 856 865 … … 1081 1090 if node.get('version'): 1082 1091 # Get the version for model conversion purposes 1083 self.version = tuple(int(e) for e in1084 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, ".")) 1085 1094 # The tuple must be at least 3 items long 1086 1095 while len(self.version) < 3: … … 1495 1504 """ 1496 1505 FEET_2 = \ 1497 """<img src="%s" ></img> 1506 """<img src="%s"></img> 1507 """ 1508 FEET_2_unix = \ 1509 """<img src="%s" width="540"></img> 1498 1510 """ 1499 1511 FEET_3 = \ -
src/sas/sascalc/fit/BumpsFitting.py
r1386b2f r0aeba4e 2 2 BumpsFitting module runs the bumps optimizer. 3 3 """ 4 from __future__ import print_function 5 4 6 import os 5 7 from datetime import timedelta, datetime … … 9 11 10 12 from bumps import fitters 13 11 14 try: 12 15 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 13 18 # Default bumps to use the Levenberg-Marquardt optimizer 14 19 FIT_CONFIG.selected_id = fitters.LevenbergMarquardtFit.id … … 17 22 except ImportError: 18 23 # 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 19 26 # Default bumps to use the Levenberg-Marquardt optimizer 20 27 fitters.FIT_DEFAULT = 'lm' … … 126 133 if initial_values is not None: 127 134 self._reset_pars(fitted, initial_values) 135 #print("constraints", constraints) 128 136 self.constraints = dict(constraints) 129 137 self.set_fitted(fitted) … … 222 230 def _setup(self): 223 231 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()) 226 235 if exprs: 227 symtab = dict((".".join(( M.name, k)), p)228 for Min self.models229 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()) 230 239 self.update = compile_constraints(symtab, exprs) 231 240 else:
Note: See TracChangeset
for help on using the changeset viewer.