Changeset 71bf6de in sasmodels


Ignore:
Timestamp:
Jan 12, 2018 8:44:30 AM (6 years ago)
Author:
Adam Washington <adam.washington@…>
Branches:
master, core_shell_microgels, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
ffc2a61, 7624dd3
Parents:
791281c
Message:

First draft of solution

Location:
sasmodels
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/core.py

    r2d81cfe r71bf6de  
    149149    """ 
    150150    if '@' in model_string: 
    151         parts = model_string.split('@') 
    152         if len(parts) != 2: 
    153             raise ValueError("Use P@S to apply a structure factor S to model P") 
    154         P_info, Q_info = [load_model_info(part) for part in parts] 
    155         return product.make_product_info(P_info, Q_info) 
     151        terms = model_string.split('+') 
     152        results = [] 
     153        for term in terms: 
     154            if '@' in term: 
     155                p_info, q_info = [load_model_info(part) 
     156                                  for part in term.split("@")] 
     157                results.append(product.make_product_info(p_info, q_info)) 
     158            else: 
     159                results.append(load_model_info(term)) 
     160        return mixture.make_mixture_info(results, operation='+') 
     161        # parts = model_string.split('@') 
     162        # if len(parts) != 2: 
     163        #     raise ValueError("Use P@S to apply a structure factor S to model P") 
     164        # P_info, Q_info = [load_model_info(part) for part in parts] 
     165        # return product.make_product_info(P_info, Q_info) 
    156166 
    157167    product_parts = [] 
  • sasmodels/mixture.py

    r2d81cfe r71bf6de  
    9494            # If model is a sum model, each constituent model gets its own scale parameter 
    9595            scale_prefix = prefix 
    96             if prefix == '' and part.operation == '*': 
     96            if prefix == '' and hasattr(part,"operation") and part.operation == '*': 
    9797                # `part` is a composition product model. Find the prefixes of 
    9898                # it's parameters to form a new prefix for the scale, eg: 
Note: See TracChangeset for help on using the changeset viewer.