Changeset 6fe5100 in sasview for test/park_integration


Ignore:
Timestamp:
Apr 6, 2014 7:29:59 AM (10 years ago)
Author:
pkienzle
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:
95d58d3
Parents:
960fdbb
Message:

Bumps first pass. Fitting works but no pretty pictures

File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/park_integration/test/test_fit_line.py

    rda5d8e8 r6fe5100  
    44""" 
    55import unittest 
     6import math 
    67 
    78from sans.fit.AbstractFitEngine import Model 
     
    1112from sans.models.Constant import Constant 
    1213 
    13 import math 
    1414class testFitModule(unittest.TestCase): 
    1515    """ test fitting """ 
     
    2121        data.name = data.filename 
    2222        #Importing the Fit module 
    23         fitter = Fit('scipy') 
     23        from bumps import fitters 
     24        fitters.FIT_DEFAULT = 'dream' 
     25        print fitters.FIT_OPTIONS['dream'].__dict__ 
     26        fitter = Fit('bumps') 
    2427        # Receives the type of model for the fitting 
    2528        model1  = LineModel() 
     
    4447        self.assertTrue( result1.fitness/len(data.x) < 2 ) 
    4548 
     49        return 
    4650        #fit with park test 
    4751        fitter = Fit('park') 
     
    103107           assert str(msg)=="Scipy can't fit more than a single fit problem at a time." 
    104108        else: raise AssertionError,"No error raised for scipy fitting with more than 2 models" 
    105          
     109 
     110        return 
    106111        #fit with park test 
    107112        fitter = Fit('park') 
     
    121126    def test3(self): 
    122127        """ fit 2 data and 2 model with 1 constrainst""" 
     128        return 
    123129        #load data 
    124130        l = Loader() 
     
    189195         
    190196        result1, = fitter.fit() 
     197        #print(result1) 
    191198        self.assert_(result1) 
    192199 
     
    194201        self.assertTrue( math.fabs(result1.pvec[1]-2.5)/3 <= result1.stderr[1]) 
    195202        self.assertTrue( result1.fitness/len(data1.x) < 2 ) 
    196          
     203 
     204        return 
    197205        #fit with park test 
    198206        fitter = Fit('park') 
     
    213221        self.assertAlmostEquals( result1.stderr[1],result2.stderr[1] ) 
    214222        self.assertTrue( result2.fitness/(len(data2.x)+len(data1.x)) < 2 ) 
    215          
    216          
     223 
     224 
     225if __name__ == "__main__": 
     226    unittest.main() 
    217227     
    218      
Note: See TracChangeset for help on using the changeset viewer.