Changeset d59cb8c in sasview for park_integration/src


Ignore:
Timestamp:
Oct 11, 2011 10:23:55 AM (13 years ago)
Author:
Gervaise Alina <gervyh@…>
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:
444c900e
Parents:
4c712ea4
Message:

make sure the ftol value is used for park

File:
1 edited

Legend:

Unmodified
Added
Removed
  • park_integration/src/sans/fit/ParkFitting.py

    r1fa4db39 rd59cb8c  
    1010import numpy 
    1111import math 
     12from  numpy.linalg.linalg import LinAlgError 
    1213#import park 
    1314from park import fit 
     
    4950    maxiter = None 
    5051    """Maximum number of iterations before fit terminates""" 
     52    def __init__(self, ftol=5e-5): 
     53        self.ftol = ftol 
     54         
    5155    def fit(self, fitness, x0): 
    5256        """Run the fit""" 
     
    106110    localfit = SansFitSimplex() 
    107111    start_points = 10 
    108  
     112    def __init__(self, localfit, start_points=10): 
     113        self.localfit = localfit 
     114        self.start_points = start_points 
     115         
    109116    def _fit(self, objective, x0, bounds): 
    110117        """ 
     
    391398        if handler == None: 
    392399            handler = fitresult.ConsoleUpdate(improvement_delta=0.1) 
    393         result = fit.fit(self.problem, fitter=fitter, handler=handler) 
    394         self.problem.all_results(result) 
    395          
    396         #print "park------", result.inputs 
    397         #for (model, data) in result.inputs: 
    398         #    print model.name, data.name 
    399         #for p in result.parameters: 
    400         #    print "simul ----", p , p.__class__, p.model.name, p.data.name 
    401     
     400        try: 
     401            result = fit.fit(self.problem, fitter=fitter, handler=handler) 
     402            self.problem.all_results(result) 
     403        except LinAlgError: 
     404            raise ValueError, "SVD did not converge" 
     405             
    402406        if result != None: 
    403407            if q != None: 
Note: See TracChangeset for help on using the changeset viewer.