Ignore:
Timestamp:
Mar 9, 2015 2:45:01 PM (9 years ago)
Author:
Doucet, Mathieu <doucetm@…>
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:
3e428ec
Parents:
5ef0633
Message:

Trying to get us starting on the right foot with code style.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/models/core_shell_cylinder.py

    ra5d0d00 r485aee2  
    111111P(q,alpha)= scale/Vs*f(q)^(2) + background, 
    112112      where: f(q)= 2(core_sld - solvant_sld) 
    113                 * Vc*sin[qLcos(alpha/2)] 
    114                 /[qLcos(alpha/2)]*J1(qRsin(alpha)) 
    115                 /[qRsin(alpha)]+2(shell_sld-solvent_sld) 
    116                 *Vs*sin[q(L+T)cos(alpha/2)][[q(L+T) 
    117                 *cos(alpha/2)]*J1(q(R+T)sin(alpha)) 
    118                 /q(R+T)sin(alpha)] 
     113        * Vc*sin[qLcos(alpha/2)] 
     114        /[qLcos(alpha/2)]*J1(qRsin(alpha)) 
     115        /[qRsin(alpha)]+2(shell_sld-solvent_sld) 
     116        *Vs*sin[q(L+T)cos(alpha/2)][[q(L+T) 
     117        *cos(alpha/2)]*J1(q(R+T)sin(alpha)) 
     118        /q(R+T)sin(alpha)] 
    119119 
    120         alpha:is the angle between the axis of 
    121                 the cylinder and the q-vector 
    122         Vs: the volume of the outer shell 
    123         Vc: the volume of the core 
    124         L: the length of the core 
    125         shell_sld: the scattering length density of the shell 
    126         solvent_sld: the scattering length density of the solvent 
    127         background: the background 
    128         T: the thickness 
    129         R+T: is the outer radius 
    130         L+2T: The total length of the outershell 
    131         J1: the first order Bessel function 
    132         theta: axis_theta of the cylinder 
    133         phi: the axis_phi of the cylinder 
     120    alpha:is the angle between the axis of 
     121        the cylinder and the q-vector 
     122    Vs: the volume of the outer shell 
     123    Vc: the volume of the core 
     124    L: the length of the core 
     125        shell_sld: the scattering length density of the shell 
     126    solvent_sld: the scattering length density of the solvent 
     127    background: the background 
     128    T: the thickness 
     129        R+T: is the outer radius 
     130     L+2T: The total length of the outershell 
     131    J1: the first order Bessel function 
     132     theta: axis_theta of the cylinder 
     133     phi: the axis_phi of the cylinder 
    134134""" 
    135135category = "shape:cylinder" 
    136136 
    137 parameters = [ 
    138 #   [ "name", "units", default, [lower, upper], "type", 
    139 #     "description" ], 
    140     [ "core_sld", "1e-6/Ang^2", 4, [-inf,inf], "", 
    141       "Cylinder core scattering length density" ], 
    142     [ "shell_sld", "1e-6/Ang^2", 4, [-inf,inf], "", 
    143       "Cylinder shell scattering length density" ], 
    144     [ "solvent_sld", "1e-6/Ang^2", 1, [-inf,inf], "", 
    145       "Solvent scattering length density" ], 
    146     [ "radius", "Ang",  20, [0, inf], "volume", 
    147       "Cylinder core radius" ], 
    148     [ "thickness", "Ang",  20, [0, inf], "volume", 
    149       "Cylinder shell thickness" ], 
    150     [ "length", "Ang",  400, [0, inf], "volume", 
    151       "Cylinder length" ], 
    152     [ "theta", "degrees", 60, [-inf, inf], "orientation", 
    153       "In plane angle" ], 
    154     [ "phi", "degrees", 60, [-inf, inf], "orientation", 
    155       "Out of plane angle" ], 
    156     ] 
     137#             ["name", "units", default, [lower, upper], "type", "description"], 
     138parameters = [["core_sld", "1e-6/Ang^2", 4, [-inf, inf], "", 
     139               "Cylinder core scattering length density"], 
     140              ["shell_sld", "1e-6/Ang^2", 4, [-inf, inf], "", 
     141               "Cylinder shell scattering length density"], 
     142              ["solvent_sld", "1e-6/Ang^2", 1, [-inf, inf], "", 
     143               "Solvent scattering length density"], 
     144              ["radius", "Ang", 20, [0, inf], "volume", 
     145               "Cylinder core radius"], 
     146              ["thickness", "Ang", 20, [0, inf], "volume", 
     147               "Cylinder shell thickness"], 
     148              ["length", "Ang", 400, [0, inf], "volume", 
     149               "Cylinder length"], 
     150              ["theta", "degrees", 60, [-inf, inf], "orientation", 
     151               "In plane angle"], 
     152              ["phi", "degrees", 60, [-inf, inf], "orientation", 
     153               "Out of plane angle"], 
     154             ] 
    157155 
    158 source = [ "lib/J1.c", "lib/gauss76.c", "core_shell_cylinder.c"] 
     156source = ["lib/J1.c", "lib/gauss76.c", "core_shell_cylinder.c"] 
    159157 
    160158def ER(radius, thickness, length): 
    161159    radius = radius + thickness 
    162     length = length + 2*thickness 
    163     ddd = 0.75*radius*(2*radius*length + (length+radius)*(length+pi*radius)) 
    164     return 0.5 * (ddd)**(1./3.) 
     160    length = length + 2 * thickness 
     161    ddd = 0.75 * radius * (2 * radius * length + (length + radius) * (length + pi * radius)) 
     162    return 0.5 * (ddd) ** (1. / 3.) 
    165163 
    166164def VR(radius, thickness, length): 
    167     whole = pi * (radius+thickness)**2 * (length+2*thickness) 
    168     core = pi * radius**2 * length 
    169     return whole, whole-core 
     165    whole = pi * (radius + thickness) ** 2 * (length + 2 * thickness) 
     166    core = pi * radius ** 2 * length 
     167    return whole, whole - core 
    170168 
    171 demo = dict( 
    172     scale=1, background=0, 
    173     core_sld=6, shell_sld=8, solvent_sld=1, 
    174     radius=45, thickness=25, length=340, 
    175     theta=30, phi=15, 
    176     radius_pd=.2, radius_pd_n=1, 
    177     length_pd=.2, length_pd_n=10, 
    178     thickness_pd=.2, thickness_pd_n=10, 
    179     theta_pd=15, theta_pd_n=45, 
    180     phi_pd=15, phi_pd_n=1, 
    181     ) 
     169demo = dict(scale=1, background=0, 
     170            core_sld=6, shell_sld=8, solvent_sld=1, 
     171            radius=45, thickness=25, length=340, 
     172            theta=30, phi=15, 
     173            radius_pd=.2, radius_pd_n=1, 
     174            length_pd=.2, length_pd_n=10, 
     175            thickness_pd=.2, thickness_pd_n=10, 
     176            theta_pd=15, theta_pd_n=45, 
     177            phi_pd=15, phi_pd_n=1) 
    182178oldname = 'CoreShellCylinderModel' 
    183179oldpars = dict(theta='axis_theta', phi='axis_phi') 
Note: See TracChangeset for help on using the changeset viewer.