source: sasmodels/doc/developer/overview.rst @ 2e66ef5

core_shell_microgelscostrafo411magnetic_modelticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since 2e66ef5 was 2e66ef5, checked in by Paul Kienzle <pkienzle@…>, 7 years ago

add a short scripting guide; start in on developer docs

  • Property mode set to 100644
File size: 3.1 KB
RevLine 
[2e66ef5]1.. py:currentmodule:: sasmodels
2
3***************************
4Code Overview
5***************************
6
7Computational kernels
8---------------------
9
10At the heart of *sasmodels* are the individual computational kernels.  These
11functions take a particular $q$ value and a set of parameter values and
12return the expected scattering for that $q$. The instructions for writing
13a kernel are documented in :ref:`Writing_a_Plugin`.  The source code for
14the kernels is stored in :mod:`sasmodels.models`.
15
16The primary interface to the models is through :mod:`sasmodels.core`, which
17provides functions for listing available models, loading the model definition
18and compiling the model.  Use :func:`sasmodels.core.load_model` to load in
19a model definition and compile it.
20
21The computational kernels are difficult to call directly, but an example
22was provided in :ref:`Scripting_Interface`.
23
24The code for loading the kernel is in
25:mod:`sasmodels.generate`, but a big part of it, which is interpreting the
26definition, lives in :mod:`sasmodels.modelinfo`.  This defines the properties
27of the model in :class:`sasmodels.modelinfo.ModelInfo`, the available
28model parameters in :class:`sasmodels.modelinfo.ParameterTable` and the
29individual parameter attributes such as units and hard limits in
30:class:`sasmodels.modelinfo.Parameter`.
31
32The kernel functions for the most part do not define polydispersity,
33resolution functions or magnetism.  Instead, code for these is generated in
34:mod:`sasmodels.generate`
35
36
37
38Sasview kernels:
39
40* :mod:`
41    ('kernel', 'Evaluator type definitions'),
42    ('kernelcl', 'OpenCL model evaluator'),
43    ('kerneldll', 'Ctypes model evaluator'),
44    ('kernelpy', 'Python model evaluator'),
45
46Bumps fitting routines:
47
48* :mod:`sasmodels.bumps_model` is a wrapper around
49    ('bumps_model', 'Bumps interface'),
50    ('direct_model', 'Simple interface'),
51
52
53Utility functions:
54
55* :mod:`sasmodels` provides :func:`sasmodels.__init__.data_files` for the installer.
56* :mod:`sasmodels.rst2html` provides tools for converting model docs to html and viewing
57  the html.  When run as a main program, it can display arbitrary rst files.
58* :mod:`sasmodels.exception` annotates the current exception with a context string,
59  such as "while opening myfile.dat" without adjusting the traceback.
60
61
62And so on::
63
64
65    ('compare_many', 'Batch compare models on different compute engines'),
66    ('compare', 'Compare models on different compute engines'),
67    ('convert', 'Sasview to sasmodel converter'),
68    ('core', 'Model access'),
69    ('data', 'Data layout and plotting routines'),
70    ('details', 'Parameter packing for kernel calls'),
71    ('generate', 'Model parser'),
72    ('list_pars', 'Identify all parameters in all models'),
73    ('mixture', 'Mixture model evaluator'),
74    ('model_test', 'Unit test support'),
75    ('modelinfo', 'Parameter and model definitions'),
76    ('product', 'Product model evaluator'),
77    ('resolution', '1-D resolution functions'),
78    ('resolution2d', '2-D resolution functions'),
79    ('sasview_model', 'Sasview interface'),
80    ('sesans', 'SESANS calculation routines'),
81    ('weights', 'Distribution functions'),
Note: See TracBrowser for help on using the repository browser.