Changeset aafa962 in sasview for Invariant/test
- Timestamp:
- Jan 16, 2010 12:44:34 PM (15 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:
- 52070a1
- Parents:
- 82703a1
- Location:
- Invariant/test
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
Invariant/test/PolySpheres.txt
ref9ed58 raafa962 1 0 0 0 1 2 0.003 5.58459588740281 1.18158747955905 2 3 0.0031098987853131 5.58031083426704 0.590567038651574 -
Invariant/test/utest_data_handling.py
r6939bd4 raafa962 31 31 32 32 # Create invariant object. Background and scale left as defaults. 33 fit = invariant. FitFunctor(data=self.data)33 fit = invariant.Extrapolator(data=self.data) 34 34 a,b = fit.fit() 35 35 … … 48 48 49 49 # Create invariant object. Background and scale left as defaults. 50 fit = invariant. FitFunctor(data=self.data)50 fit = invariant.Extrapolator(data=self.data) 51 51 a,b = fit.fit() 52 52 … … 113 113 """ 114 114 self.scale = 1.5 115 self.rg = 70.0115 self.rg = 30.0 116 116 x = numpy.arange(0.0001, 0.1, 0.0001) 117 117 y = numpy.asarray([self.scale * math.exp( -(q*self.rg)**2 / 3.0 ) for q in x]) … … 129 129 130 130 self.assertEqual(inv._low_extrapolation_npts, 20) 131 self.assertEqual(inv._low_extrapolation_function.__ name__, 'guinier')131 self.assertEqual(inv._low_extrapolation_function.__class__, invariant.Guinier) 132 132 133 133 # Data boundaries for fiiting … … 136 136 137 137 # Extrapolate the low-Q data 138 a, b = inv._fit( function=inv._low_extrapolation_function,138 a, b = inv._fit(model=inv._low_extrapolation_function, 139 139 qmin=qmin, 140 140 qmax=qmax, … … 172 172 173 173 self.assertEqual(inv._low_extrapolation_npts, 20) 174 self.assertEqual(inv._low_extrapolation_function.__ name__, 'power_law')174 self.assertEqual(inv._low_extrapolation_function.__class__, invariant.PowerLaw) 175 175 176 176 # Data boundaries for fitting … … 179 179 180 180 # Extrapolate the low-Q data 181 a, b = inv._fit( function=inv._low_extrapolation_function,181 a, b = inv._fit(model=inv._low_extrapolation_function, 182 182 qmin=qmin, 183 183 qmax=qmax, … … 186 186 self.assertAlmostEqual(self.scale, a, 6) 187 187 self.assertAlmostEqual(self.m, b, 6) 188 188 189 class TestLinearization(unittest.TestCase): 190 191 def test_guinier_incompatible_length(self): 192 g = invariant.Guinier() 193 self.assertRaises(AssertionError, g.linearize_data, [1],[1,2],None) 194 self.assertRaises(AssertionError, g.linearize_data, [1,2],[1,2],[1]) 195 196 def test_linearization(self): 197 """ 198 Check that the linearization process filters out points 199 that can't be transformed 200 """ 201 x = numpy.asarray(numpy.asarray([0,1,2,3])) 202 y = numpy.asarray(numpy.asarray([1,1,1,1])) 203 g = invariant.Guinier() 204 x_out, y_out, dy_out = g.linearize_data(x,y,None) 205 self.assertEqual(len(x_out), 3) 206 self.assertEqual(len(y_out), 3) 207 self.assertEqual(len(dy_out), 3) 208 -
Invariant/test/utest_use_cases.py
r46d50ca raafa962 3 3 4 4 """ 5 #TODO: there's no test for smeared extrapolation 5 6 import unittest 6 7 import numpy … … 24 25 25 26 # Create invariant object. Background and scale left as defaults. 26 fit = invariant. FitFunctor(data=self.data)27 fit = invariant.Extrapolator(data=self.data) 27 28 28 29 ##Without holding … … 40 41 41 42 # Create invariant object. Background and scale left as defaults. 42 fit = invariant. FitFunctor(data=self.data)43 fit = invariant.Extrapolator(data=self.data) 43 44 44 45 #With holding a = -power =4 … … 62 63 63 64 # Create invariant object. Background and scale left as defaults. 64 fit = invariant. FitFunctor(data=self.data)65 fit = invariant.Extrapolator(data=self.data) 65 66 66 67 ##Without holding … … 78 79 79 80 # Create invariant object. Background and scale left as defaults. 80 fit = invariant. FitFunctor(data=self.data)81 fit = invariant.Extrapolator(data=self.data) 81 82 82 83 #With holding a = -power =4
Note: See TracChangeset
for help on using the changeset viewer.