Skip to main content

Theory models for small angle scattering.

The models provided are usable directly in the bumps fitting package and in the sasview analysis package. If OpenCL is available, the models will run much faster. If not, then precompiled versions will be included with the distributed package. New models can be added if OpenCL or a C compiler is available.

Citing and Acknowledging SasModels

If you found this software useful to your work please cite and/or acknowledge its use in your publications. The latest instructions for citing and acknowledging are available on our website.

[Citing SasModels](http://www.sasview.org/cite/#citing-sasmodels) [Acknowledging SasModels](http://www.sasview.org/cite/#acknowledging-sasview)

Install

The easiest way to use sasmodels is from SasView.

You can also install sasmodels as a standalone package in python. Use miniconda or anaconda to create a python environment with the sasmodels dependencies:

$ conda create -n sasmodels -c conda-forge numpy scipy matplotlib pyopencl

The option -n sasmodels names the environment sasmodels, and the option -c conda-forge selects the conda-forge package channel because pyopencl is not part of the base anaconda distribution.

Activate the environment and install sasmodels:

$ conda activate sasmodels
(sasmodels) $ pip install sasmodels

Install bumps if you want to use it to fit your data:

(sasmodels) $ pip install bumps

Usage

Check that the works:

(sasmodels) $ python -m sasmodels.compare cylinder

To show the orientation explorer:

(sasmodels) $ python -m sasmodels.jitter

Documentation is available online as part of the SasView fitting perspective as well as separate pages for individual models. Programming details for sasmodels are available in the developer documentation.

Fitting Example

The example directory contains a radial+tangential data set for an oriented rod-like shape.

To load the example data, you will need the SAS data loader from the sasview package. This is not yet available on PyPI, so you will need a copy of the SasView source code to run it. Create a directory somewhere to hold the sasview and sasmodels source code, which we will refer to as $SOURCE.

Use the following to install sasview, and the sasmodels examples:

(sasmodels) $ cd $SOURCE
(sasmodels) $ conda install git
(sasmodels) $ git clone https://github.com/sasview/sasview.git
(sasmodels) $ git clone https://github.com/sasview/sasmodels.git

Set the path to the sasview source on your python path within the sasmodels environment. On Windows, this will be:

(sasmodels)> set PYTHONPATH="$SOURCE\sasview\src"
(sasmodels)> cd $SOURCE/sasmodels/example
(sasmodels)> python -m bumps.cli fit.py cylinder --preview

On Mac/Linux with the standard shell this will be:

(sasmodels) $ export PYTHONPATH="$SOURCE/sasview/src"
(sasmodels) $ cd $SOURCE/sasmodels/example
(sasmodels) $ bumps fit.py cylinder --preview

The fit.py model accepts up to two arguments. The first argument is the model type, which has been defined for cylinder, capped_cylinder, core_shell_cylinder, ellipsoid, triaxial_ellipsoid and lamellar. The second argument is view, which can be radial or tangential. To fit both radial and tangential simultaneously, use the word “both”.

See bumps documentation for detailed instructions on running the fit.

TestStatus TravisStatus

Metadata

Release files for sasmodels 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sasmodels 1.1.0
File Size Uploaded
sasmodels-1.1.0.tar.gz 20.2 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for sasmodels 1.1.0
File Interpreter ABI Platform
sasmodels-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 38.7 MB

Release files / sasmodels-1.1.0.tar.gz

Download URL sasmodels-1.1.0.tar.gz
Size 20.2 MB
Tags Source
SHA-256 checksum
How to use checksums
b164fac1a48d262a90bc17be59d8279c42489bcd4ceafdddff0a8af83dc22306
BLAKE2b-256 checksum
How to use checksums
9b80a83e1c102c0c97463b8c7cc96cefa21b1be8454422744a70c0a4c716f1d9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.11

Release files / sasmodels-1.1.0-py3-none-any.whl

Download URL sasmodels-1.1.0-py3-none-any.whl
Size 18.5 MB
Tags Python 3
SHA-256 checksum
How to use checksums
5901084845000689d13bb644094976d9e096cda356181cb6b9346ffcf6074a60
BLAKE2b-256 checksum
How to use checksums
9e47fcae44b6188a55527d778fedfe6e6e5c6ede00a0aca290a1e9857db7a8fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.11
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page