source: sasview/park_integration/test/test_large_model.py @ 99d1af6

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 99d1af6 was cfe97ea, checked in by Gervaise Alina <gervyh@…>, 16 years ago

add more tests

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