Changeset 0abf7bf in sasview for sansmodels/test/SmearList.py
- Timestamp:
- Nov 23, 2011 3:16:37 PM (12 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:
- 26da93f
- Parents:
- 953fe92
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sansmodels/test/SmearList.py
r18e250c r0abf7bf 1 1 2 from sans.models.ModelFactory import ModelFactory3 2 from sans.models.BaseComponent import BaseComponent 4 3 import math … … 15 14 16 15 ## Model to smear 17 #self.model = factory.getModel(model_name)18 16 self.model = model 19 17 ## Standard deviation of the smearing … … 53 51 54 52 # Gaussian function used to weigh points 55 #gaussian = ModelFactory().getModel("Gaussian")56 53 gaussian = Gaussian() 57 54 gaussian.setParam('sigma', self.sigmas[id]) … … 162 159 163 160 return value 164 165 # main166 if __name__ == '__main__':167 import math168 if True:169 cyl = ModelFactory().getModel("CylinderModel")170 cyl.setParam('length', 2000.0)171 cyl.setParam('cyl_phi', .45)172 cyl.setParam('cyl_theta', 2.)173 #app = Smear(cyl,['cyl_theta', 'cyl_phi'], [.01, .01])174 #app = Smear(cyl,['cyl_theta', 'cyl_phi'], [2.0, 2.0])175 #app = Smear(cyl,['cyl_theta'], [2.5])176 app = Smear(cyl, ['cyl_phi', 'cyl_theta'], [math.pi, math.pi])177 #app = Smear(cyl,['scale', 'scale'],[.5,1.0])178 val_no = cyl.run([.001, 1.0])179 print "Cylinder (no smear) f(.1):", val_no180 val_sm = app.run([.001, 1.0])181 print "Cylinder (smear) f(.1):", val_sm, app.error, app.error/val_sm182 print "Cylinder (1D) f(.1):", cyl.run(.001), cyl.run(.001)/val_sm183 184 185 print "--------------"186 sinsin = ModelFactory().getModel("SinSin")187 sinsin.setParam('a', -1.7)188 sinsin.setParam('b', 5.45)189 #app = Smear(sinsin, ['A'], [3.1])190 #app = Smear(sinsin, ['A', 'b'], [math.pi/2.0, .0])191 app = Smear(sinsin, ['A'], [math.pi/2.0])192 #app = Smear(cyl,['scale', 'scale'],[.5,1.0])193 val_no = sinsin.run(1.0)194 print "SinSin (no smear) :", val_no195 val_sm = app.run(1.0)196 print "SinSin (smear) : %g +- %g" % (val_sm, app.error)197
Note: See TracChangeset
for help on using the changeset viewer.