Changeset 39a06c9 in sasmodels for sasmodels/product.py


Ignore:
Timestamp:
Oct 25, 2018 3:58:26 PM (6 years ago)
Author:
Paul Kienzle <pkienzle@…>
Branches:
master, core_shell_microgels, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
81751c2
Parents:
304c775
Message:

Remove references to ER and VR from sasmodels. Refs #1202.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/product.py

    re44432d r39a06c9  
    6161    return pars 
    6262 
    63 # TODO: core_shell_sphere model has suppressed the volume ratio calculation 
    64 # revert it after making VR and ER available at run time as constraints. 
    6563def make_product_info(p_info, s_info): 
    6664    # type: (ModelInfo, ModelInfo) -> ModelInfo 
     
    126124    #model_info.tests = [] 
    127125    #model_info.source = [] 
    128     # Iq, Iqxy, form_volume, ER, VR and sesans 
    129126    # Remember the component info blocks so we can build the model 
    130127    model_info.composition = ('product', [p_info, s_info]) 
     
    331328        #print("R_eff=%d:%g, volfrac=%g, volume ratio=%g"%(radius_type, effective_radius, volfrac, volume_ratio)) 
    332329        if radius_type > 0: 
    333             # set the value to the model ER and set the weight to 1 
     330            # set the value to the model R_eff and set the weight to 1 
    334331            s_values[2] = s_values[2+s_npars+s_offset[0]] = effective_radius 
    335332            s_values[2+s_npars+s_offset[0]+nweights] = 1.0 
     
    366363        self.p_kernel.release() 
    367364        self.s_kernel.release() 
    368  
    369  
    370 def calc_er_vr(model_info, call_details, values): 
    371     # type: (ModelInfo, ParameterSet) -> Tuple[float, float] 
    372  
    373     if model_info.ER is None and model_info.VR is None: 
    374         return 1.0, 1.0 
    375  
    376     nvalues = model_info.parameters.nvalues 
    377     value = values[nvalues:nvalues + call_details.num_weights] 
    378     weight = values[nvalues + call_details.num_weights: nvalues + 2*call_details.num_weights] 
    379     npars = model_info.parameters.npars 
    380     # Note: changed from pairs ([v], [w]) to triples (p, [v], [w]), but the 
    381     # dispersion mesh code doesn't actually care about the nominal parameter 
    382     # value, p, so set it to None. 
    383     pairs = [(None, value[offset:offset+length], weight[offset:offset+length]) 
    384              for p, offset, length 
    385              in zip(model_info.parameters.call_parameters[2:2+npars], 
    386                     call_details.offset, 
    387                     call_details.length) 
    388              if p.type == 'volume'] 
    389     value, weight = dispersion_mesh(model_info, pairs) 
    390  
    391     if model_info.ER is not None: 
    392         individual_radii = model_info.ER(*value) 
    393         radius_effective = np.sum(weight*individual_radii) / np.sum(weight) 
    394     else: 
    395         radius_effective = 1.0 
    396  
    397     if model_info.VR is not None: 
    398         whole, part = model_info.VR(*value) 
    399         volume_ratio = np.sum(weight*part)/np.sum(weight*whole) 
    400     else: 
    401         volume_ratio = 1.0 
    402  
    403     return radius_effective, volume_ratio 
Note: See TracChangeset for help on using the changeset viewer.