# Changeset d138d43 in sasmodels

Ignore:
Timestamp:
Nov 30, 2015 2:24:28 PM (7 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:
eb69cce
Parents:
1ec7efa
Message:

remove documentation build errors

Files:
6 deleted
17 edited
4 moved

Unmodified
Removed
• ## doc/genmodel.py

 r61ba623 import sys import os sys.path.insert(0,'..') # Convert ../sasmodels/models/name.py to sasmodels.models.name module_name = sys.argv[1][3:-3].replace('/','.').replace('\\','.') print module_name #print module_name module = __import__(module_name) for part in module_name.split('.')[1:]: module = getattr(module, part) print module #print module # Load the doc string from the module definition file and store it in rst
• ## doc/index.rst

 r61ba623 guide/index.rst developer/index.rst ref/index.rst api/index.rst
• ## sasmodels/exception.py

 r0763009 to the caller using a bare "raise" statement to reraise the annotated exception. Example:: >>> D = {} >>> try:
• ## sasmodels/generate.py

 re1ace4d import sys from os.path import abspath, dirname, join as joinpath, exists, basename from os.path import abspath, dirname, join as joinpath, exists, basename, \ splitext import re demo_parameters = dict((p[0],p[2]) for p in parameters) filename = abspath(kernel_module.__file__) kernel_id = basename(filename)[:-3] kernel_id = splitext(basename(filename))[0] name = getattr(kernel_module, 'name', None) if name is None:
• ## sasmodels/kerneldll.py

 r5edfe12 free from microsoft: http://www.microsoft.com/en-us/download/details.aspx?id=44266_ _ Again, this requires that the compiler is available on your path.  This is
• ## sasmodels/models/bcc.py

 rcd3dba0 and the size of the paracrystal is infinitely large. Paracrystalline distortion is assumed to be isotropic and characterized by a Gaussian distribution. The returned value is scaled to units of |cm^-1|\ |sr^-1|, absolute scale. Definition where $g$ is a fractional distortion based on the nearest neighbor distance. The body-centered cubic lattice is .. image:: img/bcc_lattice.jpg .. figure:: img/bcc_lattice.jpg Body-centered cubic lattice. For a crystal, diffraction peaks appear at reduced q-values given by \end{eqnarray} **NB: The calculation of $Z(q)$ is a double numerical integral that must **NB**: The calculation of $Z(q)$ is a double numerical integral that must be carried out with a high density of points to properly capture the sharp peaks of the paracrystalline scattering.** So be warned that the calculation peaks of the paracrystalline scattering. So be warned that the calculation is SLOW. Go get some coffee. Fitting of any experimental data must be resolution smeared for any meaningful fit. This makes a triple integral. *qmin* = 0.001 |Ang^-1|, *qmax* = 0.1 |Ang^-1| and the above default values. .. image:: img/bcc_1d.jpg .. figure:: img/bcc_1d.jpg *Figure. 1D plot in the linear scale using the default values (w/200 data point).* 1D plot in the linear scale using the default values (w/200 data point). The 2D (Anisotropic model) is based on the reference below where $I(q)$ is model computation. .. image:: img/bcc_orientation.gif .. figure:: img/crystal_orientation.gif .. image:: img/bcc_2d.jpg Orientation of the crystal with respect to the scattering plane. *Figure. 2D plot using the default values (w/200X200 pixels).* .. figure:: img/bcc_2d.jpg REFERENCE 2D plot using the default values (w/200X200 pixels).* Reference ---------

 r485aee2 .. image:: img/image175.jpg .. figure:: img/broad_peak_1d.jpg *Figure. 1D plot using the default values (w/200 data point).* 1D plot using the default values (w/200 data point). REFERENCE
• ## sasmodels/models/cylinder.py

 r3e428ec r""" The form factor is normalized by the particle volume. For information about polarised and magnetic scattering, click here_. Definition
• ## sasmodels/models/fcc.py

 r3e428ec a Gaussian distribution. The returned value is scaled to units of |cm^-1|\ |sr^-1|, absolute scale. Definition ---------- The scattering intensity *I(q)* is calculated as The scattering intensity $I(q)$ is calculated as .. image:: img/image158.jpg .. math:: where *scale* is the volume fraction of spheres, *Vp* is the volume of I(q) = \frac{\text{scale}}{V_p} P(q) Z(q) where *scale* is the volume fraction of spheres, $V_p$ is the volume of the primary particle, *V(lattice)* is a volume correction for the crystal structure, *P(q)* is the form factor of the sphere (normalized), and *Z(q)* structure, $P(q)$ is the form factor of the sphere (normalized), and $Z(q)$ is the paracrystalline structure factor for a face-centered cubic structure. Equation (1) of the 1990 reference is used to calculate *Z(q)*, using equations (23)-(25) from the 1987 paper for *Z1*\ , *Z2*\ , and *Z3*\ . Equation (1) of the 1990 reference is used to calculate $Z(q)$, using equations (23)-(25) from the 1987 paper for $Z1$, $Z2$, and $Z3$. The lattice correction (the occupied volume of the lattice) for a face-centered cubic structure of particles of radius *R* and nearest neighbor separation *D* is neighbor separation $D$ is .. image:: img/image159.jpg .. math:: V_\text{lattice} = \frac{16\pi}{3}\frac{R^3}{\left(D\sqrt{2}\right)^3} The distortion factor (one standard deviation) of the paracrystal is included in the calculation of *Z(q)* included in the calculation of $Z(q)$ .. image:: img/image160.jpg .. math:: where *g* is a fractional distortion based on the nearest neighbor distance. \Delta a = gD The face-centered cubic lattice is where $g$ is a fractional distortion based on the nearest neighbor distance. .. image:: img/image161.jpg .. figure:: img/fcc_lattice.jpg Face-centered cubic lattice. For a crystal, diffraction peaks appear at reduced q-values given by .. image:: img/image162.jpg .. math:: where for a face-centered cubic lattice *h*\ , *k*\ , *l* all odd or all even are allowed and reflections where *h*\ , *k*\ , *l* are mixed odd/even \frac{qD}{2\pi} = \sqrt{h^2 + k^2 + l^2} where for a face-centered cubic lattice $h, k , l$ all odd or all even are allowed and reflections where $h, k, l$ are mixed odd/even are forbidden. Thus the peak positions correspond to (just the first 5) .. image:: img/image163.jpg .. math:: **NB: The calculation of** *Z(q)* **is a double numerical integral that must be carried out with a high density of** **points to properly capture the sharp peaks of the paracrystalline scattering.** So be warned that the \begin{array}{cccccc} q/q_0 & 1 & \sqrt{4/3} & \sqrt{8/3} & \sqrt{11/3} & \sqrt{4} \\ \text{Indices} & (111)  & (200) & (220) & (311) & (222) \end{array} **NB**: The calculation of $Z(q)$ is a double numerical integral that must be carried out with a high density of points to properly capture the sharp peaks of the paracrystalline scattering. So be warned that the calculation is SLOW. Go get some coffee. Fitting of any experimental data must be resolution smeared for any meaningful fit. This makes a triple *qmax* = 0.1 |Ang^-1| and the above default values. .. image:: img/image164.jpg .. figure:: img/fcc_1d.jpg *Figure. 1D plot in the linear scale using the default values (w/200 data point).* 1D plot in the linear scale using the default values (w/200 data point). The 2D (Anisotropic model) is based on the reference below where *I(q)* is 2D model computation. .. image:: img/image165.gif .. figure:: img/crystal_orientation.gif .. image:: img/image166.jpg Orientation of the crystal with respect to the scattering plane. *Figure. 2D plot using the default values (w/200X200 pixels).* .. figure:: img/fcc_2d.jpg REFERENCE 2D plot using the default values (w/200X200 pixels). Reference --------- Hideki Matsuoka et. al. *Physical Review B*, 36 (1987) 1754-1765
• ## sasmodels/models/hollow_cylinder.py

 r66ebdd6 r""" This model provides the form factor, *P(q)*, for a monodisperse hollow right This model provides the form factor, $P(q)$, for a monodisperse hollow right angle circular cylinder (tube) where the form factor is normalized by the volume of the tube *P(q)* = *scale* \* ** / *V*\ :sub:shell + *background* .. math:: where the averaging < > is applied only for the 1D calculation. P(q) = \text{scale} \langle F^2 \rangle/V_\text{shell} + \text{background} where the averaging $\langle \rangle$ is applied only for the 1D calculation. The inside and outside of the hollow cylinder are assumed have the same SLD. \begin{eqnarray} P(q)&=&(\text{scale})V_{shell}(\Delta\rho)^2\int_0^{1}\Psi^2[q_z, R_{shell}(1-x^2)^{1/2},R_{core}(1-x^2)^{1/2}][\frac{sin(qHx)}{qHx}]^2dx\\ \Psi[q,y,z]&=&\frac{1}{1-\gamma^2}[\Lambda(qy)-\gamma^2\Lambda(qz)]\\ \Lambda(a)&=&2J_1(a)/a\\ \gamma&=&R_{core}/R_{shell}\\ V_{shell}&=&\pi(R_{shell}^2-R_{core}^2)L\\ J_1(x)&=&\frac{(sin(x)-x\cdot cos(x))}{x^2}\\ P(q)           &=& (\text{scale})V_\text{shell}\Delta\rho^2 \int_0^{1}\Psi^2 \left[q_z, R_\text{shell}(1-x^2)^{1/2}, R_\text{core}(1-x^2)^{1/2}\right] \left[\frac{\sin(qHx)}{qHx}\right]^2 dx \\ \Psi[q,y,z]    &=& \frac{1}{1-\gamma^2} \left[ \Lambda(qy) - \gamma^2\Lambda(qz) \right] \\ \Lambda(a)     &=& 2 J_1(a) / a \\ \gamma         &=& R_\text{core} / R_\text{shell} \\ V_\text{shell} &=& \pi \left(R_\text{shell}^2 - R_\text{core}^2 \right)L \\ J_1(x)         &=& \frac{(\sin(x)-x\cdot \cos(x))}{x^2} \\ \end{eqnarray} where *scale* is a scale factor and *J1* is the 1st order Bessel function. where *scale* is a scale factor and $J_1$ is the 1st order Bessel function. To provide easy access to the orientation of the core-shell cylinder, we define the axis of the cylinder using two angles |theta| and |phi|\ . As for the case the axis of the cylinder using two angles $\theta$ and $\phi$. As for the case of the cylinder, those angles are defined in Figure 2 of the CylinderModel. NB: The 2nd virial coefficient of the cylinder is calculated based on the radius and 2 length values, and used as the effective radius for *S(Q)* when *P(Q)* \* *S(Q)* is applied. **NB**: The 2nd virial coefficient of the cylinder is calculated based on the radius and 2 length values, and used as the effective radius for $S(Q)$ when $P(Q) * S(Q)$ is applied. In the parameters, the contrast represents SLD :sub:shell - SLD :sub:solvent and the *radius* = *R*\ :sub:shell while *core_radius* = *R*\ :sub:core. and the *radius* is $R_\text{shell}$ while *core_radius* is $R_\text{core}$. .. image:: img/image074.jpg .. figure:: img/hollow_cylinder_1d.jpg *Figure. 1D plot using the default values (w/1000 data point).* 1D plot using the default values (w/1000 data point). Our model uses the form factor calculations implemented in a c-library provided by the NIST Center for Neutron Research (Kline, 2006). .. figure:: img/orientation.jpg .. image:: img/image061.jpg Definition of the angles for the oriented hollow_cylinder model. *Figure. Definition of the angles for the oriented hollow_cylinder model.* .. figure:: img/orientation2.jpg .. image:: img/image062.jpg Examples of the angles for oriented pp against the detector plane. *Figure. Examples of the angles for oriented pp against the detector plane.* REFERENCE Reference --------- L A Feigin and D I Svergun, *Structure Analysis by Small-Angle X-Ray and
• ## sasmodels/models/lamellarFFHG.py

 r22eac46 region is taken to be different from the SLD of the tail region. *2.1.31.1. Definition* Definition ---------- The scattering intensity *I(q)* is The scattering intensity $I(q)$ is .. math:: I(Q) = 2\pi{P(Q) \over (2(|delta|\ H +|delta|\ T) Q^2) I(q) = 2\pi\frac{\text{scale}}{2(\delta_H + \delta_T)}  P(q) \frac{1}{q^2} The form factor is The form factor $P(q)$ is .. image:: img/lamellarFFHG_.jpg .. math:: where |delta|\ T = tail length (or *tail_length*), |delta|\ H = head thickness (or *h_thickness*), |drho|\ H = SLD(headgroup) - SLD(solvent), and |drho|\ T = SLD(tail) - SLD(solvent). P(q) = \frac{4}{q^2} \left\lbrace \Delta \rho_H \left[\sin[q(\delta_H + \delta_T)\ - \sin(q\delta_T)\right] + \Delta\rho_T\sin(q\delta_T) \right\rbrace^2 where $\delta_T$ is *tail_length*, \delta_H is *head_length*, $\Delta\rho_H$ is the head contrast (*head_sld* $-$ *solvent_sld*), and $\Delta\rho_T$ is tail contrast (*sld* $-$ *solvent_sld*). The 2D scattering intensity is calculated in the same way as 1D, where .. math:: Q = \sqrt{Q_x^2 + Q_y^2} q = \sqrt{q_x^2 + q_y^2} The returned value is in units of |cm^-1|, on absolute scale. In the parameters, *sld_tail* = SLD of the tail group, and *sld_head* = SLD of the head group. .. image:: img/lamellarFFHG_138.jpg .. figure:: img/lamellarFFHG_1d.jpg *Figure. 1D plot using the default values (w/1000 data point).* 1D plot using the default values (w/1000 data point). Our model uses the form factor calculations implemented in a C library provided by the NIST Center for Neutron Research (Kline, 2006). REFERENCE References ---------- F Nallet, R Laversanne, and D Roux, J. Phys. II France, 3, (1993) 487-502 name = "lamellar_FFHG" title = "Random lamellar phase with Head Groups " title = "Random lamellar phase with Head Groups" description = """\ [Random lamellar phase with Head Groups]
• ## sasmodels/models/lamellarPC.py

 r3e428ec can be used for large multilamellar vesicles.** *2.1.33.1. Definition* Definition ---------- The scattering intensity *I(q)* is calculated as In the equations below, .. image:: img/image145.jpg - *scale* is used instead of the mass per area of the bilayer $\Gamma_m$ (this corresponds to the volume fraction of the material in the bilayer, *not* the total excluded volume of the paracrystal), - *sld* $-$ *solvent_sld* is the contrast $\Delta \rho$, - *thickness* is the layer thickness $t$, - *Nlayers* is the number of layers $N$, - *spacing* is the average distance between adjacent layers $\langle D \rangle$, and - *spacing_polydisp* is the relative standard deviation of the Gaussian layer distance distribution $\sigma_D / \langle D \rangle$. The scattering intensity $I(q)$ is calculated as .. math:: I(q) = 2\pi\Delta\rho^2\Gamma_m\frac{P_\text{bil}(q)}{q^2} Z_N(q) The form factor of the bilayer is approximated as the cross section of an infinite, planar bilayer of thickness *t* infinite, planar bilayer of thickness $t$ .. image:: img/image146.jpg .. math:: Here, the scale factor is used instead of the mass per area of the bilayer (*G*). The scale factor is the volume fraction of the material in the bilayer, *not* the total excluded volume of the paracrystal. *Z*\ :sub:N\ *(q)* describes the interference effects for aggregates P_\text{bil}(q) = \left(\frac{\sin(qt/2)}{qt/2}\right)^2 $Z_N(q)$ describes the interference effects for aggregates consisting of more than one bilayer. The equations used are (3-5) from the Bergstrom reference below. from the Bergstrom reference: .. math:: Z_N(q) = \frac{1 - w^2}{1 + w^2 - 2w \cos(q \langle D \rangle)} + x_N S_N + (1 - x_N) S_{N+1} where .. math:: S_N(q) = \frac{a_N}{N}[1 + w^2 - 2 w \cos(q \langle D \rangle)]^2 and .. math:: a_N = 4w^2 - 2(w^3 + w) \cos(q \langle D \rangle) - 4w^{N+2}\cos(Nq \langle D \rangle) + 2 w^{N+3}\cos[(N-1)q \langle D \rangle] + 2w^{N+1}\cos[(N+1)q \langle D \rangle] for the layer spacing distribution $w = \exp(-\sigma_D^2 q^2/2)$. Non-integer numbers of stacks are calculated as a linear combination of the lower and higher values .. image:: img/image147.jpg .. math:: N_L = x_N N + (1 - x_N)(N+1) The 2D scattering intensity is the same as 1D, regardless of the orientation of the *q* vector which is defined as of the $q$ vector which is defined as .. math:: Q = \sqrt{Q_x^2 + Q_y^2} q = \sqrt{q_x^2 + q_y^2} The parameters of the model are *Nlayers* = no. of layers, and *pd_spacing* = polydispersity of spacing. ==============  ========  ============= Parameter name  Units     Default value ==============  ========  ============= background      |cm^-1|   0 scale           None      1 Nlayers         None      20 pd_spacing      None      0.2 sld_layer       |Ang^-2|  1e-6 sld_solvent     |Ang^-2|  6.34e-6 spacing         |Ang|     250 thickness       |Ang|     33 ==============  ========  ============= .. figure:: img/lamellarPC_1d.jpg .. image:: img/image148.jpg 1D plot using the default values above (w/20000 data point). *Figure. 1D plot using the default values above (w/20000 data point).* Our model uses the form factor calculations implemented in a C library provided by the NIST Center for Neutron Research (Kline, 2006). REFERENCE Reference --------- M Bergstrom, J S Pedersen, P Schurtenberger, S U Egelhaaf, "d-spacing of paracrystal stack"], ["spacing_polydisp", "Ang", 0.0, [0.0, inf], "", "d-spacing of paracrystal stack"], "d-spacing polydispersity"], ["sld", "1e-6/Ang^2", 1.0, [-inf, inf], "", "layer scattering length density"],
• ## sasmodels/models/lorentz.py

 r66ebdd6 For 2D data: The 2D scattering intensity is calculated in the same way as 1D, where the *q* vector is defined as where the $q$ vector is defined as .. math:: q=\sqrt{q_x^2 + q_y^2} .. image:: img/image179.jpg .. figure:: img/lorentz_1d.jpg *Figure. 1D plot using the default values (w/200 data point).* REFERENCE 1D plot using the default values (w/200 data point). Reference --------- L.S. Qrnstein and F. Zernike, *Proc. Acad. Sci. Amsterdam* 17, 793 (1914), and
• ## sasmodels/models/parallelepiped.py

 rcd3dba0 r""" The form factor is normalized by the particle volume. For information about polarised and magnetic scattering, click here_. Definition This model provides the form factor, *P(q)*, for a rectangular parallelepiped (below) where the form factor is normalized by the volume of the parallelepiped. If you need to apply polydispersity, see also the RectangularPrismModel_. parallelepiped. If you need to apply polydispersity, see also rectangular_prism_. The calculated form factor is:
• ## sasmodels/models/spherepy.py

 r34375ea Validation of our code was done by comparing the output of the 1D model to the output of the software provided by the NIST (Kline, 2006). Figure :num:figure #sphere-comparison shows a comparison of the output Figure :num:figure #spherepy-comparison shows a comparison of the output of our model and the output of the NIST software. .. _sphere-comparison: .. _spherepy-comparison: .. figure:: img/sphere_comparison.jpg
• ## sasmodels/resolution.py

 r7f7f99f """ from __future__ import division __all__ = ["Resolution", "Perfect1D", "Pinhole1D", "Slit1D", "apply_resolution_matrix", "pinhole_resolution", "slit_resolution", "pinhole_extend_q", "slit_extend_q", "bin_edges", "interpolate", "linear_extrapolation", "geometric_extrapolation", ] from scipy.special import erf from numpy import sqrt, log, log10 Algorithm --------- **Algorithm** We are using the mid-point integration rule to assign weights to each Substituting: .. math:: n_\text{extend} = (n-1) (\log q_\text{max} - \log q_n)
• ## sasmodels/sasview_model.py

 raa4946b def evalDistribution(self, qdist): """ r""" Evaluate a distribution of q-values. * For 1D, a numpy array is expected as input: :: :param qdist: array of q or a list of arrays [qx,qy] * For 1D, a numpy array is expected as input :: evalDistribution(q) where q is a numpy array. * For 2D, a list of numpy arrays are expected: [qx,qy], with 1D arrays:: where *q* is a numpy array. * For 2D, a list of *[qx,qy]* is expected with 1D arrays as input :: qx = [ qx[0], qx[1], qx[2], ....] and:: qy = [ qy[0], qy[1], qy[2], ....] Then get :: q = numpy.sqrt(qx^2+qy^2) that is a qr in 1D array:: q = [q[0], q[1], q[2], ....] :param qdist: ndarray of scalar q-values or list [qx,qy] where qx,qy are 1D ndarrays If the model is 1D only, then .. math:: q = \sqrt{q_x^2+q_y^2} """ if isinstance(qdist, (list, tuple)):
Note: See TracChangeset for help on using the changeset viewer.