Changeset a151caa in sasmodels
- Timestamp:
- Jul 28, 2017 10:49:09 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:
- 404ebbd
- Parents:
- 0bdddc2
- Location:
- sasmodels/models
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/models/barbell.py
r9802ab3 ra151caa 115 115 source = ["lib/polevl.c", "lib/sas_J1.c", "lib/gauss76.c", "barbell.c"] 116 116 117 def random(): 118 import numpy as np 119 pars = dict( 120 scale=10**np.random.uniform(-4,-1), 121 radius_bell=10**np.random.uniform(1.3,3), 122 length=10**np.random.uniform(0,3), 123 ) 124 pars['radius'] = pars['radius_bell']*np.random.uniform(0,1) 125 if pars['radius_bell'] < 100: 126 pars['length'] *= 10 127 pars['scale'] *= 100 128 return pars 129 117 130 # parameters for demo 118 131 demo = dict(scale=1, background=0, -
sasmodels/models/be_polyelectrolyte.py
r3330bb4 ra151caa 17 17 r_{0}^2 = \frac{1}{\alpha \sqrt{C_a} \left( b/\sqrt{48\pi L_b}\right)} 18 18 19 where 19 where 20 20 21 21 $K$ is the contrast factor for the polymer which is defined differently than in … … 28 28 29 29 a = b_p - (v_p/v_s) b_s 30 30 31 31 where $b_p$ and $b_s$ are sum of the scattering lengths of the atoms 32 32 constituting the monomer of the polymer and the sum of the scattering lengths … … 35 35 36 36 $L_b$ is the Bjerrum length(|Ang|) - **Note:** This parameter needs to be 37 kept constant for a given solvent and temperature! 37 kept constant for a given solvent and temperature! 38 38 39 39 $h$ is the virial parameter (|Ang^3|/mol) - **Note:** See [#Borue]_ for the … … 67 67 * **Author:** NIST IGOR/DANSE **Date:** pre 2010 68 68 * **Last Modified by:** Paul Kienzle **Date:** July 24, 2016 69 * **Last Reviewed by:** Paul Butler and Richard Heenan **Date:** 69 * **Last Reviewed by:** Paul Butler and Richard Heenan **Date:** 70 70 October 07, 2016 71 71 """ … … 139 139 Iq.vectorized = True # Iq accepts an array of q values 140 140 141 def random(): 142 import numpy as np 143 pars = dict( 144 scale=10000, #background=0, 145 #polymer_concentration=0.7, 146 polymer_concentration=np.random.beta(5, 3), # around 70% 147 #salt_concentration=0.0, 148 # keep salt concentration extremely low 149 # and use explicit molar to match polymer concentration 150 salt_concentration=np.random.beta(1, 100)*6.022136e-4, 151 #contrast_factor=10.0, 152 contrast_fact=np.random.uniform(1, 100), 153 #bjerrum_length=7.1, 154 bjerrum_length=np.random.uniform(1, 10), 155 #virial_param=12.0, 156 virial_param=np.random.uniform(-1000, 30), 157 #monomer_length=10.0, 158 monomer_length=10.0**(4*np.random.beta(1.5, 3)), 159 #ionization_degree=0.05, 160 ionization_degree=np.random.beta(1.5, 4), 161 ) 162 return pars 141 163 142 164 demo = dict(scale=1, background=0.1, -
sasmodels/models/core_multi_shell.py
r5a0b3d7 ra151caa 70 70 sld_shell: the SLD of the shell# 71 71 A_shell#: the coefficient in the exponential function 72 73 72 73 74 74 scale: 1.0 if data is on absolute scale 75 75 volfraction: volume fraction of spheres … … 102 102 103 103 source = ["lib/sas_3j1x_x.c", "core_multi_shell.c"] 104 105 def random(): 106 import numpy as np 107 num_shells = np.minimum(np.random.poisson(3)+1, 10) 108 total_radius = 10**np.random.uniform(1.7, 4) 109 thickness = np.random.exponential(size=num_shells+1) 110 thickness *= total_radius/np.sum(thickness) 111 volume_fraction = 10**np.random.uniform(-4, -1) 112 pars = dict( 113 #background=0, 114 scale=volume_fraction/total_radius**3*1e10, 115 n=num_shells, 116 radius=thickness[0], 117 ) 118 for k, v in enumerate(thickness[1:]): 119 pars['thickness%d'%(k+1)] = v 120 return pars 104 121 105 122 def profile(sld_core, radius, sld_solvent, n, sld, thickness): -
sasmodels/models/core_shell_bicelle.py
r9802ab3 ra151caa 17 17 .. figure:: img/core_shell_bicelle_parameters.png 18 18 19 Cross section of cylindrical symmetry model used here. Users will have 20 to decide how to distribute "heads" and "tails" between the rim, face 19 Cross section of cylindrical symmetry model used here. Users will have 20 to decide how to distribute "heads" and "tails" between the rim, face 21 21 and core regions in order to estimate appropriate starting parameters. 22 22 … … 27 27 .. math:: 28 28 29 \rho(r) = 30 \begin{cases} 29 \rho(r) = 30 \begin{cases} 31 31 &\rho_c \text{ for } 0 \lt r \lt R; -L \lt z\lt L \\[1.5ex] 32 32 &\rho_f \text{ for } 0 \lt r \lt R; -(L+2t) \lt z\lt -L; … … 47 47 .. math:: 48 48 49 \begin{align} 50 F(Q,\alpha) = &\bigg[ 49 \begin{align} 50 F(Q,\alpha) = &\bigg[ 51 51 (\rho_c - \rho_f) V_c \frac{2J_1(QRsin \alpha)}{QRsin\alpha}\frac{sin(QLcos\alpha/2)}{Q(L/2)cos\alpha} \\ 52 52 &+(\rho_f - \rho_r) V_{c+f} \frac{2J_1(QRsin\alpha)}{QRsin\alpha}\frac{sin(Q(L/2+t_f)cos\alpha)}{Q(L/2+t_f)cos\alpha} \\ 53 53 &+(\rho_r - \rho_s) V_t \frac{2J_1(Q(R+t_r)sin\alpha)}{Q(R+t_r)sin\alpha}\frac{sin(Q(L/2+t_f)cos\alpha)}{Q(L/2+t_f)cos\alpha} 54 54 \bigg] 55 \end{align} 55 \end{align} 56 56 57 57 where $V_t$ is the total volume of the bicelle, $V_c$ the volume of the core, … … 63 63 cylinders is then given by integrating over all possible $\theta$ and $\phi$. 64 64 65 For oriented bicelles the *theta*, and *phi* orientation parameters will appear when fitting 2D data, 65 For oriented bicelles the *theta*, and *phi* orientation parameters will appear when fitting 2D data, 66 66 see the :ref:`cylinder` model for further information. 67 67 Our implementation of the scattering kernel and the 1D scattering intensity … … 96 96 title = "Circular cylinder with a core-shell scattering length density profile.." 97 97 description = """ 98 P(q,alpha)= (scale/Vs)*f(q)^(2) + bkg, where: 98 P(q,alpha)= (scale/Vs)*f(q)^(2) + bkg, where: 99 99 f(q)= Vt(sld_rim - sld_solvent)* sin[qLt.cos(alpha)/2] 100 100 /[qLt.cos(alpha)/2]*J1(qRout.sin(alpha)) … … 147 147 "core_shell_bicelle.c"] 148 148 149 def random(): 150 import numpy as np 151 pars = dict( 152 radius=10**np.random.uniform(1.3, 3), 153 length=10**np.random.uniform(1.3, 4), 154 thick_rim=10**np.random.uniform(0, 1.7), 155 thick_face=10**np.random.uniform(0, 1.7), 156 ) 157 return pars 158 149 159 demo = dict(scale=1, background=0, 150 160 radius=20.0,
Note: See TracChangeset
for help on using the changeset viewer.