Fitting small angle scattering data in SasView version 5.0.3

page contents by Dan McDowall

This document will guide you through how to use the SasView software to load and fit small angle scattering data to models. A PDF version is available here.

Training data files for practicing with SasView are available here: 2NapFF_Solution.txt, PBI-A_pH4_20%MeOH_BgSub_D4.dat, and PBI-A_pH6_20%MeOH_BgSub_D7.dat. After clicking on the links, you’ll be taken to a page where Google is trying to display the file. It will fail but just click on the download icon in the top right of the page to save the file to your computer.

1      SasView Information

We use the SasView fitting software to fit small angle scattering data. It is free software that can be downloaded at https://www.sasview.org/. The software changes as new versions are released, therefore it is important to note which version of the software you use to fit a set of data as new versions may change the fitting. This guide is for SasView version 5.0.3. When in the software, the version you are using can be found by going to “Help” and then “About”. In the screenshot below you can see that SasView 5.0.3 is being used.

Shows 5.0.2 but guide still applicable to 5.0.3.

1.1     Useful information sources

Listed here are a few useful information sources.

2      Basics of SasView

The screenshot below shows the SasView window upon starting the software. On the left you have the “Data Explorer” panel from which data can be loaded and controlled. The fit panel is in the central workspace of the software.

2.1     Data Explorer Panel

The data explorer panel is used to load SAS data into the program. From here it can then be sent to the fit panel or plotted.

2.1.1    Loading data into SasView

Typically we are provided with scattering vector (Q) vs intensity data after our experiments by the beamline scientists. This is obtained by radially averaging the 2D scattering pattern obtained from the instrument. Additionally a background subtraction should already have been done by the beamline scientist. The data is loaded into SasView as follows.

  • Click on “Load data” then navigate to where the scattering data is stored. For SAXS data from Diamond Light Source, this comes as a DAT file.
  • Select the file and click open.
  • The data will now be displayed in the Data Explorer panel.

Next to each data set in this panel there is a tick. To take an action on a data set this box must be ticked.

2.1.2    Plotting the data

Before attempting to fit the data it is best to study the scattering curves by eye. This will allow you to compare data, check to see there are no obvious problems with the data (such as background subtraction errors) and give an idea of which models may be suitable.

With the box next to the file name ticket, the data can be plotted by clicking “Create New” in the Plot box within the Data Explorer panel. This has been done in the below screenshot.

The data shows low scattering intensity with larger error bars at high Q and high scattering intensity at low Q.

The error bars can be removed by right clicking on the plot hovering over the name of the data set and clicking “Hide error bars”

If multiple data sets are ticked when creating the plot, they will be plotted together. In the screenshot below both the pH 2.0 and pH 4.5 data are displayed. Plotting the data like this is useful for quickly studying and comparing by eye. For example, in the data shown you can immediately see higher scattering intensity at low Q for the pH 2 data.

2.1.3    Sending data to the fit panel

To start the fitting process use the “Send data to” button at the bottom the data explorer panel. Make sure that “fitting” is selected in the drop down box next to this button. The data must be ticked in the data explorer panel. Only do this to one data set at a time.

This is shown in the screenshots below.

You are now ready to begin the fitting process.

3      Data Processing

3.1     Background subtraction

Note; if the background subtraction has already been performed (ask the person who gave you the data), you can skip this step.

The scattering vector vs scattering intensity plots represent a combination of the scattering of both the self-assembled structures and the solvent used. In order to properly analyse the data of the self-assembled structures, the scattering from the solvent must be subtracted from the data. As such, it is imperative that the scattering of just the solvent is collected during the scattering experiments. The instructions here will guide you through doing this in the SasView software.

There are a few important points to raise first. This process cannot be done if the data sets have a different number of points. This should not be an issue if the background and the sample were measured on the same beamline with the same settings. You probably couldn’t use a solvent background measured from a different beamline (and it wouldn’t be good practise to anyway!). Also, doing the data subtraction process can give you greater insight into your data than if you are given it already subtracted. You should use this opportunity to study the data and try to deduce what it is showing you.

