SASfit has been written for analyzing and plotting small angle scattering data. It can calculate integral structural parameters like radius of gyration, scattering invariant, Porod constant. Furthermore it can fit size distributions together with several form factors including different structure factors.
Additionally, an algorithm has been implemented, which allows to simultaneously fit several scattering curves with a common set of (global) parameters. This last option is especially important in contrast variation experiments or measurements with polarised neutrons. The global fit helps to determine fit parameters unambiguously which by analysing a single curve would be otherwise strongly correlated.
The program has been written to fulfill the needs at the small angle neutron scattering facility at PSI. The numerical routines have been written in C whereas the menu interface has been written in Tcl/Tk and the plotting routine with the BLT extension.
SASfit was developed and is maintained by:
- Joachim Kohlbrecher ([email protected])
- Ingo Bressler ([email protected])
Laboratory for Neutron Scattering and Imaging
Paul Scherrer Institut
CH-5232 Villigen PSI
Switzerland
Tel: +41 (0)56 310 3165
Fax: +41 (0)56 310 3131
- SASfit has been developed at the Paul Scherrer Institute (PSI) and remains copyright of the PSI.
- SASfit is available for users analysing data taken at PSI.
- SASfit is provided for users of the PSI facilities.
- SASfit is provided "as is" and with no warranty.
- SASfit is licensed under the GPLv3. For more details see COPYING.txt.
Academic papers about SASfit have been published in:
- J. Appl. Cryst. (2015). 48, 1587-1598
- J. Appl. Cryst. (2017). 50, 1395-1403
- J. Appl. Cryst. (2022). 55, 1677-1688
If SASfit has been significant in your research, and you would like to acknowledge the project in your academic publication, we suggest citing one of the aforementioned publications.
There is a comprehensive manual included the software package with a jumble of formulas used by SASfit. It evolves with the program to cover most of the implemented models and functions. The latest version can also be viewed online.
For introduction and demonstration of the program and its main features, some tutorial videos can be found in our YouTube channel:
- Introducing SASfit
- SASfit demo fitting dense spherical particles SAS data
- plus somewhat older videos
The latest stable changes and versions of the program can be found in the Releases section at GitHub.
Up to date development snapshots for all supported platforms can be found on cloudsmith (this link is also placed at the top on this page).
As of March 13th '24 the latest SASfit development binary package was tested successfully (single-fit -> simulate single curve -> plots curve) on the following macOS (Intel) versions:
- Sonoma 14.4
- Ventura 13.6
- Monterey 12.7
It is very likely that the XQuartz package is missing which is a requirement for SASfit to run on modern macOS. You can download its package from here: https://www.xquartz.org/releases/index.html Descriptions on using macports or homebrew for installing it can be found there too.
In case of this error about an unidentified developer (because we are not registered with Apple yet) it should work to right-click -> Open on the file sasfit.command
to get a dialog with an Open button:
Opening a downloaded package for the first time in this way, you might have to confirm this security exception with an admin account (won't pop-up when opening it the 2nd time or later):
Another workaround is to remove the quarantine label of the downloaded file on macOS. This can be done by the following command in a Terminal window. It requires admin privileges:
% cd Downloads
% sudo xattr -c sasfit_*_macos64.tar.bz2
If your user is not allowed to call sudo, you have to change to a user which does:
~ % cd /
/ % su admin
Password:...
/ % sudo xattr -c /Users/<username>/Downloads/sasfit_*_macos64.tar.bz2
Once the quarantine label was removed, the package can be extracted by double-clicking on it. Starting the program by clicking on the sasfit.command
file should open it without further errors.
(Tested with Windows 10 x64 1809)
On a fresh system, download and install the latest MSYS2 (x86_64) software distro and building platform for Windows.
The following commands have to be executed in the previously installed MSYS2 shell. Ensure software repository mirrors and GIT version control system are up to date:
pacman -S --needed --noconfirm pacman-mirrors
pacman -S --needed --noconfirm git
Update all packages first. Twice, because the MSYS2 window has to be closed in between and opened again, just as the updater in the shell tells you:
pacman -Syu --noconfirm
pacman -Syu --noconfirm
Installing required packages for building SASfit:
pacman -S --noconfirm make diffutils patch mingw-w64-x86_64-gcc mingw-w64-x86_64-cmake mingw-w64-x86_64-python-pip mingw-w64-x86_64-fftw mingw-w64-x86_64-gsl mingw-w64-x86_64-zlib
Get a copy of the latest SASfit source code:
git clone https://github.com/SASfit/SASfit.git sasfit
Create a build directory:
% cd sasfit
sasfit % mkdir build
sasfit % cd build
Close the terminal window and open the one named MSYS2 MinGW 64-bit in the Windows Start Menu (Do not use the plain MSYS2 terminal, it does not work as expected). The terminal should have the commands gcc and cmake in PATH.
Configure the source with CMake which builds required packages on the way:
sasfit/build % cmake -G "MSYS Makefiles" ../src
Finally, build SASfit itself which should generate a binary package if it was successful:
sasfit/build % make
(Tested with Catalina 10.15)
On a fresh system, install the required development tools with Homebrew:
% brew install git cmake gcc gsl fftw zlib
% brew cask install xquartz
To avoid using macOS default gcc (which as clang actually), specify the compiler by the following environment variables:
% export CC=/usr/local/bin/gcc-9
% export CXX=/usr/local/bin/g++-9
Get a copy of the latest SASfit source code:
% git clone https://github.com/SASfit/SASfit.git sasfit
Create a build directory:
% cd sasfit
sasfit % mkdir build
sasfit % cd build
Configure the source with CMake which builds required packages on the way:
sasfit/build % cmake ../src
Finally, build SASfit itself which should generate a binary package if it was successful:
sasfit/build % make -j4
(Tested on Ubuntu 22+24)
Install GIT first and get a copy of the latest SASfit source code:
apt install git
git clone https://github.com/SASfit/SASfit.git sasfit
Note: This works for building except packaging for now. Getting the appimagetool working in a container for packaging is not working yet. (would require --device /dev/fuse --device /dev/snd
below, at least)
Run container interactively:
podman run -it -u 0 -v .:/sasfit --rm ubuntu:latest bash
In the container shell:
apt update && apt install -y lsb-release sudo fuse-overlayfs
Run this on your system natively or within the container started as described before.
Use the scripts provided for continous integration (CI) in subfolder src/appveyor
:
cd <SASfit-path>
sh src/appveyor/0_install_linux4building.sh
For the compiler, the latest installed gcc is selected and indicated at the beginning of the output. To override this, export the CC and CXX environment variables with an absolute path to the compiler for C and C++ respectively.
cd <SASfit-path>
sh src/appveyor/4_build.sh
The resulting package can be found in the src directory while the assembled package directory structure is next to the SASfit directory one level up ('/../').
Clean the source tree from build products and other temporary files with GIT by running:
$ git clean -xdf
This command removes files with are set to be ignored by GIT (-x), removes files in sub-directories recursively (-d) and does not ask questions (-f).
Package repository hosting is graciously provided by Cloudsmith. Cloudsmith is the only fully hosted, cloud-native, universal package management solution, that enables your organization to create, store and share packages in any format, to any place, with total confidence.