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