Ignore:
Timestamp:
Sep 12, 2008 12:05:19 PM (16 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:
e7430b6
Parents:
49b7efa
Message:

park_integration working better for large model

File:
1 edited

Legend:

Unmodified
Added
Removed
  • park_integration/test/testnewscipy.py

    r48882d1 r388309d  
    2222        #Importing the Fit module 
    2323        from sans.fit.Fitting import Fit 
    24         fitter= Fit('scipy') 
     24        fitter= Fit('park') 
    2525         
    2626        # Receives the type of model for the fitting 
     
    3131        #Do the fit SCIPY 
    3232        
    33         fitter.set_data_assembly(data1,1) 
    34         fitter.set_model_assembly(model,"M1",1,['A','B']) 
     33        fitter.set_data(data1,1) 
     34        fitter.set_model(model,"M1",1,['A','B']) 
    3535     
    3636        result=fitter.fit() 
    37         print "scipy",result.pvec, 
    38         chisqr1, out1, cov1=fitter.fit() 
    39         """ testing SCIPy results""" 
    40         self.assert_(math.fabs(out1[1]-2.5)/math.sqrt(cov1[1][1]) < 2) 
    41         self.assert_(math.fabs(out1[0]-4.0)/math.sqrt(cov1[0][0]) < 2) 
    42         self.assert_(chisqr1/len(data1.x) < 2) 
    43         
     37        print "park",result.pvec, 
     38         
     39        self.assert_(result) 
    4440       
     41    def test_cylinder_scipy(self): 
     42        """ test fitting large model with scipy""" 
     43        #load data 
     44        from sans.fit.Loader import Load 
     45        load= Load() 
     46        load.set_filename("cyl_testdata.txt") 
     47        load.set_values() 
     48        data11 = Data1D(x=[], y=[],dx=None, dy=None) 
     49        load.load_data(data11) 
     50        data1=Data(sans_data=data11) 
     51         
     52         
     53        #Importing the Fit module 
     54        from sans.fit.Fitting import Fit 
     55        fitter= Fit('park') 
     56         
     57        # Receives the type of model for the fitting 
     58        from sans.models.CylinderModel import CylinderModel 
     59        model1  = CylinderModel() 
     60        model =Model(model1) 
     61         
     62        #Do the fit SCIPY 
     63        fitter.set_data(data1,1) 
     64        import math 
     65        pars1=['background','contrast', 'length'] 
     66        #pars1=['background','contrast',\ 
     67        #        'cyl_phi','cyl_theta','length','radius','scale'] 
     68        pars1.sort() 
     69        fitter.set_model(model,"M1",1,pars1) 
     70        fitter.set_data(data1,1) 
     71       
     72        result=fitter.fit() 
     73        print "park",result.fitness,result.cov, result.pvec 
     74        self.assert_(result.fitness) 
     75         
     76     
     77       
Note: See TracChangeset for help on using the changeset viewer.