3.1.1    Background subtraction method

  1. Load the averaged scattering data of the solvent and the sample into SasView. Before doing the subtraction it is advised to plot and study both the solvent and the sample data. This will give you a better understanding of your data. Below is a plot of scattering vector vs scattering intensity for both the solvent (water) in blue and an aqueous solution of 10 mg/mL PBI-V at pH 6 in orange.
  1. In SasView, to subtract the solvent data from the sample data, navigate to the “Tool” button on the bar at the top and click on “Data operation” in the sub-menu. This brings up the panel shown below.
  1. Input a name for the background subtracted data, ensuring to include important details, in the “Output data name” box. For example, “201029_SAXS_031_8_water_sub” gives the date the data was processed, the sample name and that it has been background subtracted.
  1. In the “Data 1” dropdown box select the sample data. In the next dropdown box select minus and in the “Data 2” dropdown box select the solvent data. A preview of the scattering data is shown beneath each.
  1. Press compute and the subtracted data will appear in your data explorer panel. From here it can be plotted (shown below) and fitted. At this stage it is essential to save this data. Right click on it in the data explorer panel and click save as. Save the data as a .txt file (this is the default). This can then be re-opened in SasView or plotted in a graphing software such as Origin.
  1. The data is now ready for model fitting.

3.1.2    Potential issues

There are some important issues to look out for in your data after the subtraction.

  • Increase in scattering intensity at the high Q.
  • Large error bars or intensity drop off at high Q.

3.1.3    Modifying the background

If the background subtraction process results in large error bars and low intensity at high Q then the background can be adjusted to account for this. Using the data operation function as before the intensity of the background data can be reduced, meaning that when the background is subtracted, large error bars do not appear.

An example of this “over-subtraction” is shown below (green data).

The intensity of the background sample can be reduced slightly using the data operation panel. In this instance, the background data is loaded into the “Data1” box and the multiply function selected. Then in “Data2”, “Number” is selected and the data set is multiplied by a number that is less than 1. This reduces the intensity of the background. Only a small amount of intensity should be removed (so multiplying by 0.6-0.9 is acceptable). If, to get the data to not be noisy, you are reducing the background intensity by half (multiplying by 0.5 or less) then you should stop. In this instance there is probably a more significant issue with your data.

A screenshot of this process is shown below. Again, give the output data a sensible name.

The screenshot below shows the water background before and after this process.

Next, you perform the background subtraction as normal but select your reduced intensity background sample for the “data2” box. This subtracts you reduced intensity background from the sample.

As can be seen in the below image, this process has significantly reduced the size of the error bars are high Q.

4      Model fitting in SasView

The aim of the fitting process is to fit the data to a suitable model. This can provide information about the structures present in a sample.

4.1     The Fit Panel

Below is a summary of the purpose of each tab within the fit panel. It is important to be familiar with them before starting the fitting process.

4.1.1    Model tab

The model tab is where different models are selected and used. There are a large number of models to choose from. Once loaded in, the parameters contained within the model will be displayed here. This is where each parameter within a model is selected and controlled during the fitting process.

4.1.2    Fit options tab

The fit options tab within the fit panel can be used to change the fitting range. Ideally you would not need to change this but it is sometimes necessary based on the data.

For example, in the data below the scattering intensity drops off at low Q (towards the left of the x axis). The overall scattering intensity is low for this sample and this drop off in intensity may be due to the background subtraction. For this reason the fitting range was reduced to 0.08 – 0.44 Å-1. This data was fitted to a spherical model which depicts spheres of ~10 Å.

The fit options tab also shows you the number of data points in the data set as well as allowing you to change the weighting. Weighting is discuss in the assessing fit quality section. There is no reason to change this.

4.1.3    Resolution

Resolution is not relevant here and should be left as the default which is “None” for instrument smearing.

4.1.4    Polydispersity

When polydispersity is enabled by ticking the relevant box in the model tab, the polydispersity tab becomes available. This is discussed in further detail later. Polydispersity is used to fit systems which do not have monodisperse structures but must be used with caution and uses more computing power.

4.1.5    Magnetism

This panel is not available by default and is not relevant to this guide.

