Skip to content

SASfit/SASfit

Repository files navigation

Latest Download SASfit on Zenodo

Build status Windows Build status macOS Build status Linux

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

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.

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:

Versions and Changes

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

MacOS Startup issues

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

no display name and no $DISPLAY environment variable

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.

SASfit is from an unidentified developer

sasfit.command error on macOS

Solution A

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:

Open sasfit.command on macOS

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

Confirm Security Exception for opening sasfit.command on macOS

Solution B

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.

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

macOS

(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

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 

As well as gsl and fftw3 library

$ sudo apt install libgsl-dev libfftw3-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).

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.