Changeset 68532f3 in sasmodels for _sources/model/cylinder.txt


Ignore:
Timestamp:
Nov 1, 2015 2:10:22 PM (8 years ago)
Author:
ajj
Branches:
gh-pages
Children:
4a9a316
Parents:
d1fe925
Message:

Adding docs

File:
1 moved

Legend:

Unmodified
Added
Removed
  • _sources/model/cylinder.txt

    rd1fe925 r68532f3  
    1 # cylinder model 
    2 # Note: model title and parameter table are inserted automatically 
    3 r""" 
     1.. _cylinder: 
     2 
     3Cylinder 
     4======================================================= 
     5 
     6Right circular cylinder with uniform scattering length density. 
     7 
     8=========== ================================== ============ ============= 
     9Parameter   Description                        Units        Default value 
     10=========== ================================== ============ ============= 
     11scale       Source intensity                   None                     1 
     12background  Source background                  |cm^-1|                  0 
     13sld         Cylinder scattering length density |1e-6Ang^-2|             4 
     14solvent_sld Solvent scattering length density  |1e-6Ang^-2|             1 
     15radius      Cylinder radius                    |Ang|                   20 
     16length      Cylinder length                    |Ang|                  400 
     17theta       In plane angle                     degree                  60 
     18phi         Out of plane angle                 degree                  60 
     19=========== ================================== ============ ============= 
     20 
     21The returned value is scaled to units of |cm^-1|. 
     22 
     23 
    424The form factor is normalized by the particle volume. 
    525 
     
    106126    *length* = 400 |Ang|, *contrast* = 3e-6 |Ang^-2|, and 
    107127    *background* = 0.0 |cm^-1|. 
    108 """ 
    109128 
    110 import numpy as np 
    111 from numpy import pi, inf 
    112  
    113 name = "cylinder" 
    114 title = "Right circular cylinder with uniform scattering length density." 
    115 description = """ 
    116      f(q,alpha) = 2*(sld - solvent_sld)*V*sin(qLcos(alpha/2)) 
    117                 /[qLcos(alpha/2)]*J1(qRsin(alpha/2))/[qRsin(alpha)] 
    118  
    119             P(q,alpha)= scale/V*f(q,alpha)^(2)+background 
    120             V: Volume of the cylinder 
    121             R: Radius of the cylinder 
    122             L: Length of the cylinder 
    123             J1: The bessel function 
    124             alpha: angle between the axis of the 
    125             cylinder and the q-vector for 1D 
    126             :the ouput is P(q)=scale/V*integral 
    127             from pi/2 to zero of... 
    128             f(q,alpha)^(2)*sin(alpha)*dalpha + background 
    129 """ 
    130 category = "shape:cylinder" 
    131  
    132 #             [ "name", "units", default, [lower, upper], "type", "description"], 
    133 parameters = [["sld", "1e-6/Ang^2", 4, [-inf, inf], "", 
    134                "Cylinder scattering length density"], 
    135               ["solvent_sld", "1e-6/Ang^2", 1, [-inf, inf], "", 
    136                "Solvent scattering length density"], 
    137               ["radius", "Ang", 20, [0, inf], "volume", 
    138                "Cylinder radius"], 
    139               ["length", "Ang", 400, [0, inf], "volume", 
    140                "Cylinder length"], 
    141               ["theta", "degrees", 60, [-inf, inf], "orientation", 
    142                "In plane angle"], 
    143               ["phi", "degrees", 60, [-inf, inf], "orientation", 
    144                "Out of plane angle"], 
    145              ] 
    146  
    147 source = ["lib/J1.c", "lib/gauss76.c", "cylinder.c"] 
    148  
    149 def ER(radius, length): 
    150     ddd = 0.75 * radius * (2 * radius * length + (length + radius) * (length + pi * radius)) 
    151     return 0.5 * (ddd) ** (1. / 3.) 
    152  
    153 # parameters for demo 
    154 demo = dict(scale=1, background=0, 
    155             sld=6, solvent_sld=1, 
    156             radius=20, length=300, 
    157             theta=60, phi=60, 
    158             radius_pd=.2, radius_pd_n=9, 
    159             length_pd=.2, length_pd_n=10, 
    160             theta_pd=10, theta_pd_n=5, 
    161             phi_pd=10, phi_pd_n=5) 
    162  
    163 # For testing against the old sasview models, include the converted parameter 
    164 # names and the target sasview model name. 
    165 oldname = 'CylinderModel' 
    166 oldpars = dict(theta='cyl_theta', phi='cyl_phi', sld='sldCyl', solvent_sld='sldSolv') 
    167  
    168  
    169 qx, qy = 0.2 * np.cos(2.5), 0.2 * np.sin(2.5) 
    170 tests = [[{}, 0.2, 0.041761386790780453], 
    171          [{}, [0.2], [0.041761386790780453]], 
    172          [{'theta':10.0, 'phi':10.0}, (qx, qy), 0.03414647218513852], 
    173          [{'theta':10.0, 'phi':10.0}, [(qx, qy)], [0.03414647218513852]], 
    174         ] 
    175 del qx, qy  # not necessary to delete, but cleaner 
Note: See TracChangeset for help on using the changeset viewer.