Changeset b297ba9 in sasmodels for sasmodels/models/hollow_cylinder.py
- Timestamp:
- Mar 20, 2019 5:03:50 PM (5 years ago)
- Branches:
- master, core_shell_microgels, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- 4e28511
- Parents:
- 0d362b7
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/models/hollow_cylinder.py
r99658f6 rb297ba9 60 60 .. [#] L A Feigin and D I Svergun, *Structure Analysis by Small-Angle X-Ray and 61 61 Neutron Scattering*, Plenum Press, New York, (1987) 62 L. Onsager, Ann. New York Acad. Sci. 51, 627-659 (1949). 62 L. Onsager, Ann. New York Acad. Sci. 51, 627-659 (1949). 63 63 64 64 Authorship and Verification … … 103 103 have_Fq = True 104 104 effective_radius_type = [ 105 "excluded volume", "equivalent outer volume sphere", "outer radius", "half length", 105 "excluded volume", "equivalent outer volume sphere", 106 "outer radius", "half length", 106 107 "half outer min dimension", "half outer max dimension", 107 108 "half outer diagonal", … … 109 110 110 111 def random(): 112 """Return a random parameter set for the model.""" 111 113 length = 10**np.random.uniform(1, 4.7) 112 114 outer_radius = 10**np.random.uniform(1, 4.7) … … 130 132 theta_pd=10, theta_pd_n=5, 131 133 ) 134 135 def r_eff(radius, thickness, length): 136 """R_eff from excluded volume""" 137 radius += thickness 138 return (0.5*(0.75*radius*(2.0*radius*length 139 + (radius + length)*(pi*radius + length)) 140 )**(1./3.)) 141 142 def shell_volume(radius, thickness, length): 143 """shell volume for parameter set""" 144 return pi*((radius+thickness)**2-radius**2)*length 145 146 def form_shell_ratio(radius, thickness, length): 147 """form:shell ratio""" 148 return (radius+thickness)**2/((radius+thickness)**2 - radius**2) 149 132 150 q = 0.1 133 151 # april 6 2017, rkh added a 2d unit test, assume correct! 134 152 qx = q*cos(pi/6.0) 135 153 qy = q*sin(pi/6.0) 136 radius = parameters[0][2] 137 thickness = parameters[1][2] 138 length = parameters[2][2] 154 test_pars = [ 155 parameters[0][2], # radius 156 parameters[1][2], # thickness 157 parameters[2][2], # length 158 ] 139 159 # Parameters for unit tests 140 160 tests = [ 141 161 [{}, 0.00005, 1764.926], 142 162 [{}, 0.1, None, None, 143 0.5*(0.75*(radius+thickness)*(2.0*(radius+thickness)*length + ((radius+thickness) + length)*(pi*(radius+thickness) + length)))**(1./3.), # R_eff from excluded volume 144 pi*((radius+thickness)**2-radius**2)*length, # shell volume 145 (radius+thickness)**2/((radius+thickness)**2 - radius**2), # form:shell ratio 163 r_eff(*test_pars), shell_volume(*test_pars), form_shell_ratio(*test_pars), 146 164 ], 147 165 [{}, 0.001, 1756.76], 148 166 [{}, (qx, qy), 2.36885476192], 149 167 ] 150 del qx, qy # not necessary to delete, but cleaner168 del qx, qy, test_pars # not necessary to delete, but cleaner
Note: See TracChangeset
for help on using the changeset viewer.