Changeset 19dcb933 in sasmodels for sasmodels/models/cylinder_clone.py
- Timestamp:
- Sep 3, 2014 3:16:10 AM (10 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:
- 1c7ffdc
- Parents:
- 87985ca
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/models/cylinder_clone.py
r5d4777d r19dcb933 1 r"""2 CylinderModel3 =============4 5 This model provides the form factor for a right circular cylinder with uniform6 scattering length density. The form factor is normalized by the particle volume.7 8 For information about polarised and magnetic scattering, click here_.9 10 Definition11 ----------12 13 The output of the 2D scattering intensity function for oriented cylinders is14 given by (Guinier, 1955)15 16 .. math::17 18 P(q,\alpha) = \frac{\text{scale}}{V}f^2(q) + \text{bkg}19 20 where21 22 .. math::23 24 f(q) = 2 (\Delta \rho) V25 \frac{\sin (q L/2 \cos \alpha)}{q L/2 \cos \alpha}26 \frac{J_1 (q r \sin \alpha)}{q r \sin \alpha}27 28 and $\alpha$ is the angle between the axis of the cylinder and $\vec q$, $V$29 is the volume of the cylinder, $L$ is the length of the cylinder, $r$ is the30 radius of the cylinder, and $d\rho$ (contrast) is the scattering length density31 difference between the scatterer and the solvent. $J_1$ is the first order32 Bessel function.33 34 To provide easy access to the orientation of the cylinder, we define the35 axis of the cylinder using two angles $\theta$ and $\phi$. Those angles36 are defined in Figure :num:`figure #CylinderModel-orientation`.37 38 .. _CylinderModel-orientation:39 40 .. figure:: img/image061.JPG41 42 Definition of the angles for oriented cylinders.43 44 .. figure:: img/image062.JPG45 46 Examples of the angles for oriented pp against the detector plane.47 48 NB: The 2nd virial coefficient of the cylinder is calculated based on the49 radius and length values, and used as the effective radius for $S(Q)$50 when $P(Q) \cdot S(Q)$ is applied.51 52 The returned value is scaled to units of |cm^-1| and the parameters of53 the CylinderModel are the following:54 55 %(parameters)s56 57 The output of the 1D scattering intensity function for randomly oriented58 cylinders is then given by59 60 .. math::61 62 P(q) = \frac{\text{scale}}{V}63 \int_0^{\pi/2} f^2(q,\alpha) \sin \alpha d\alpha + \text{background}64 65 The *theta* and *phi* parameters are not used for the 1D output. Our66 implementation of the scattering kernel and the 1D scattering intensity67 use the c-library from NIST.68 69 Validation of the CylinderModel70 -------------------------------71 72 Validation of our code was done by comparing the output of the 1D model73 to the output of the software provided by the NIST (Kline, 2006).74 Figure :num:`figure #CylinderModel-compare` shows a comparison of75 the 1D output of our model and the output of the NIST software.76 77 .. _CylinderModel-compare:78 79 .. figure:: img/image065.JPG80 81 Comparison of the SasView scattering intensity for a cylinder with the82 output of the NIST SANS analysis software.83 The parameters were set to: *Scale* = 1.0, *Radius* = 20 |Ang|,84 *Length* = 400 |Ang|, *Contrast* = 3e-6 |Ang^-2|, and85 *Background* = 0.01 |cm^-1|.86 87 In general, averaging over a distribution of orientations is done by88 evaluating the following89 90 .. math::91 92 P(q) = \int_0^{\pi/2} d\phi93 \int_0^\pi p(\theta, \phi) P_0(q,\alpha) \sin \theta d\theta94 95 96 where $p(\theta,\phi)$ is the probability distribution for the orientation97 and $P_0(q,\alpha)$ is the scattering intensity for the fully oriented98 system. Since we have no other software to compare the implementation of99 the intensity for fully oriented cylinders, we can compare the result of100 averaging our 2D output using a uniform distribution $p(\theta, \phi) = 1.0$.101 Figure :num:`figure #CylinderModel-crosscheck` shows the result of102 such a cross-check.103 104 .. _CylinderModel-crosscheck:105 106 .. figure:: img/image066.JPG107 108 Comparison of the intensity for uniformly distributed cylinders109 calculated from our 2D model and the intensity from the NIST SANS110 analysis software.111 The parameters used were: *Scale* = 1.0, *Radius* = 20 |Ang|,112 *Length* = 400 |Ang|, *Contrast* = 3e-6 |Ang^-2|, and113 *Background* = 0.0 |cm^-1|.114 """115 1 116 2 from numpy import pi, inf
Note: See TracChangeset
for help on using the changeset viewer.