Changeset ce99754 in sasmodels
- Timestamp:
- Nov 2, 2017 3:44:10 PM (7 years ago)
- Branches:
- master, core_shell_microgels, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- 17db833
- Parents:
- 6aee3ab
- Location:
- sasmodels
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/details.py
r6aee3ab rce99754 318 318 parameter set in the vector. 319 319 """ 320 value, dispersity, weight = zip(*mesh)320 _, dispersity, weight = zip(*mesh) 321 321 #weight = [w if len(w)>0 else [1.] for w in weight] 322 322 weight = np.vstack([v.flatten() for v in meshgrid(*weight)]) -
sasmodels/product.py
redb0f85 rce99754 279 279 weight = values[nvalues + call_details.num_weights: nvalues + 2*call_details.num_weights] 280 280 npars = model_info.parameters.npars 281 pairs = [(value[offset:offset+length], weight[offset:offset+length]) 281 # Note: changed from pairs ([v], [w]) to triples (p, [v], [w]), but the 282 # dispersion mesh code doesn't actually care about the nominal parameter 283 # value, p, so set it to None. 284 pairs = [(None, value[offset:offset+length], weight[offset:offset+length]) 282 285 for p, offset, length 283 286 in zip(model_info.parameters.call_parameters[2:2+npars], -
sasmodels/sasview_model.py
ra06af5d rce99754 673 673 #call_details.show() 674 674 #print("pairs", pairs) 675 #for k, p in enumerate(self._model_info.parameters.call_parameters): 676 # print(k, p.name, *pairs[k]) 675 677 #print("params", self.params) 676 678 #print("values", values) … … 678 680 result = calculator(call_details, values, cutoff=self.cutoff, 679 681 magnetic=is_magnetic) 682 #print("result", result) 680 683 self._intermediate_results = getattr(calculator, 'results', None) 681 684 calculator.release() … … 761 764 return self.multiplicity, [self.multiplicity], [1.0] 762 765 else: 763 # For hidden parameters use the default value. 764 default = self._model_info.parameters.defaults.get(par.name, np.NaN) 765 return default, [default], [1.0] 766 # For hidden parameters use NaN 767 return np.NaN, [np.NaN], [1.0] 766 768 elif par.polydisperse: 767 769 value = self.params[par.name] … … 776 778 else: 777 779 value = self.params[par.name] 778 return value, [value if par.relative_pd else 0.0], [1.0]780 return value, [value], [1.0] 779 781 780 782 def test_cylinder(): … … 797 799 if np.isnan(value): 798 800 raise ValueError("hardsphere returns null") 801 802 def test_product(): 803 # type: () -> float 804 """ 805 Test that 2-D hardsphere model runs and doesn't produce NaN. 806 """ 807 S = _make_standard_model('hayter_msa')() 808 P = _make_standard_model('cylinder')() 809 model = MultiplicationModel(P, S) 810 value = model.evalDistribution([0.1, 0.1]) 811 if np.isnan(value): 812 raise ValueError("cylinder*hatyer_msa returns null") 799 813 800 814 def test_rpa(): … … 850 864 if __name__ == "__main__": 851 865 print("cylinder(0.1,0.1)=%g"%test_cylinder()) 866 #test_product() 867 #test_rpa() 852 868 #test_empty_distribution()
Note: See TracChangeset
for help on using the changeset viewer.