Changeset a18c5b3 in sasmodels


Ignore:
Timestamp:
Apr 13, 2016 10:10:43 AM (9 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:
04dc697
Parents:
793beb3
Message:

code cleanup; make categories work again

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/sasview_model.py

    r793beb3 ra18c5b3  
    112112    All the attributes should be immutable to avoid accidents. 
    113113    """ 
    114     attrs = {}  # type: Dict[str, Any] 
    115     attrs['_model_info'] = model_info 
    116     attrs['name'] = model_info.name 
    117     attrs['id'] = model_info.id 
    118     attrs['description'] = model_info.description 
    119     attrs['category'] = None 
    120114 
    121115    # TODO: allow model to override axis labels input/output name/unit 
    122116 
    123     parameters = model_info.parameters 
    124  
    125     #self.is_multifunc = False 
     117    # Process multiplicity 
    126118    non_fittable = []  # type: List[str] 
    127119    xlabel = model_info.profile_axes[0] if model_info.profile is not None else "" 
    128120    variants = MultiplicityInfo(0, "", [], xlabel) 
    129     for p in parameters.kernel_parameters: 
     121    for p in model_info.parameters.kernel_parameters: 
    130122        if p.name == model_info.control: 
    131123            non_fittable.append(p.name) 
     
    141133            break 
    142134 
    143     attrs['is_structure_factor'] = model_info.structure_factor 
    144     attrs['is_form_factor'] = model_info.ER is not None 
    145     attrs['is_multiplicity_model'] = variants[0] > 1 
    146     attrs['multiplicity_info'] = variants 
    147  
     135    # Organize parameter sets 
    148136    orientation_params = [] 
    149137    magnetic_params = [] 
    150138    fixed = [] 
    151     for p in parameters.user_parameters(): 
     139    for p in model_info.parameters.user_parameters(): 
    152140        if p.type == 'orientation': 
    153141            orientation_params.append(p.name) 
     
    158146            magnetic_params.append(p.name) 
    159147            fixed.append(p.name+".width") 
     148 
     149    # Build class dictionary 
     150    attrs = {}  # type: Dict[str, Any] 
     151    attrs['_model_info'] = model_info 
     152    attrs['name'] = model_info.name 
     153    attrs['id'] = model_info.id 
     154    attrs['description'] = model_info.description 
     155    attrs['category'] = model_info.category 
     156    attrs['is_structure_factor'] = model_info.structure_factor 
     157    attrs['is_form_factor'] = model_info.ER is not None 
     158    attrs['is_multiplicity_model'] = variants[0] > 1 
     159    attrs['multiplicity_info'] = variants 
    160160    attrs['orientation_params'] = tuple(orientation_params) 
    161161    attrs['magnetic_params'] = tuple(magnetic_params) 
    162162    attrs['fixed'] = tuple(fixed) 
    163  
    164163    attrs['non_fittable'] = tuple(non_fittable) 
    165164 
     
    227226    def __init__(self, multiplicity=None): 
    228227        # type: () -> None 
    229         print("initializing", self.name) 
    230         #raise Exception("first initialization") 
    231         self._model = None 
    232228 
    233229        ## _persistency_dict is used by sas.perspectives.fitting.basepage 
     
    564560            from . import weights 
    565561            disperser = weights.dispersers[dispersion.__class__.__name__] 
    566             dispersion = weights.models[disperser]() 
     562            dispersion = weights.MODELS[disperser]() 
    567563            self.dispersion[parameter] = dispersion.get_pars() 
    568564        else: 
Note: See TracChangeset for help on using the changeset viewer.