Logo

Small-Angle Scattering Analysis Toolbox.

View the Project on GitHub

Contents

A Software package for fitting small-angle scattering curves

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.

Global fit screenshot

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.

Author Information

SASfit was developed and is maintained by:

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

Publications

Academic papers about SASfit have been published in:

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.

Documentation

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.

Videos

Some tutorial videos can be found in our channel on YouTube. An introduction on a simple single curve fit for example.

Versions and Changes

The latest changes and versions of the program can be found in the Releases section at GitHub.

Startup issues on macOS

sasfit.command error on macOS

In case of this error about an unidentified developer (because we are not registered with Apple yet) one possible 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.

Building from source

Windows

(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

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

macOS

(Tested with Catalina 10.15)

On a fresh system, install the required development tools with Homebrew:

% brew install git cmake gcc
% 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

Linux

(Tested with Ubuntu 20.04 LTS)

On a fresh system, install the required development tools:

$ sudo apt install git build-essential cmake gcc

Additionally install the X11 development packages:

$ sudo apt install libx11-dev

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

Common helpers

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).

To do

A list of technical details to be fixed or changed in mid-term scope is documented in todo.md.

Sponsors

Hosted By: Cloudsmith

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.