Changeset a34b811 in sasmodels for sasmodels/product.py
- Timestamp:
- Mar 28, 2019 5:02:53 PM (5 years ago)
- Branches:
- master, ticket-1257-vesicle-product, ticket_1156, ticket_822_more_unit_tests
- Children:
- db1d9d5
- Parents:
- e5cb3df
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/product.py
rd8e81f7 ra34b811 31 31 # pylint: enable=unused-import 32 32 33 # TODO: make estimates available to constraints33 # TODO: make shape averages available to constraints 34 34 #ESTIMATED_PARAMETERS = [ 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"], 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"], 37 38 #] 38 # NOTE there are radius_effective_mode, effective_radius_type, but only structure_factor_mode39 39 STRUCTURE_MODE_ID = "structure_factor_mode" 40 40 RADIUS_MODE_ID = "radius_effective_mode" … … 44 44 # type: (ModelInfo) -> List[Parameter] 45 45 """ 46 Create parameters for structure _factor_type and radius_effective_type.46 Create parameters for structure factor and effective radius modes. 47 47 """ 48 48 pars = [] … … 56 56 "Structure factor calculation") 57 57 pars.append(par) 58 if p_info. effective_radius_typeis not None:58 if p_info.radius_effective_modes is not None: 59 59 par = parse_parameter( 60 60 RADIUS_MODE_ID, 61 61 "", 62 62 1, 63 [["unconstrained"] + p_info. effective_radius_type],63 [["unconstrained"] + p_info.radius_effective_modes], 64 64 "", 65 65 "Effective radius calculation") … … 177 177 S, # type: np.ndarray 178 178 scale, # type: float 179 effective_radius, # type: float179 radius_effective, # type: float 180 180 beta_mode, # type: bool 181 181 ): … … 193 193 ("beta(Q)", F1**2 / F2), 194 194 ("S_eff(Q)", 1 + (F1**2 / F2)*(S-1)), 195 ("effective_radius", effective_radius),195 ("effective_radius", radius_effective), 196 196 # ("I(Q)", scale*(F2 + (F1**2)*(S-1)) + bg), 197 197 )) … … 200 200 ("P(Q)", scale*F2), 201 201 ("S(Q)", S), 202 ("effective_radius", effective_radius),202 ("effective_radius", radius_effective), 203 203 )) 204 204 return parts … … 281 281 # R_eff type parameter is the second parameter after P and S parameters 282 282 # unless the model doesn't support beta mode, in which case it is first 283 have_radius_type = p_info. effective_radius_typeis not None283 have_radius_type = p_info.radius_effective_modes is not None 284 284 #print(p_npars,s_npars) 285 285 radius_type_offset = 2+p_npars+s_npars + (1 if have_beta_mode else 0) … … 333 333 # Call the form factor kernel to compute <F> and <F^2>. 334 334 # If the model doesn't support Fq the returned <F> will be None. 335 F1, F2, effective_radius, shell_volume, volume_ratio = self.p_kernel.Fq(335 F1, F2, radius_effective, shell_volume, volume_ratio = self.p_kernel.Fq( 336 336 p_details, p_values, cutoff, magnetic, radius_type) 337 337 … … 343 343 # implementation details in kernel_iq.c. 344 344 print("R_eff=%d:%g, volfrac=%g, volume ratio=%g" 345 % (radius_type, effective_radius, volfrac, volume_ratio))345 % (radius_type, radius_effective, volfrac, volume_ratio)) 346 346 if radius_type > 0: 347 347 # set the value to the model R_eff and set the weight to 1 348 s_values[2] = s_values[2+s_npars+s_offset[0]] = effective_radius348 s_values[2] = s_values[2+s_npars+s_offset[0]] = radius_effective 349 349 s_values[2+s_npars+s_offset[0]+nweights] = 1.0 350 350 s_values[3] = s_values[2+s_npars+s_offset[1]] = volfrac*volume_ratio … … 372 372 # the results directly rather than through a lazy evaluator. 373 373 self.results = lambda: _intermediates( 374 F1, F2, S, combined_scale, effective_radius, beta_mode)374 F1, F2, S, combined_scale, radius_effective, beta_mode) 375 375 376 376 return final_result
Note: See TracChangeset
for help on using the changeset viewer.