Changeset 78d3341 in sasmodels


Ignore:
Timestamp:
Mar 17, 2016 12:24:09 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:
3a45c2c
Parents:
3bcd03d
Message:

allow the sld on the start or end, or as an sld type

Location:
sasmodels
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/convert.py

    r228cbd3 r78d3341  
    7272    new model definition end with sld. 
    7373    """ 
    74     return dict((p, (v*1e-6 if p.endswith('sld') 
     74    return dict((p, (v*1e-6 if p.startswith('sld') or p.endswith('sld') 
    7575                     else v*1e15 if 'ndensity' in p 
    7676                     else v)) 
  • sasmodels/generate.py

    rfcd7bbd r78d3341  
    9191    in *Iqxy* and *Imagnetic*.  "magnetic* parameters will be used in 
    9292    *Imagnetic* only.  If *type* is the empty string, the parameter will 
    93     be used in all of *Iq*, *Iqxy* and *Imagnetic*. 
     93    be used in all of *Iq*, *Iqxy* and *Imagnetic*.  "sld" parameters 
     94    can automatically be promoted to magnetic parameters, each of which 
     95    will have a magnitude and a direction, which may be different from 
     96    other sld parameters. 
    9497 
    9598    *description* is a short description of the parameter.  This will 
     
    216219import re 
    217220import string 
     221import warnings 
    218222from collections import namedtuple 
    219223 
     
    604608    """ 
    605609    partype = { 
    606         'volume': [], 'orientation': [], 'magnetic': [], '': [], 
     610        'volume': [], 'orientation': [], 'magnetic': [], 'sld': [], '': [], 
    607611        'fixed-1d': [], 'fixed-2d': [], 'pd-1d': [], 'pd-2d': [], 
    608612        'pd-rel': set(), 
     
    618622        elif p.type == 'orientation': 
    619623            partype['pd-2d'].append(p.name) 
    620         elif p.type == '': 
     624        elif p.type in ('', 'sld'): 
    621625            partype['fixed-1d'].append(p.name) 
    622626            partype['fixed-2d'].append(p.name) 
     
    632636    """ 
    633637    # convert parameters into named tuples 
     638    for p in model_info['parameters']: 
     639        if p[4] == '' and (p[0].startswith('sld') or p[0].endswith('sld')): 
     640            p[4] = 'sld' 
     641            # TODO: make sure all models explicitly label their sld parameters 
     642            #raise ValueError("%s.%s needs to be explicitly set to type 'sld'" %(model_info['id'], p[0])) 
     643 
    634644    pars = [Parameter(*p) for p in model_info['parameters']] 
    635645    # Fill in the derived attributes 
Note: See TracChangeset for help on using the changeset viewer.