Changeset 7cf2cfd in sasmodels for example


Ignore:
Timestamp:
Nov 22, 2015 11:37:15 PM (9 years ago)
Author:
Paul Kienzle <pkienzle@…>
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:
3b4243d
Parents:
677ccf1
Message:

refactor compare.py so that bumps/sasview not required for simple tests

File:
1 edited

Legend:

Unmodified
Added
Removed
  • example/fit.py

    r346bc88 r7cf2cfd  
    55from bumps.names import * 
    66from sasmodels.core import load_model 
    7 from sasmodels import bumps_model as sas 
     7from sasmodels.bumps_model import Model, Experiment 
     8from sasmodels.data import load_data, set_beam_stop, set_top 
    89 
    910""" IMPORT THE DATA USED """ 
    10 radial_data = sas.load_data('DEC07267.DAT') 
    11 sas.set_beam_stop(radial_data, 0.00669, outer=0.025) 
    12 sas.set_top(radial_data, -.0185) 
     11radial_data = load_data('DEC07267.DAT') 
     12set_beam_stop(radial_data, 0.00669, outer=0.025) 
     13set_top(radial_data, -.0185) 
    1314 
    14 tan_data = sas.load_data('DEC07266.DAT') 
    15 sas.set_beam_stop(tan_data, 0.00669, outer=0.025) 
    16 sas.set_top(tan_data, -.0185) 
     15tan_data = load_data('DEC07266.DAT') 
     16set_beam_stop(tan_data, 0.00669, outer=0.025) 
     17set_top(tan_data, -.0185) 
    1718#sas.set_half(tan_data, 'right') 
    1819 
     
    2829 
    2930if name == "ellipsoid": 
    30     model = sas.Model(kernel, 
     31    model = Model(kernel, 
    3132        scale=0.08, 
    3233        rpolar=15, requatorial=800, 
     
    5152 
    5253elif name == "lamellar": 
    53     model = sas.Model(kernel, 
     54    model = Model(kernel, 
    5455        scale=0.08, 
    5556        thickness=19.2946, 
     
    8788        theta_pd=10, theta_pd_n=50, theta_pd_nsigma=3, 
    8889        phi_pd=0, phi_pd_n=10, phi_pd_nsigma=3) 
    89     model = sas.Model(kernel, **pars) 
     90    model = Model(kernel, **pars) 
    9091 
    9192    # SET THE FITTING PARAMETERS 
     
    102103 
    103104elif name == "core_shell_cylinder": 
    104     model = sas.Model(kernel, 
     105    model = Model(kernel, 
    105106        scale= .031, radius=19.5, thickness=30, length=22, 
    106107        core_sld=7.105, shell_sld=.291, solvent_sld=7.105, 
     
    129130 
    130131elif name == "capped_cylinder": 
    131     model = sas.Model(kernel, 
     132    model = Model(kernel, 
    132133        scale=.08, radius=20, cap_radius=40, length=400, 
    133134        sld_capcyl=1, sld_solv=6.3, 
     
    144145 
    145146elif name == "triaxial_ellipsoid": 
    146     model = sas.Model(kernel, 
     147    model = Model(kernel, 
    147148        scale=0.08, req_minor=15, req_major=20, rpolar=500, 
    148149        sldEll=7.105, solvent_sld=.291, 
     
    170171 
    171172model.cutoff = cutoff 
    172 M = sas.Experiment(data=data, model=model) 
     173M = Experiment(data=data, model=model) 
    173174if section == "both": 
    174    tan_model = sas.Model(model.kernel, **model.parameters()) 
     175   tan_model = Model(model.kernel, **model.parameters()) 
    175176   tan_model.phi = model.phi - 90 
    176177   tan_model.cutoff = cutoff 
    177    tan_M = sas.Experiment(data=tan_data, model=tan_model) 
     178   tan_M = Experiment(data=tan_data, model=tan_model) 
    178179   problem = FitProblem([M, tan_M]) 
    179180else: 
Note: See TracChangeset for help on using the changeset viewer.