Changeset fa79f5c in sasmodels for example/sesansfit.py


Ignore:
Timestamp:
Nov 29, 2017 8:43:12 AM (7 years ago)
Author:
Paul Kienzle <pkienzle@…>
Branches:
master, core_shell_microgels, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
a839b22
Parents:
32398dc
Message:

restore working sesans example using direct model

File:
1 edited

Legend:

Unmodified
Added
Removed
  • example/sesansfit.py

    r9217ef8 rfa79f5c  
     1import logging 
     2 
    13from bumps.names import * 
    24from sasmodels import core, bumps_model, sesans 
     
    810    return model 
    911 
    10 def sesans_fit(file, model, initial_vals={}, custom_params={}, param_range=[], acceptance_angle=None): 
     12def sesans_fit(file, model, initial_vals={}, custom_params={}, param_range=[], 
     13               acceptance_angle=None): 
    1114    """ 
    1215 
     
    1922    @return: FitProblem for Bumps usage 
    2023    """ 
     24    logging.basicConfig() 
     25 
    2126    initial_vals['background'] = 0.0 
    2227    try: 
    2328        loader = Loader() 
    24         data = loader.load(file) 
    25         if data is None: raise IOError("Could not load file %r"%(file)) 
     29        data = loader.load(file)[0] 
     30        if data is None: 
     31            raise IOError("Could not load file %r"%(file)) 
    2632 
    27     except: 
     33    except Exception: 
     34        raise 
    2835        # If no loadable data file, generate random data 
    2936        SElength = np.linspace(0, 2400, 61) # [A] 
     
    5057    data.Rmax = 30*radius # [A] 
    5158 
    52     if isinstance(model, basestring): 
     59    if isinstance(model, str): 
    5360        model = get_bumps_model(model) 
    5461 
Note: See TracChangeset for help on using the changeset viewer.