source: sasview/park_integration/test/test_large_model.py @ 77c1c29d

ESS_GUIESS_GUI_DocsESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_iss959ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalccostrafo411magnetic_scattrelease-4.1.1release-4.1.2release-4.2.2release_4.0.1ticket-1009ticket-1094-headlessticket-1242-2d-resolutionticket-1243ticket-1249ticket885unittest-saveload
Last change on this file since 77c1c29d was f44dbc7, checked in by Gervaise Alina <gervyh@…>, 16 years ago

change made on set_model method receive a list instead of dict.
need to rewrite test

  • Property mode set to 100644
File size: 1.6 KB
RevLine 
[30c6721]1"""
2    Unit tests for fitting module
3"""
4import unittest
5from sans.guitools.plottables import Theory1D
6from sans.guitools.plottables import Data1D
7
8import math
9class testFitModule(unittest.TestCase):
10    """ test fitting """
[f44dbc7]11   
[d53bc33]12     
13    def testfit_11Data_1Model(self):
14        """ test fitting for one data and one model park vs scipy"""
15        #load data
16        from sans.fit.Loader import Load
17        load= Load()
18        load.set_filename("cyl_testdata.txt")
19        load.set_values()
20        data1 = Data1D(x=[], y=[],dx=None, dy=None)
21        load.load_data(data1)
[30c6721]22       
23        load.set_filename("testdata_line1.txt")
24        load.set_values()
25        data2 = Data1D(x=[], y=[],dx=None, dy=None)
26        load.load_data(data2)
27       
28        #Importing the Fit module
29        from sans.fit.Fitting import Fit
30        fitter= Fit('park')
31       
32        # Receives the type of model for the fitting
33        from sans.models.CylinderModel import CylinderModel
34        model1  = CylinderModel()
[cfe97ea]35        #model2  = CylinderModel()
[30c6721]36       
37        #Do the fit SCIPY
38        fitter.set_data(data1,1)
[cfe97ea]39        import math
40        pars1={'background':0,'contrast':3*math.pow(10, -6),\
41                'cyl_phi':1,'cyl_theta':1,'length':400,'radius':20,'scale':1}
42        fitter.set_model(model1,"M1",1,pars1)
[30c6721]43       
[cfe97ea]44        #fitter.set_data(data2,2)
45        #fitter.set_model(model1,"M1",2,pars1)
[30c6721]46       
47        chisqr1, out1, cov1=fitter.fit()
48        print "park",chisqr1, out1, cov1
49        self.assert_(chisqr1)
50       
51       
52     
Note: See TracBrowser for help on using the repository browser.