Ignore:
Timestamp:
Apr 4, 2014 10:44: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:
d44648e
Parents:
e6d9703
Message:

correct fitting tests so that they run (though not yet automatically)

File:
1 edited

Legend:

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

    r5777106 r6c00702  
    44""" 
    55import unittest 
     6import math 
    67 
    78from sans.guiframe.dataFitting import Data1D  
    89from sans.fit.AbstractFitEngine import Model,FitData1D 
    9 import math 
    1010from sans.fit.Fitting import Fit 
    11 from DataLoader.loader import Loader 
     11from sans.dataloader.loader import Loader 
     12from sans.models.MultiplicationModel import MultiplicationModel 
     13from sans.models.CylinderModel import CylinderModel 
     14from sans.models.SquareWellStructure import SquareWellStructure 
    1215 
    1316class testFitModule(unittest.TestCase): 
     
    2124        data = Data1D(x=out.x, y=out.y, dx=out.dx, dy=out.dy) 
    2225        # Receives the type of model for the fitting 
    23         from sans.models.MultiplicationModel import MultiplicationModel 
    24         from sans.models.CylinderModel import CylinderModel 
    25         from sans.models.SquareWellStructure import SquareWellStructure 
    2626        model1  =  MultiplicationModel(CylinderModel(),SquareWellStructure()) 
    2727        model1.setParam('background', 0.0) 
    28         model1.setParam('contrast', 3e-006) 
    29         model1.setParam('length', 600) 
    30         model1.setParam('radius', 20) 
    31         model1.setParam('scale', 10) 
     28        model1.setParam('sldCyl', 3e-006) 
     29        model1.setParam('sldSolv', 0.0) 
     30        model1.setParam('length', 420) 
     31        model1.setParam('radius', 40) 
     32        model1.setParam('scale_factor', 2) 
    3233        model1.setParam('volfraction', 0.04) 
    3334        model1.setParam('welldepth', 1.5) 
     
    3637        model = Model(model1) 
    3738     
    38         pars1 =['length','radius','scale'] 
     39        pars1 =['length','radius','scale_factor'] 
    3940        fitter = Fit('scipy') 
    4041        fitter.set_data(data,1) 
    4142        fitter.set_model(model,1,pars1) 
    42         fitter.select_problem_for_fit(Uid=1,value=1) 
    43         result1 = fitter.fit() 
    44        
     43        fitter.select_problem_for_fit(id=1,value=1) 
     44        result1, = fitter.fit() 
     45 
    4546        self.assert_(result1) 
    4647        self.assertTrue(len(result1.pvec)>=0 ) 
    4748        self.assertTrue(len(result1.stderr)>= 0) 
    48          
     49 
     50        print "results",list(zip(result1.pvec, result1.stderr)) 
    4951        self.assertTrue( math.fabs(result1.pvec[0]-605)/3.0 <= result1.stderr[0] ) 
    5052        self.assertTrue( math.fabs(result1.pvec[1]-20.0)/3.0  <= result1.stderr[1] ) 
Note: See TracChangeset for help on using the changeset viewer.