Changeset 7874e80 in sasmodels


Ignore:
Timestamp:
Mar 21, 2016 8:53:06 AM (8 years ago)
Author:
richardh
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:
bf59527
Parents:
a2f9aa2 (diff), e56883e (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:
2 added
2 deleted
7 edited

Legend:

Unmodified
Added
Removed
  • example/sesans_parameters_sphere.py

    rfa902d4 r9217ef8  
    2727    "sld" : 7.0, 
    2828    "radius" : 1000, 
    29     "solvent_sld" : 1.0, 
     29    "sld_solvent" : 1.0, 
    3030} 
    3131 
  • example/sesansfit.py

    rfa902d4 r9217ef8  
    5454 
    5555    # Load custom parameters, initial values and parameter ranges 
     56    pars = model.parameters().copy() 
     57    pars.update(custom_params) 
    5658    for k, v in custom_params.items(): 
     59        if k not in pars: 
     60            par_error("Can't set parameter %r in model"%k, pars) 
    5761        setattr(model, k, v) 
    5862        model._parameter_names.append(k) 
    5963    for k, v in initial_vals.items(): 
    60         param = model.parameters().get(k) 
     64        if k not in pars: 
     65            par_error("Can't get parameter %r from model"%k, pars) 
     66        param = pars[k] 
    6167        param.value = v 
    6268    for k, v in param_range.items(): 
    63         param = model.parameters().get(k) 
    64         if param is not None: 
    65             param.range(*v) 
     69        if k not in pars: 
     70            par_error("Can't set range on parameter %r in model"%k, pars) 
     71        param = pars[k] 
     72        param.range(*v) 
    6673 
    6774    if False: # for future implementation 
     
    7380        problem = FitProblem(M_sesans) 
    7481    return problem 
     82 
     83 
     84def par_error(msg, pars): 
     85    raise ValueError(msg+"\nAvailable parameters: %s"%", ".join(sorted(pars.keys()))) 
  • sasmodels/bumps_model.py

    ra84a0ca r9217ef8  
    238238        Not Implemented. 
    239239        """ 
     240        if self.data_type == "sesans": 
     241            np.savetxt(basename+".dat", np.array([self._data.x, self.theory()]).T) 
    240242        pass 
    241243 
  • sasmodels/compare.py

    r98d6cfc r1671636  
    366366        composition_type, parts = model_info['composition'] 
    367367        if composition_type == 'product': 
    368             from sas.models.MultiplicationModel import MultiplicationModel 
     368            from sas.sascalc.fit.MultiplicationModel import MultiplicationModel 
    369369            P, S = [get_model(p) for p in model_info['oldname']] 
    370370            model = MultiplicationModel(P, S) 
  • sasmodels/convert.py

    r062db5a rc6ca41e  
    156156        elif name == 'vesicle': 
    157157            del oldpars['volfraction'] 
     158        elif name == 'multilayer_vesicle': 
     159            del oldpars['volfraction'] 
    158160 
    159161    return oldpars 
     
    195197        elif name == 'vesicle': 
    196198            pars['volfraction'] = 1 
     199        elif name == 'multilayer_vesicle': 
     200            pars['volfraction'] = 1 
    197201             
  • sasmodels/models/linear_pearls.py

    r2f0c07d ra2f9aa2  
    5757    ["edge_sep",    "Ang",      350.0, [0, inf],     "", "Length of the string segment - surface to surface"], 
    5858    ["num_pearls",  "",           3.0, [0, inf],     "", "Number of the pearls"], 
    59     ["pearl_sld",   "1e-6/Ang^2", 1.0, [-inf, inf],  "", "SLD of the pearl spheres"], 
    60     ["solvent_sld", "1e-6/Ang^2", 6.3, [-inf, inf],  "", "SLD of the solvent"], 
     59    ["sld",   "1e-6/Ang^2", 1.0, [-inf, inf],  "", "SLD of the pearl spheres"], 
     60    ["sld_solvent", "1e-6/Ang^2", 6.3, [-inf, inf],  "", "SLD of the solvent"], 
    6161    ] 
    6262# pylint: enable=bad-whitespace, line-too-long 
     
    6868            edge_sep=350.0, 
    6969            num_pearls=3, 
    70             pearl_sld=1.0, 
    71             solvent_sld=6.3) 
     70            sld=1.0, 
     71            sld_solvent=6.3) 
    7272 
    7373oldname = "LinearPearlsModel" 
    7474 
    7575oldpars = dict(edge_sep='edge_separation', 
    76                pearl_sld='sld_pearl', 
    77                solvent_sld='sld_solv') 
     76               sld='sld_pearl', 
     77               sld_solvent='sld_solv') 
    7878 
    7979""" 
     
    8484    [{'radius':      20.0, 
    8585      'num_pearls':   2.0, 
    86       'pearl_sld':    1.0, 
    87       'solvent_sld':  6.3, 
     86      'sld':    1.0, 
     87      'sld_solvent':  6.3, 
    8888      'edge_sep':   400.0, 
    8989     }, 0.001, 185.135], 
     
    9292    [{'radius':     120.0, 
    9393      'num_pearls':   5.0, 
    94       'pearl_sld':    2.0, 
    95       'solvent_sld':  2.3, 
     94      'sld':    2.0, 
     95      'sld_solvent':  2.3, 
    9696      'edge_sep':   100.0, 
    9797     }, 0.01, 45.4984], 
     
    9999    [{'radius':       7.0, 
    100100      'num_pearls':   2.0, 
    101       'pearl_sld':   10.0, 
    102       'solvent_sld': 99.3, 
     101      'sld':   10.0, 
     102      'sld_solvent': 99.3, 
    103103      'edge_sep':    20.0, 
    104104     }, 1.0, 0.632811], 
  • sasmodels/models/pearl_necklace.py

    r2f0c07d ra2f9aa2  
    1313---------- 
    1414 
    15 The output of the scattering intensity function for the PearlNecklaceModel is 
     15The output of the scattering intensity function for the pearl_necklace is 
    1616given by (Schweins, 2004) 
    1717 
     
    5858 
    5959name = "pearl_necklace" 
    60 title = "Colloidal spheres chained together with o preferential orientation" 
     60title = "Colloidal spheres chained together with no preferential orientation" 
    6161description = """ 
    6262Calculate form factor for Pearl Necklace Model 
     
    7676 
    7777#             ["name", "units", default, [lower, upper], "type","description"], 
    78 parameters = [["radius", "Angstrom", 80.0, [0, inf], "volume", 
     78parameters = [["radius", "Ang", 80.0, [0, inf], "volume", 
    7979               "Mean radius of the chained spheres"], 
    80               ["edge_separation", "Angstrom", 350.0, [0, inf], "volume", 
     80              ["edge_separation", "Ang", 350.0, [0, inf], "volume", 
    8181               "Mean separation of chained particles"], 
    82               ["string_thickness", "Angstrom", 2.5, [0, inf], "volume", 
     82              ["string_thickness", "Ang", 2.5, [0, inf], "volume", 
    8383               "Thickness of the chain linkage"], 
    8484              ["number_of_pearls", "none", 3, [0, inf], "volume", 
    85                "Mean number of pearls in each necklace"], 
    86               ["sld", "Angstrom^2", 1.0, [-inf, inf], "", 
     85               "Number of pearls in the necklace (must be integer)"], 
     86              ["sld", "1e-6/Ang^2", 1.0, [-inf, inf], "", 
    8787               "Scattering length density of the chained spheres"], 
    88               ["string_sld", "Angstrom^2", 1.0, [-inf, inf], "", 
     88              ["sld_string", "1e-6/Ang^2", 1.0, [-inf, inf], "", 
    8989               "Scattering length density of the chain linkage"], 
    90               ["solvent_sld", "Angstrom^2", 6.3, [-inf, inf], "", 
     90              ["sld_solvent", "1e-6/Ang^2", 6.3, [-inf, inf], "", 
    9191               "Scattering length density of the solvent"], 
    9292             ] 
     
    117117# parameters for demo 
    118118demo = dict(scale=1, background=0, radius=80.0, edge_separation=350.0, 
    119             number_of_pearls=3, sld=1, solvent_sld=6.3, string_sld=1, 
     119            number_of_pearls=3, sld=1, sld_solvent=6.3, sld_string=1, 
    120120            string_thickness=2.5, 
    121121            radius_pd=.2, radius_pd_n=5, 
     
    129129oldname = 'PearlNecklaceModel' 
    130130oldpars = dict(scale='scale', background='background', radius='radius', 
    131                number_of_pearls='num_pearls', solvent_sld='sld_solv', 
     131               number_of_pearls='num_pearls', sld_solvent='sld_solv', 
    132132               string_thickness='thick_string', sld='sld_pearl', 
    133                string_sld='sld_string', edge_separation='edge_separation') 
     133               sld_string='sld_string', edge_separation='edge_separation') 
    134134 
    135135tests = [[{}, 0.001, 17380.245], [{}, 'ER', 115.39502]] 
Note: See TracChangeset for help on using the changeset viewer.