Changeset 93cac17 in sasmodels
- Timestamp:
- Mar 29, 2019 2:43:48 PM (6 years ago)
- Branches:
- ticket-1257-vesicle-product
- Children:
- 7eb2a4d
- Parents:
- 89dba62 (diff), 065d77d (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - Location:
- sasmodels
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/product.py
rb2f0e5d r93cac17 295 295 The result may be an array or a float. 296 296 """ 297 # CRUFT: remove effective_radius once SasView 5.0 is released. 297 298 if beta_mode: 298 299 # TODO: 1. include calculated Q vector … … 304 305 ("S_eff(Q)", 1 + (F**2 / Fsq)*(S-1)), 305 306 ("effective_radius", radius_effective), 307 ("radius_effective", radius_effective), 306 308 # ("I(Q)", scale*(Fsq + (F**2)*(S-1)) + bg), 307 309 )) … … 311 313 ("S(Q)", S), 312 314 ("effective_radius", radius_effective), 315 ("radius_effective", radius_effective), 313 316 )) 314 317 return parts -
sasmodels/mixture.py
rb297ba9 rb2f0e5d 117 117 combined_pars.append(p) 118 118 parameters = ParameterTable(combined_pars) 119 # Allow for the scenario in which each component has all its PD parameters 120 # active simultaneously. details.make_details() will throw an error if 121 # too many are used from any one component. 119 122 parameters.max_pd = sum(part.parameters.max_pd for part in parts) 120 123 -
sasmodels/modelinfo.py
ra34b811 r98c045a 70 70 processed.append(parse_parameter(*p)) 71 71 partable = ParameterTable(processed) 72 partable.check_angles( )72 partable.check_angles(strict=True) 73 73 return partable 74 74 … … 446 446 # properties, such as default=0.0 for structure factor backgrounds. 447 447 self.common_parameters = [Parameter(*p) for p in COMMON_PARAMETERS] 448 449 448 self.kernel_parameters = parameters 450 449 self._set_vector_lengths() … … 495 494 self.pd_2d = set(p.name for p in self.call_parameters if p.polydisperse) 496 495 496 # Final checks 497 self.check_duplicates() 498 self.check_angles() 499 497 500 def set_zero_background(self): 498 501 """ … … 506 509 self.defaults = self._get_defaults() 507 510 508 def check_angles(self ):511 def check_angles(self, strict=False): 509 512 """ 510 513 Check that orientation angles are theta, phi and possibly psi. 514 515 *strict* should be True when checking a parameter table defined 516 in a model file, but False when checking from mixture models, etc., 517 where the parameters aren't being passed to a calculator directly. 511 518 """ 512 519 theta = phi = psi = -1 … … 524 531 if p.type != 'orientation': 525 532 raise TypeError("psi must be an orientation parameter") 526 elif p.type == 'orientation' :533 elif p.type == 'orientation' and strict: 527 534 raise TypeError("only theta, phi and psi can be orientation parameters") 528 535 if theta >= 0 and phi >= 0: … … 532 539 if psi >= 0 and psi != phi+1: 533 540 raise TypeError("psi must follow phi") 541 # TODO: Why must theta/phi/psi be at the end? Consistency only? 534 542 if (psi >= 0 and psi != last_par) or (psi < 0 and phi != last_par): 535 raise TypeError("orientation parameters must appear at the " 536 "end of the parameter table") 543 if strict: 544 raise TypeError("orientation parameters must appear at the " 545 "end of the parameter table") 537 546 elif theta >= 0 or phi >= 0 or psi >= 0: 538 547 raise TypeError("oriented shapes must have both theta and phi and maybe psi") 548 549 def check_duplicates(self): 550 """ 551 Check for duplicate parameter names 552 """ 553 checked, dups = set(), set() 554 for p in self.call_parameters: 555 if p.id in checked: 556 dups.add(p.id) 557 else: 558 checked.add(p.id) 559 if dups: 560 raise TypeError("Duplicate parameters: {}" 561 .format(", ".join(sorted(dups)))) 539 562 540 563 def __getitem__(self, key):
Note: See TracChangeset
for help on using the changeset viewer.