- Timestamp:
- Mar 31, 2015 11:52:01 AM (10 years ago)
- 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:
- 4342107f, c971c98
- Parents:
- 6987c8a
- Location:
- test
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
test/pr_inversion/test/test_output.txt
r9f7fbd9 racf8e4a5 3 3 #alpha=0.0007 4 4 #chi2=836.797 5 #elapsed=0.0003 778935 #elapsed=0.000389099 6 6 #qmin=None 7 7 #qmax=None -
test/sasfit/test/batch_fit.py
refa5e44 racf8e4a5 3 3 import unittest 4 4 from sas.dataloader.loader import Loader 5 from sas.fit.Fitting import Fit5 from sas.fit.Fitting import BumpsFit as Fit 6 6 from sas.models.CylinderModel import CylinderModel 7 7 import sas.models.dispersion_models … … 42 42 self.qmax = qmax 43 43 44 def _reset_helper(self, path=None, engine="bumps",npts=NPTS):44 def _reset_helper(self, path=None, npts=NPTS): 45 45 """ 46 Set value to fitter engineand prepare inputs for map function46 Set value to fitter and prepare inputs for map function 47 47 """ 48 48 for i in range(npts): 49 49 data = Loader().load(path) 50 fitter = Fit( engine)50 fitter = Fit() 51 51 #create model 52 52 model = CylinderModel() … … 77 77 self.list_of_mapper.append(classMapper) 78 78 79 def reset_value(self , engine='bumps'):79 def reset_value(self): 80 80 """ 81 81 Initialize inputs for the map function … … 88 88 89 89 path = "testdata_line3.txt" 90 self._reset_helper(path=path, engine=engine,npts=NPTS)90 self._reset_helper(path=path, npts=NPTS) 91 91 path = "testdata_line.txt" 92 self._reset_helper(path=path, engine=engine,npts=NPTS)92 self._reset_helper(path=path, npts=NPTS) 93 93 path = "SILIC010_noheader.DAT" 94 self._reset_helper(path=path, engine=engine,npts=NPTS)94 self._reset_helper(path=path, npts=NPTS) 95 95 path = "cyl_400_20.txt" 96 self._reset_helper(path=path, engine=engine,npts=NPTS)96 self._reset_helper(path=path, npts=NPTS) 97 97 path = "sphere_80.txt" 98 self._reset_helper(path=path, engine=engine,npts=NPTS)98 self._reset_helper(path=path, npts=NPTS) 99 99 path = "PolySpheres.txt" 100 self._reset_helper(path=path, engine=engine,npts=NPTS)100 self._reset_helper(path=path, npts=NPTS) 101 101 path = "latex_qdev.txt" 102 self._reset_helper(path=path, engine=engine,npts=NPTS)102 self._reset_helper(path=path, npts=NPTS) 103 103 path = "latex_qdev2.txt" 104 self._reset_helper(path=path, engine=engine,npts=NPTS)104 self._reset_helper(path=path, npts=NPTS) 105 105 106 106 -
test/sasfit/test/utest_fit_cylinder.py
rc3caa49 racf8e4a5 7 7 8 8 from sas.fit.AbstractFitEngine import Model 9 from sas.fit. Fitting importFit9 from sas.fit.BumpsFitting import BumpsFit as Fit 10 10 from sas.dataloader.loader import Loader 11 11 … … 15 15 """ initialize data""" 16 16 self.data = Loader().load("cyl_400_20.txt") 17 # Create model that fitt ing engineunderstands17 # Create model that fitter understands 18 18 from sas.models.CylinderModel import CylinderModel 19 19 self.model = CylinderModel() … … 27 27 self.pars1 =['length','radius','scale'] 28 28 29 def _fit(self, name="bumps"):30 """ return fit result"""31 fitter = Fit( name)29 def test_fit(self): 30 """Simple cylinder model fit""" 31 fitter = Fit() 32 32 fitter.set_data(self.data,1) 33 33 fitter.set_model(self.model,1,self.pars1) … … 43 43 self.assertTrue( math.fabs(result1.pvec[2]-1.0)/3.0 < result1.stderr[2] ) 44 44 self.assertTrue( result1.fitness < 1.0 ) 45 46 47 def test_bumps(self):48 """ Simple cylinder model fit """49 self._fit("bumps")50 45 51 46 … … 82 77 def test_constrained_bumps(self): 83 78 """ Simultaneous cylinder model fit """ 84 self._run_fit(Fit( 'bumps'))79 self._run_fit(Fit()) 85 80 86 81 #@unittest.skip("") … … 92 87 93 88 for n, v, dv in zip(result1.param_list, result1.pvec, result1.stderr): 94 #print "%s M1.%s = %s +/- %s"%(fitter._engine.__class__.__name__,n,v,dv)95 89 if n == "length": 96 90 self.assertTrue( math.fabs(v-400.0)/3.0 < dv ) … … 100 94 self.assertTrue( math.fabs(v-1.0)/3.0 < dv ) 101 95 for n, v, dv in zip(result2.param_list, result2.pvec, result2.stderr): 102 #print "%s M2.%s = %s +/- %s"%(fitter._engine.__class__.__name__,n,v,dv)103 96 if n=='radius': 104 97 self.assertTrue( math.fabs(v-40.0)/3.0 < dv ) -
test/sasfit/test/utest_fit_line.py
refa5e44 racf8e4a5 8 8 from sas.fit.AbstractFitEngine import Model, FitHandler 9 9 from sas.dataloader.loader import Loader 10 from sas.fit. Fitting importFit10 from sas.fit.BumpsFitting import BumpsFit as Fit 11 11 from sas.models.LineModel import LineModel 12 12 from sas.models.Constant import Constant … … 16 16 17 17 def test_bad_pars(self): 18 fitter = Fit( 'bumps')18 fitter = Fit() 19 19 20 20 data = Loader().load("testdata_line.txt") … … 34 34 raise AssertionError("No error raised for fitting with wrong parameters name to fit") 35 35 36 def fit_single(self, fitter_name,isdream=False):37 fitter = Fit( fitter_name)36 def fit_single(self, isdream=False): 37 fitter = Fit() 38 38 39 39 data = Loader().load("testdata_line.txt") … … 74 74 #print "fitting",alg,opts 75 75 #kprint "options",fitters.FIT_OPTIONS[alg].__dict__ 76 self.fit_single( 'bumps',isdream=(alg=='dream'))76 self.fit_single(isdream=(alg=='dream')) 77 77 78 78 def test_bumps_de(self): … … 102 102 103 103 #Importing the Fit module 104 fitter = Fit( 'bumps')104 fitter = Fit() 105 105 # Receives the type of model for the fitting 106 106 model11 = LineModel() … … 161 161 162 162 #Importing the Fit module 163 fitter = Fit( 'bumps')163 fitter = Fit() 164 164 fitter.set_data(data1,1) 165 165 fitter.set_model(model1,1,pars1) … … 194 194 #Importing the Fit module 195 195 196 fitter = Fit( 'bumps')196 fitter = Fit() 197 197 fitter.set_data(data1,1,qmin=0, qmax=7) 198 198 fitter.set_model(model,1,pars1) -
test/sasfit/test/utest_fit_smeared.py
ra3f125f0 racf8e4a5 8 8 import numpy 9 9 from sas.fit.AbstractFitEngine import Model 10 from sas.fit. Fitting importFit10 from sas.fit.BumpsFitting import BumpsFit as Fit 11 11 from sas.dataloader.loader import Loader 12 12 from sas.models.qsmearing import smear_selection … … 24 24 #out.dy = out.y 25 25 26 fitter = Fit( 'bumps')26 fitter = Fit() 27 27 fitter.set_data(out,1) 28 28 … … 62 62 #fitters.FIT_OPTIONS[alg].options.update(opts) 63 63 fitters.FIT_OPTIONS[alg].options.update(monitors=[]) 64 self._dispersion(fitter = Fit( 'bumps'))64 self._dispersion(fitter = Fit()) 65 65 66 66 def _dispersion(self, fitter): … … 94 94 #import time; T0 = time.time() 95 95 result1, = fitter.fit() 96 #print "time",time.time()-T0,fitter._engine.__class__.__name__ 97 96 98 97 self.assert_(result1) 99 98 self.assertTrue(len(result1.pvec)>0) … … 137 136 138 137 # Fit 139 fitter = Fit( 'bumps')138 fitter = Fit() 140 139 141 140 # Data: right now this is the only way to set the smearer object … … 143 142 # data for a given fit. 144 143 fitter.set_data(self.data_res,1) 145 fitter. _engine.fit_arrange_dict[1].data_list[0].smearer = smear144 fitter.fit_arrange_dict[1].data_list[0].smearer = smear 146 145 147 146 # Model: maybe there's a better way to do this. … … 169 168 #self.assertEqual(smear.__class__.__name__, 'PySmearer') 170 169 171 fitter = Fit( 'bumps')170 fitter = Fit() 172 171 173 172 # Data: right now this is the only way to set the smearer object … … 175 174 # data for a given fit. 176 175 fitter.set_data(self.data_slit,1) 177 fitter. _engine.fit_arrange_dict[1].data_list[0].smearer = smear178 fitter. _engine.fit_arrange_dict[1].data_list[0].qmax = 0.003176 fitter.fit_arrange_dict[1].data_list[0].smearer = smear 177 fitter.fit_arrange_dict[1].data_list[0].qmax = 0.003 179 178 180 179 # Model -
test/sasfit/test/utest_multiplicative_model.py
r769a422 racf8e4a5 8 8 from sas.dataloader.data_info import Data1D 9 9 from sas.fit.AbstractFitEngine import Model,FitData1D 10 from sas.fit. Fitting importFit10 from sas.fit.BumpsFitting import BumpsFit as Fit 11 11 from sas.dataloader.loader import Loader 12 12 from sas.models.MultiplicationModel import MultiplicationModel … … 38 38 39 39 pars1 =['length','radius','scale_factor'] 40 fitter = Fit( 'bumps')40 fitter = Fit() 41 41 fitter.set_data(data,1) 42 42 fitter.set_model(model,1,pars1) -
test/sasfit/test/utest_small_test.py
refa5e44 racf8e4a5 4 4 import unittest 5 5 import math 6 from sas.fit. Fitting importFit6 from sas.fit.BumpsFitting import BumpsFit as Fit 7 7 from sas.dataloader.loader import Loader 8 8 import bumps.fitters … … 16 16 out= Loader().load("cyl_400_20.txt") 17 17 18 fitter = Fit( 'bumps')18 fitter = Fit() 19 19 # Receives the type of model for the fitting 20 20 from sas.models.CylinderModel import CylinderModel
Note: See TracChangeset
for help on using the changeset viewer.