Changeset 1511c37c in sasmodels
- Timestamp:
- Aug 1, 2017 5:29:07 PM (7 years ago)
- Branches:
- master, core_shell_microgels, costrafo411, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- 8f04da4
- Parents:
- 31df0c9
- Location:
- sasmodels/models
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/models/bcc_paracrystal.py
r0bdddc2 r1511c37c 140 140 # useful between 0.01 and 0.7. Use an exponential distribution 141 141 # in this range 'cuz its easy. 142 radius = 10**np.random.uniform(1.3, 4) 143 d_factor = 10**np.random.uniform(-2, -0.7) # sigma_d in 0.01-0.7 142 144 dnn_fraction = np.random.beta(a=10, b=1) 145 dnn = radius*4/np.sqrt(3)/dnn_fraction 143 146 pars = dict( 144 147 #sld=1, sld_solvent=0, scale=1, background=1e-32, 145 radius=10**np.random.uniform(1.3, 4), 146 d_factor=10**np.random.uniform(-2, -0.7), # sigma_d in 0.01-0.7 148 dnn=dnn, 149 d_factor=d_factor, 150 radius=radius, 147 151 ) 148 pars['dnn'] = pars['radius']*4/np.sqrt(3)/dnn_fraction149 #pars['scale'] = 1/(0.68*dnn_fraction**3) # bcc packing fraction is 0.68150 pars['scale'] = 1151 152 return pars 152 153 153 # parameters for demo154 demo = dict(155 scale=1, background=0,156 dnn=220, d_factor=0.06, sld=4, sld_solvent=1,157 radius=40,158 theta=60, phi=60, psi=60,159 radius_pd=.2, radius_pd_n=2,160 theta_pd=15, theta_pd_n=0,161 phi_pd=15, phi_pd_n=0,162 psi_pd=15, psi_pd_n=0,163 )164 154 # april 6 2017, rkh add unit tests, NOT compared with any other calc method, assume correct! 165 155 # add 2d test later … … 168 158 [{ }, 169 159 [0.001, q, 0.215268], [1.46601394721, 2.85851284174, 0.00866710287078]], 170 [{'theta': 20.0,'phi':30,'psi':40.0},(-0.017,0.035),2082.20264399],171 [{'theta': 20.0,'phi':30,'psi':40.0},(-0.081,0.011),0.436323144781 ]160 [{'theta': 20.0, 'phi': 30, 'psi': 40.0}, (-0.017, 0.035), 2082.20264399], 161 [{'theta': 20.0, 'phi': 30, 'psi': 40.0}, (-0.081, 0.011), 0.436323144781], 172 162 ] -
sasmodels/models/core_multi_shell.py
ra151caa r1511c37c 109 109 thickness = np.random.exponential(size=num_shells+1) 110 110 thickness *= total_radius/np.sum(thickness) 111 volume_fraction = 10**np.random.uniform(-4, -1)112 111 pars = dict( 113 112 #background=0, 114 scale=volume_fraction/total_radius**3*1e10,115 113 n=num_shells, 116 114 radius=thickness[0], -
sasmodels/models/fcc_paracrystal.py
r404ebbd r1511c37c 121 121 def random(): 122 122 import numpy as np 123 # Define lattice spacing as a multiple of the particle radius 124 # using the formulat a = 4 r/sqrt(3). Systems which are ordered 125 # are probably mostly filled, so use a distribution which goes from 126 # zero to one, but leaving 90% of them within 80% of the 127 # maximum bcc packing. Lattice distortion values are empirically 128 # useful between 0.01 and 0.7. Use an exponential distribution 129 # in this range 'cuz its easy. 123 # copied from bcc_paracrystal 124 radius = 10**np.random.uniform(1.3, 4) 125 d_factor = 10**np.random.uniform(-2, -0.7) # sigma_d in 0.01-0.7 130 126 dnn_fraction = np.random.beta(a=10, b=1) 127 dnn = radius*4/np.sqrt(3)/dnn_fraction 131 128 pars = dict( 132 129 #sld=1, sld_solvent=0, scale=1, background=1e-32, 133 radius=10**np.random.uniform(1.3, 4), 134 d_factor=10**np.random.uniform(-2, -0.7), # sigma_d in 0.01-0.7 130 dnn=dnn, 131 d_factor=d_factor, 132 radius=radius, 135 133 ) 136 pars['dnn'] = pars['radius']*4/np.sqrt(3)/dnn_fraction137 #pars['scale'] = 1/(0.68*dnn_fraction**3) # bcc packing fraction is 0.68138 pars['scale'] = 1139 134 return pars 140 135 141 # parameters for demo142 demo = dict(scale=1, background=0,143 dnn=220, d_factor=0.06, sld=4, sld_solvent=1,144 radius=40,145 theta=60, phi=60, psi=60,146 radius_pd=.2, radius_pd_n=0.2,147 theta_pd=15, theta_pd_n=0,148 phi_pd=15, phi_pd_n=0,149 psi_pd=15, psi_pd_n=0,150 )151 136 # april 10 2017, rkh add unit tests, NOT compared with any other calc method, assume correct! 152 137 q =4.*pi/220. … … 154 139 [{ }, 155 140 [0.001, q, 0.215268], [0.275164706668, 5.7776842567, 0.00958167119232]], 156 [{}, (-0.047, -0.007), 238.103096286],157 [{}, (0.053, 0.063), 0.863609587796 ],141 [{}, (-0.047, -0.007), 238.103096286 ], 142 [{}, (0.053, 0.063), 0.863609587796 ], 158 143 ] -
sasmodels/models/fractal.py
r404ebbd r1511c37c 111 111 pars = dict( 112 112 #background=0, sld_block=1, sld_solvent=0, 113 scale=1e4/radius**(fractal_dim/2),114 113 volfraction=volfraction, 115 114 radius=radius, -
sasmodels/models/fractal_core_shell.py
r404ebbd r1511c37c 113 113 pars = dict( 114 114 #background=0, sld_block=1, sld_solvent=0, 115 scale=1e3/total_radius**(fractal_dim/2),116 115 volfraction=volfraction, 117 116 radius=radius, -
sasmodels/models/lamellar.py
r404ebbd r1511c37c 92 92 import numpy as np 93 93 thickness = 10**np.random.uniform(1, 4) 94 scale = thickness * 10**np.random.uniform(-7, -4)95 94 pars = dict( 96 scale=scale,97 95 thickness=thickness, 98 96 ) -
sasmodels/models/lamellar_hg.py
r404ebbd r1511c37c 103 103 length_head = thickness * np.random.uniform(0, 1) 104 104 length_tail = thickness - length_head 105 scale = thickness * 10**np.random.uniform(-7, -4)106 105 pars = dict( 107 scale=scale,108 106 length_head=length_head, 109 107 length_tail=length_tail, -
sasmodels/models/lamellar_hg_stack_caille.py
r404ebbd r1511c37c 132 132 length_tail = thickness - length_head 133 133 Caille_parameter = np.random.uniform(0, 0.8) 134 scale = thickness * 10**np.random.uniform(-7, -4)135 134 pars = dict( 136 scale=1,137 135 length_head=length_head, 138 136 length_tail=length_tail, -
sasmodels/models/lamellar_stack_caille.py
r404ebbd r1511c37c 105 105 thickness = d_spacing * np.random.uniform(0, 1) 106 106 Caille_parameter = np.random.uniform(0, 0.8) 107 scale = thickness * 10**np.random.uniform(-7, -4)108 107 pars = dict( 109 scale=1,110 108 thickness=thickness, 111 109 Nlayers=Nlayers, -
sasmodels/models/lamellar_stack_paracrystal.py
r404ebbd r1511c37c 142 142 scale = thickness * 10**np.random.uniform(-7, -4) 143 143 pars = dict( 144 scale=1,144 #scale=1, 145 145 thickness=thickness, 146 146 Nlayers=Nlayers, -
sasmodels/models/sc_paracrystal.py
r404ebbd r1511c37c 140 140 def random(): 141 141 import numpy as np 142 # Define lattice spacing as a multiple of the particle radius 143 # using the formulat a = 4 r/sqrt(3). Systems which are ordered 144 # are probably mostly filled, so use a distribution which goes from 145 # zero to one, but leaving 90% of them within 80% of the 146 # maximum bcc packing. Lattice distortion values are empirically 147 # useful between 0.01 and 0.7. Use an exponential distribution 148 # in this range 'cuz its easy. 142 # copied from bcc_paracrystal 143 radius = 10**np.random.uniform(1.3, 4) 144 d_factor = 10**np.random.uniform(-2, -0.7) # sigma_d in 0.01-0.7 149 145 dnn_fraction = np.random.beta(a=10, b=1) 146 dnn = radius*4/np.sqrt(3)/dnn_fraction 150 147 pars = dict( 151 148 #sld=1, sld_solvent=0, scale=1, background=1e-32, 152 radius=10**np.random.uniform(1.3, 4), 153 d_factor=10**np.random.uniform(-2, -0.7), # sigma_d in 0.01-0.7 149 dnn=dnn, 150 d_factor=d_factor, 151 radius=radius, 154 152 ) 155 pars['dnn'] = pars['radius']*4/np.sqrt(3)/dnn_fraction156 #pars['scale'] = 1/(0.68*dnn_fraction**3) # bcc packing fraction is 0.68157 pars['scale'] = 1158 153 return pars 159 160 demo = dict(scale=1, background=0,161 dnn=220.0,162 d_factor=0.06,163 radius=40.0,164 sld=3.0,165 sld_solvent=6.3,166 theta=0.0,167 phi=0.0,168 psi=0.0)169 154 170 155 tests = [ … … 172 157 [{}, 0.001, 10.3048], 173 158 [{}, 0.215268, 0.00814889], 174 [{}, (0.414467), 0.001313289],175 [{'theta': 10.0,'phi':20,'psi':30.0},(0.045,-0.035),18.0397138402],176 [{'theta': 10.0,'phi':20,'psi':30.0},(0.023,0.045),0.0177333171285 ]159 [{}, 0.414467, 0.001313289], 160 [{'theta': 10.0, 'phi': 20, 'psi': 30.0}, (0.045, -0.035), 18.0397138402], 161 [{'theta': 10.0, 'phi': 20, 'psi': 30.0}, (0.023, 0.045), 0.0177333171285], 177 162 ] 178 163
Note: See TracChangeset
for help on using the changeset viewer.