Changeset 485aee2 in sasmodels for sasmodels/models/capped_cylinder.py


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/capped_cylinder.py

    ra5d0d00 r485aee2  
    115115title = "Right circular cylinder with spherical end caps and uniform SLD" 
    116116description = """That is, a sphereocylinder 
    117         with end caps that have a radius larger than 
    118         that of the cylinder and the center of the 
    119         end cap radius lies within the cylinder. 
    120         Note: As the length of cylinder -->0, 
    121         it becomes a ConvexLens. 
    122         It must be that radius <(=) cap_radius. 
    123         [Parameters]; 
    124         scale: volume fraction of spheres, 
    125         background:incoherent background, 
    126         radius: radius of the cylinder, 
    127         length: length of the cylinder, 
    128         cap_radius: radius of the semi-spherical cap, 
    129         sld: SLD of the capped cylinder, 
    130         solvent_sld: SLD of the solvent. 
     117    with end caps that have a radius larger than 
     118    that of the cylinder and the center of the 
     119    end cap radius lies within the cylinder. 
     120    Note: As the length of cylinder -->0, 
     121    it becomes a ConvexLens. 
     122    It must be that radius <(=) cap_radius. 
     123    [Parameters]; 
     124    scale: volume fraction of spheres, 
     125    background:incoherent background, 
     126    radius: radius of the cylinder, 
     127    length: length of the cylinder, 
     128    cap_radius: radius of the semi-spherical cap, 
     129    sld: SLD of the capped cylinder, 
     130    solvent_sld: SLD of the solvent. 
    131131""" 
    132132category = "shape:cylinder" 
    133133 
    134 parameters = [ 
    135     #   [ "name", "units", default, [lower, upper], "type", 
    136     #     "description" ], 
    137     [ "sld", "1e-6/Ang^2", 4, [-inf,inf], "", 
    138       "Cylinder scattering length density" ], 
    139     [ "solvent_sld", "1e-6/Ang^2", 1, [-inf,inf], "", 
    140       "Solvent scattering length density" ], 
    141     [ "radius", "Ang",  20, [0, inf], "volume", 
    142       "Cylinder radius" ], 
    143     # TODO: use an expression for cap radius with fixed bounds. 
    144     # The current form requires cap radius R bigger than cylinder radius r. 
    145     # Could instead use R/r in [1,inf], r/R in [0,1], or the angle between 
    146     # cylinder and cap in [0,90].  The problem is similar for the barbell 
    147     # model.  Propose r/R in [0,1] in both cases, with the model specifying 
    148     # cylinder radius in the capped cylinder model and sphere radius in the 
    149     # barbell model.  This leads to the natural value of zero for no cap 
    150     # in the capped cylinder, and zero for no bar in the barbell model.  In 
    151     # both models, one would be a pill. 
    152     [ "cap_radius", "Ang", 20, [0, inf], "volume", 
    153       "Cap radius" ], 
    154     [ "length", "Ang",  400, [0, inf], "volume", 
    155       "Cylinder length" ], 
    156     [ "theta", "degrees", 60, [-inf, inf], "orientation", 
    157       "In plane angle" ], 
    158     [ "phi", "degrees", 60, [-inf, inf], "orientation", 
    159       "Out of plane angle" ], 
    160     ] 
     134#             ["name", "units", default, [lower, upper], "type", "description"], 
     135parameters = [["sld", "1e-6/Ang^2", 4, [-inf, inf], "", 
     136               "Cylinder scattering length density"], 
     137              ["solvent_sld", "1e-6/Ang^2", 1, [-inf, inf], "", 
     138               "Solvent scattering length density"], 
     139              ["radius", "Ang", 20, [0, inf], "volume", "Cylinder radius"], 
     140              # TODO: use an expression for cap radius with fixed bounds. 
     141              # The current form requires cap radius R bigger than cylinder radius r. 
     142              # Could instead use R/r in [1,inf], r/R in [0,1], or the angle between 
     143              # cylinder and cap in [0,90].  The problem is similar for the barbell 
     144              # model.  Propose r/R in [0,1] in both cases, with the model specifying 
     145              # cylinder radius in the capped cylinder model and sphere radius in the 
     146              # barbell model.  This leads to the natural value of zero for no cap 
     147              # in the capped cylinder, and zero for no bar in the barbell model.  In 
     148              # both models, one would be a pill. 
     149              ["cap_radius", "Ang", 20, [0, inf], "volume", "Cap radius"], 
     150              ["length", "Ang", 400, [0, inf], "volume", "Cylinder length"], 
     151              ["theta", "degrees", 60, [-inf, inf], "orientation", "In plane angle"], 
     152              ["phi", "degrees", 60, [-inf, inf], "orientation", "Out of plane angle"], 
     153             ] 
    161154 
    162 source = [ "lib/J1.c", "lib/gauss76.c", "capped_cylinder.c" ] 
     155source = ["lib/J1.c", "lib/gauss76.c", "capped_cylinder.c"] 
    163156 
    164  
    165 demo = dict( 
    166     scale=1, background=0, 
    167     sld=6, solvent_sld=1, 
    168     radius=260, cap_radius=290, length=290, 
    169     theta=30, phi=15, 
    170     radius_pd=.2, radius_pd_n=1, 
    171     cap_radius_pd=.2, cap_radius_pd_n=1, 
    172     length_pd=.2, length_pd_n=10, 
    173     theta_pd=15, theta_pd_n=45, 
    174     phi_pd=15, phi_pd_n=1, 
    175     ) 
     157demo = dict(scale=1, background=0, 
     158            sld=6, solvent_sld=1, 
     159            radius=260, cap_radius=290, length=290, 
     160            theta=30, phi=15, 
     161            radius_pd=.2, radius_pd_n=1, 
     162            cap_radius_pd=.2, cap_radius_pd_n=1, 
     163            length_pd=.2, length_pd_n=10, 
     164            theta_pd=15, theta_pd_n=45, 
     165            phi_pd=15, phi_pd_n=1) 
    176166oldname = 'CappedCylinderModel' 
    177167oldpars = dict(sld='sld_capcyl', solvent_sld='sld_solv', 
Note: See TracChangeset for help on using the changeset viewer.