Changeset 886a89d in sasmodels
- Timestamp:
- Mar 18, 2016 4:27:44 AM (9 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:
- 3a45c2c
- Parents:
- 044a9c1 (diff), 325e89a (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/models/core_shell_ellipsoid.c
re7678b2 r29172aa 8 8 double equat_shell, 9 9 double polar_shell, 10 double core_sld,11 double s hell_sld,12 double s olvent_sld);10 double sld_core, 11 double sld_shell, 12 double sld_solvent); 13 13 14 14 … … 18 18 double equat_shell, 19 19 double polar_shell, 20 double core_sld,21 double s hell_sld,22 double s olvent_sld,20 double sld_core, 21 double sld_shell, 22 double sld_solvent, 23 23 double theta, 24 24 double phi); … … 40 40 double equat_shell, 41 41 double polar_shell, 42 double core_sld,43 double s hell_sld,44 double s olvent_sld)42 double sld_core, 43 double sld_shell, 44 double sld_solvent) 45 45 { 46 46 … … 51 51 double summ = 0.0; //initialize intergral 52 52 53 const double delpc = core_sld - shell_sld; //core - shell54 const double delps = s hell_sld - solvent_sld; //shell - solvent53 const double delpc = sld_core - sld_shell; //core - shell 54 const double delps = sld_shell - sld_solvent; //shell - solvent 55 55 56 56 for(int i=0;i<N_POINTS_76;i++) { … … 81 81 double equat_shell, 82 82 double polar_shell, 83 double core_sld,84 double s hell_sld,85 double s olvent_sld,83 double sld_core, 84 double sld_shell, 85 double sld_solvent, 86 86 double theta, 87 87 double phi) … … 96 96 const double cyl_y = sin(theta); 97 97 98 const double sldcs = core_sld - shell_sld;99 const double sldss = s hell_sld- solvent_sld;98 const double sldcs = sld_core - sld_shell; 99 const double sldss = sld_shell- sld_solvent; 100 100 101 101 // Compute the angle btw vector q and the … … 124 124 double equat_shell, 125 125 double polar_shell, 126 double core_sld,127 double s hell_sld,128 double s olvent_sld)126 double sld_core, 127 double sld_shell, 128 double sld_solvent) 129 129 { 130 130 double intensity = core_shell_ellipsoid_kernel(q, … … 133 133 equat_shell, 134 134 polar_shell, 135 core_sld,136 s hell_sld,137 s olvent_sld);135 sld_core, 136 sld_shell, 137 sld_solvent); 138 138 139 139 return intensity; … … 146 146 double equat_shell, 147 147 double polar_shell, 148 double core_sld,149 double s hell_sld,150 double s olvent_sld,148 double sld_core, 149 double sld_shell, 150 double sld_solvent, 151 151 double theta, 152 152 double phi) … … 159 159 equat_shell, 160 160 polar_shell, 161 core_sld,162 s hell_sld,163 s olvent_sld,161 sld_core, 162 sld_shell, 163 sld_solvent, 164 164 theta, 165 165 phi); -
sasmodels/models/core_shell_ellipsoid.py
r5111921 r29172aa 1 1 r""" 2 2 This model provides the form factor, $P(q)$, for a core shell ellipsoid (below) 3 where the form factor is normalized by the volume of the cylinder.3 where the form factor is normalized by the volume of the outer [CHECK]. 4 4 5 5 .. math:: … … 7 7 P(q) = scale * \left<f^2\right>/V + background 8 8 9 where the volume $V = (4/3)\pi( r_{maj}r_{min}^2)$ and the averaging $< >$ is9 where the volume $V = (4/3)\pi(R_{major\_outer}R_{minor\_outer}^2)$ and the averaging $< >$ is 10 10 applied over all orientations for 1D. 11 11 … … 22 22 23 23 P(q) = \frac{scale}{V}\int_0^1 24 \left|F(q,r_{min },r_{max},\alpha)\right|^2d\alpha + background24 \left|F(q,r_{minor\_core},r_{major\_core},\alpha) + F(q,r_{major\_outer},r_{major\_outer},\alpha)\right|^2d\alpha + background 25 25 26 \left|F(q,r_{min },r_{max},\alpha)\right|=V\Delta \rho \cdot (3j_1(u)/u)26 \left|F(q,r_{minor},r_{major},\alpha)\right|=(4\pi/3)r_{major}r_{minor}^2 \Delta \rho \cdot (3j_1(u)/u) 27 27 28 u = q\left[ r_{maj }^2\alpha ^2 + r_{min}^2(1-\alpha ^2)\right]^{1/2}28 u = q\left[ r_{major}^2\alpha ^2 + r_{minor}^2(1-\alpha ^2)\right]^{1/2} 29 29 30 30 where … … 43 43 polar core radius, *equat_shell* = $r_{min}$ (or equatorial outer radius), 44 44 and *polar_shell* = $r_{maj}$ (or polar outer radius). 45 46 Note:It is the users' responsibility to ensure that shell radii are larger than 47 the core radii, especially if both are polydisperse, in which case the 48 core_shell_ellipsoid_xt model may be much better. 49 45 50 46 51 .. note:: … … 77 82 single particle scattering amplitude. 78 83 [Parameters]: 79 equat_core = equatorial radius of core, 80 polar_core = polar radius of core, 81 equat_shell = equatorial radius of shell, 82 polar_shell = polar radius (revolution axis) of shell,83 core_sld = SLD_core84 s hell_sld = SLD_shell85 s olvent_sld = SLD_solvent84 equat_core = equatorial radius of core, Rminor_core, 85 polar_core = polar radius of core, Rmajor_core, 86 equat_shell = equatorial radius of shell, Rminor_outer, 87 polar_shell = polar radius of shell, Rmajor_outer, 88 sld_core = scattering length density of core, 89 sld_shell = scattering length density of shell, 90 sld_solvent = scattering length density of solvent, 86 91 background = Incoherent bkg 87 92 scale =scale 88 93 Note:It is the users' responsibility to ensure 89 that shell radii are larger than core radii. 94 that shell radii are larger than core radii, 95 especially if both are polydisperse. 90 96 oblate: polar radius < equatorial radius 91 97 prolate : polar radius > equatorial radius … … 97 103 # ["name", "units", default, [lower, upper], "type", "description"], 98 104 parameters = [ 99 ["equat_core", "Ang", 200, [0, inf], "volume", "Equatorial radius of core "],100 ["polar_core", "Ang", 10, [0, inf], "volume", "Polar radius of core "],101 ["equat_shell", "Ang", 250, [0, inf], "volume", "Equatorial radius of shell "],102 ["polar_shell", "Ang", 30, [0, inf], "volume", "Polar radius of shell "],103 [" core_sld", "1e-6/Ang^2", 2, [-inf, inf], "", "Core scattering length density"],104 ["s hell_sld", "1e-6/Ang^2", 1, [-inf, inf], "", "Shell scattering length density"],105 ["s olvent_sld", "1e-6/Ang^2", 6.3, [-inf, inf], "", "Solvent scattering length density"],105 ["equat_core", "Ang", 200, [0, inf], "volume", "Equatorial radius of core, Rminor_core "], 106 ["polar_core", "Ang", 10, [0, inf], "volume", "Polar radius of core, Rmajor_core"], 107 ["equat_shell", "Ang", 250, [0, inf], "volume", "Equatorial radius of shell, Rminor_outer "], 108 ["polar_shell", "Ang", 30, [0, inf], "volume", "Polar radius of shell, Rmajor_outer"], 109 ["sld_core", "1e-6/Ang^2", 2, [-inf, inf], "sld", "Core scattering length density"], 110 ["sld_shell", "1e-6/Ang^2", 1, [-inf, inf], "sld", "Shell scattering length density"], 111 ["sld_solvent", "1e-6/Ang^2", 6.3, [-inf, inf], "sld", "Solvent scattering length density"], 106 112 ["theta", "degrees", 0, [-inf, inf], "orientation", "Oblate orientation wrt incoming beam"], 107 113 ["phi", "degrees", 0, [-inf, inf], "orientation", "Oblate orientation in the plane of the detector"], … … 116 122 equat_shell=250.0, 117 123 polar_shell=30.0, 118 core_sld=2.0,119 s hell_sld=1.0,120 s olvent_sld=6.3,124 sld_core=2.0, 125 sld_shell=1.0, 126 sld_solvent=6.3, 121 127 theta=0, 122 128 phi=0) … … 124 130 oldname = 'CoreShellEllipsoidModel' 125 131 126 oldpars = dict(core_sld='sld_core', 127 shell_sld='sld_shell', 128 solvent_sld='sld_solvent', 132 oldpars = dict(equat_core='equat_core',polar_core='polar_core',equat_shell='equat_shell',polar_shell='polar_shell', 133 sld_core='sld_core', 134 sld_shell='sld_shell', 135 sld_solvent='sld_solvent', 129 136 theta='axis_theta', 130 137 phi='axis_phi') … … 141 148 'equat_shell': 250.0, 142 149 'polar_shell': 30.0, 143 ' core_sld': 2.0,144 's hell_sld': 1.0,145 's olvent_sld': 6.3,150 'sld_core': 2.0, 151 'sld_shell': 1.0, 152 'sld_solvent': 6.3, 146 153 'background': 0.001, 147 154 'scale': 1.0, … … 155 162 'equat_shell': 54.0, 156 163 'polar_shell': 3.0, 157 ' core_sld': 20.0,158 's hell_sld': 10.0,159 's olvent_sld': 6.0,164 'sld_core': 20.0, 165 'sld_shell': 10.0, 166 'sld_solvent': 6.0, 160 167 'background': 0.0, 161 168 'scale': 1.0, … … 168 175 'equat_shell': 54.0, 169 176 'polar_shell': 3.0, 170 ' core_sld': 20.0,171 's hell_sld': 10.0,172 's olvent_sld': 6.0,177 'sld_core': 20.0, 178 'sld_shell': 10.0, 179 'sld_solvent': 6.0, 173 180 'background': 0.01, 174 181 'scale': 0.01, -
sasmodels/models/core_shell_ellipsoid_xt.py
r5111921 r29172aa 1 1 r""" 2 An alternative version of $P(q)$ for the core -shellellipsoid3 (see CoreShellEllipsoidModel), having as parameters the core axial ratio X 4 and a shell thickness,which are more often what we would like to determine.2 An alternative version of $P(q)$ for the core_shell_ellipsoid 3 having as parameters the core axial ratio X and a shell thickness, 4 which are more often what we would like to determine. 5 5 6 6 This model is also better behaved when polydispersity is applied than the four 7 independent radii in CoreShellEllipsoidModel.7 independent radii in core_shell_ellipsoid model. 8 8 9 9 Definition … … 52 52 ---------- 53 53 54 R K Heenan, *Private communication*54 R K Heenan, 2015, reparametrised the core_shell_ellipsoid model 55 55 56 56 """ … … 69 69 [Parameters]: 70 70 equat_core = equatorial radius of core, 71 x_core = polar radius of core,71 x_core = ratio of core polar/equatorial radii, 72 72 t_shell = equatorial radius of outer surface, 73 x_polar_shell = polar radius (revolution axis) of outer surface74 core_sld= SLD_core75 s hell_sld= SLD_shell76 s olvent_sld= SLD_solvent73 x_polar_shell = ratio of polar shell thickness to equatorial shell thickness, 74 sld_core = SLD_core 75 sld_shell = SLD_shell 76 sld_solvent = SLD_solvent 77 77 background = Incoherent bkg 78 78 scale =scale … … 92 92 ["t_shell", "Ang", 30, [0, inf], "volume", "Equatorial radius of shell"], 93 93 ["x_polar_shell", "", 1, [0, inf], "volume", "Polar radius of shell"], 94 [" core_sld", "1e-6/Ang^2", 2, [-inf, inf], "", "Core scattering length density"],95 ["s hell_sld", "1e-6/Ang^2", 1, [-inf, inf], "", "Shell scattering length density"],96 ["s olvent_sld", "1e-6/Ang^2", 6.3, [-inf, inf], "", "Solvent scattering length density"],94 ["sld_core", "1e-6/Ang^2", 2, [-inf, inf], "", "Core scattering length density"], 95 ["sld_shell", "1e-6/Ang^2", 1, [-inf, inf], "", "Shell scattering length density"], 96 ["sld_solvent", "1e-6/Ang^2", 6.3, [-inf, inf], "", "Solvent scattering length density"], 97 97 ["theta", "degrees", 0, [-inf, inf], "orientation", "Oblate orientation wrt incoming beam"], 98 98 ["phi", "degrees", 0, [-inf, inf], "orientation", "Oblate orientation in the plane of the detector"], … … 108 108 t_shell=30.0, 109 109 x_polar_shell=1.0, 110 core_sld=2.0,111 s hell_sld=1.0,112 s olvent_sld=6.3,110 sld_core=2.0, 111 sld_shell=1.0, 112 sld_solvent=6.3, 113 113 theta=0, 114 114 phi=0) … … 119 119 x_core='X_core', 120 120 t_shell='T_shell', 121 core_sld='sld_core',122 s hell_sld='sld_shell',123 s olvent_sld='sld_solvent',121 sld_core='sld_core', 122 sld_shell='sld_shell', 123 sld_solvent='sld_solvent', 124 124 theta='axis_theta', 125 125 phi='axis_phi') … … 136 136 't_shell': 50.0, 137 137 'x_polar_shell': 0.2, 138 ' core_sld': 2.0,139 's hell_sld': 1.0,140 's olvent_sld': 6.3,138 'sld_core': 2.0, 139 'sld_shell': 1.0, 140 'sld_solvent': 6.3, 141 141 'background': 0.001, 142 142 'scale': 1.0, … … 150 150 't_shell': 54.0, 151 151 'x_polar_shell': 3.0, 152 ' core_sld': 20.0,153 's hell_sld': 10.0,154 's olvent_sld': 6.0,152 'sld_core': 20.0, 153 'sld_shell': 10.0, 154 'sld_solvent': 6.0, 155 155 'background': 0.0, 156 156 'scale': 1.0, … … 163 163 't_shell': 54.0, 164 164 'x_polar_shell': 3.0, 165 ' core_sld': 20.0,166 's hell_sld': 10.0,167 's olvent_sld': 6.0,165 'sld_core': 20.0, 166 'sld_shell': 10.0, 167 'sld_solvent': 6.0, 168 168 'background': 0.01, 169 169 'scale': 0.01, -
doc/genmodel.py
r735507b r044a9c1 2 2 import numpy as np 3 3 import matplotlib.pyplot as plt 4 import pylab 4 5 sys.path.insert(0, os.path.abspath('..')) 5 6 from sasmodels import generate, core … … 28 29 'q_max' : 1.0, 29 30 'nq' : 1000, 30 'nq2d' : 400,31 'nq2d' : 100, 31 32 'vmin' : 1e-3, # floor for the 2D data results 32 33 'qx_max' : 0.5, … … 59 60 if opts['zscale'] == 'log': 60 61 Iq2D = np.log(np.clip(Iq2D, opts['vmin'], np.inf)) 61 h = ax.imshow(Iq2D, interpolation='nearest', aspect=1, origin='upper', 62 extent=[-qx_max, qx_max, -qx_max, qx_max], cmap=ice_cm()) 63 # , vmin=vmin, vmax=vmax) 62 ax.imshow(Iq2D, interpolation='nearest', aspect=1, origin='lower', 63 extent=[-qx_max, qx_max, -qx_max, qx_max], cmap=pylab.cm.jet) 64 64 ax.set_xlabel(r'$Q_x \/(\AA^{-1})$') 65 65 ax.set_ylabel(r'$Q_y \/(\AA^{-1})$') 66 67 # im = self.subplot.imshow(output, interpolation='nearest', 68 # origin='lower', 69 # vmin=zmin_temp, vmax=self.zmax_2D, 70 # cmap=self.cmap, 71 # extent=(self.xmin_2D, self.xmax_2D, 72 # self.ymin_2D, self.ymax_2D)) 66 73 67 74 def ice_cm(): … … 97 104 plot_2d(model, opts, ax2d) 98 105 ax1d = fig.add_axes([ax_left, ax_bottom, ax_width, ax_height]) 106 plot_1d(model, opts, ax1d) 99 107 #ax.set_aspect('square') 100 108 else: … … 121 129 captionstr += '.. figure:: img/' + model_info['id'] + '_autogenfig.png\n' 122 130 captionstr += '\n' 123 captionstr += ' 1D plot corresponding to the default parameters of the model.\n' 131 if model_info['has_2d']: 132 captionstr += ' 1D and 2D plots corresponding to the default parameters of the model.\n' 133 else: 134 captionstr += ' 1D plot corresponding to the default parameters of the model.\n' 124 135 captionstr += '\n' 125 136
Note: See TracChangeset
for help on using the changeset viewer.