Changeset ec2ca99 in sasmodels for sasmodels/models/hollow_cylinder.py
- Timestamp:
- Feb 8, 2016 6:01:18 AM (8 years ago)
- Branches:
- master, core_shell_microgels, costrafo411, magnetic_model, release_v0.94, release_v0.95, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- f0fb9fe, 66d119f
- Parents:
- 98f3053
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/models/hollow_cylinder.py
r0420af7 rec2ca99 78 78 """ 79 79 category = "shape:cylinder" 80 81 # 80 # pylint: disable=bad-whitespace, line-too-long 81 # ["name", "units", default, [lower, upper], "type","description"], 82 82 parameters = [ 83 ["radius", "Ang", 30.0, [0, inf], "volume", "Cylinder radius"], 84 ["core_radius", "Ang", 20.0, [0, inf], "volume", "Hollow core radius"], 85 ["length", "Ang", 400.0, [0, inf], "volume", "Cylinder length"], 86 ["sld", "1/Ang^2", 6.3, [-inf, inf], "", "Cylinder sld"], 87 ["solvent_sld", "1/Ang^2", 1, [-inf, inf], "", "Solvent sld"], 88 ["theta", "degrees", 90, [-360, 360], "orientation", "Theta angle"], 89 ["phi", "degrees", 0, [-360, 360], "orientation", "Phi angle"], 90 ] 83 ["radius", "Ang", 30.0, [0, inf], "volume", "Cylinder radius"], 84 ["core_radius", "Ang", 20.0, [0, inf], "volume", "Hollow core radius"], 85 ["length", "Ang", 400.0, [0, inf], "volume", "Cylinder length"], 86 ["sld", "1/Ang^2", 6.3, [-inf, inf], "", "Cylinder sld"], 87 ["solvent_sld", "1/Ang^2", 1, [-inf, inf], "", "Solvent sld"], 88 ["theta", "degrees", 90, [-360, 360], "orientation", "Theta angle"], 89 ["phi", "degrees", 0, [-360, 360], "orientation", "Phi angle"], 90 ] 91 # pylint: enable=bad-whitespace, line-too-long 91 92 92 93 source = ["lib/J1.c", "lib/gauss76.c", "hollow_cylinder.c"] 93 94 94 95 def ER(radius, core_radius, length): 96 """ 97 :param radius: Cylinder radius 98 :param core_radius: Hollow core radius, UNUSED 99 :param length: Cylinder length 100 :return: Effective radius 101 """ 95 102 if radius == 0 or length == 0: 96 103 return 0.0 … … 104 111 105 112 def VR(radius, core_radius, length): 113 """ 114 :param radius: Cylinder radius 115 :param core_radius: Hollow core radius 116 :param length: Cylinder length 117 :return: Volf ratio for P(q)*S(q) 118 """ 106 119 vol_core = pi*core_radius*core_radius*length 107 120 vol_total = pi*radius*radius*length … … 110 123 111 124 # parameters for demo 112 demo = dict(scale=1.0, background=0.0,length=400.0,radius=30.0,core_radius=20.0,113 sld=6.3,solvent_sld=1,theta=90,phi=0,125 demo = dict(scale=1.0, background=0.0, length=400.0, radius=30.0, 126 core_radius=20.0, sld=6.3, solvent_sld=1, theta=90, phi=0, 114 127 radius_pd=.2, radius_pd_n=9, 115 128 length_pd=.2, length_pd_n=10, 116 129 core_radius_pd=.2, core_radius_pd_n=9, 117 130 theta_pd=10, theta_pd_n=5, 118 131 ) 119 132 120 133 # For testing against the old sasview models, include the converted parameter 121 134 # names and the target sasview model name. 122 135 oldname = 'HollowCylinderModel' 123 oldpars = dict(scale='scale', background='background',radius='radius',124 core_radius='core_radius', sld='sldCyl',length='length',125 solvent_sld='sldSolv', phi='axis_phi',theta='axis_theta')136 oldpars = dict(scale='scale', background='background', radius='radius', 137 core_radius='core_radius', sld='sldCyl', length='length', 138 solvent_sld='sldSolv', phi='axis_phi', theta='axis_theta') 126 139 127 140 # Parameters for unit tests 128 141 tests = [ 129 [{"radius" : 30.0},0.00005,1764.926],130 [{},'VR',1.8],131 [{},0.001,1756.76]132 142 [{"radius": 30.0}, 0.00005, 1764.926], 143 [{}, 'VR', 1.8], 144 [{}, 0.001, 1756.76] 145 ]
Note: See TracChangeset
for help on using the changeset viewer.