Changeset 5d3d7b4 in sasmodels

Sep 4, 2014 11:40:26 AM (7 years ago)
Paul Kienzle <pkienzle@…>
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

fix tangential and simultaneous fit in example

2 edited


  • README.rst

    r19dcb933 r5d3d7b4  
    99the distributed package.  New models can be added if OpenCL or a C compiler 
    1010is available. 
     15The example directory contains a radial+tangential data set for an oriented 
     16rod-like shape. 
     18The data is loaded by sans.dataloader from the sasview package, so sasview 
     19is needed to run the example. 
     21To run the example, you need sasview, sasmodels and bumps.  Assuming these 
     22repositories are installed side by side, change to the sasmodels/example 
     23directory and enter:: 
     25    PYTHONPATH=..:../../sasview/src ../../bumps/ \ 
     26        cylinder --preview 
     28See bumps documentation for instructions on running the fit.  With the 
     29python packages installed, e.g., into a virtual environment, then the 
     30python path need not be set, and the command would be:: 
     32    bumps cylinder --preview 
     34The model accepts up to two arguments.  The first argument is the 
     35model type, which has been defined for cylinder, capped_cylinder, 
     36core_shell_cylinder, ellipsoid, triaxial_ellipsoid and lamellar.  The 
     37second argument is view, which can be radial or tangential.  To fit 
     38both radial and tangential simultaneously, use the word "both". 
    1243cylinder.c + is the cylinder model with renamed variables and 
  • example/

    r6ce1a29 r5d3d7b4  
    1818name = "ellipsoid" if len(sys.argv) < 2 else sys.argv[1] 
    1919section = "radial" if len(sys.argv) < 3 else sys.argv[2] 
    20 data = radial_data if section is not "tangent" else tan_data 
     20if section not in ("radial","tangential","both"): 
     21    raise ValueError("section %r should be 'radial', 'tangential' or 'both'" 
     22            % section) 
     23data = radial_data if section != "tangential" else tan_data 
     24phi = 0 if section != "tangential" else 90 
    2125kernel = sas.load_model(name, dtype="single") 
    2226cutoff = 1e-3 
    2832    sld=.291, solvent_sld=7.105, 
    2933    background=0, 
    30     theta=90, phi=0, 
     34    theta=90, phi=phi, 
    3135    theta_pd=15, theta_pd_n=40, theta_pd_nsigma=3, 
    3236    rpolar_pd=0.222296, rpolar_pd_n=1, rpolar_pd_nsigma=0, 
    6569    pars = dict(scale=0.0023, radius=92.5, length=798.3, 
    6670        sld=.29, solvent_sld=7.105, background=5, 
    67         theta=0, phi=0, 
     71        theta=0, phi=phi, 
    6872        theta_pd=22.11, theta_pd_n=5, theta_pd_nsigma=3, 
    6973        radius_pd=.0084, radius_pd_n=10, radius_pd_nsigma=3, 
    7579        sld=.291, solvent_sld=5.77,  
    7680        radius=250, length=178,  
    77         theta=90, phi=0, 
     81        theta=90, phi=phi, 
    7882        radius_pd=0.1, radius_pd_n=5, radius_pd_nsigma=3, 
    7983        length_pd=0.1,length_pd_n=5, length_pd_nsigma=3, 
    98102    scale= .031, radius=19.5, thickness=30, length=22, 
    99103    core_sld=7.105, shell_sld=.291, solvent_sld=7.105, 
    100     background=0, theta=0, phi=0, 
     104    background=0, theta=0, phi=phi, 
    102106    radius_pd=0.26, radius_pd_n=10, radius_pd_nsigma=3, 
    125129    scale=.08, radius=20, cap_radius=40, length=400, 
    126130    sld_capcyl=1, sld_solv=6.3, 
    127     background=0, theta=0, phi=0, 
     131    background=0, theta=0, phi=phi, 
    128132    radius_pd=.1, radius_pd_n=5, radius_pd_nsigma=3, 
    129133    cap_radius_pd=.1, cap_radius_pd_n=5, cap_radius_pd_nsigma=3, 
    140144    scale=0.08, req_minor=15, req_major=20, rpolar=500, 
    141145    sldEll=7.105, solvent_sld=.291, 
    142     background=5, theta=0, phi=0, psi=0, 
     146    background=5, theta=0, phi=phi, psi=0, 
    143147    theta_pd=20, theta_pd_n=40, theta_pd_nsigma=3, 
    144148    phi_pd=.1, phi_pd_n=1, phi_pd_nsigma=0, 
    163167model.cutoff = cutoff 
    164 if section is "both": 
     168if section == "both": 
    165169   tan_model = sas.BumpsModel(tan_data, model.model, model.parameters()) 
    166170   tan_model.phi = model.phi - 90 
     171   tan_model.cutoff = cutoff 
    167172   problem = FitProblem([model, tan_model]) 
Note: See TracChangeset for help on using the changeset viewer.