Changeset ce896fd in sasmodels


Ignore:
Timestamp:
Mar 28, 2016 7:27:22 AM (8 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:
fb5914f, d1c4760
Parents:
5c028e3
Message:

improved handling of vector parameters; remove compile errors from onion.c

Location:
sasmodels
Files:
1 deleted
8 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/convert.py

    rc6ca41e rce896fd  
    7373    new model definition end with sld. 
    7474    """ 
     75    print "pars",pars 
    7576    return dict((p, (v*1e-6 if p.startswith('sld') or p.endswith('sld') 
    7677                     else v*1e15 if 'ndensity' in p 
  • sasmodels/generate.py

    rd19962c rce896fd  
    192192import numpy as np 
    193193 
    194 from .modelinfo import ModelInfo, Parameter, make_parameter_table 
     194from .modelinfo import ModelInfo, Parameter, make_parameter_table, set_demo 
    195195 
    196196# TODO: identify model files which have changed since loading and reload them. 
     
    539539    return '\n'.join(source) 
    540540 
    541 def process_parameters(model_info): 
    542     """ 
    543     Process parameter block, precalculating parameter details. 
    544     """ 
    545     partable = model_info['parameters'] 
    546     if model_info.get('demo', None) is None: 
    547         model_info['demo'] = partable.defaults 
    548  
    549541class CoordinationDetails(object): 
    550542    def __init__(self, model_info): 
     
    664656    if callable(model_info['Iq']) and model_info['Iqxy'] is None: 
    665657        partable = model_info['parameters'] 
    666         if partable.type['1d'] != partable.type['2d']: 
     658        if partable.has_2d: 
    667659            raise ValueError("Iqxy model is missing") 
    668660        Iq = model_info['Iq'] 
     
    735727        single=getattr(kernel_module, 'single', True), 
    736728        structure_factor=getattr(kernel_module, 'structure_factor', False), 
     729        profile_axes=getattr(kernel_module, 'profile_axes', ['x','y']), 
    737730        variant_info=getattr(kernel_module, 'invariant_info', None), 
    738731        demo=getattr(kernel_module, 'demo', None), 
     
    742735        tests=getattr(kernel_module, 'tests', []), 
    743736        ) 
    744     process_parameters(model_info) 
     737    set_demo(model_info, getattr(kernel_module, 'demo', None)) 
    745738    # Check for optional functions 
    746     functions = "ER VR form_volume Iq Iqxy shape sesans".split() 
     739    functions = "ER VR form_volume Iq Iqxy profile sesans".split() 
    747740    model_info.update((k, getattr(kernel_module, k, None)) for k in functions) 
    748741    create_default_functions(model_info) 
  • sasmodels/modelinfo.py

    rd19962c rce896fd  
    4545    if isinstance(limits, list) and all(isstr(k) for k in limits): 
    4646        choices = limits 
    47         limits = [1, len(choices)] 
     47        limits = [0, len(choices)-1] 
    4848    else: 
    49         choices = None 
     49        choices = [] 
    5050    # TODO: maybe allow limits of None for (-inf, inf) 
    5151    try: 
     
    115115    return parameter 
    116116 
     117 
     118def set_demo(model_info, demo): 
     119    """ 
     120    Assign demo parameters to model_info['demo'] 
     121 
     122    If demo is not defined, then use defaults. 
     123 
     124    If demo is defined, override defaults with value from demo. 
     125 
     126    If demo references vector fields, such as thickness[n], then support 
     127    different ways of assigning the demo values, including assigning a 
     128    specific value (e.g., thickness3=50.0), assigning a new value to all 
     129    (e.g., thickness=50.0) or assigning values using list notation. 
     130    """ 
     131    partable = model_info['parameters'] 
     132    if demo is None: 
     133        result = partable.defaults 
     134    else: 
     135        pars = dict((p.id, p) for p in partable.kernel_parameters) 
     136        result = partable.defaults.copy() 
     137        vectors = dict((name,value) for name,value in demo.items() 
     138                       if name in pars and pars[name].length > 1) 
     139        if vectors: 
     140            scalars = dict((name, value) for name, value in demo.items() 
     141                           if name not in pars or pars[name].length == 1) 
     142            for name, value in vectors.items(): 
     143                if np.isscalar(value): 
     144                    # support for the form 
     145                    #    demo(thickness=0, thickness2=50) 
     146                    for k in pars[name].length: 
     147                        key = name+str(k) 
     148                        if key not in scalars: 
     149                            scalars[key] = vectors 
     150                else: 
     151                    # supoprt for the form 
     152                    #    demo(thickness=[20,10,3]) 
     153                    for (k,v) in enumerate(value): 
     154                        scalars[name+str(k)] = v 
     155            result.update(scalars) 
     156        else: 
     157            result.update(demo) 
     158 
     159    model_info['demo'] = result 
     160 
    117161class Parameter(object): 
    118162    """ 
     
    171215        self.type = type 
    172216        self.description = description 
    173         self.choices = None 
    174217 
    175218        # Length and length_control will be filled in once the complete 
     
    182225        self.polydisperse = False 
    183226        self.relative_pd = False 
     227 
     228        # choices are also set externally. 
     229        self.choices = [] 
    184230 
    185231    def as_definition(self): 
  • sasmodels/models/onion.c

    rfdb1487 rce896fd  
    44    double thickness, double A) 
    55{ 
    6   const double vol = 4.0/3.0 * M_PI * r * r * r; 
     6  const double vol = M_4PI_3 * cube(r); 
    77  const double qr = q * r; 
    88  const double alpha = A * r/thickness; 
     
    1919    double sinqr, cosqr; 
    2020    SINCOS(qr, sinqr, cosqr); 
    21     fun = -3.0( 
     21    fun = -3.0*( 
    2222            ((alphasq - qrsq)*sinqr/qr - 2.0*alpha*cosqr) / sumsq 
    2323                - (alpha*sinqr/qr - cosqr) 
     
    3232f_linear(double q, double r, double sld, double slope) 
    3333{ 
    34   const double vol = 4.0/3.0 * M_PI * r * r * r; 
     34  const double vol = M_4PI_3 * cube(r); 
    3535  const double qr = q * r; 
    3636  const double bes = sph_j1c(qr); 
     
    5252{ 
    5353  const double bes = sph_j1c(q * r); 
    54   const double vol = 4.0/3.0 * M_PI * r * r * r; 
     54  const double vol = M_4PI_3 * cube(r); 
    5555  return sld * vol * bes; 
    5656} 
     
    6464    r += thickness[i]; 
    6565  } 
    66   return 4.0/3.0 * M_PI * r * r * r; 
     66  return M_4PI_3*cube(r); 
    6767} 
    6868 
    6969static double 
    70 Iq(double q, double core_sld, double core_radius, double solvent_sld, 
    71     double n, double in_sld[], double out_sld[], double thickness[], 
     70Iq(double q, double sld_core, double core_radius, double sld_solvent, 
     71    double n, double sld_in[], double sld_out[], double thickness[], 
    7272    double A[]) 
    7373{ 
    7474  int i; 
    75   r = core_radius; 
    76   f = f_constant(q, r, core_sld); 
     75  double r = core_radius; 
     76  double f = f_constant(q, r, sld_core); 
    7777  for (i=0; i<n; i++){ 
    7878    const double r0 = r; 
     
    9292    } 
    9393  } 
    94   f -= f_constant(q, r, solvent_sld); 
    95   f2 = f * f * 1.0e-4; 
     94  f -= f_constant(q, r, sld_solvent); 
     95  const double f2 = f * f * 1.0e-4; 
    9696 
    9797  return f2; 
  • sasmodels/models/onion.py

    r6a8fdfe rce896fd  
    292292 
    293293#             ["name", "units", default, [lower, upper], "type","description"], 
    294 parameters = [["core_sld", "1e-6/Ang^2", 1.0, [-inf, inf], "", 
     294parameters = [["sld_core", "1e-6/Ang^2", 1.0, [-inf, inf], "", 
    295295               "Core scattering length density"], 
    296               ["core_radius", "Ang", 200., [0, inf], "", 
     296              ["core_radius", "Ang", 200., [0, inf], "volume", 
    297297               "Radius of the core"], 
    298               ["solvent_sld", "1e-6/Ang^2", 6.4, [-inf, inf], "", 
     298              ["sld_solvent", "1e-6/Ang^2", 6.4, [-inf, inf], "", 
    299299               "Solvent scattering length density"], 
    300300              ["n", "", 1, [0, 10], "volume", 
    301301               "number of shells"], 
    302               ["in_sld[n]", "1e-6/Ang^2", 1.7, [-inf, inf], "", 
     302              ["sld_in[n]", "1e-6/Ang^2", 1.7, [-inf, inf], "", 
    303303               "scattering length density at the inner radius of shell k"], 
    304               ["out_sld[n]", "1e-6/Ang^2", 2.0, [-inf, inf], "", 
     304              ["sld_out[n]", "1e-6/Ang^2", 2.0, [-inf, inf], "", 
    305305               "scattering length density at the outer radius of shell k"], 
    306306              ["thickness[n]", "Ang", 40., [0, inf], "volume", 
     
    310310              ] 
    311311 
    312 #source = ["lib/sph_j1c.c", "onion.c"] 
    313  
    314 def Iq(q, *args, **kw): 
    315     return q 
    316  
    317 def Iqxy(qx, *args, **kw): 
    318     return qx 
    319  
    320  
    321 def shape(core_sld, core_radius, solvent_sld, n, in_sld, out_sld, thickness, A): 
     312source = ["lib/sph_j1c.c", "onion.c"] 
     313 
     314#def Iq(q, *args, **kw): 
     315#    return q 
     316 
     317profile_axes = ['Radius (A)', 'SLD (1e-6/A^2)'] 
     318def profile(core_sld, core_radius, solvent_sld, n, in_sld, out_sld, thickness, A): 
    322319    """ 
    323320    SLD profile 
     
    373370 
    374371demo = { 
    375     "solvent_sld": 2.2, 
    376     "core_sld": 1.0, 
     372    "sld_solvent": 2.2, 
     373    "sld_core": 1.0, 
    377374    "core_radius": 100, 
    378375    "n": 4, 
    379     "in_sld": [0.5, 1.5, 0.9, 2.0], 
    380     "out_sld": [nan, 0.9, 1.2, 1.6], 
     376    "sld_in": [0.5, 1.5, 0.9, 2.0], 
     377    "sld_out": [nan, 0.9, 1.2, 1.6], 
    381378    "thickness": [50, 75, 150, 75], 
    382379    "A": [0, -1, 1e-4, 1], 
  • sasmodels/models/spherical_sld.py

    re42b0b9 rce896fd  
    163163title = "Sperical SLD intensity calculation" 
    164164description = """ 
    165             I(q) = 
    166                background = Incoherent background [1/cm] 
    167         """ 
     165    I(q) = 
     166    background = Incoherent background [1/cm] 
     167    """ 
    168168category = "sphere-based" 
    169169 
    170170# pylint: disable=bad-whitespace, line-too-long 
    171171#            ["name", "units", default, [lower, upper], "type", "description"], 
    172 parameters = [["n_shells",         "",               1,      [0, 9],         "", "number of shells"], 
    173               ["thick_inter[n]",   "Ang",            50,     [-inf, inf],    "", "intern layer thickness"], 
    174               ["func_inter[n]",    "",               0,      [0, 4],         "", "Erf:0, RPower:1, LPower:2, RExp:3, LExp:4"], 
    175               ["sld_core",         "1e-6/Ang^2",     2.07,   [-inf, inf],    "", "sld function flat"], 
    176               ["sld_solvent",      "1e-6/Ang^2",     1.0,    [-inf, inf],    "", "sld function solvent"], 
    177               ["sld_flat[n]",      "1e-6/Ang^2",     4.06,   [-inf, inf],    "", "sld function flat"], 
    178               ["thick_inter[n]",   "Ang",            50.0,   [0, inf],    "", "intern layer thickness"], 
    179               ["thick_flat[n]",    "Ang",            100.0,  [0, inf],    "", "flat layer_thickness"], 
    180               ["inter_nu[n]",      "",               2.5,    [-inf, inf],    "", "steepness parameter"], 
    181               ["npts_inter",       "",               35,     [0, 35],        "", "number of points in each sublayer Must be odd number"], 
    182               ["core_rad",         "Ang",            50.0,   [0, inf],    "", "intern layer thickness"], 
     172parameters = [["n_shells",                "",               1,      [0, 9],      "", "number of shells"], 
     173              ["thick_inter[n_shells]",   "Ang",            50,     [-inf, inf], "", "intern layer thickness"], 
     174              ["func_inter[n_shells]",    "",               0,      [0, 4],      "", "Erf:0, RPower:1, LPower:2, RExp:3, LExp:4"], 
     175              ["sld_core",                "1e-6/Ang^2",     2.07,   [-inf, inf], "", "sld function flat"], 
     176              ["sld_solvent",             "1e-6/Ang^2",     1.0,    [-inf, inf], "", "sld function solvent"], 
     177              ["sld_flat[n_shells]",      "1e-6/Ang^2",     4.06,   [-inf, inf], "", "sld function flat"], 
     178              ["thick_inter[n_shells]",   "Ang",            50.0,   [0, inf],    "", "intern layer thickness"], 
     179              ["thick_flat[n_shells]",    "Ang",            100.0,  [0, inf],    "", "flat layer_thickness"], 
     180              ["inter_nu[n_shells]",      "",               2.5,    [-inf, inf], "", "steepness parameter"], 
     181              ["npts_inter",              "",               35,     [0, 35],     "", "number of points in each sublayer Must be odd number"], 
     182              ["core_rad",                "Ang",            50.0,   [0, inf],    "", "intern layer thickness"], 
    183183              ] 
    184184# pylint: enable=bad-whitespace, line-too-long 
     185 
    185186#source = ["lib/librefl.c",  "lib/sph_j1c.c", "spherical_sld.c"] 
    186  
    187187def Iq(q, *args, **kw): 
    188188    return q 
    189189 
    190 def Iqxy(qx, *args, **kw): 
    191     return qx 
    192  
    193  
    194190demo = dict( 
    195         n_shells=4, 
    196         scale=1.0, 
    197         solvent_sld=1.0, 
    198         background=0.0, 
    199         npts_inter=35.0, 
    200         func_inter_0=0, 
    201         nu_inter_0=2.5, 
    202         rad_core_0=50.0, 
    203         core0_sld=2.07, 
    204         thick_inter_0=50.0, 
    205         func_inter_1=0, 
    206         nu_inter_1=2.5, 
    207         thick_inter_1=50.0, 
    208         flat1_sld=4.0, 
    209         thick_flat_1=100.0, 
    210         func_inter_2=0, 
    211         nu_inter_2=2.5, 
    212         thick_inter_2=50.0, 
    213         flat2_sld=3.5, 
    214         thick_flat_2=100.0, 
    215         func_inter_3=0, 
    216         nu_inter_3=2.5, 
    217         thick_inter_3=50.0, 
    218         flat3_sld=4.0, 
    219         thick_flat_3=100.0, 
    220         func_inter_4=0, 
    221         nu_inter_4=2.5, 
    222         thick_inter_4=50.0, 
    223         flat4_sld=3.5, 
    224         thick_flat_4=100.0, 
    225         func_inter_5=0, 
    226         nu_inter_5=2.5, 
    227         thick_inter_5=50.0, 
    228         flat5_sld=4.0, 
    229         thick_flat_5=100.0, 
    230         func_inter_6=0, 
    231         nu_inter_6=2.5, 
    232         thick_inter_6=50.0, 
    233         flat6_sld=3.5, 
    234         thick_flat_6=100.0, 
    235         func_inter_7=0, 
    236         nu_inter_7=2.5, 
    237         thick_inter_7=50.0, 
    238         flat7_sld=4.0, 
    239         thick_flat_7=100.0, 
    240         func_inter_8=0, 
    241         nu_inter_8=2.5, 
    242         thick_inter_8=50.0, 
    243         flat8_sld=3.5, 
    244         thick_flat_8=100.0, 
    245         func_inter_9=0, 
    246         nu_inter_9=2.5, 
    247         thick_inter_9=50.0, 
    248         flat9_sld=4.0, 
    249         thick_flat_9=100.0, 
    250         func_inter_10=0, 
    251         nu_inter_10=2.5, 
    252         thick_inter_10=50.0, 
    253         flat10_sld=3.5, 
    254         thick_flat_10=100.0 
    255         ) 
     191    n_shells=4, 
     192    scale=1.0, 
     193    solvent_sld=1.0, 
     194    background=0.0, 
     195    npts_inter=35.0, 
     196    func_inter_0=0, 
     197    nu_inter_0=2.5, 
     198    rad_core_0=50.0, 
     199    core0_sld=2.07, 
     200    thick_inter_0=50.0, 
     201    func_inter_1=0, 
     202    nu_inter_1=2.5, 
     203    thick_inter_1=50.0, 
     204    flat1_sld=4.0, 
     205    thick_flat_1=100.0, 
     206    func_inter_2=0, 
     207    nu_inter_2=2.5, 
     208    thick_inter_2=50.0, 
     209    flat2_sld=3.5, 
     210    thick_flat_2=100.0, 
     211    func_inter_3=0, 
     212    nu_inter_3=2.5, 
     213    thick_inter_3=50.0, 
     214    flat3_sld=4.0, 
     215    thick_flat_3=100.0, 
     216    func_inter_4=0, 
     217    nu_inter_4=2.5, 
     218    thick_inter_4=50.0, 
     219    flat4_sld=3.5, 
     220    thick_flat_4=100.0, 
     221    func_inter_5=0, 
     222    nu_inter_5=2.5, 
     223    thick_inter_5=50.0, 
     224    flat5_sld=4.0, 
     225    thick_flat_5=100.0, 
     226    func_inter_6=0, 
     227    nu_inter_6=2.5, 
     228    thick_inter_6=50.0, 
     229    flat6_sld=3.5, 
     230    thick_flat_6=100.0, 
     231    func_inter_7=0, 
     232    nu_inter_7=2.5, 
     233    thick_inter_7=50.0, 
     234    flat7_sld=4.0, 
     235    thick_flat_7=100.0, 
     236    func_inter_8=0, 
     237    nu_inter_8=2.5, 
     238    thick_inter_8=50.0, 
     239    flat8_sld=3.5, 
     240    thick_flat_8=100.0, 
     241    func_inter_9=0, 
     242    nu_inter_9=2.5, 
     243    thick_inter_9=50.0, 
     244    flat9_sld=4.0, 
     245    thick_flat_9=100.0, 
     246    func_inter_10=0, 
     247    nu_inter_10=2.5, 
     248    thick_inter_10=50.0, 
     249    flat10_sld=3.5, 
     250    thick_flat_10=100.0 
     251    ) 
    256252 
    257253oldname = "SphereSLDModel" 
    258254oldpars = dict( 
    259         n_shells="n_shells", 
    260         scale="scale", 
    261         npts_inter='npts_inter', 
    262         solvent_sld='sld_solv', 
    263         func_inter_0='func_inter0', 
    264         nu_inter_0='nu_inter0', 
    265         background='background', 
    266         rad_core_0='rad_core0', 
    267         core0_sld='sld_core0', 
    268         thick_inter_0='thick_inter0', 
    269         func_inter_1='func_inter1', 
    270         nu_inter_1='nu_inter1', 
    271         thick_inter_1='thick_inter1', 
    272         flat1_sld='sld_flat1', 
    273         thick_flat_1='thick_flat1', 
    274         func_inter_2='func_inter2', 
    275         nu_inter_2='nu_inter2', 
    276         thick_inter_2='thick_inter2', 
    277         flat2_sld='sld_flat2', 
    278         thick_flat_2='thick_flat2', 
    279         func_inter_3='func_inter3', 
    280         nu_inter_3='nu_inter3', 
    281         thick_inter_3='thick_inter3', 
    282         flat3_sld='sld_flat3', 
    283         thick_flat_3='thick_flat3', 
    284         func_inter_4='func_inter4', 
    285         nu_inter_4='nu_inter4', 
    286         thick_inter_4='thick_inter4', 
    287         flat4_sld='sld_flat4', 
    288         thick_flat_4='thick_flat4', 
    289         func_inter_5='func_inter5', 
    290         nu_inter_5='nu_inter5', 
    291         thick_inter_5='thick_inter5', 
    292         flat5_sld='sld_flat5', 
    293         thick_flat_5='thick_flat5', 
    294         func_inter_6='func_inter6', 
    295         nu_inter_6='nu_inter6', 
    296         thick_inter_6='thick_inter6', 
    297         flat6_sld='sld_flat6', 
    298         thick_flat_6='thick_flat6', 
    299         func_inter_7='func_inter7', 
    300         nu_inter_7='nu_inter7', 
    301         thick_inter_7='thick_inter7', 
    302         flat7_sld='sld_flat7', 
    303         thick_flat_7='thick_flat7', 
    304         func_inter_8='func_inter8', 
    305         nu_inter_8='nu_inter8', 
    306         thick_inter_8='thick_inter8', 
    307         flat8_sld='sld_flat8', 
    308         thick_flat_8='thick_flat8', 
    309         func_inter_9='func_inter9', 
    310         nu_inter_9='nu_inter9', 
    311         thick_inter_9='thick_inter9', 
    312         flat9_sld='sld_flat9', 
    313         thick_flat_9='thick_flat9', 
    314         func_inter_10='func_inter10', 
    315         nu_inter_10='nu_inter10', 
    316         thick_inter_10='thick_inter10', 
    317         flat10_sld='sld_flat10', 
    318         thick_flat_10='thick_flat10') 
     255    n_shells="n_shells", 
     256    scale="scale", 
     257    background='background', 
     258    npts_inter='npts_inter', 
     259    solvent_sld='sld_solv', 
     260 
     261    func_inter_0='func_inter0', 
     262    nu_inter_0='nu_inter0', 
     263    rad_core_0='rad_core0', 
     264    core0_sld='sld_core0', 
     265    thick_inter_0='thick_inter0', 
     266    func_inter_1='func_inter1', 
     267    nu_inter_1='nu_inter1', 
     268    thick_inter_1='thick_inter1', 
     269    flat1_sld='sld_flat1', 
     270    thick_flat_1='thick_flat1', 
     271    func_inter_2='func_inter2', 
     272    nu_inter_2='nu_inter2', 
     273    thick_inter_2='thick_inter2', 
     274    flat2_sld='sld_flat2', 
     275    thick_flat_2='thick_flat2', 
     276    func_inter_3='func_inter3', 
     277    nu_inter_3='nu_inter3', 
     278    thick_inter_3='thick_inter3', 
     279    flat3_sld='sld_flat3', 
     280    thick_flat_3='thick_flat3', 
     281    func_inter_4='func_inter4', 
     282    nu_inter_4='nu_inter4', 
     283    thick_inter_4='thick_inter4', 
     284    flat4_sld='sld_flat4', 
     285    thick_flat_4='thick_flat4', 
     286    func_inter_5='func_inter5', 
     287    nu_inter_5='nu_inter5', 
     288    thick_inter_5='thick_inter5', 
     289    flat5_sld='sld_flat5', 
     290    thick_flat_5='thick_flat5', 
     291    func_inter_6='func_inter6', 
     292    nu_inter_6='nu_inter6', 
     293    thick_inter_6='thick_inter6', 
     294    flat6_sld='sld_flat6', 
     295    thick_flat_6='thick_flat6', 
     296    func_inter_7='func_inter7', 
     297    nu_inter_7='nu_inter7', 
     298    thick_inter_7='thick_inter7', 
     299    flat7_sld='sld_flat7', 
     300    thick_flat_7='thick_flat7', 
     301    func_inter_8='func_inter8', 
     302    nu_inter_8='nu_inter8', 
     303    thick_inter_8='thick_inter8', 
     304    flat8_sld='sld_flat8', 
     305    thick_flat_8='thick_flat8', 
     306    func_inter_9='func_inter9', 
     307    nu_inter_9='nu_inter9', 
     308    thick_inter_9='thick_inter9', 
     309    flat9_sld='sld_flat9', 
     310    thick_flat_9='thick_flat9', 
     311    func_inter_10='func_inter10', 
     312    nu_inter_10='nu_inter10', 
     313    thick_inter_10='thick_inter10', 
     314    flat10_sld='sld_flat10', 
     315    thick_flat_10='thick_flat10') 
    319316 
    320317#TODO: Not working yet 
  • sasmodels/product.py

    re9b1663d rce896fd  
    1414 
    1515from .core import call_ER_VR 
    16 from .generate import process_parameters 
    1716 
    1817SCALE=0 
     
    6463    model_info['oldpars'] = oldpars 
    6564    model_info['composition'] = ('product', [p_info, s_info]) 
    66     process_parameters(model_info) 
    6765    return model_info 
    6866 
  • sasmodels/sasview_model.py

    r787be86 rce896fd  
    3232 
    3333    Returns a class that can be used directly as a sasview model.t 
    34  
    35     Defaults to using the new name for a model.  Setting 
    36     *namestyle='oldname'* will produce a class with a name 
    37     compatible with SasView. 
    3834    """ 
    3935    model_info = core.load_model_info(model_name) 
     
    5854        self._kernel = None 
    5955        model_info = self._model_info 
     56        parameters = model_info['parameters'] 
    6057 
    6158        self.name = model_info['name'] 
    62         self.oldname = model_info['oldname'] 
    6359        self.description = model_info['description'] 
    6460        self.category = None 
    65         self.multiplicity_info = None 
    66         self.is_multifunc = False 
     61        #self.is_multifunc = False 
     62        for p in parameters.kernel_parameters: 
     63            if p.is_control: 
     64                profile_axes = model_info['profile_axes'] 
     65                self.multiplicity_info = [ 
     66                    p.limits[1], p.name, p.choices, profile_axes[0] 
     67                    ] 
     68                break 
     69        else: 
     70            self.multiplicity_info = [] 
    6771 
    6872        ## interpret the parameters 
Note: See TracChangeset for help on using the changeset viewer.