Changeset 7b3e62c in sasmodels


Ignore:
Timestamp:
Mar 16, 2016 10:07:19 AM (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:
91c5fdc
Parents:
8e45182
Message:

support load_model('p*q')

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/core.py

    rb8e5e21 r7b3e62c  
    4646    Load model info and build model. 
    4747    """ 
     48    parts = model_name.split('+') 
     49    if len(parts) > 1: 
     50        from .mixture import MixtureModel 
     51        models = [load_model(p, **kw) for p in parts] 
     52        return MixtureModel(models) 
     53 
     54    parts = model_name.split('*') 
     55    if len(parts) > 1: 
     56        # Note: currently have circular reference 
     57        from .product import ProductModel 
     58        if len(parts) > 2: 
     59            raise ValueError("use P*S to apply structure factor S to model P") 
     60        P, Q = [load_model(p, **kw) for p in parts] 
     61        return ProductModel(P, Q) 
     62 
    4863    return build_model(load_model_info(model_name), **kw) 
    4964 
     
    5570    used with functions in generate to build the docs or extract model info. 
    5671    """ 
     72    #import sys; print "\n".join(sys.path) 
    5773    __import__('sasmodels.models.'+model_name) 
    5874    kernel_module = getattr(models, model_name, None) 
Note: See TracChangeset for help on using the changeset viewer.