Changeset 256dfe1 in sasmodels for sasmodels/modelinfo.py


Ignore:
Timestamp:
Jul 18, 2016 12:42:29 AM (8 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:
c5ac2b2
Parents:
46ed760
Message:

allow comparison of multiplicity models with sasview 3.x

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/modelinfo.py

    r98ba1fc r256dfe1  
    186186        vectors = dict((name,value) for name,value in pars.items() 
    187187                       if name in lookup and lookup[name].length > 1) 
     188        #print("lookup", lookup) 
     189        #print("scalars", scalars) 
     190        #print("vectors", vectors) 
    188191        if vectors: 
    189192            for name, value in vectors.items(): 
     
    194197                        key = name+str(k) 
    195198                        if key not in scalars: 
    196                             scalars[key] = vectors 
     199                            scalars[key] = value 
    197200                else: 
    198201                    # supoprt for the form 
    199202                    #    dict(thickness=[20,10,3]) 
    200203                    for (k,v) in enumerate(value): 
    201                         scalars[name+str(k)] = v 
     204                        scalars[name+str(k+1)] = v 
    202205        result.update(scalars) 
     206        #print("expanded", result) 
    203207 
    204208    return result 
     
    402406    parameters don't use vector notation, and instead use p1, p2, ... 
    403407 
    404     * *control_parameters* is the 
    405  
    406408    """ 
    407409    # scale and background are implicit parameters 
     
    455457                         if p.polydisperse and p.type != 'magnetic') 
    456458 
    457  
    458459    def _set_vector_lengths(self): 
    459         # type: () -> None 
     460        # type: () -> List[str] 
    460461        """ 
    461462        Walk the list of kernel parameters, setting the length field of the 
     
    466467        initially created. 
    467468 
     469        Returns the list of control parameter names. 
     470 
    468471        Note: This modifies the underlying parameter object. 
    469472        """ 
    470473        # Sort out the length of the vector parameters such as thickness[n] 
     474 
    471475        for p in self.kernel_parameters: 
    472476            if p.length_control: 
     
    478482                                     % (p.length_control, p.name)) 
    479483                ref.is_control = True 
     484                ref.polydisperse = False 
    480485                low, high = ref.limits 
    481486                if int(low) != low or int(high) != high or low < 0 or high > 20: 
     
    689694    info.profile = getattr(kernel_module, 'profile', None) # type: ignore 
    690695    info.sesans = getattr(kernel_module, 'sesans', None) # type: ignore 
    691     info.control = getattr(kernel_module, 'control', None) 
     696 
     697    # multiplicity info 
     698    control_pars = [p.id for p in parameters.kernel_parameters if p.is_control] 
     699    default_control = control_pars[0] if control_pars else None 
     700    info.control = getattr(kernel_module, 'control', default_control) 
    692701    info.hidden = getattr(kernel_module, 'hidden', None) # type: ignore 
    693702 
Note: See TracChangeset for help on using the changeset viewer.