Changeset eda8b30 in sasmodels
 Timestamp:
 Oct 28, 2017 6:42:15 AM (2 years ago)
 Branches:
 master, core_shell_microgels, magnetic_model, ticket1257vesicleproduct, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
 Children:
 5f8b72b
 Parents:
 da5536f
 Files:

 12 edited
Legend:
 Unmodified
 Added
 Removed

doc/developer/overview.rst
rda5536f reda8b30 165 165 Further details are provided in the next section, 166 166 :ref:`Calculator_Interface` 167 168 .. _orientation_developer: 167 169 168 170 Orientation and Numerical Integration 
doc/guide/orientation/orientation.rst
rda5536f reda8b30 42 42 cylinder cross section. (When $\theta = \phi = 0$ these are parallel to the $Y$ and $X$ axes of the instrument.) 43 43 The third orientation distribution, in $\psi$, is about the $c$ axis of the particle. Some experimentation may be required to 44 understand the 2d patterns fully. A number of different shapes of distribution are available, as described for polydispersity. 44 understand the 2d patterns fully. A number of different shapes of distribution are available, as described for 45 polydispersity, see :ref:`polydispersityhelp` . 45 46 46 47 Earlier versions of SasView had numerical integration issues in some circumstances when … … 52 53 values of Npts and Nsigs, the number of steps used in the integration and the range spanned in number of standard deviations. 53 54 The standard deviation is entered in units of degrees. For a rectangular (uniform) distribution the full width 54 should be $\pm\sqrt(3)$ ~ 1.73 standard deviations .55 should be $\pm\sqrt(3)$ ~ 1.73 standard deviations (this may be changed soon). 55 56 56 57 Where appropriate, for best numerical results, keep $a < b < c$ and the $\theta$ distribution narrower than the $\phi$ distribution. 57 58 58 Some more detailed technical notes are provided in the Developer section of this manual.59 Some more detailed technical notes are provided in the developer section of this manual :ref:`orientation_developer` . 59 60 60 61 *Document History* 
doc/guide/pd/polydispersity.rst
r1f058ea reda8b30 6 6 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 7 7 8 .. _polydispersityhelp: 9 8 10 Polydispersity Distributions 9 11  10 12 11 With some models in sasmodels we can calculate the average form factorfor a13 With some models in sasmodels we can calculate the average intensity for a 12 14 population of particles that exhibit size and/or orientational 13 polydispersity. The resultant form factoris normalized by the average15 polydispersity. The resultant intensity is normalized by the average 14 16 particle volume such that 15 17 
sasmodels/models/bcc_paracrystal.py
r8f04da4 reda8b30 65 65 \end{array} 66 66 67 **NB**: The calculation of $Z(q)$ is a double numerical integral that must 68 be carried out with a high density of points to properly capture the sharp 69 peaks of the paracrystalline scattering. So be warned that the calculation 70 is SLOW. Go get some coffee. Fitting of any experimental data must be 71 resolution smeared for any meaningful fit. This makes a triple integral. 72 Very, very slow. Go get lunch! 67 .. note:: 73 68 69 The calculation of $Z(q)$ is a double numerical integral that 70 must be carried out with a high density of points to properly capture 71 the sharp peaks of the paracrystalline scattering. 72 So be warned that the calculation is slow. Fitting of any experimental data 73 must be resolution smeared for any meaningful fit. This makes a triple integral 74 which may be very slow. 75 74 76 This example dataset is produced using 200 data points, 75 77 *qmin* = 0.001 Ang^1, *qmax* = 0.1 Ang^1 and the above default values. … … 77 79 The 2D (Anisotropic model) is based on the reference below where $I(q)$ is 78 80 approximated for 1d scattering. Thus the scattering pattern for 2D may not 79 be accurate. 81 be accurate, particularly at low $q$. For general details of the calculation and angular 82 dispersions for oriented particles see :ref:`orientation` . 83 Note that we are not responsible for any incorrectness of the 2D model computation. 80 84 81 85 .. figure:: img/parallelepiped_angle_definition.png 
sasmodels/models/core_shell_parallelepiped.py
r8f04da4 reda8b30 85 85 effective radius, for $S(Q)$ when $P(Q) * S(Q)$ is applied. 86 86 87 To provide easy access to the orientation of the parallelepiped, we define the 88 axis of the cylinder using three angles $\theta$, $\phi$ and $\Psi$. 89 (see :ref:`cylinder orientation <cylinderangledefinition>`). 90 The angle $\Psi$ is the rotational angle around the *long_c* axis against the 91 $q$ plane. For example, $\Psi = 0$ when the *short_b* axis is parallel to the 92 *x*axis of the detector. 87 For 2d data the orientation of the particle is required, described using 88 angles $\theta$, $\phi$ and $\Psi$ as in the diagrams below, for further details 89 of the calculation and angular dispersions see :ref:`orientation` . 90 The angle $\Psi$ is the rotational angle around the *long_c* axis. For example, 91 $\Psi = 0$ when the *short_b* axis is parallel to the *x*axis of the detector. 93 92 94 93 .. figure:: img/parallelepiped_angle_definition.png 95 94 96 95 Definition of the angles for oriented coreshell parallelepipeds. 96 Note that rotation $\theta$, initially in the $xz$ plane, is carried out first, then 97 rotation $\phi$ about the $z$ axis, finally rotation $\Psi$ is now around the axis of the cylinder. 98 The neutron or Xray beam is along the $z$ axis. 97 99 98 100 .. figure:: img/parallelepiped_angle_projection.png 
sasmodels/models/cylinder.py
r31df0c9 reda8b30 54 54 when $P(q) \cdot S(q)$ is applied. 55 55 56 For oriented cylinders, we define the direction of the56 For 2d scattering from oriented cylinders, we define the direction of the 57 57 axis of the cylinder using two angles $\theta$ (note this is not the 58 58 same as the scattering angle used in q) and $\phi$. Those angles 59 are defined in :numref:`cylinderangledefinition` .59 are defined in :numref:`cylinderangledefinition` , for further details see :ref:`orientation` . 60 60 61 61 .. _cylinderangledefinition: … … 63 63 .. figure:: img/cylinder_angle_definition.png 64 64 65 Definition of the $\theta$ and $\phi$ orientation angles for a cylinder relative 66 to the beam line coordinates, plus an indication of their orientation distributions 67 which are described as rotations about each of the perpendicular axes $\delta_1$ and $\delta_2$ 65 Angles $\theta$ and $\phi$ orient the cylinder relative 66 to the beam line coordinates, where the beam is along the $z$ axis. Rotation $\theta$, initially 67 in the $xz$ plane, is carried out first, then rotation $\phi$ about the $z$ axis. Orientation distributions 68 are described as rotations about two perpendicular axes $\delta_1$ and $\delta_2$ 68 69 in the frame of the cylinder itself, which when $\theta = \phi = 0$ are parallel to the $Y$ and $X$ axes. 69 70 … … 73 74 74 75 The $\theta$ and $\phi$ parameters to orient the cylinder only appear in the model when fitting 2d data. 75 On introducing "Orientational Distribution" in the angles, "distribution of theta" and "distribution of phi" parameters will76 appear. These are actually rotations about the axes $\delta_1$ and $\delta_2$ of the cylinder, which when $\theta = \phi = 0$ are parallel77 to the $Y$ and $X$ axes of the instrument respectively. Some experimentation may be required to understand the 2d patterns fully.78 (Earlier implementations had numerical integration issues in some circumstances when orientation distributions passed through 90 degrees, such79 situations, with very broad distributions, should still be approached with care.)80 76 81 77 Validation 
sasmodels/models/ellipsoid.py
r92708d8 reda8b30 53 53 r = R_e \left[ 1 + u^2\left(R_p^2/R_e^2  1\right)\right]^{1/2} 54 54 55 To provide easy access to the orientation of the ellipsoid, we define 56 the rotation axis of the ellipsoid using two angles $\theta$ and $\phi$. 57 These angles are defined in the 55 For 2d data from oriented ellipsoids the direction of the rotation axis of 56 the ellipsoid is defined using two angles $\theta$ and $\phi$ as for the 58 57 :ref:`cylinder orientation figure <cylinderangledefinition>`. 59 58 For the ellipsoid, $\theta$ is the angle between the rotational axis 60 59 and the $z$ axis in the $xz$ plane followed by a rotation by $\phi$ 61 in the $xy$ plane. 60 in the $xy$ plane, for further details of the calculation and angular 61 dispersions see :ref:`orientation` . 62 62 63 63 NB: The 2nd virial coefficient of the solid ellipsoid is calculated based 
sasmodels/models/elliptical_cylinder.py
rd9ec8f9 reda8b30 1 1 # pylint: disable=linetoolong 2 2 r""" 3 Definition for 2D (orientated system)4 5 6 The angles $\theta$ and $\phi$ define the orientation of the axis of the7 cylinder. The angle $\Psi$ is defined as the orientation of the major8 axis of the ellipse with respect to the vector $Q$. A gaussian polydispersity9 can be added to any of the orientation angles, and also for the minor10 radius and the ratio of the ellipse radii.11 3 12 4 .. figure:: img/elliptical_cylinder_geometry.png … … 44 36 45 37 46 Definition for 1D (no preferred orientation) 47  48 49 The form factor is averaged over all possible orientation before normalized 38 For 1D scattering, with no preferred orientation, the form factor is averaged over all possible orientations and normalized 50 39 by the particle volume 51 40 … … 54 43 P(q) = \text{scale} <F^2> / V 55 44 56 To provide easy access to the orientation of the elliptical cylinder, we 57 define the axis of the cylinder using two angles $\theta$, $\phi$ and $\Psi$ 58 (see :ref:`cylinder orientation <cylinderangledefinition>`). The angle 59 $\Psi$ is the rotational angle around its own long_c axis. 45 For 2d data the orientation of the particle is required, described using a different set 46 of angles as in the diagrams below, for further details of the calculation and angular 47 dispersions see :ref:`orientation` . 60 48 61 All angle parameters are valid and given only for 2D calculation; ie, an62 oriented system.63 49 64 50 .. figure:: img/elliptical_cylinder_angle_definition.png 65 51 66 Definition of angles for oriented elliptical cylinder, where axis_ratio is drawn >1, 67 and angle $\Psi$ is now a rotation around the axis of the cylinder. 52 Note that the angles here are not the same as in the equations for the scattering function. 53 Rotation $\theta$, initially in the $xz$ plane, is carried out first, then 54 rotation $\phi$ about the $z$ axis, finally rotation $\Psi$ is now around the axis of the cylinder. 55 The neutron or Xray beam is along the $z$ axis. 68 56 69 57 .. figure:: img/elliptical_cylinder_angle_projection.png … … 73 61 74 62 The $\theta$ and $\phi$ parameters to orient the cylinder only appear in the model when fitting 2d data. 75 On introducing "Orientational Distribution" in the angles, "distribution of theta" and "distribution of phi" parameters will 76 appear. These are actually rotations about the axes $\delta_1$ and $\delta_2$ of the cylinder, the $b$ and $a$ axes of the 77 cylinder cross section. (When $\theta = \phi = 0$ these are parallel to the $Y$ and $X$ axes of the instrument.) 78 The third orientation distribution, in $\psi$, is about the $c$ axis of the particle. Some experimentation may be required to 79 understand the 2d patterns fully. (Earlier implementations had numerical integration issues in some circumstances when orientation 80 distributions passed through 90 degrees, such situations, with very broad distributions, should still be approached with care.) 63 81 64 82 65 NB: The 2nd virial coefficient of the cylinder is calculated based on the 
sasmodels/models/fcc_paracrystal.py
r8f04da4 reda8b30 64 64 \end{array} 65 65 66 **NB**: The calculation of $Z(q)$ is a double numerical integral that 67 must be carried out with a high density of points to properly capture 68 the sharp peaks of the paracrystalline scattering. So be warned that the 69 calculation is SLOW. Go get some coffee. Fitting of any experimental data 70 must be resolution smeared for any meaningful fit. This makes a triple 71 integral. Very, very slow. Go get lunch! 66 .. note:: 67 68 The calculation of $Z(q)$ is a double numerical integral that 69 must be carried out with a high density of points to properly capture 70 the sharp peaks of the paracrystalline scattering. 71 So be warned that the calculation is slow. Fitting of any experimental data 72 must be resolution smeared for any meaningful fit. This makes a triple integral 73 which may be very slow. 72 74 73 75 The 2D (Anisotropic model) is based on the reference below where $I(q)$ is 74 76 approximated for 1d scattering. Thus the scattering pattern for 2D may not 75 be accurate. Note that we are not responsible for any incorrectness of the 77 be accurate particularly at low $q$. For general details of the calculation 78 and angular dispersions for oriented particles see :ref:`orientation` . 79 Note that we are not responsible for any incorrectness of the 76 80 2D model computation. 77 81 
sasmodels/models/parallelepiped.py
rca04add reda8b30 74 74 $S(q)$ when $P(q) \cdot S(q)$ is applied. 75 75 76 To provide easy access to the orientation of the parallelepiped, we define 77 three angles $\theta$, $\phi$ and $\Psi$. The definition of $\theta$ and 78 $\phi$ is the same as for the cylinder model (see also figures below).76 For 2d data the orientation of the particle is required, described using 77 angles $\theta$, $\phi$ and $\Psi$ as in the diagrams below, for further details 78 of the calculation and angular dispersions see :ref:`orientation` . 79 79 80 80 .. Comment by Miguel Gonzalez: … … 89 89 The angle $\Psi$ is the rotational angle around the $C$ axis. 90 90 For $\theta = 0$ and $\phi = 0$, $\Psi = 0$ corresponds to the $B$ axis 91 oriented parallel to the yaxis of the detector with $A$ along the zaxis.91 oriented parallel to the yaxis of the detector with $A$ along the xaxis. 92 92 For other $\theta$, $\phi$ values, the parallelepiped has to be first rotated 93 $\theta$ degrees around $z$ and $\phi$ degrees around $y$, 94 before doing a final rotation of $\Psi$ degrees around the resulting $C$ to 95 obtain the final orientation of the parallelepiped. 96 For example, for $\theta = 0$ and $\phi = 90$, we have that $\Psi = 0$ 97 corresponds to $A$ along $x$ and $B$ along $y$, 98 while for $\theta = 90$ and $\phi = 0$, $\Psi = 0$ corresponds to 99 $A$ along $z$ and $B$ along $x$. 93 $\theta$ degrees in the $zx$ plane and then $\phi$ degrees around the $z$ axis, 94 before doing a final rotation of $\Psi$ degrees around the resulting $C$ axis 95 of the particle to obtain the final orientation of the parallelepiped. 100 96 101 97 .. _parallelepipedorientation: … … 114 110 (When $\theta = \phi = 0$ these are parallel to the $Y$ and $X$ axes of the instrument.) The third orientation distribution, in $\psi$, is 115 111 about the $c$ axis of the particle, perpendicular to the $a$ x $b$ face. Some experimentation may be required to 116 understand the 2d patterns fully. (Earlier implementations had numerical integration issues in some circumstances when orientation 117 distributions passed through 90 degrees, such situations, with very broad distributions, should still be approached with care.) 118 112 understand the 2d patterns fully as discussed in :ref:`orientation` . 119 113 120 114 For a given orientation of the parallelepiped, the 2D form factor is 
sasmodels/models/sc_paracrystal.py
r9bc4882 reda8b30 73 73 carried out with a high density of points to properly capture the sharp 74 74 peaks of the paracrystalline scattering. 75 So be warned that the calculation is SLOW. Go get some coffee. 76 Fitting of any experimental data must be resolution smeared for any 77 meaningful fit. This makes a triple integral. Very, very slow. 78 Go get lunch! 75 So be warned that the calculation is slow. Fitting of any experimental data 76 must be resolution smeared for any meaningful fit. This makes a triple integral 77 which may be very slow. 79 78 80 79 The 2D (Anisotropic model) is based on the reference below where *I(q)* is 81 80 approximated for 1d scattering. Thus the scattering pattern for 2D may not 82 be accurate. Note that we are not responsible for any incorrectness of the 2D 83 model computation. 81 be accurate particularly at low $q$. For general details of the calculation 82 and angular dispersions for oriented particles see :ref:`orientation` . 83 Note that we are not responsible for any incorrectness of the 84 2D model computation. 84 85 85 86 .. figure:: img/parallelepiped_angle_definition.png 
sasmodels/models/stacked_disks.py
r8f04da4 reda8b30 74 74 the layers. 75 75 76 To provide easy access to the orientation of the stacked disks, we define 77 the axis of the cylinder using two angles $\theta$ and $\varphi$. 76 2d scattering from oriented stacks is calculated in the same way as for cylinders, 77 for further details of the calculation and angular dispersions see :ref:`orientation` . 78 78 79 79 .. figure:: img/cylinder_angle_definition.png 80 80 81 Examples of the angles against the detector plane. 81 Angles $\theta$ and $\phi$ orient the stack of discs relative 82 to the beam line coordinates, where the beam is along the $z$ axis. Rotation $\theta$, initially 83 in the $xz$ plane, is carried out first, then rotation $\phi$ about the $z$ axis. Orientation distributions 84 are described as rotations about two perpendicular axes $\delta_1$ and $\delta_2$ 85 in the frame of the cylinder itself, which when $\theta = \phi = 0$ are parallel to the $Y$ and $X$ axes. 82 86 83 87
Note: See TracChangeset
for help on using the changeset viewer.