Changeset 50ec515 in sasmodels


Ignore:
Timestamp:
Aug 5, 2016 8:35:30 AM (4 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:
e187b25
Parents:
e7fe459
Message:

spherical sld: document interface shape number→interface relationship since UI doesn't show dropdown list yet

Location:
sasmodels
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/modelinfo.py

    r9eb3632 r50ec515  
    101101                limits = (float(low), float(high)) 
    102102            except Exception: 
    103                 print("user_limits",user_limits) 
    104                 raise ValueError("invalid limits for %s"%name) 
    105             else: 
    106                 if low >= high: 
    107                     raise ValueError("require lower limit < upper limit") 
     103                raise ValueError("invalid limits for %s: %r"%(name,user_limits)) 
     104            if low >= high: 
     105                raise ValueError("require lower limit < upper limit") 
    108106 
    109107    # Process default value as float, making sure it is in range 
     
    281279    15 degrees). 
    282280 
     281    *choices* is the option names for a drop down list of options, as for 
     282    example, might be used to set the value of a shape parameter. 
     283 
    283284    These values are set by :func:`make_parameter_table` and 
    284285    :func:`parse_parameter` therein. 
     
    522523                    pk.polydisperse = p.polydisperse 
    523524                    pk.relative_pd = p.relative_pd 
     525                    pk.choices = p.choices 
    524526                    full_list.append(pk) 
    525527 
  • sasmodels/models/spherical_sld.py

    r4e0968b r50ec515  
    1515sub-shell is described by a line function, with *n_steps* sub-shells per 
    1616interface. The form factor is normalized by the total volume of the sphere. 
     17 
     18Interface shapes are as follows:: 
     19 
     20    0: erf(|nu|*z) 
     21    1: Rpow(z^|nu|) 
     22    2: Lpow(z^|nu|) 
     23    3: Rexp(-|nu|z) 
     24    4: Lexp(-|nu|z) 
    1725 
    1826Definition 
     
    186194category = "shape:sphere" 
    187195 
    188 SHAPES = ["erf(|nu|*z)", "Rpow(z^|nu|)", "Lpow(z^|nu|)", 
    189           "Rexp(-|nu|z)", "Lexp(-|nu|z)"], 
     196SHAPES = [["erf(|nu|*z)", "Rpow(z^|nu|)", "Lpow(z^|nu|)", 
     197           "Rexp(-|nu|z)", "Lexp(-|nu|z)"]] 
    190198 
    191199# pylint: disable=bad-whitespace, line-too-long 
     
    234242        sld_l = sld[i] 
    235243        sld_r = sld[i+1] if i < n_shells-1 else sld_solvent 
    236         interface = SHAPE_FUNCTIONS[int(np.clip(shape[i], 0, len(SHAPES)-1))] 
     244        fn = SHAPE_FUNCTIONS[int(np.clip(shape[i], 0, len(SHAPE_FUNCTIONS)-1))] 
    237245        for step in range(1, n_steps+1): 
    238             portion = interface(float(step)/n_steps, max(abs(nu[i]), 1e-14)) 
     246            portion = fn(float(step)/n_steps, max(abs(nu[i]), 1e-14)) 
    239247            z0 += dz 
    240248            z.append(z0) 
  • sasmodels/sasview_model.py

    re7fe459 r50ec515  
    3838 
    3939# TODO: separate x_axis_label from multiplicity info 
    40 # The profile x-axis label belongs with the profile generating function 
    4140MultiplicityInfo = collections.namedtuple( 
    4241    'MultiplicityInfo', 
     
    141140                p.name, p.choices, xlabel 
    142141            ) 
     142            break 
     143 
     144    # Only a single drop-down list parameter available 
     145    fun_list = [] 
     146    for p in model_info.parameters.kernel_parameters: 
     147        if p.choices: 
     148            fun_list = p.choices 
     149            if p.length > 1: 
     150                non_fittable.extend(p.id+str(k) for k in range(1, p.length+1)) 
    143151            break 
    144152 
     
    173181    attrs['fixed'] = tuple(fixed) 
    174182    attrs['non_fittable'] = tuple(non_fittable) 
     183    attrs['fun_list'] = tuple(fun_list) 
    175184 
    176185    return attrs 
Note: See TracChangeset for help on using the changeset viewer.