sasmodels package
Project description
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.
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file sasmodels-1.0.8.tar.gz
.
File metadata
- Download URL: sasmodels-1.0.8.tar.gz
- Upload date:
- Size: 10.9 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 96bc2679492a1f8df9fc7907e0fe12bb3a9224caa652b13b8b941b2a71d5d4ef |
|
MD5 | 5543849ed2c2870c299fd18713181884 |
|
BLAKE2b-256 | 12cdbd39ded7fd55bde86b5e054c0c931bc65c4c006ddff2ea55f5f250f72c15 |
File details
Details for the file sasmodels-1.0.8-py3-none-any.whl
.
File metadata
- Download URL: sasmodels-1.0.8-py3-none-any.whl
- Upload date:
- Size: 550.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2e1c26d86d097262f9a806c33f66d2cefb0fd06edd94cc795cb54462b011065f |
|
MD5 | c231f398ae9ffbdabc68f40636ed57d1 |
|
BLAKE2b-256 | cb409f1e9dfb78261b7b8660dc07aec6865a8ad1cc8fad117b9b8b2be66afbe5 |