source: sasmodels/example/cylinder_eval.py @ d0b0f5d

Last change on this file since d0b0f5d was 23df833, checked in by Paul Kienzle <pkienzle@…>, 6 years ago

Document direct call to Fq in user guide

  • Property mode set to 100644
File size: 691 bytes
Line 
1"""
2Minimal example of calling a kernel for a specific set of q values.
3"""
4
5from numpy import logspace, sqrt
6from matplotlib import pyplot as plt
7from sasmodels.core import load_model
8from sasmodels.direct_model import call_kernel, call_Fq
9
10model = load_model('cylinder')
11q = logspace(-3, -1, 200)
12kernel = model.make_kernel([q])
13pars = {'radius': 200, 'radius_pd': 0.1, 'scale': 2}
14Iq = call_kernel(kernel, pars)
15F, Fsq, Reff, V, Vratio = call_Fq(kernel, pars)
16plt.loglog(q, Iq, label='2 I(q)')
17plt.loglog(q, F**2/V, label='<F(q)>^2/V')
18plt.loglog(q, Fsq/V, label='<F^2(q)>/V')
19plt.xlabel('q (1/A)')
20plt.ylabel('I(q) (1/cm)')
21plt.title('Cylinder with radius 200.')
22plt.legend()
23plt.show()
Note: See TracBrowser for help on using the repository browser.