4.2     Choosing a model

Scattering data on its own with no further structural information is limited. SasView has a large number of models with which to fit your data and in all likelihood you could get scattering data of a low molecular weight gel to fit to a model that is not remotely representative of the structures you have. Therefore, using good practise you would use nanofibers seen in an SEM image of a sample to justify selecting some form of cylinder model when fitting the scattering data. Alternatively, previous literature on the same materials may fulfil this purpose and give you a basis for which model to select.

Once a general type of model is selected, there are often variants within this. For example, there is a cylinder model as well as a flexible cylinder model available. The cylinder model is simpler than the flexible cylinder model and uses fewer parameters. It is always best to start with a simpler model first and move to more complex models if a good fit cannot be achieved.

4.2.1    Getting a feel for the models

Before starting to fit data it is useful to get a feel for the models that are available and what the scattering vector vs intensity plots look like. You can use the fit panel to display and play around with models with no experimental data involved.

If you haven’t loaded in any data (says “No data loaded” in the top left of the panel) you can start from here. If you have already have data loaded in go to “Fitting” in the top left and click “New fit page”. This will open a blank fitting page with no data loaded.

Using this new, blank fitting page select a category of model such as cylinder and then select the cylinder model within the model name drop down box. Don’t select a structure factor. This now opens the cylinder model with each parameter.

Leave the values as default and click “Calculate”. Once that is complete click “Show plot”. This then shows you the scattering vector vs scattering intensity plot for that model with the default parameters. If you play around with the parameters, such as increasing the length to 1000 Å and radius to 60 Å the model will re-calculate scatting intensity based on this. Simply click on the “value” box for each parameter and type in the new number and press enter. This is shown below where you can see the shape of the model changes significantly.

Theoretical scattering intensity of a cylinder model with a radius of 60 Å and length of 400 Å.
Theoretical scattering intensity of a cylinder model with a the radius changed to 20 Å and the length increased to 3000 Å.

You can do this for the various different models to get a feel for what the models look like and how each parameter changes the data.

4.3     Fitting parameters

This section summarises the fitting parameters that are present in most models.

The parameters change with each model that is selected. For further reading about each model and the parameters within it select a model in the fit panel and then press the “Help” button in the bottom right of the panel. This takes you to the SasView website and gives you details about that specific model.

4.3.1    Scattering length densities

The scattering length density (SLD) is a measure of the “scattering power” of a material. Each scattering entity has an intrinsic SLD but the SLD also increases with physical density.

