Changeset 6871c9e in sasmodels
- Timestamp:
- Mar 24, 2015 4:05:05 PM (10 years ago)
- Branches:
- master, core_shell_microgels, costrafo411, magnetic_model, release_v0.94, release_v0.95, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- 42ade62, f1b8c90
- Parents:
- c210c94
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/resolution.py
r7954f5c r6871c9e 357 357 """ 358 358 from scipy.integrate import romberg 359 360 if any(k not in form.info['defaults'] for k in pars.keys()): 361 keys = set(form.info['defaults'].keys()) 362 extra = set(pars.keys()) - keys 363 raise ValueError("bad parameters: [%s] not in [%s]"% 364 (", ".join(sorted(extra)), ", ".join(sorted(keys)))) 365 359 366 _fn = lambda u, q0: eval_form(sqrt(q0**2 + u**2), form, pars) 360 367 r = [romberg(_fn, 0, delta_qv[0], args=(qi,), … … 373 380 """ 374 381 from scipy.integrate import romberg 382 383 if any(k not in form.info['defaults'] for k in pars.keys()): 384 keys = set(form.info['defaults'].keys()) 385 extra = set(pars.keys()) - keys 386 raise ValueError("bad parameters: [%s] not in [%s]"% 387 (", ".join(sorted(extra)), ", ".join(sorted(keys)))) 375 388 376 389 _fn = lambda q, q0, dq: eval_form(q, form, pars)*gaussian(q, q0, dq) … … 593 606 # TODO: relative error should be lower 594 607 self.compare(q, output, answer, 0.025) 608 609 def test_ellipsoid(self): 610 """ 611 Compare romberg integration for ellipsoid model. 612 """ 613 from .core import load_model 614 pars = { 615 'scale':0.05, 616 'rpolar':500, 'requatorial':15000, 617 'sld':6, 'solvent_sld': 1, 618 } 619 form = load_model('ellipsoid', dtype='double') 620 q = np.logspace(log10(4e-5),log10(2.5e-2), 68) 621 delta_qv = [0.117] 622 resolution = Slit1D(q, width=delta_qv, height=0) 623 answer = romberg_slit_1d(q, delta_qv, form, pars) 624 output = resolution.apply(eval_form(resolution.q_calc, form, pars)) 625 # TODO: 10% is too much error; use better algorithm 626 self.compare(q, output, answer, 0.1) 595 627 596 628 #TODO: can sas q spacing be too sparse for the resolution calculation?
Note: See TracChangeset
for help on using the changeset viewer.