Changeset 9e85792 in sasview for park_integration/test


Ignore:
Timestamp:
Jul 2, 2008 5:37:38 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:
96510c8
Parents:
c125e0c
Message:

working ont he 3 rd used cases

Location:
park_integration/test
Files:
2 added
1 edited

Legend:

Unmodified
Added
Removed
  • park_integration/test/testfitting.py

    r7705306 r9e85792  
    165165            self.assertEqual(cov1[1][1],cov2[1][1]) 
    166166        """ 
     167    def test2models2dataonconstraint(self): 
     168        """ test for 2 Models two data one constraint""" 
     169        from sans.fit.Loader import Load 
     170        load= Load() 
     171        #Load the first set of data 
     172        load.set_filename("testdata1.txt") 
     173        load.set_values() 
     174        data1 = Data1D(x=[], y=[],dx=None, dy=None) 
     175        load.load_data(data1) 
     176         
     177        #Load the second set of data 
     178        load.set_filename("testdata2.txt") 
     179        load.set_values() 
     180        data2 = Data1D(x=[], y=[],dx=None, dy=None) 
     181        load.load_data(data2) 
     182        
     183        #Importing the Fit module 
     184        from sans.fit.Fitting import Fit 
     185        fitter= Fit() 
     186        # Receives the type of model for the fitting 
     187        from sans.guitools.LineModel import LineModel 
     188        model1  = LineModel() 
     189        model1.name='M1' 
     190        model2  = LineModel() 
     191        model2.name='M2' 
     192        #set engine for scipy  
     193        fitter.fit_engine('scipy') 
     194        engine = fitter.returnEngine() 
     195        #Do the fit 
     196        engine.set_model(model1,1) 
     197        engine.set_data(data1,1) 
     198        engine.set_model(model2,2) 
     199        engine.set_data(data2,2) 
     200     
     201        try: engine.fit({'A':2,'B':1},None,None) 
     202        except ValueError,msg: 
     203            assert str(msg)=="cannot fit more than one model",'Message: <%s>'%(msg) 
     204         
     205        #set engine for park  
     206        fitter= Fit() 
     207        fitter.fit_engine('park') 
     208        engine = fitter.returnEngine() 
     209        #Do the fit 
     210        engine.set_data(data1,1) 
     211        engine.set_param(model1,{'A':2,'B':1}) 
     212        engine.set_model(model1,1) 
     213         
     214        engine.set_param(model2,{'A':3,'B':'5*M1.B'}) 
     215        engine.set_model(model2,2) 
     216        engine.set_data(data2,2) 
     217        engine.fit({'A':2,'B':1},None,None) 
     218         
Note: See TracChangeset for help on using the changeset viewer.