Changeset 202f93a in sasview for park_integration/test


Ignore:
Timestamp:
Jul 18, 2008 1:54:23 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:
acb1ad1
Parents:
75b40ce
Message:

fixing fit , only fit parameters newly set in model

File:
1 edited

Legend:

Unmodified
Added
Removed
  • park_integration/test/constrainttestpark.py

    r4dd63eb r202f93a  
    5252        #self.assert_(chisqr2/len(data1.x) < 2) 
    5353        #self.assert_(chisqr2/len(data2.x) < 2) 
     54    def testmodel1data1param1(self): 
     55        """ test fitting for two set of data  and one model with 2 constraint""" 
     56        from sans.fit.Loader import Load 
     57        load= Load() 
     58        #Load the first set of data 
     59        load.set_filename("testdata1.txt") 
     60        load.set_values() 
     61        data1 = Data1D(x=[], y=[],dx=None, dy=None) 
     62        load.load_data(data1) 
    5463         
     64        #Load the second set of data 
     65        load.set_filename("testdata2.txt") 
     66        load.set_values() 
     67        data2 = Data1D(x=[], y=[],dx=None, dy=None) 
     68        load.load_data(data2) 
     69         
     70        #Importing the Fit module 
     71        from sans.fit.Fitting import Fit 
     72        fitter= Fit('park') 
     73        # Receives the type of model for the fitting 
     74        from sans.guitools.LineModel import LineModel 
     75        model1  = LineModel() 
     76        
     77         
     78        #Do the fit 
     79         
     80        fitter.set_model(model1,"M1",1, {'A':1}) 
     81        fitter.set_data(data1,1) 
     82        
     83      
     84         
     85        chisqr2, out2, cov2 = fitter.fit() 
     86        print "chisqr2",chisqr2 
     87        print "out2", out2 
     88        print " cov2", cov2 
     89        print chisqr2/len(data1.x) 
     90         
     91        self.assert_(math.fabs(out2[1]-2.5)/math.sqrt(cov2[1][1]) < 2) 
     92        self.assert_(math.fabs(out2[0]-4.0)/math.sqrt(cov2[0][0]) < 2) 
     93        #self.assert_(chisqr2/len(data1.x) < 2) 
     94        #self.assert_(chisqr2/len(data2.x) < 2) 
     95     
Note: See TracChangeset for help on using the changeset viewer.