source: sasmodels/README.rst @ e220acc

ticket-1257-vesicle-productticket_1156ticket_822_more_unit_tests
Last change on this file since e220acc was 2a64722, checked in by Paul Kienzle <pkienzle@…>, 6 years ago

improve tutorial shown on the github landing page for sasmodels

  • Property mode set to 100644
File size: 3.5 KB
Line 
1Sasmodels
2=========
3
4Theory models for small angle scattering.
5
6The models provided are usable directly in the bumps fitting package and
7in the sasview analysis package.  If OpenCL is available, the models will
8run much faster.  If not, then precompiled versions will be included with
9the distributed package.  New models can be added if OpenCL or a C compiler
10is available.
11
12Install
13-------
14
15The easiest way to use sasmodels is from `SasView <http://www.sasview.org/>`_.
16
17You can also install sasmodels as a standalone package in python. Use
18`miniconda <https://docs.conda.io/en/latest/miniconda.html>`_
19or `anaconda <https://www.anaconda.com/>`_
20to create a python environment with the sasmodels dependencies::
21
22    $ conda create -n sasmodels -c conda-forge numpy scipy matplotlib pyopencl
23
24The option ``-n sasmodels`` names the environment sasmodels, and the option
25``-c conda-forge`` selects the conda-forge package channel because pyopencl
26is not part of the base anaconda distribution.
27
28Activate the environment and install sasmodels::
29
30    $ conda activate sasmodels
31    (sasmodels) $ pip install sasmodels
32
33Install `bumps <https://github.com/bumps/bumps>`_ if you want to use it to fit
34your data::
35
36    (sasmodels) $ pip install bumps
37
38Usage
39-----
40
41Check that the works::
42
43    (sasmodels) $ python -m sasmodels.compare cylinder
44
45To show the orientation explorer::
46
47    (sasmodels) $ python -m sasmodels.jitter
48
49Documentation is available online as part of the SasView
50`fitting perspective <http://www.sasview.org/docs/index.html>`_
51as well as separate pages for
52`individual models <http://www.sasview.org/docs/user/sasgui/perspectives/fitting/models/index.html>`_.
53Programming details for sasmodels are available in the
54`developer documentation <http://www.sasview.org/docs/dev/dev.html>`_.
55
56
57Fitting Example
58---------------
59
60The example directory contains a radial+tangential data set for an oriented
61rod-like shape.
62
63To load the example data, you will need the SAS data loader from the sasview
64package. This is not yet available on PyPI, so you will need a copy of the
65SasView source code to run it.  Create a directory somewhere to hold the
66sasview and sasmodels source code, which we will refer to as $SOURCE.
67
68Use the following to install sasview, and the sasmodels examples::
69
70    (sasmodels) $ cd $SOURCE
71    (sasmodels) $ conda install git
72    (sasmodels) $ git clone https://github.com/sasview/sasview.git
73    (sasmodels) $ git clone https://github.com/sasview/sasmodels.git
74
75Set the path to the sasview source on your python path within the sasmodels
76environment.  On Windows, this will be::
77
78    (sasmodels)> set PYTHONPATH="$SOURCE\sasview\src"
79    (sasmodels)> cd $SOURCE/sasmodels/example
80    (sasmodels)> python -m bumps.cli fit.py cylinder --preview
81
82On Mac/Linux with the standard shell this will be::
83
84    (sasmodels) $ export PYTHONPATH="$SOURCE/sasview/src"
85    (sasmodels) $ cd $SOURCE/sasmodels/example
86    (sasmodels) $ bumps fit.py cylinder --preview
87
88The fit.py model accepts up to two arguments.  The first argument is the
89model type, which has been defined for cylinder, capped_cylinder,
90core_shell_cylinder, ellipsoid, triaxial_ellipsoid and lamellar.  The
91second argument is view, which can be radial or tangential.  To fit
92both radial and tangential simultaneously, use the word "both".
93
94See `bumps documentation <https://bumps.readthedocs.io/>`_ for detailed
95instructions on running the fit.
96
97|TravisStatus|_
98
99.. |TravisStatus| image:: https://travis-ci.org/SasView/sasmodels.svg?branch=master
100.. _TravisStatus: https://travis-ci.org/SasView/sasmodels
Note: See TracBrowser for help on using the repository browser.