Changeset c7062fe in sasmodels


Ignore:
Timestamp:
Mar 17, 2016 8:37:25 AM (8 years ago)
Author:
smk78
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:
246517d
Parents:
228cbd3 (diff), d529d93 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of https://github.com/SasView/sasmodels

Files:
1 added
39 edited

Legend:

Unmodified
Added
Removed
  • doc/Makefile

    r7bb290c r63776d3  
    131131pdf: latex 
    132132        $(MAKE) -C _build/latex all-pdf 
     133        $(COPY) _build/latex/SASModels.pdf _build/html 
    133134 
    134135changes: 
  • doc/genmodel.py

    r91c5fdc r70bbb74  
    1 import sys, os 
     1import sys, os, math, re 
     2import numpy as np 
     3import matplotlib.pyplot as plt 
    24sys.path.insert(0, os.path.abspath('..')) 
    35from sasmodels import generate, core 
     6from sasmodels.direct_model import DirectModel 
     7from sasmodels.data import empty_data1D, empty_data2D 
     8 
    49 
    510# Convert ../sasmodels/models/name.py to name 
     
    813# Load the doc string from the module definition file and store it in rst 
    914docstr = generate.make_doc(core.load_model_info(model_name)) 
     15     
     16# Generate automatically plot of the model and add it to rst documentation 
     17 
     18info = core.load_model_info(model_name) 
     19 
     20# Calculate 1D curve for default parameters 
     21pars = dict((p[0], p[2]) for p in info['parameters']) 
     22 
     23# Plotting ranges and options 
     24opts = { 
     25        'xscale'    : 'log', 
     26        'yscale'    : 'log' if not info['structure_factor'] else 'linear', 
     27        'qmin'      : 0.005, 
     28        'qmax'      : 1.0, 
     29        'nq'        : 1000, 
     30        'nq2d'      : 100, 
     31} 
     32 
     33qmin, qmax, nq = opts['qmin'], opts['qmax'], opts['nq'] 
     34qmin = math.log10(qmin) 
     35qmax = math.log10(qmax) 
     36q = np.logspace(qmin, qmax, nq) 
     37data = empty_data1D(q) 
     38model = core.load_model(model_name) 
     39calculator = DirectModel(data, model) 
     40Iq1D = calculator() 
     41 
     42# TO DO: Generation of 2D plots  
     43# Problem in sasmodels.direct_model._calc_theory 
     44# There self._kernel.q_input.nq  gets a value of 0 in the 2D case 
     45# and returns a 0 numpy array (it does not call the C code) 
     46 
     47# If 2D model, compute 2D image 
     48#if info['has_2d'] != []: 
     49#    qmax, nq2d = opts['qmax'], opts['nq2d'] 
     50#    data2d = empty_data2D(np.linspace(-qmax, qmax, nq2d), resolution=0.0)  
     51#    #model = core.load_model(model_name) 
     52#    calculator = DirectModel(data2d, model) 
     53#    Iq2D = calculator() 
     54 
     55# Generate image (comment IF for 1D/2D for the moment) and generate only 1D 
     56#if info['has_2d'] == []: 
     57#    fig = plt.figure() 
     58#    ax = fig.add_subplot(1,1,1) 
     59#    ax.plot(q, Iq1D, color='blue', lw=2, label=model_name) 
     60#    ax.set_xlabel(r'$Q \/(\AA^{-1})$') 
     61#    ax.set_xscale(opts['xscale'])    
     62#    ax.set_ylabel(r'$I(Q) \/(\mathrm{cm}^{-1})$') 
     63#    ax.set_yscale(opts['yscale'])   
     64#    ax.legend() 
     65#else: 
     66#    # need figure with 1D + 2D 
     67#    pass 
     68fig = plt.figure() 
     69ax = fig.add_subplot(1,1,1) 
     70ax.plot(q, Iq1D, color='blue', lw=2, label=model_name) 
     71ax.set_xlabel(r'$Q \/(\AA^{-1})$') 
     72ax.set_xscale(opts['xscale'])    
     73ax.set_ylabel(r'$I(Q) \/(\mathrm{cm}^{-1})$') 
     74ax.set_yscale(opts['yscale'])   
     75ax.legend() 
     76  
     77 
     78# Save image in model/img 
     79figname = model_name + '_autogenfig.png' 
     80filename = os.path.join('model', 'img', figname) 
     81plt.savefig(filename) 
     82 
     83# Auto caption for figure 
     84captionstr = '\n' 
     85captionstr += '.. figure:: img/' + model_name + '_autogenfig.png\n' 
     86captionstr += '\n' 
     87#if info['has_2d'] == []: 
     88#    captionstr += '    1D plot corresponding to the default parameters of the model.\n' 
     89#else: 
     90#    captionstr += '    1D and 2D plots corresponding to the default parameters of the model.\n' 
     91captionstr += '    1D plot corresponding to the default parameters of the model.\n' 
     92captionstr += '\n' 
     93 
     94# Add figure reference and caption to documentation (at end, before References) 
     95pattern = '\*\*REFERENCE' 
     96m = re.search(pattern, docstr.upper()) 
     97 
     98if m: 
     99    docstr1 = docstr[:m.start()] 
     100    docstr2 = docstr[m.start():] 
     101    docstr = docstr1 + captionstr + docstr2 
     102else: 
     103    print 'References NOT FOUND for model: ', model_name 
     104    docstr = docstr + captionstr 
     105 
    10106open(sys.argv[2],'w').write(docstr) 
  • sasmodels/bumps_model.py

    r190fc2b rc5dadbb  
    8383    pars = {} 
    8484    for p in model_info['parameters']: 
    85         name, default, limits = p[0], p[2], p[3] 
    86         value = kwargs.pop(name, default) 
    87         pars[name] = Parameter.default(value, name=name, limits=limits) 
     85        value = kwargs.pop(p.name, p.default) 
     86        pars[p.name] = Parameter.default(value, name=p.name, limits=p.limits) 
    8887    for name in model_info['partype']['pd-2d']: 
    8988        for xpart, xdefault, xlimits in [ 
    90                 ('_pd', 0., limits), 
     89                ('_pd', 0., pars[name].limits), 
    9190                ('_pd_n', 35., (0, 1000)), 
    9291                ('_pd_nsigma', 3., (0, 10)), 
  • sasmodels/compare.py

    r91c5fdc rfcd7bbd  
    681681    """ 
    682682    # Get the default values for the parameters 
    683     pars = dict((p[0], p[2]) for p in model_info['parameters']) 
     683    pars = dict((p.name, p.default) for p in model_info['parameters']) 
    684684 
    685685    # Fill in default values for the polydispersity parameters 
    686686    for p in model_info['parameters']: 
    687         if p[4] in ('volume', 'orientation'): 
    688             pars[p[0]+'_pd'] = 0.0 
    689             pars[p[0]+'_pd_n'] = 0 
    690             pars[p[0]+'_pd_nsigma'] = 3.0 
    691             pars[p[0]+'_pd_type'] = "gaussian" 
     687        if p.type in ('volume', 'orientation'): 
     688            pars[p.name+'_pd'] = 0.0 
     689            pars[p.name+'_pd_n'] = 0 
     690            pars[p.name+'_pd_nsigma'] = 3.0 
     691            pars[p.name+'_pd_type'] = "gaussian" 
    692692 
    693693    # Plug in values given in demo 
     
    833833        pars = suppress_pd(pars) 
    834834    pars.update(presets)  # set value after random to control value 
     835    #import pprint; pprint.pprint(model_info) 
    835836    constrain_pars(model_info, pars) 
    836837    constrain_new_to_old(model_info, pars) 
  • sasmodels/generate.py

    r2f0c07d rfcd7bbd  
    8080    is selected, or when an initial value is not otherwise specified. 
    8181 
    82     [*lb*, *ub*] are the hard limits on the parameter value, used to limit 
    83     the polydispersity density function.  In the fit, the parameter limits 
     82    *limits = [lb, ub]* are the hard limits on the parameter value, used to 
     83    limit the polydispersity density function.  In the fit, the parameter limits 
    8484    given to the fit are the limits  on the central value of the parameter. 
    8585    If there is polydispersity, it will evaluate parameter values outside 
     
    216216import re 
    217217import string 
     218from collections import namedtuple 
    218219 
    219220import numpy as np 
     221 
     222PARAMETER_FIELDS = ['name', 'units', 'default', 'limits', 'type', 'description'] 
     223Parameter = namedtuple('Parameter', PARAMETER_FIELDS) 
    220224 
    221225#TODO: determine which functions are useful outside of generate 
     
    293297    """ 
    294298    column_widths = [ 
    295         max(len(p[0]) for p in pars), 
    296         max(len(p[-1]) for p in pars), 
    297         max(len(format_units(p[1])) for p in pars), 
     299        max(len(p.name) for p in pars), 
     300        max(len(p.description) for p in pars), 
     301        max(len(format_units(p.units)) for p in pars), 
    298302        PARTABLE_VALUE_WIDTH, 
    299303        ] 
     
    310314    for p in pars: 
    311315        lines.append(" ".join([ 
    312             "%-*s" % (column_widths[0], p[0]), 
    313             "%-*s" % (column_widths[1], p[-1]), 
    314             "%-*s" % (column_widths[2], format_units(p[1])), 
    315             "%*g" % (column_widths[3], p[2]), 
     316            "%-*s" % (column_widths[0], p.name), 
     317            "%-*s" % (column_widths[1], p.description), 
     318            "%-*s" % (column_widths[2], format_units(p.units)), 
     319            "%*g" % (column_widths[3], p.default), 
    316320            ])) 
    317321    lines.append(sep) 
     
    469473    fixed_2d = partype['fixed-1d'] 
    470474 
    471     iq_parameters = [p[0] 
     475    iq_parameters = [p.name 
    472476                     for p in model_info['parameters'][2:]  # skip scale, background 
    473                      if p[0] in set(fixed_1d + pd_1d)] 
    474     iqxy_parameters = [p[0] 
     477                     if p.name in set(fixed_1d + pd_1d)] 
     478    iqxy_parameters = [p.name 
    475479                       for p in model_info['parameters'][2:]  # skip scale, background 
    476                        if p[0] in set(fixed_2d + pd_2d)] 
    477     volume_parameters = [p[0] 
     480                       if p.name in set(fixed_2d + pd_2d)] 
     481    volume_parameters = [p.name 
    478482                         for p in model_info['parameters'] 
    479                          if p[4] == 'volume'] 
     483                         if p.type == 'volume'] 
    480484 
    481485    # Fill in defintions for volume parameters 
     
    606610 
    607611    for p in pars: 
    608         name, ptype = p[0], p[4] 
    609         if ptype == 'volume': 
    610             partype['pd-1d'].append(name) 
    611             partype['pd-2d'].append(name) 
    612             partype['pd-rel'].add(name) 
    613         elif ptype == 'magnetic': 
    614             partype['fixed-2d'].append(name) 
    615         elif ptype == 'orientation': 
    616             partype['pd-2d'].append(name) 
    617         elif ptype == '': 
    618             partype['fixed-1d'].append(name) 
    619             partype['fixed-2d'].append(name) 
     612        if p.type == 'volume': 
     613            partype['pd-1d'].append(p.name) 
     614            partype['pd-2d'].append(p.name) 
     615            partype['pd-rel'].add(p.name) 
     616        elif p.type == 'magnetic': 
     617            partype['fixed-2d'].append(p.name) 
     618        elif p.type == 'orientation': 
     619            partype['pd-2d'].append(p.name) 
     620        elif p.type == '': 
     621            partype['fixed-1d'].append(p.name) 
     622            partype['fixed-2d'].append(p.name) 
    620623        else: 
    621             raise ValueError("unknown parameter type %r" % ptype) 
    622         partype[ptype].append(name) 
     624            raise ValueError("unknown parameter type %r" % p.type) 
     625        partype[p.type].append(p.name) 
    623626 
    624627    return partype 
     
    628631    Process parameter block, precalculating parameter details. 
    629632    """ 
     633    # convert parameters into named tuples 
     634    pars = [Parameter(*p) for p in model_info['parameters']] 
    630635    # Fill in the derived attributes 
    631     partype = categorize_parameters(model_info['parameters']) 
    632     model_info['limits'] = dict((p[0], p[3]) for p in model_info['parameters']) 
     636    model_info['parameters'] = pars 
     637    partype = categorize_parameters(pars) 
     638    model_info['limits'] = dict((p.name, p.limits) for p in pars) 
    633639    model_info['partype'] = partype 
    634     model_info['defaults'] = dict((p[0], p[2]) for p in model_info['parameters']) 
     640    model_info['defaults'] = dict((p.name, p.default) for p in pars) 
    635641    if model_info.get('demo', None) is None: 
    636642        model_info['demo'] = model_info['defaults'] 
     
    649655    * *id* is the id of the kernel 
    650656    * *name* is the display name of the kernel 
     657    * *filename* is the full path to the module defining the file (if any) 
    651658    * *title* is a short description of the kernel 
    652659    * *description* is a long description of the kernel (this doesn't seem 
  • sasmodels/kernelpy.py

    r17bbadd rfcd7bbd  
    111111 
    112112        # First two fixed pars are scale and background 
    113         pars = [p[0] for p in model_info['parameters'][2:]] 
     113        pars = [p.name for p in model_info['parameters'][2:]] 
    114114        offset = len(self.q_input.q_vectors) 
    115115        self.args = self.q_input.q_vectors + [None] * len(pars) 
  • sasmodels/list_pars.py

    r17bbadd rfcd7bbd  
    2626        model_info = load_model_info(name) 
    2727        for p in model_info['parameters']: 
    28             pname = p[0] 
    29             partable.setdefault(pname, []) 
    30             partable[pname].append(name) 
     28            partable.setdefault(p.name, []) 
     29            partable[p.name].append(name) 
    3130    return partable 
    3231 
  • sasmodels/model_test.py

    r17bbadd rfcd7bbd  
    251251  python -m sasmodels.model_test [-v] [opencl|dll] model1 model2 ... 
    252252 
    253 If -v is included on the 
     253If -v is included on the command line, then use verboe output. 
     254 
    254255If neither opencl nor dll is specified, then models will be tested with 
    255256both opencl and dll; the compute target is ignored for pure python models. 
  • sasmodels/models/be_polyelectrolyte.py

    r2f0c07d r6dd90c1  
    170170      'ionization_degree':      2.0, 
    171171      'polymer_concentration': 10.0, 
     172      'background':             0.0, 
    172173     }, 0.1, -3.75693800588], 
    173174 
     
    189190      'ionization_degree':     0.5, 
    190191      'polymer_concentration': 0.1, 
     192      'background':             0.0, 
    191193     }, 200., 1.80664667511e-06], 
    192194    ] 
  • sasmodels/models/core_shell_parallelepiped.py

    r2f0c07d r6dd90c1  
    186186 
    187187qx, qy = 0.2 * np.cos(2.5), 0.2 * np.sin(2.5) 
    188 tests = [[{}, 0.2, 0.532149288477], 
    189          [{}, [0.2], [0.532149288477]], 
    190          [{'theta':10.0, 'phi':10.0}, (qx, qy), 0.031102135569], 
    191          [{'theta':10.0, 'phi':10.0}, [(qx, qy)], [0.031102135569]], 
     188tests = [[{}, 0.2, 0.533149288477], 
     189         [{}, [0.2], [0.533149288477]], 
     190         [{'theta':10.0, 'phi':10.0}, (qx, qy), 0.032102135569], 
     191         [{'theta':10.0, 'phi':10.0}, [(qx, qy)], [0.032102135569]], 
    192192        ] 
    193193del qx, qy  # not necessary to delete, but cleaner 
  • sasmodels/models/correlation_length.py

    r3e6c5c1 r6dd90c1  
    8484 
    8585tests = [[{}, 0.001, 1009.98], 
    86          [{}, 0.150141, 0.174645], 
    87          [{}, 0.442528, 0.0203957]] 
     86         [{}, 0.150141, 0.175645], 
     87         [{}, 0.442528, 0.0213957]] 
  • sasmodels/models/cylinder.py

    r2f0c07d r6dd90c1  
    167167 
    168168qx, qy = 0.2 * np.cos(2.5), 0.2 * np.sin(2.5) 
    169 tests = [[{}, 0.2, 0.041761386790780453], 
    170          [{}, [0.2], [0.041761386790780453]], 
    171          [{'theta':10.0, 'phi':10.0}, (qx, qy), 0.03414647218513852], 
    172          [{'theta':10.0, 'phi':10.0}, [(qx, qy)], [0.03414647218513852]], 
     169tests = [[{}, 0.2, 0.042761386790780453], 
     170         [{}, [0.2], [0.042761386790780453]], 
     171         [{'theta':10.0, 'phi':10.0}, (qx, qy), 0.03514647218513852], 
     172         [{'theta':10.0, 'phi':10.0}, [(qx, qy)], [0.03514647218513852]], 
    173173        ] 
    174174del qx, qy  # not necessary to delete, but cleaner 
  • sasmodels/models/gauss_lorentz_gel.py

    r168052c r6dd90c1  
    132132      'lorentz_scale_factor': 50.0, 
    133133      'dynamic_cor_length':   20.0, 
    134      }, 0.001, 149.481], 
     134     }, 0.001, 149.482], 
    135135 
    136136    [{'gauss_scale_factor':  100.0, 
     
    138138      'lorentz_scale_factor': 50.0, 
    139139      'dynamic_cor_length':   20.0, 
    140      }, 0.105363, 9.1903], 
     140     }, 0.105363, 9.1913], 
    141141 
    142142    [{'gauss_scale_factor':  100.0, 
     
    144144      'lorentz_scale_factor': 50.0, 
    145145      'dynamic_cor_length':   20.0, 
    146      }, 0.441623, 0.632811], 
     146     }, 0.441623, 0.633811], 
    147147 
    148148    # Additional tests with larger range of parameters 
     
    151151      'lorentz_scale_factor': 3.0, 
    152152      'dynamic_cor_length':   1.0, 
    153      }, 0.1, 2.9702970297], 
     153     }, 0.1, 2.9712970297], 
    154154 
    155155    [{'gauss_scale_factor':  10.0, 
     
    158158      'dynamic_cor_length':   1.0, 
    159159      'background':         100.0 
    160      }, 5.0, 100.115384615], 
     160     }, 5.0, 100.116384615], 
    161161 
    162162    [{'gauss_scale_factor':  10.0, 
     
    164164      'lorentz_scale_factor': 3.0, 
    165165      'dynamic_cor_length':   1.0, 
     166      'background':           0.0, 
    166167     }, 200., 7.49981250469e-05], 
    167168    ] 
  • sasmodels/models/gel_fit.py

    r5111921 r6dd90c1  
    9292           'gyration_radius': 10.0, 
    9393           'fractal_exp': 10.0, 
    94            'cor_length': 20.0 
     94           'cor_length': 20.0, 
     95           'background': 0.0, 
    9596          }, 0.1, 0.716532], 
    9697 
  • sasmodels/models/guinier.py

    r723cebe r6dd90c1  
    5757 
    5858# parameters for unit tests 
    59 tests = [[{'rg' : 31.5}, 0.005, 0.991756]] 
     59tests = [[{'rg' : 31.5}, 0.005, 0.992756]] 
  • sasmodels/models/hardsphere.py

    r8e45182 rd529d93  
    33spherical particles interacting through hard sphere (excluded volume) 
    44interactions. 
     5May be a reasonable approximation for other shapes of particles that  
     6freely rotate, and for moderately polydisperse systems. Though strictly  
     7the maths needs to be modified (no \Beta(Q) correction yet in sasview). 
    58 
    6 The calculation uses the Percus-Yevick closure where the interparticle 
     9radius_effective is the effective hard sphere radius. 
     10volfraction is the volume fraction occupied by the spheres. 
     11 
     12In sasview the effective radius may be calculated from the parameters 
     13used in the form factor $P(q)$ that this $S(q)$ is combined with. 
     14 
     15For numerical stability the computation uses a Taylor series expansion  
     16at very small $qR$, there may be a very minor glitch at the transition point 
     17in some circumstances. 
     18 
     19The S(Q) uses the Percus-Yevick closure where the interparticle 
    720potential is 
    821 
     
    4457        systems. Though strictly the maths needs to be modified - 
    4558    which sasview does not do yet. 
    46     effect_radius is the hard sphere radius 
     59    radius_effective is the hard sphere radius 
    4760    volfraction is the volume fraction occupied by the spheres. 
    4861""" 
     
    5164 
    5265#             ["name", "units", default, [lower, upper], "type","description"], 
    53 parameters = [["effect_radius", "Ang", 50.0, [0, inf], "volume", 
     66parameters = [["radius_effective", "Ang", 50.0, [0, inf], "volume", 
    5467               "effective radius of hard sphere"], 
    5568              ["volfraction", "", 0.2, [0, 0.74], "", 
     
    6679      double D,A,B,G,X,X2,X4,S,C,FF,HARDSPH; 
    6780 
    68       if(fabs(effect_radius) < 1.E-12) { 
     81      if(fabs(radius_effective) < 1.E-12) { 
    6982               HARDSPH=1.0; 
    7083               return(HARDSPH); 
     
    7588      A= (1.+2.*volfraction)*D; 
    7689      A *=A; 
    77       X=fabs(q*effect_radius*2.0); 
     90      X=fabs(q*radius_effective*2.0); 
    7891 
    7992      if(X < 5.E-06) { 
     
    138151# VR defaults to 1.0 
    139152 
    140 demo = dict(effect_radius=200, volfraction=0.2, effect_radius_pd=0.1, effect_radius_pd_n=40) 
     153demo = dict(radius_effective=200, volfraction=0.2, radius_effective_pd=0.1, radius_effective_pd_n=40) 
    141154oldname = 'HardsphereStructure' 
    142 oldpars = dict() 
     155oldpars = dict(radius_effective="effect_radius",radius_effective_pd="effect_radius_pd",radius_effective_pd_n="effect_radius_pd_n") 
    143156# Q=0.001 is in the Taylor series, low Q part, so add Q=0.1, assuming double precision sasview is correct 
    144157tests = [ 
    145         [ {'scale': 1.0, 'background' : 0.0, 'effect_radius' : 50.0, 'volfraction' : 0.2, 
    146            'effect_radius_pd' : 0}, [0.001,0.1], [0.209128,0.930587]] 
     158        [ {'scale': 1.0, 'background' : 0.0, 'radius_effective' : 50.0, 'volfraction' : 0.2, 
     159           'radius_effective_pd' : 0}, [0.001,0.1], [0.209128,0.930587]] 
    147160        ] 
    148  
     161# ADDED by: RKH  ON: 16Mar2016  using equations from FISH as better than orig sasview, see notes above. Added Taylor expansions at small Q,  
  • sasmodels/models/hayter_msa.py

    r348557a rd529d93  
    99 
    1010**This routine only works for charged particles**. If the charge is set to 
    11 zero the routine will self-destruct! For non-charged particles use a hard 
     11zero the routine may self-destruct! For non-charged particles use a hard 
    1212sphere potential. 
    1313 
     
    1515which in turn is used to compute the Debye screening length. At present 
    1616there is no provision for entering the ionic strength directly nor for use 
    17 of any multivalent salts. The counterions are also assumed to be monovalent. 
     17of any multivalent salts, though it should be possible to simulate the effect 
     18of this by increasing the salt concentration. The counterions are also assumed to  
     19be monovalent. 
     20 
     21In sasview the effective radius may be calculated from the parameters 
     22used in the form factor $P(q)$ that this $S(q)$ is combined with. 
     23 
     24The computation uses a Taylor series expansion at very small rescaled $qR$, to  
     25avoid some serious rounding error issues, this may result in a minor artefact  
     26in the transition region under some circumstances. 
    1827 
    1928For 2D data, the scattering intensity is calculated in the same way as 1D, 
     
    2433    q = \sqrt{q_x^2 + q_y^2} 
    2534 
    26 .. figure:: img/HayterMSAsq_227.jpg 
    27  
    28     1D plot using the default values (in linear scale). 
    2935 
    3036References 
     
    3541J P Hansen and J B Hayter, *Molecular Physics*, 46 (1982) 651-656 
    3642""" 
     43from numpy import inf 
    3744 
    38 #  dp[0] = 2.0*effect_radius(); 
     45category = "structure-factor" 
     46structure_factor = True 
     47single = False  # double precision only! 
     48 
     49#  dp[0] = 2.0*radius_effective(); 
    3950#  dp[1] = fabs(charge()); 
    4051#  dp[2] = volfraction(); 
     
    4354#  dp[5] = dielectconst(); 
    4455 
    45 from numpy import inf 
    4656 
    47 source = ["hayter_msa_kernel.c"] 
     57 
    4858 
    4959name = "hayter_msa" 
    50 title = "Hayter-Penfold MSA charged sphere interparticle S(Q) structure factor" 
     60title = "Hayter-Penfold rescaled MSA, charged sphere, interparticle S(Q) structure factor" 
    5161description = """\ 
    52     [Hayter-Penfold MSA charged sphere interparticle S(Q) structure factor] 
     62    [Hayter-Penfold RMSA charged sphere interparticle S(Q) structure factor] 
    5363        Interparticle structure factor S(Q)for a charged hard spheres. 
    5464        Routine takes absolute value of charge, use HardSphere if charge 
    5565        goes to zero. 
    56         In sasview the effective radius will be calculated from the 
    57         parameters used in P(Q). 
     66        In sasview the effective radius and volume fraction may be calculated  
     67        from the parameters used in P(Q). 
    5868""" 
    59 single = False  # double precision only! 
     69 
    6070 
    6171# pylint: disable=bad-whitespace, line-too-long 
    6272#             [ "name", "units", default, [lower, upper], "type", "description" ], 
    6373parameters = [ 
    64     ["effect_radius", "Ang", 20.75,   [0, inf],    "volume", "effective radius of hard sphere"], 
     74    ["radius_effective", "Ang", 20.75,   [0, inf],    "volume", "effective radius of charged sphere"], 
    6575    ["charge",        "e",   19.0,    [0, inf],    "", "charge on sphere (in electrons)"], 
    66     ["volfraction",   "",     0.0192, [0, 0.74],   "", "volume fraction of spheres"], 
     76    ["volfraction",   "None",     0.0192, [0, 0.74],   "", "volume fraction of spheres"], 
    6777    ["temperature",   "K",  318.16,   [0, inf],    "", "temperature, in Kelvin, for Debye length calculation"], 
    68     ["saltconc",      "M",    0.0,    [-inf, inf], "", "conc of salt, 1:1 electolyte, for Debye length"], 
    69     ["dielectconst",  "",    71.08,   [-inf, inf], "", "dielectric constant of solvent (default water), for Debye length"], 
     78    ["saltconc",      "M",    0.0,    [-inf, inf], "", "conc of salt, moles/litre, 1:1 electolyte, for Debye length"], 
     79    ["dielectconst",  "None",    71.08,   [-inf, inf], "", "dielectric constant (relative permittivity) of solvent, default water, for Debye length"] 
    7080    ] 
    7181# pylint: enable=bad-whitespace, line-too-long 
    72 category = "structure-factor" 
    7382 
     83source = ["hayter_msa_kernel.c"] 
    7484# No volume normalization despite having a volume parameter 
    7585# This should perhaps be volume normalized? 
     
    8595 
    8696oldname = 'HayterMSAStructure' 
    87 oldpars = dict() 
     97#oldpars = dict(effect_radius="radius_effective",effect_radius_pd="radius_effective_pd",effect_radius_pd_n="radius_effective_pd_n") 
     98oldpars = dict(radius_effective="effect_radius",radius_effective_pd="effect_radius_pd",radius_effective_pd_n="effect_radius_pd_n") 
     99#oldpars = dict( ) 
    88100# default parameter set,  use  compare.sh -midQ -linear 
    89101# note the calculation varies in different limiting cases so a wide range of 
    90102# parameters will be required for a thorough test! 
    91103# odd that the default st has saltconc zero 
    92 demo = dict(effect_radius=20.75, 
     104demo = dict(radius_effective=20.75, 
    93105            charge=19.0, 
    94106            volfraction=0.0192, 
     
    96108            saltconc=0.05, 
    97109            dielectconst=71.08, 
    98             effect_radius_pd=0.1, 
    99             effect_radius_pd_n=40) 
     110            radius_effective_pd=0.1, 
     111            radius_effective_pd_n=40) 
    100112# 
    101113# attempt to use same values as old sasview unit test at Q=.001 was 0.0712928,  
     
    104116    [{'scale': 1.0, 
    105117      'background': 0.0, 
    106       'effect_radius': 20.75, 
     118      'radius_effective': 20.75, 
    107119      'charge': 19.0, 
    108120      'volfraction': 0.0192, 
     
    110122      'saltconc': 0, 
    111123      'dielectconst': 78.0, 
    112       'effect_radius_pd': 0}, 
     124      'radius_effective_pd': 0}, 
    113125     [0.00001,0.0010,0.01,0.075], [0.0711646,0.0712928,0.0847006,1.07150]], 
    114126    [{'scale': 1.0, 
    115127      'background': 0.0, 
    116       'effect_radius': 20.75, 
     128      'radius_effective': 20.75, 
    117129      'charge': 19.0, 
    118130      'volfraction': 0.0192, 
     
    120132      'saltconc': 0.05, 
    121133      'dielectconst': 78.0, 
    122       'effect_radius_pd': 0.1, 
    123       'effect_radius_pd_n': 40}, 
     134      'radius_effective_pd': 0.1, 
     135      'radius_effective_pd_n': 40}, 
    124136     [0.00001,0.0010,0.01,0.075], [0.450272,0.450420,0.465116,1.039625]] 
    125137    ] 
    126  
     138# ADDED by:  RKH  ON: 16Mar2016 converted from sasview, new Taylor expansion at smallest rescaled Q 
  • sasmodels/models/hayter_msa_kernel.c

    r348557a rd529d93  
    33// C99 needs declarations of routines here 
    44double Iq(double QQ, 
    5       double effect_radius, double zz, double VolFrac, double Temp, double csalt, double dialec); 
     5      double radius_effective, double zz, double VolFrac, double Temp, double csalt, double dialec); 
    66int 
    77sqcoef(int ir, double gMSAWave[]); 
     
    1414   
    1515double Iq(double QQ, 
    16       double effect_radius, double zz, double VolFrac, double Temp, double csalt, double dialec)   
     16      double radius_effective, double zz, double VolFrac, double Temp, double csalt, double dialec)   
    1717{ 
    1818    double gMSAWave[17]={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17}; 
     
    2828        pi = M_PI; 
    2929 
    30         diam=2*effect_radius;           //in A 
     30        diam=2*radius_effective;                //in A 
    3131 
    3232                                                //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 
  • sasmodels/models/hollow_rectangular_prism.py

    r5111921 r6dd90c1  
    158158               thickness='thickness', sld='sldPipe', solvent_sld='sldSolv') 
    159159 
    160 tests = [[{}, 0.2, 0.76587283098], 
    161          [{}, [0.2], [0.76587283098]], 
     160tests = [[{}, 0.2, 0.76687283098], 
     161         [{}, [0.2], [0.76687283098]], 
    162162        ] 
    163163 
  • sasmodels/models/hollow_rectangular_prism_infinitely_thin_walls.py

    rdeb7ee0 r6dd90c1  
    137137               sld='sldPipe', solvent_sld='sldSolv') 
    138138 
    139 tests = [[{}, 0.2, 0.836719188592], 
    140          [{}, [0.2], [0.836719188592]], 
     139tests = [[{}, 0.2, 0.837719188592], 
     140         [{}, [0.2], [0.837719188592]], 
    141141        ] 
    142142 
  • sasmodels/models/line.py

    r4b0e1f3 r6dd90c1  
    8080    [{'intercept':   1.0, 
    8181      'slope': 1.0, 
    82      }, 1.0, 2.0], 
     82     }, 1.0, 2.001], 
    8383 
    8484    [{'intercept':   1.0, 
    8585      'slope': 1.0, 
    86      }, 0.0, 1.0], 
     86     }, 0.0, 1.001], 
    8787 
    8888    [{'intercept':   1.0, 
    8989      'slope': 1.0, 
    90      }, 0.4, 1.4], 
     90     }, 0.4, 1.401], 
    9191 
    9292    [{'intercept':   1.0, 
    9393      'slope': 1.0, 
    94      }, 1.3, 2.3], 
     94     }, 1.3, 2.301], 
    9595 
    9696    [{'intercept':   1.0, 
    9797      'slope': 1.0, 
    98      }, 0.5, 1.5], 
     98     }, 0.5, 1.501], 
    9999 
    100100    [{'intercept':   1.0, 
    101101      'slope': 1.0, 
    102      }, [0.4, 0.5], [1.4, 1.5]], 
     102     }, [0.4, 0.5], [1.401, 1.501]], 
    103103 
    104104    [{'intercept':   1.0, 
    105105      'slope': 1.0, 
     106      'background': 0.0, 
    106107     }, (1.3, 1.57), 5.911], 
    107108] 
  • sasmodels/models/lorentz.py

    reb5901b r6dd90c1  
    6464 
    6565# parameters for unit tests 
    66 tests = [[{'cor_length': 250}, 0.01, 0.137931]] 
     66tests = [[{'cor_length': 250}, 0.01, 0.138931]] 
  • sasmodels/models/mass_fractal.py

    r168052c r6dd90c1  
    106106      'mass_dim':        1.9, 
    107107      'cutoff_length': 100.0, 
    108      }, 0.05, 279.59322], 
     108     }, 0.05, 279.59422], 
    109109 
    110110    # Additional tests with larger range of parameters 
     
    112112      'mass_dim':      3.3, 
    113113      'cutoff_length': 1.0, 
    114      }, 0.5, 1.29016774904], 
     114     }, 0.5, 1.29116774904], 
    115115 
    116116    [{'radius':        1.0, 
     
    124124      'cutoff_length': 1.0, 
    125125      'scale':        10.0, 
    126      }, 0.051, 11.6227966145], 
     126     }, 0.051, 11.6237966145], 
    127127    ] 
  • sasmodels/models/mass_surface_fractal.py

    r168052c r6dd90c1  
    115115      'cluster_rg':   86.7, 
    116116      'primary_rg': 4000.0, 
     117      'background':    0.0, 
    117118     }, 0.05, 1.77537e-05], 
    118119 
     
    122123      'cluster_rg':   90.0, 
    123124      'primary_rg': 4000.0, 
    124      }, 0.001, 0.18462699016], 
     125     }, 0.001, 0.18562699016], 
    125126 
    126127    [{'mass_dim':      1.3, 
     
    136137      'primary_rg': 1000.0, 
    137138      'scale':        10.0, 
     139      'background':    0.0, 
    138140     }, 0.051, 0.000169548800377], 
    139141    ] 
  • sasmodels/models/mono_gauss_coil.py

    r4c05f49 r6dd90c1  
    6161 
    6262# NB: Scale and Background are implicit parameters on every model 
    63 def Iq(q, radius_gyration): 
     63def Iq(q, i_zero, radius_gyration): 
    6464    # pylint: disable = missing-docstring 
    65     z = (x * radius_gyration) * (x * radius_gyration) 
    66     if x == 0: 
     65    z = (q * radius_gyration) ** 2 
     66    if q == 0: 
    6767       inten = 1.0 
    6868    else: 
    6969       inten = i_zero * 2.0 * (exp(-z) + z - 1.0 ) / (z * z) 
    7070    return inten 
    71 Iq.vectorized =  True # Iq accepts an array of q values 
     71#Iq.vectorized = True # Iq accepts an array of q values 
    7272 
    7373def Iqxy(qx, qy, *args): 
    7474    # pylint: disable = missing-docstring 
    7575    return Iq(sqrt(qx ** 2 + qy ** 2), *args) 
    76 Iqxy.vectorized = True # Iqxy accepts an array of qx, qy values 
     76#Iqxy.vectorized = True # Iqxy accepts an array of qx, qy values 
    7777 
    7878demo =  dict(scale = 1.0, 
  • sasmodels/models/parallelepiped.py

    r5111921 r6dd90c1  
    233233 
    234234qx, qy = 0.2 * np.cos(2.5), 0.2 * np.sin(2.5) 
    235 tests = [[{}, 0.2, 0.17658004974], 
    236          [{}, [0.2], [0.17658004974]], 
    237          [{'theta':10.0, 'phi':10.0}, (qx, qy), 0.00460296014], 
    238          [{'theta':10.0, 'phi':10.0}, [(qx, qy)], [0.00460296014]], 
     235tests = [[{}, 0.2, 0.17758004974], 
     236         [{}, [0.2], [0.17758004974]], 
     237         [{'theta':10.0, 'phi':10.0}, (qx, qy), 0.00560296014], 
     238         [{'theta':10.0, 'phi':10.0}, [(qx, qy)], [0.00560296014]], 
    239239        ] 
    240240del qx, qy  # not necessary to delete, but cleaner 
  • sasmodels/models/poly_gauss_coil.py

    r4c05f49 r6dd90c1  
    6767 
    6868# NB: Scale and Background are implicit parameters on every model 
    69 def Iq(q, radius_gyration, polydispersity): 
     69def Iq(q, i_zero, radius_gyration, polydispersity): 
    7070    # pylint: disable = missing-docstring 
    71         u = polydispersity - 1.0 
     71    u = polydispersity - 1.0 
    7272    # TO DO 
    73         # should trap the case of polydispersity = 1 by switching to a taylor expansion 
    74         minusoneonu = -1.0 / u 
    75         z = ((x * radius_gyration) * (x * radius_gyration)) / (1.0 + 2.0 * u) 
    76         if x == 0: 
    77            inten = i_zero * 1.0 
    78         else: 
    79            inten = i_zero * 2.0 * (power((1.0 + u * z),minusoneonu) + z - 1.0 ) / ((1.0 + u) * (z * z)) 
    80         return inten 
    81 Iq.vectorized =  True # Iq accepts an array of q values 
     73    # should trap the case of polydispersity = 1 by switching to a taylor expansion 
     74    minusoneonu = -1.0 / u 
     75    z = (q * radius_gyration) ** 2 / (1.0 + 2.0 * u) 
     76    if q == 0: 
     77        inten = i_zero * 1.0 
     78    else: 
     79        inten = i_zero * 2.0 * (power((1.0 + u * z),minusoneonu) + z - 1.0 ) / ((1.0 + u) * (z * z)) 
     80    return inten 
     81#Iq.vectorized = True # Iq accepts an array of q values 
    8282 
    8383def Iqxy(qx, qy, *args): 
    8484    # pylint: disable = missing-docstring 
    8585    return Iq(sqrt(qx ** 2 + qy ** 2), *args) 
    86 Iqxy.vectorized = True # Iqxy accepts an array of qx, qy values 
     86#Iqxy.vectorized = True # Iqxy accepts an array of qx, qy values 
    8787 
    8888demo =  dict(scale = 1.0, 
  • sasmodels/models/polymer_excl_volume.py

    r168052c r6dd90c1  
    168168tests = [ 
    169169    # Accuracy tests based on content in test/polyexclvol_default_igor.txt 
    170     [{'rg': 60, 'porod_exp': 3.0}, 0.001, 0.998801], 
    171     [{'rg': 60, 'porod_exp': 3.0}, 0.105363, 0.0162751], 
    172     [{'rg': 60, 'porod_exp': 3.0}, 0.665075, 6.56261e-05], 
     170    [{'rg': 60, 'porod_exp': 3.0}, 0.001, 0.999801], 
     171    [{'rg': 60, 'porod_exp': 3.0}, 0.105363, 0.0172751], 
     172    [{'rg': 60, 'porod_exp': 3.0, 'background': 0.0}, 0.665075, 6.56261e-05], 
    173173 
    174174    # Additional tests with larger range of parameters 
    175     [{'rg': 10, 'porod_exp': 4.0}, 0.1, 0.723436675809], 
     175    [{'rg': 10, 'porod_exp': 4.0}, 0.1, 0.724436675809], 
    176176    [{'rg': 2.2, 'porod_exp': 22.0, 'background': 100.0}, 5.0, 100.0], 
    177177    [{'rg': 1.1, 'porod_exp': 1, 'background': 10.0, 'scale': 1.25}, 
  • sasmodels/models/rectangular_prism.py

    rdeb7ee0 r6dd90c1  
    135135               sld='sldPipe', solvent_sld='sldSolv') 
    136136 
    137 tests = [[{}, 0.2, 0.374248406825], 
    138          [{}, [0.2], [0.374248406825]], 
     137tests = [[{}, 0.2, 0.375248406825], 
     138         [{}, [0.2], [0.375248406825]], 
    139139        ] 
  • sasmodels/models/sc_crystal.py

    r5111921 r6dd90c1  
    152152tests = [ 
    153153    # Accuracy tests based on content in test/utest_extra_models.py 
    154     [{}, 0.001, 10.3038], 
    155     [{}, 0.215268, 0.00714889], 
    156     [{}, (0.414467), 0.000313289] 
     154    [{}, 0.001, 10.3048], 
     155    [{}, 0.215268, 0.00814889], 
     156    [{}, (0.414467), 0.001313289] 
    157157    ] 
    158158 
  • sasmodels/models/squarewell.py

    r5111921 rd529d93  
    88Positive well depths correspond to an attractive potential well. Negative well depths correspond to a potential 
    99"shoulder", which may or may not be physically reasonable. The stickyhardsphere model may be a better choice in 
    10 some circumstances. Computed values may behave badly at extremely small Q. 
     10some circumstances. Computed values may behave badly at extremely small $qR$. 
    1111 
    12 The well width (*l*\ ) is defined as multiples of the particle diameter (2\*\ *R*\ ) 
     12The well width (|lambda| ) is defined as multiples of the particle diameter (2\*\ *R*\ ) 
    1313 
    1414The interaction potential is: 
     
    2222    U(r) = \begin{cases} 
    2323    \infty & r < 2R \\ 
    24     -\epsilon , 2R \leq < 2R\lambda 
    25     0 & r \geq 2R 
     24    -\epsilon & 2R \leq r < 2R\lambda \\ 
     25    0 & r \geq 2R\lambda 
    2626    \end{cases} 
    2727 
    2828where $r$ is the distance from the center of the sphere of a radius $R$. 
    2929 
     30In sasview the effective radius may be calculated from the parameters 
     31used in the form factor $P(q)$ that this $S(q)$ is combined with. 
    3032 
    3133For 2D data: The 2D scattering intensity is calculated in the same way as 1D, where the *q* vector is defined as 
     
    3537    q = \sqrt{q_x^2 + q_y^2} 
    3638 
    37 .. comment:: 
    38  
    39   .. figure:: img/squarewell_226.jpg 
    40  
    41     1D plot using the default values (in linear scale).* 
    4239 
    4340REFERENCE 
     
    5956""" 
    6057category = "structure-factor" 
     58structure_factor = True 
    6159 
    6260#single = False 
     
    6563    #   [ "name", "units", default, [lower, upper], "type", 
    6664    #     "description" ], 
    67     ["effect_radius", "Ang", 50.0, [0, inf], "volume", 
     65    ["radius_effective", "Ang", 50.0, [0, inf], "volume", 
    6866     "effective radius of hard sphere"], 
    6967    ["volfraction", "", 0.04, [0, 0.08], "", 
     
    7169    ["welldepth", "kT", 1.5, [0.0, 1.5], "", 
    7270     "depth of well, epsilon"], 
    73     ["wellwidth", "diameters", 1.2, [0, inf], "", 
    74      "width of well in diameters (=2R) units"], 
     71    ["wellwidth", "diameters", 1.2, [1.0, inf], "", 
     72     "width of well in diameters (=2R) units, must be > 1"], 
    7573    ] 
    7674 
     
    8987        x= q; 
    9088         
    91         req = effect_radius; 
     89        req = radius_effective; 
    9290        phis = volfraction; 
    9391        edibkb = welldepth; 
     
    134132 
    135133oldname = 'SquareWellStructure' 
    136 oldpars = dict() 
    137 demo = dict(effect_radius=50, volfraction=0.04, welldepth=1.5, 
    138             wellwidth=1.2, effect_radius_pd=0, effect_radius_pd_n=0) 
     134oldpars = dict(radius_effective="effect_radius",radius_effective_pd="effect_radius_pd",radius_effective_pd_n="effect_radius_pd_n") 
     135demo = dict(radius_effective=50, volfraction=0.04, welldepth=1.5, 
     136            wellwidth=1.2, radius_effective_pd=0, radius_effective_pd_n=0) 
    139137# 
    140138tests = [ 
    141         [ {'scale': 1.0, 'background' : 0.0, 'effect_radius' : 50.0, 'volfraction' : 0.04,'welldepth' : 1.5, 'wellwidth' : 1.2,  
    142            'effect_radius_pd' : 0}, [0.001], [0.97665742]] 
     139        [ {'scale': 1.0, 'background' : 0.0, 'radius_effective' : 50.0, 'volfraction' : 0.04,'welldepth' : 1.5, 'wellwidth' : 1.2,  
     140           'radius_effective_pd' : 0}, [0.001], [0.97665742]] 
    143141        ] 
    144 # ADDED by: converting from sasview RKH  ON: 16Mar2016 - in progress 
     142# ADDED by: converting from sasview RKH  ON: 16Mar2016 
    145143 
  • sasmodels/models/star_polymer.py

    r13ed84c r6dd90c1  
    7676tests = [[{'radius2': 2.0, 
    7777           'arms':    3.3, 
    78           }, 0.5, 0.850646091108], 
     78          }, 0.5, 0.851646091108], 
    7979 
    8080         [{'radius2':    1.0, 
  • sasmodels/models/stickyhardsphere.py

    r8e45182 rd529d93  
    4949the optimization does not hit the constraints. 
    5050 
    51 In sasview the effective radius will be calculated from the parameters 
     51In sasview the effective radius may be calculated from the parameters 
    5252used in the form factor $P(q)$ that this $S(q)$ is combined with. 
    5353 
  • sasmodels/models/surface_fractal.py

    r168052c r6dd90c1  
    106106      'surface_dim': 2.0, 
    107107      'cutoff_length': 500.0, 
    108      }, 0.05, 301428.65916], 
     108     }, 0.05, 301428.66016], 
    109109 
    110110    # Additional tests with larger range of parameters 
     
    112112      'surface_dim': 1.0, 
    113113      'cutoff_length': 10.0, 
    114      }, 0.332070182643, 1125.00321004], 
     114     }, 0.332070182643, 1125.00421004], 
    115115 
    116116    [{'radius': 3.5, 
     
    124124      'cutoff_length': 33.0, 
    125125      'scale': 0.1, 
    126      }, 0.51, 2.50020147004], 
     126     }, 0.51, 2.50120147004], 
    127127    ] 
  • sasmodels/models/teubner_strey.py

    reb69cce r6dd90c1  
    9191oldpars = dict(a2='scale') 
    9292 
    93 tests = [[{}, 0.2, 0.144927536232]] 
     93tests = [[{}, 0.2, 0.145927536232]] 
  • sasmodels/models/vesicle.py

    rfa8011eb r6dd90c1  
    130130 
    131131 
    132 # NOTE: test results taken from values returned by SasView 3.1.2 
    133 tests = [[{}, 0.0010005303255, 17139.8268799], 
    134          [{}, 0.200027832249, 0.130387268704], 
     132# NOTE: test results taken from values returned by SasView 3.1.2, with 
     133# 0.001 added for a non-zero default background. 
     134tests = [[{}, 0.0010005303255, 17139.8278799], 
     135         [{}, 0.200027832249, 0.131387268704], 
    135136         [{}, 'ER', 130.], 
    136137         [{}, 'VR', 0.54483386436], 
  • sasmodels/product.py

    r35b4c47 rfcd7bbd  
    2828    s_id, s_name, s_pars = s_info['id'], s_info['name'], s_info['parameters'] 
    2929    # We require models to start with scale and background 
    30     assert s_pars[SCALE][0] == 'scale' 
    31     assert s_pars[BACKGROUND][0] == 'background' 
     30    assert s_pars[SCALE].name == 'scale' 
     31    assert s_pars[BACKGROUND].name == 'background' 
    3232    # We require structure factors to start with effect radius and volfraction 
    33     assert s_pars[EFFECT_RADIUS][0] == 'effect_radius' 
    34     assert s_pars[VOLFRACTION][0] == 'volfraction' 
     33    assert s_pars[EFFECT_RADIUS].name == 'effect_radius' 
     34    assert s_pars[VOLFRACTION].name == 'volfraction' 
    3535    # Combine the parameter sets.  We are skipping the first three 
    3636    # parameters of S since scale, background are defined in P and 
     
    3838    pars = p_pars + s_pars[3:] 
    3939    # check for duplicates; can't use assertion since they may never be checked 
    40     if len(set(p[0] for p in pars)) != len(pars): 
     40    if len(set(p.name for p in pars)) != len(pars): 
    4141        raise ValueError("Duplicate parameters in %s and %s"%(p_id)) 
    4242    # For comparison with sasview, determine the old parameters. 
     
    5252    model_info['title'] = 'Product of %s and structure factor %s'%(p_name, s_name) 
    5353    model_info['description'] = model_info['title'] 
     54    model_info['docs'] = model_info['title'] 
    5455    model_info['category'] = "custom" 
    5556    model_info['parameters'] = pars 
    56     # Remember the component info blocks so we can build the product model 
    57     model_info['composition'] = ('product', [p_info, s_info]) 
     57    #model_info['single'] = p_info['single'] and s_info['single'] 
     58    model_info['structure_factor'] = False 
     59    model_info['variant_info'] = None 
     60    #model_info['tests'] = [] 
     61    #model_info['source'] = [] 
     62    # Iq, Iqxy, form_volume, ER, VR and sesans 
    5863    model_info['oldname'] = oldname 
    5964    model_info['oldpars'] = oldpars 
     65    model_info['composition'] = ('product', [p_info, s_info]) 
    6066    process_parameters(model_info) 
    6167    return model_info 
  • sasmodels/sasview_model.py

    r28da77d rfcd7bbd  
    6060        self.dispersion = dict() 
    6161        partype = model.info['partype'] 
    62         for name, units, default, limits, _, _ in model.info['parameters']: 
    63             self.params[name] = default 
    64             self.details[name] = [units] + limits 
     62        for p in model.info['parameters']: 
     63            self.params[p.name] = p.default 
     64            self.details[p.name] = [p.units] + p.limits 
    6565 
    6666        for name in partype['pd-2d']: 
  • sasmodels/convert.py

    r310ddcb r228cbd3  
    129129            warnings.warn("parameter background not used in sasview %s"%name) 
    130130 
     131 
    131132    # If it is a product model P*S, then check the individual forms for special 
    132133    # cases.  Note: despite the structure factor alone not having scale or 
     
    146147            for p in "La", "Lb", "Lc", "Ld": 
    147148                if p in oldpars: oldpars[p] *= 1e-13 
     149        elif name == 'core_shell_parallelepiped': 
     150            _remove_pd(oldpars, 'rimA', name) 
     151        elif name in ['mono_gauss_coil','poly_gauss_coil']: 
     152            del oldpars['i_zero'] 
    148153 
    149154    return oldpars 
     
    177182        elif name == 'rpa': 
    178183            pars['case_num'] = int(pars['case_num']) 
     184        elif name == 'mono_gauss_coil': 
     185            pars['i_zero'] = 1 
     186        elif name == 'poly_gauss_coil': 
     187            pars['i_zero'] = 1 
     188             
Note: See TracChangeset for help on using the changeset viewer.