SASFIT software

The famous question of the uninitiated in small-angle scattering is: “Do you have a bit of software which will give me an answer from my data?”. After a lengthy explanation (coloured with some anecdotes) about why small-angle scattering is not a uniquely defined problem with an often unique answer such as wide-angle diffraction might be, the new user is then left with a copy of Matlab or Fit2D and asked not to return until he has a more “sensible” question. I guess this is because there are not many alternative treatments for these users. These days, I may also give them a copy of the most recent SAXSGUI, but since this lacks quite some fitting functions, it is only really useful for users who already know what they are doing and can program their own 1D or 2D fitting functions. An all-in-one package that is not only good for beginning users but can also remain a useful tool for advanced users is not something which I’ve seen so far. Until now, that is.

I’d like to draw your attention to a very useful software package for anyone working with isotropic small-angle x-ray/neutron scattering data called SASFIT and can be found here. I noticed this package only last month during the SAS09 conference in Oxford, but I have been told that it has been under development for quite some years now by Joachim Kohlbrecher and Ingo Bressler. It comes precompiled for OS X (Macintosh) as well as for some other unmentionable operating systems, so colour me happy.

The one thing that struck me as particularly good about this package is its completeness. I think you will be hard pressed to find any other package containing as many form factors and structure factors to fit your 1D data as this package. On top of that, all the functions are described in the documentation, so if nothing else, do take a look at that (and ste– recode the functions in your favourite language of choice if you must).

The code is open source (as opposed to some other SAS fitting software which is more like a black box) and it has been written in C. While it is not the language I’m familiar with, it is a very good choice. Much more readable than FORTRAN (in which much of the other software is written), can be compiled on a plethora of platforms, and is a language which is the backbone of much good software (i.e. it doesn’t change much over time, it has been around for a while, and it will be around for a while).

To get going, you must have your data in a format readable by SASFIT, and the easiest data format is to have your data in an ASCII-readable file with three columns, q, I, and the error in I (although the last is not necessary). That means you must preprocess your data using your own tools to obtain it in this form, for example using the binning method described two weeks ago, which will supply you with data-points with equal error. Once that is done, you can use your binned data as input into SASFIT.

When using the software, I must say it was not the most intuitive software I have ever used. The TCL/TK interface is partly to blame for this, as it’s not very well integrated with OS X, and therefore appears awkward and occasionally “hangs”. Reading the manual is therefore recommended for this software, to prevent premature baldness. Once you get going, though, it’s very good. Initially, applying some random fitting functions to my data resulted in many (not very straightforward) errors, which could be resolved when setting the parameter boundaries for the fitting parameters correctly. If you do not do that the fitting may optimise parameters to “impossible” values, which subsequently results in impossible intensities, impossible residuals, and impossible optimisation criteria. Once you set the limits correctly, it works much better, and good results can be obtained.

During my initial test, I found the optimisation algorithm to be not so robust. This is likely due to my choice of fitting function, but from my experience with the Matlab “fminsearch” and “fminsearchbnd” functions, I had expected these to work a little better. The fitting is also rather slow, which may be due to the continuous updating of the fitting curve in the graphical display.

These experiences of an inexperienced user aside, I would very much recommend this package to anyone working with 1D SAS data. It holds much promise, contains a hell of a lot of fitting functions, is well documented and open source, and in my eyes is essential software for all levels of users. If it becomes slightly easier to use off-the-bat (i.e. with preset sensible parameter limits for each fitting function, some pre-loaded example data and a good welcome screen pointing you at the place to start) our lives would become a lot easier: “Take this package, little man, and don’t come back until you have a sensible answer!”.

Be the first to comment

Leave a Reply

Your email address will not be published.


*


*

This site uses Akismet to reduce spam. Learn how your comment data is processed.