Changes in sasmodels/product.py [065d77d:b297ba9] in sasmodels


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/product.py

    r065d77d rb297ba9  
    3131# pylint: enable=unused-import 
    3232 
    33 # TODO: make shape averages available to constraints 
     33# TODO: make estimates available to constraints 
    3434#ESTIMATED_PARAMETERS = [ 
    35 #    ["mean_radius_effective", "A", 0.0, [0, np.inf], "", "mean effective radius"], 
    36 #    ["mean_volume", "A", 0.0, [0, np.inf], "", "mean volume"], 
    37 #    ["mean_volume_ratio", "", 1.0, [0, np.inf], "", "mean form: mean shell volume ratio"], 
     35#    ["est_radius_effective", "A", 0.0, [0, np.inf], "", "Estimated effective radius"], 
     36#    ["est_volume_ratio", "", 1.0, [0, np.inf], "", "Estimated volume ratio"], 
    3837#] 
     38 
    3939STRUCTURE_MODE_ID = "structure_factor_mode" 
    4040RADIUS_MODE_ID = "radius_effective_mode" 
     
    4444    # type: (ModelInfo) -> List[Parameter] 
    4545    """ 
    46     Create parameters for structure factor and effective radius modes. 
     46    Create parameters for structure_factor_mode and radius_effective_mode. 
    4747    """ 
    4848    pars = [] 
     
    5656            "Structure factor calculation") 
    5757        pars.append(par) 
    58     if p_info.radius_effective_modes is not None: 
     58    if p_info.effective_radius_type is not None: 
    5959        par = parse_parameter( 
    6060            RADIUS_MODE_ID, 
    6161            "", 
    6262            1, 
    63             [["unconstrained"] + p_info.radius_effective_modes], 
     63            [["unconstrained"] + p_info.effective_radius_type], 
    6464            "", 
    6565            "Effective radius calculation") 
     
    177177        S,                # type: np.ndarray 
    178178        scale,            # type: float 
    179         radius_effective, # type: float 
     179        effective_radius, # type: float 
    180180        beta_mode,        # type: bool 
    181181    ): 
     
    185185    The result may be an array or a float. 
    186186    """ 
    187     # CRUFT: remove effective_radius once SasView 5.0 is released. 
    188187    if beta_mode: 
    189188        # TODO: 1. include calculated Q vector 
     
    194193            ("beta(Q)", F1**2 / F2), 
    195194            ("S_eff(Q)", 1 + (F1**2 / F2)*(S-1)), 
    196             ("effective_radius", radius_effective), 
    197             ("radius_effective", radius_effective), 
     195            ("effective_radius", effective_radius), 
    198196            # ("I(Q)", scale*(F2 + (F1**2)*(S-1)) + bg), 
    199197        )) 
     
    202200            ("P(Q)", scale*F2), 
    203201            ("S(Q)", S), 
    204             ("effective_radius", radius_effective), 
    205             ("radius_effective", radius_effective), 
     202            ("effective_radius", effective_radius), 
    206203        )) 
    207204    return parts 
     
    284281        # R_eff type parameter is the second parameter after P and S parameters 
    285282        # unless the model doesn't support beta mode, in which case it is first 
    286         have_radius_type = p_info.radius_effective_modes is not None 
    287         #print(p_npars,s_npars) 
     283        have_radius_type = p_info.effective_radius_type is not None 
    288284        radius_type_offset = 2+p_npars+s_npars + (1 if have_beta_mode else 0) 
    289         #print(values[radius_type_offset]) 
    290285        radius_type = int(values[radius_type_offset]) if have_radius_type else 0 
    291286 
     
    336331        # Call the form factor kernel to compute <F> and <F^2>. 
    337332        # If the model doesn't support Fq the returned <F> will be None. 
    338         F1, F2, radius_effective, shell_volume, volume_ratio = self.p_kernel.Fq( 
     333        F1, F2, effective_radius, shell_volume, volume_ratio = self.p_kernel.Fq( 
    339334            p_details, p_values, cutoff, magnetic, radius_type) 
    340335 
     
    346341        # implementation details in kernel_iq.c. 
    347342        #print("R_eff=%d:%g, volfrac=%g, volume ratio=%g" 
    348         #      % (radius_type, radius_effective, volfrac, volume_ratio)) 
     343        #      % (radius_type, effective_radius, volfrac, volume_ratio)) 
    349344        if radius_type > 0: 
    350345            # set the value to the model R_eff and set the weight to 1 
    351             s_values[2] = s_values[2+s_npars+s_offset[0]] = radius_effective 
     346            s_values[2] = s_values[2+s_npars+s_offset[0]] = effective_radius 
    352347            s_values[2+s_npars+s_offset[0]+nweights] = 1.0 
    353348        s_values[3] = s_values[2+s_npars+s_offset[1]] = volfrac*volume_ratio 
     
    375370        # the results directly rather than through a lazy evaluator. 
    376371        self.results = lambda: _intermediates( 
    377             F1, F2, S, combined_scale, radius_effective, beta_mode) 
     372            F1, F2, S, combined_scale, effective_radius, beta_mode) 
    378373 
    379374        return final_result 
Note: See TracChangeset for help on using the changeset viewer.