Changeset 41e7f2e in sasmodels for sasmodels/compare.py


Ignore:
Timestamp:
Oct 1, 2016 2:04:51 PM (8 years ago)
Author:
ajj
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:
80013a6 (diff), 2f46e83 (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' into ticket651

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/compare.py

    r80013a6 r41e7f2e  
    3838from . import core 
    3939from . import kerneldll 
     40from . import weights 
    4041from .data import plot_theory, empty_data1D, empty_data2D 
    4142from .direct_model import DirectModel 
     
    390391    from sas.models.qsmearing import smear_selection 
    391392    from sas.models.MultiplicationModel import MultiplicationModel 
     393    from sas.models.dispersion_models import models as dispersers 
    392394 
    393395    def get_model_class(name): 
     
    422424        ModelClass = get_model_class(old_name) 
    423425        model = [ModelClass()] 
     426    model[0].disperser_handles = {} 
    424427 
    425428    # build a smearer with which to call the model, if necessary 
     
    458461            model[0] = ModelClass(control) 
    459462        # paying for parameter conversion each time to keep life simple, if not fast 
     463        for k, v in oldpars.items(): 
     464            if k.endswith('.type'): 
     465                par = k[:-5] 
     466                cls = dispersers[v if v != 'rectangle' else 'rectangula'] 
     467                handle = cls() 
     468                model[0].disperser_handles[par] = handle 
     469                model[0].set_dispersion(par, handle) 
     470 
    460471        #print("sasview pars",oldpars) 
    461472        for k, v in oldpars.items(): 
    462473            name_attr = k.split('.')  # polydispersity components 
    463474            if len(name_attr) == 2: 
    464                 model[0].dispersion[name_attr[0]][name_attr[1]] = v 
     475                par, disp_par = name_attr 
     476                model[0].dispersion[par][disp_par] = v 
    465477            else: 
    466478                model[0].setParam(k, v) 
Note: See TracChangeset for help on using the changeset viewer.