Changeset 24415e9 in sasview
- Timestamp:
- Apr 9, 2009 6:00:13 PM (16 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:
- 87fbc60
- Parents:
- 56e1202
- Location:
- sansmodels/src/sans/models
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sansmodels/src/sans/models/MultiplicationModel.py
rdb39b2a r24415e9 74 74 for name , value in self.model1.params.iteritems(): 75 75 self.params[name]= value 76 if name in self.model2.getParamList(): 77 self.model2.setParam(name, value) 76 78 77 79 for name , value in self.model2.params.iteritems(): … … 98 100 @param value: value of the parameter 99 101 """ 100 self._setParamHelper( name, value)102 101 103 if name in self.model1.getParamList(): 102 104 self.model1.setParam( name, value) … … 104 106 if name in self.model2.getParamList(): 105 107 self.model2.setParam( name, value) 106 108 109 self._setParamHelper( name, value) 107 110 108 111 def _setParamHelper(self, name, value): … … 150 153 @return: (DAB value) 151 154 """ 155 152 156 return self.model1.run(x)* self.model2.run(x) 153 157 -
sansmodels/src/sans/models/test/utest_modelmultiplication.py
r8cfdd5e r24415e9 28 28 fixed=['radius.width'] 29 29 30 30 def test_multiplication_radius(self): 31 """ test multiplication model""" 32 from sans.models.MultiplicationModel import MultiplicationModel 33 from sans.models.SphereModel import SphereModel 34 from sans.models.HayterMSAStructure import HayterMSAStructure 35 my_sphere = SphereModel() 36 my_struct = HayterMSAStructure() 37 model1 = MultiplicationModel(my_sphere,my_struct) 38 self.assertEquals(model1.getParam("radius"), 39 my_struct.getParam("radius"), 40 my_sphere.getParam("radius")) 41 model2 = SphereModel() 42 x= 2 43 44 model1.setParam("radius", 60) 45 self.assertEqual(model1.getParam("radius"), 60) 46 a = model1.run(x) 47 self.assertEqual(a, 2.5723183020756634e-006) 48 model1.setParam("radius", 70) 49 b = model1.run(x) 50 self.assertNotEqual(a, b) 51 model1.setParam("radius", 60) 52 c = model1.run(x) 53 self.assertEqual(c, 2.5723183020756634e-006) 54 self.assertEqual(a, c) 55 56 57 58 31 59 def test_multiplication(self): 32 60 """ test multiplication model"""
Note: See TracChangeset
for help on using the changeset viewer.