core_shell_microgelsmagnetic_modelticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change
on this file since 4476951 was
2e66ef5,
checked in by Paul Kienzle <pkienzle@…>, 8 years ago
|
add a short scripting guide; start in on developer docs
|
-
Property mode set to
100644
|
File size:
469 bytes
|
Rev | Line | |
---|
[2e66ef5] | 1 | """ |
---|
| 2 | Minimal example of calling a kernel for a specific set of q values. |
---|
| 3 | """ |
---|
| 4 | |
---|
| 5 | from numpy import logspace |
---|
| 6 | from matplotlib import pyplot as plt |
---|
| 7 | from sasmodels.core import load_model |
---|
| 8 | from sasmodels.direct_model import call_kernel |
---|
| 9 | |
---|
| 10 | model = load_model('cylinder') |
---|
| 11 | q = logspace(-3, -1, 200) |
---|
| 12 | kernel = model.make_kernel([q]) |
---|
| 13 | Iq = call_kernel(kernel, dict(radius=200.)) |
---|
| 14 | plt.loglog(q, Iq) |
---|
| 15 | plt.xlabel('q (1/A)') |
---|
| 16 | plt.ylabel('I(q)') |
---|
| 17 | plt.title('Cylinder with radius 200.') |
---|
| 18 | plt.show() |
---|
Note: See
TracBrowser
for help on using the repository browser.