SLDs for both the solvent and the material you are studying are required as part of the fitting procedure. These can be calculated on the NIST Center for Neutron Research website (Follow this link https://www.ncnr.nist.gov/resources/activation/). The difference between the scattering length densities of the material and solvent provide the contrast required to achieve neutron and X-ray scattering. Once obtained the values are input into the model and kept fixed during the fitting procedure.

Below is the NIST SLD calculator.

SLD values for the PBIs and other gelators have previously been calculated.

In the calculator shown above, a value of 1.55 can be used for the density for most low molecular weight gelators.

4.3.2    Scale

This fitting parameter scales the fit to an intensity appropriate to the experimental data. It can be related to the concentration of the structures that the scattering comes from. A small scale (due to low scattering intensity) indicates either that there is a low concentration of the structures or that they scatter weakly.

When using a combined model each component of the model will receive its own scale (typically called A scale and B scale). In this instance these are the ones that you use to fit. The overall scale must be kept at 1.0 and not fitted. The relative values of each scale represents how much of the fit uses each model.

4.3.3    Background

The background represents the background intensity that is picked up by the detector. This is seen at high Q where the intensity flattens and there are large error bars. The correct fitting of the background is important for the fit as a whole.

4.4     Fitting data

4.4.1    General fitting procedure

As has previously been discussed, the aim of the fitting process is to select a viable model with which to fit the data and then attempt to get a good fit. If a good fit can’t be achieved, another model is selected and attempted to be fitted to. If this fails the same models can be attempted but the polydispersity of different parameters can be varied.

As an example, you may have SEM images of a sample that show 1D structures present. Therefore you would select some form of structural model that represents 1D structures with which to attempt to fit the data. You may start with a cylinder model (the simplest form of cylinder model) and not get a good fit. Then moving to a flexible cylinder you get a slightly better fit. Then having tried each form of cylinder model you still find the flexible cylinder to give the closest fit you could investigate change the polydispersity of the radius within the flexible cylinder model. If then this gave you a sufficiently good fit (how to decide whether a fit is acceptable is discussed later) you would be fairly confident you have chosen the model that best fits the data.

It is important to undertake this time-consuming and thorough approach to ensure the data is fitted as well as possible.

Important points

  • Data should be attempted to be fitted to as few parameters as possible. Using more complex models with fewer parameters runs the risk of over-fitting the data, in which the obtained values lose meaning.
  • Just because a data set has been fitted to a structural model it doesn’t necessarily mean the structure is exactly the dimensions that your fit suggests. Experimental and fitting errors do exist.
  • A data set may be sufficiently fitted to two or more different models. In this instance, either both are presented or there may be reason to suggest one is favoured over the other (such as a subtly lower fitting error).

Summary of the fitting process

This is a quick summary of the process as undertaken in SasView.

  1. Select a model and adjust the Q range if necessary.
  2. Input scattering length densities (SLDs) and keep them fixed throughout.
  3. Fit the scale.
  4. Fit scale and background. Once the background is fitted this is also kept fixed throughout.
  5. Fit the scale and each parameter individually.
  6. Repeat the fitting of scale and individual parameters.
  7. If this fit becomes sufficiently close to the data fit the scale and all of the parameters together. This should bring the fit very close to the data and give a reduced chi squared of <5.
  8. If not attempt a different model or apply polydispersity.
  9. Check that the values are reasonable. (No cylinder with radii smaller than atoms or with lengths larger than earth!)
  10. Copy the result and export the data.

4.4.2    Step-by-step fitting of SAXS data

In this section the step-by-step fitting of data from a 5 mg/mL PBI-F solution at pH 5 is shown. It is SAXS data from the B21 beamline at Diamond Light Source.

The SAXS data is shown in the screenshot below.

  1. Having loaded in the data you wish to fit, ensure the box next to the file name in the data explorer panel is ticked. Then click “send data to” with “fitting” selected in the drop down box to the right. This sends that data set to the fitting panel. In the top left of the fitting panel it now says “Data loaded from: PBI-F_pH5….”
  2. From previously published work it is known that PBI-F self-assembles into 1D structures so it is likely that some form of cylinder model is most suitable to use for the attempted fitting. Therefore “cylinder” is chosen as the model category.

At this stage the fit panel looks as shown below.

The way to approach this is to start with simpler models (with fewer parameters) and try to fit them to your data. If the model cannot be fitted to the data you then move to more complex models.

For example if a cylinder model does not work you could then try the flexible cylinder model. The simple cylinder models depicts rigid cylinders but often the 1D structures are curved or bent therefore may require a flexible component. If none of the models are suitable polydispersity can be used to fit the data. This should be used as a last resort.

As you increase the number of parameters that are being used to fit the data you can be at risk of overfitting the data and the numbers obtained from the fitting lose their meaning. This is particularly the case when using combined models which will be discussed later. A reduced chi squared (see assessing fit quality) of <1 may indicate overfitting.

  1. Next click “Show Plot” and the software will bring up two plots, one showing the SAXS data (blue circles) with the fit (orange line) and the other showing the residuals from the fit (see assessing fit quality). See the example below.

The SAXS data and fit are in the above plot and the residuals below.

As you can see the fit is currently far off from the data. This is also represented in the residuals. The aim of fitting is to bring this as close to the experimental data as possible by capturing both the shape and intensity of the data.

  1. Before starting the fitting process it is important to check the data.

There may be various reasons why you do not want to fit all of the data (at least to start with). For example for this data at low Q there is a kink derived from a background subtraction error. We do not want to include this in the fitting so we go to the “Fit Options” tab and reduce the fitting range. The min range is changed to 0.006 Å. Upon returning to the model tab it adjusts the fit line to not include the data <0.006 Å. See the screenshots below.

Full fitting range. Red circle shows where to change the fitting range.
Shortened fitting range 0f 0.006 – 0.44 Å-1.The kink in the data (red circle) is no longer included in the fitting range.
  1. Next the calculated SLDs are input into the “value” column in the fitting panel (see screenshot below). The SLDs are kept fixed during the fitting process.

At this point it is prudent to copy the parameters by going to “Edit” and “Copy params”. This means should anything go wrong during the fitting process you can use “Paste params” to bring you back to this point. This function is useful throughout the fitting process so you don’t lose your fit if the fit gets stuck or software crashes.

Screenshot showing a fitting panel with the SLDs input (red circle).
  1. To select which parameters are fitted at each stage tick the box to the left of them. The SLDs are never ticked as they are kept fixed.

To start the fitting process the scale is fitted first. Tick the box next to scale and click fit. This scales the fit to the intensity of the experimental data but the shape is wrong because the shape parameters are yet to be fitted. Note: The scale box is kept ticked during every fitting step.

Also note the fitting error (χ2) shown in the red box of the screenshot is very large at this point. As the fit gets closer to the experimental data this number will decrease. We aim to ideally have a χ2 of <5. See the “Assessing fit quality” section of this guide for further information.

Red box showing the location of the reduced chi squared (χ2) value
  1. Next the background is fitted. Fit scale and background (both parameters ticked at the same time). In this instance the background goes negative when fitted so it is set back to 0.001. The current background is not far off the experimental data so we can continue to fit the other parameters. When the fit is closer to the data the background will be fitted again.

Typically the background should fit to a reasonable value and is then kept constant for the rest of the fit.

When the background goes negative as seen above.
  1. Now we are ready to fit the other parameters. This process involves fitting the scale with each relevant parameter individually.

First fit the scale and the radius. The radius has increased to ~52 Å and the fit has changed.

  1. Next fit scale and length (remember to untick the previous parameter). The length has increased to ~8800 Å.

As you fit it is important to check that the values are realistic. In this instance many of the 1D structures we study have lengths longer than can be captured using this SAXS setup. In this fitting step the length has fitted to a value greater than can be measured using this SAXS setup but is not an unrealistic number. This means there is a greater uncertainty associated with this value and essentially tells us that they are longer than can be measured. Sometimes upon fitting a parameter it may go to an unreasonable number. For example when fitting length it can go to an unrealistic number (such as 3×1026 Å!!!). In this instance it is best to set the length to a large value (such as 5000 Å) and not fit it any further.

  1. Now the fit is slightly closer to the experimental data we attempt to fit the background again. Fit the scale and background together. In this instance the background has gone very high and is not going through the data at high Q.

Once again it is set back to 0.001 cm-1. In this instance when the background won’t suitably fit to the data it is acceptable to fix the value. It is important to make it clear that this is what has been done when reporting the results.

  1. Next the scale and radius are fitted.
  1. Next the scale and length are fitted. At this stage the fit is not getting closer to the data which suggests that the model is unsuitable.
  1. The scale and radius and length are all fitted together. The fit is not much closer to the data, suggesting that this model is unsuitable.

Next we move to a different form of cylinder model.  It is important to try all of the different avenues (within reason) in order to find the best fit to the data.

  1. Having tried many different models (all the steps not shown here!) this data can be suitably fitted to a flexible elliptical cylinder model.

In the screenshot below, individually fitting each parameter with the scale (as discussed above) has been done multiple times, lowering the reduced chi squared and bringing the fit closer to the experimental data.At this point, where the fit is relatively close and you have spent a bit of time fitting the data, it is useful to copy the parameters using “copy params”.

From this point where the fit is close to the experimental data all the parameters are fitted together.

In this case the fitting is successful (see screenshot) with a reduced chi squared of 3.8 and the fit is very close to the experimental data.

This fit depicts flexible elliptical cylinders with a minor axis radius of 10 Å, an axis ratio of 5 and a Kuhn length of 27 Å. The Kuhn length corresponds to the flexibility of the cylinders and is in this case small, suggesting the cylinders are very flexible. The length is longer than can be measured with this technique.

4.4.3    Polydispersity

Without polydispersity the models assume that the structures are monodisperse. In the real world this is often not the case.

Polydispersity is used as a last resort if you cannot get any appropriate model to fit to the data. Polydispersity can be changed from 0 to 1 but typically you should not use a polydispersity of greater than 0.3. When using polydispersity, incrementally increase the value used. For example, start with 0.1 and work up in increments of 0.05.

When using a polydispersity the fitting process takes longer and can lead to crashes of the SasView software.

As an example, two identical models, one without polydispersity and one with a polydispersity of radius of 0.2 are shown below.

A cylinder model with no polydispersity.
A cylinder model with the same parameters using a polydispersity of radius of 0.2.

How to apply polydispersity

  1. To add polydispersity while fitting, get the fit as close as possible to the data first and then start using polydispersity.
  1. Go to options and tick polydispersity.
  1. Next go to the polydispersity tab in the fit panel and add a value between 0 and 1 for PD[ratio]. It is best to start small. So I input 0.1.

Do not tick the box next to the parameter. If ticked this fits the polydispersity, we only want to apply a defined value of polydispersity.

  1. Next go back to the model panel and fit the scale (see below screenshot). This will implement the polydispersity change. A small graph displaying the polydispersity will appear and the fit should change.

Expanding the radius line by clicking the “+” buttons shows the size of the polydispersity used.

  1. Next fit the scale and radius (the parameter we have given polydispersity). See below screenshot.

As can be seen the addition of polydispersity has “smoothed” the bumps in the data at high Q slightly.

  1. Having incrementally increased the polydispersity of radius by 0.05, up to a value of 0.3 showed that the polydispersity does not greatly improve the fit. The fit is far from the data at high Q.

4.4.4    Combined model fitting

Depending on the solution conditions there may be a co-existence of two (or more) different structures. For example, for low molecular weight gels this may be at an intermediate pH where self-assembly has started and there is a co-existence of 1D structures and smaller aggregates. For systems like this, the scattering patter will reflect this co-existence, meaning it can’t be fitted to one model. Here, combined models can be used to fit the data. Combined models should be used carefully as they can easily result in overfitting the data.

Any of the models provided can be combined using the “Add/Multiply Models” function.

Navigate to “Fitting” and click “Add/Multiply Models”.

This opens the “Easy Add/Multiply Editor”.

Give the model an appropriate name, this should be a short number of characters. So a flexible cylinder model combined with a sphere should be something simple such as “FC_Sph”. Then in the description write a useful summary such as “Flexible cylinder + Sphere model”

Then in the model selection section choose the models that are to go into that model. Leave the default setting to add (+) the models together.

Click apply to combine the models. There will be a notification in the Log Explorer (bottom left) telling you if the process has been successful.

The combined model can now be used as you would any other. To find the model in the Fit Panel choose “Plugin Models” as the model category and then find the model you created in “Model Name”. See the screenshot below.

The parameters are divided into A and B categories. The A and B denote the different models. From the parameters for each you can see that A represents the sphere (radius is the only structural parameter) and B represents the flexible cylinder.

Each model within the combined model has a scale (A_scale and B_scale). These are the ones that are fitted. The overall scale (the one normally used) at the top is set at 1.0 for the fitting process and not fitted.

If the co-existing structures are made from the same material (say two different self-assembled structures of a perylene bisimides) the SLDs are filled in the same.

If you had a co-existence of two different materials (say a micelle of one compound and 1D structures of another) you need the SLDs of each component.

The SLDs of the solvent must also be input in both A and B.

4.4.5    When a fit gets stuck in an energy minimum

Sometimes the fitting process can get “stuck” where fitting does not bring the fit closer to the data but is clearly an incorrect fit.

In the example below we are trying to fit the data to a spherical model. A Q range of 0.08 – 0.44 Å is used due to the drop off in intensity at low Q. A spherical model has been chosen based on the overall scattering intensity is low. The lack of intensity at low Q suggests that the structures are not large.

Upon fitting the scale and the radius the radius goes to 48.6 Å. The shape of the fit is not close to the data but fitting is not bringing it any closer. This occurs sometimes when the fit falls into a minimum. To get around this you can manually change the parameters to try and bring the fit closer to the data. This should be done with caution.

To start, copy the parameters so you can get back to this point again easily.

Then manually set the radius to a different value and fit scale. The radius is set to 100 Å and the scale fitted.

Above you can see that setting the radius to 100 Å has increased the number of bumps and made it less similar to the data. Next, try adjusting the radius to a lower number than 48 Å. So I set radius to 11 Å and fit the scale.

Now the fit is much closer to the data, which appears we are now closer and should be out of the minimum in which the fit was stuck.

Now we can continue the fit as you would normally.

A good fit has be achieved but it is important to note down that you have done this when saving the data.

Due to fitting with a significantly reduced Q range, the reduced chi squared value is less than 1 here.

4.4.6    Finishing a fit

When a fit is finished it is important to check that the values are reasonable and that they are consistent with information you may have through other methods (such as an SEM image of the nanofibers).

Overfitting

Overfitting is something to be wary of when fitting SAXS data. This can happen when using models with many parameters, combined models and polydispersity. In the event of overfitting the values obtained from the fit can lose their significance. Typically a reduced chi squared of less than 1 indicates overfitting. If this happens it is best to try and simplify the fitting parameters, such as by using a simpler model or reducing the polydispersity.

4.4.7    Copying the parameters and exporting data

When saving the data from the fit the main things that need to be saved are;

  • The experimental data (scattering vector vs scattering intensity)
  • The fit data (scattering vector vs scattering intensity)
  • The fit parameters (length, scale etc)
  • The reduced chi squared value
  • The polydispersity value (if used)
  • Optional: A screenshot of the SasView page (allows for easy viewing of the data)

Below is an example of how you could save fitting data to ensure you have all the information you need. There is by no means a right answer, as long as you have all the information needed.

Copying the fitting parameters

To copy the fitting parameters from the fit panel navigate to “Edit”, “Copy params to format” and click “Excel”. This copies the data to your clipboard so can be directly pasted into Excel.

Ensure to also write down the model used, the fitting range (Q range) and the fitting error.

Exporting data

The experimental and fit data can be exported to .txt files as follows.

Right click on the plot and an options panel comes up. Within the panel it contains the filename “PBI-F…” as well as the fit which in this case is called “M1 [PBI-F…]”. With each of these navigate into the options and click “Save Point as a file”.

Save the data and the fit file as .txt files.

Once saved go into excel and open the .txt file.

Separate the columns with the “Fixed width function”

Then adjust the column width with the arrows to ensure that the data is separated into three columns (two columns for the fit data as it does not have y error bars).

Click finish and the data will be in Excel. From here it can be plotted or easily copied into Origin.

Report Results function

The data can be reported in a clear way quickly using the SasView “Report Results” function. Navigate to “Edit” and click “Report Results”. This instantly displays all the data and can be saved as a .pdf file. This does not give you the data in an Excel format from which you can make your own graphs and tables however.

4.5     Assessing fit quality

SasView provides two ways in which you can assess the quality of a fit to a data set. I have briefly summarised these below but more information can be found on the SasView website (http://www.sasview.org/docs/user/qtgui/Perspectives/Fitting/residuals_help.html)

4.5.1    Residuals

The residuals represent the difference between your experimental data and the fit data. SasView calculates the residuals for each data point in the fit. When you click “Show plot” in the Fit Panel you are provided with your data and the fit plotted on one panel (graph 13 below) and the residuals (graph 14 below) plotted in another.

An example of the residuals to a fit of a flexible cylinder.

4.5.2    Reduced Chi Squared

The fitting provides a χ2 (Chi squared) value, which is a useful number for gauging the quality of the fit to the data. Further details can be found on the SasView website. Typically we look for a Reduced Chi2 value of less than 5.

4.5.3    Weighting

The calculations for both the Reduce Chi Squared and the Residuals utilise a weighting factor. This can be changed in the “Fit Options” panel. SasView selects “Use dI data” as a default for the weighting. Use this default setting but be aware that if you do change it this will change the reduced chi squared and residuals.