Changeset bda194e3 in sasview for sansmodels/src/sans/models/test
- Timestamp:
- Aug 21, 2009 8:06:40 AM (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:
- c1c29b6
- Parents:
- 861a2d3
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sansmodels/src/sans/models/test/validate_2D_3axes_shape_model.py
r8e36cdd rbda194e3 25 25 Averaging the 3-axes 2D scattering intensity give a slightly 26 26 different output than the 1D function 27 at hight Q (Q>~0.2). This is due (?)to the way the IGOR library28 averages , taking only 76 points in alpha, the angle between27 at hight Q (Q>~0.2). This is due to the way the IGOR library 28 averages(?), taking only 76 points in alpha, the angle between 29 29 the axis of the ellipsoid and the q vector. 30 30 … … 59 59 60 60 npts =points 61 #The average values are very sensitive to npts of phi so npts_alpha should be large enough. 62 npts_alpha =180 #npts of phi 61 63 model = model_class() 62 64 #model.setParam('scale', 1.0) … … 84 86 output_f.write("<q_average> <2d_average> <1d_average>\n") 85 87 86 for i_q in range(1, 40):88 for i_q in range(1, 23): 87 89 q = 0.01*i_q 88 90 sum = 0.0 91 weight = 0.0 89 92 for i_theta in range(npts): 90 93 theta = math.pi/npts*(i_theta+1) … … 92 95 model.setParam(theta_label, theta) 93 96 94 for j in range(npts ):95 model.setParam(phi_label, math.pi * 2.0 / npts * j)97 for j in range(npts_alpha): 98 model.setParam(phi_label, math.pi * 2.0 / npts_alpha * j) 96 99 for k in range(npts): 97 100 model.setParam(psi_label, math.pi * 2.0 / npts * k) 98 101 if str(model.run([q, 0])).count("INF")>0: 99 102 print "ERROR", q, theta, math.pi * 2.0 / npts * k 103 104 # sin() is due to having not uniform bin number density wrt the q plane. 100 105 sum += model.run([q, 0])*math.sin(theta) 101 #sum += model.run([q, 0]) 102 value = sum/npts/(npts)/npts*math.pi/2.0 106 weight += math.sin(theta) 107 108 value = sum/weight #*math.pi/2.0 103 109 ana = model.run(q) 104 if q<0. 2and (value-ana)/ana>0.05:110 if q<0.3 and (value-ana)/ana>0.05: 105 111 passed = False 106 112 output_f.write("%10g %10g %10g\n" % (q, value, ana)) … … 115 121 validator = Validate2D() 116 122 117 #te was not passed. 123 #Note: Test one model by one model, otherwise it could crash depending on the memory. 124 118 125 te_passed =validator(TriaxialEllipsoidModel, points=76) 119 pp_passed = validator(ParallelepipedModel, points=76)120 ell_passed = validator(EllipticalCylinderModel, points=76)126 #pp_passed = validator(ParallelepipedModel, points=76) 127 #ell_passed = validator(EllipticalCylinderModel, points=76) 121 128 122 129 print "" 123 130 print "Model Passed" 124 131 print "TriaxialEllipsoid %s" % te_passed 125 print "ParallelepipedModel %s" % pp_passed126 print "EllipticalCylinder %s" % ell_passed132 #print "ParallelepipedModel %s" % pp_passed 133 #print "EllipticalCylinder %s" % ell_passed 127 134 128 135
Note: See TracChangeset
for help on using the changeset viewer.