Index: .travis.yml
===================================================================
--- .travis.yml	(revision a4974faeb601edd2f64a5007601948ef1f10ab35)
+++ .travis.yml	(revision 58918dead841ea3835871dd227fc166cb1dd7b61)
@@ -12,17 +12,27 @@
   system_site_packages: true
 before_install:
-  - 'if [ $TRAVIS_PYTHON_VERSION == "2.7" ]; then sudo apt-get update;sudo apt-get install python-numpy python-scipy python-matplotlib; fi'
+  - 'if [ $TRAVIS_PYTHON_VERSION == "2.7" ]; then sudo apt-get update;sudo apt-get install python-numpy python-scipy python-matplotlib libhdf5-serial-dev python-h5py fglrx opencl-headers python-pyopencl; fi'
 
 install:
   - pip install -r build_tools/requirements.txt
+
+before_script:
+  - "export DISPLAY=:99.0"
+  - "sh -e /etc/init.d/xvfb start"
+  - sleep 3 # give xvfb some time to start
+  
 script:
-  - export WORKSPACE=/home/travis/build/SasView/sasview/
+  - export WORKSPACE=/home/travis/build/SasView/
+  - cd $WORKSPACE
+  - git clone --depth=50 --branch=master https://github.com/SasView/sasmodels.git sasmodels
   - export PYTHONPATH=$WORKSPACE/sasview-install:$WORKSPACE/utils:$PYTHONPATH
+  - cd $WORKSPACE
+  - ls -ltr
   - if [ ! -d "utils" ]; then mkdir utils; fi
-  - /bin/sh -xe build_tools/jenkins_linux_build.sh
-  - /bin/sh -xe build_tools/jenkins_linux_test.sh
+  - /bin/sh -xe sasview/build_tools/travis_build.sh
+#  - /bin/sh -xe sasview/build_tools/jenkins_linux_test.sh
   - export LC_ALL=en_US.UTF-8
   - export LANG=en_US.UTF-8
-  - python setup.py docs; echo 0
-  - python setup.py bdist_egg --skip-build
+#  - python setup.py docs; echo 0
+#  - python setup.py bdist_egg --skip-build
 
Index: Vagrantfile
===================================================================
--- Vagrantfile	(revision 072b52cd18b9b25ae7d9b369e6b613da2b7aff70)
+++ Vagrantfile	(revision 601b93d4f5d0df9b804d41b2f5cd81359a7dd583)
@@ -21,6 +21,5 @@
   # Every Vagrant development environment requires a box. You can search for
   # boxes at https://atlas.hashicorp.com/search.
-  config.vm.box = "ubuntu1404"
-  config.vm.box_url = "https://github.com/hnakamur/packer-templates/releases/download/v1.0.2/ubuntu-14-04-x64-virtualbox.box"
+  config.vm.box = "ubuntu/trusty64"
   #config.vm.box = "fedora19"
   #config.vm.box_url = "https://dl.dropboxusercontent.com/u/86066173/fedora-19.box"
Index: build_tools/sasview_deploy_test.au3
===================================================================
--- build_tools/sasview_deploy_test.au3	(revision 55bbe0b27a20e96052e70b3b233bcf5dff44cea3)
+++ build_tools/sasview_deploy_test.au3	(revision e9f8208976730e8b55d9cbc48c4d9bfc30db61ec)
@@ -92,8 +92,9 @@
    ; Start app - DEBUG ONLY
    ;;Run("C:\Program Files (x86)\SasView\SasView.exe")
+   local $sActiveWindow = "SasView  - Fitting -"
    Local $iFailFlag = 2
    ; Wait for the window
    Sleep(1000)
-   Local $hWnd = WinWaitActive("SasView  - Fitting -", "", $lTimeout)
+   Local $hWnd = WinWaitActive($sActiveWindow, "", $lTimeout)
    Assert($hWnd, $iFailFlag)
 
@@ -113,9 +114,27 @@
    ControlClick($hWnd, "Send To", 231)
 
-   ;; Choose a model
+   ;; Choose a python model
    ControlCommand($hWnd, "", "ComboBox3", "SetCurrentSelection", 1)
-
    ;; Calculate the model
    ControlClick($hWnd, "Compute", 211)
+   ;; Assure we got the charts
+   Local $hPlot = WinWait($sActiveWindow, "Graph2", $lTimeout)
+   Assert($hPlot, $iFailFlag)
+   $hPlot = WinWait($sActiveWindow, "Graph3", $lTimeout)
+   Assert($hPlot, $iFailFlag)
+
+   sleep(1000)
+   ;; Calculate a compiled model
+   ControlClick($hWnd, "Send To", 231)
+
+   ;; Choose Shapes/Cylinder
+   ControlCommand($hWnd, "", "ComboBox2", "SetCurrentSelection", 1)
+   ControlCommand($hWnd, "", "ComboBox3", "SetCurrentSelection", 11)
+   ;; Calculate the model
+   ControlClick($hWnd, "Compute", 211)
+
+   ;; Assure we got another chart
+   $hPlot = WinWait($sActiveWindow, "Graph4", $lTimeout)
+   Assert($hPlot, $iFailFlag)
 
    ;; Close SasView
Index: build_tools/travis_build.sh
===================================================================
--- build_tools/travis_build.sh	(revision 68e6ac8dfb8e0ac6022e1d579d09bf5e755c908e)
+++ build_tools/travis_build.sh	(revision 68e6ac8dfb8e0ac6022e1d579d09bf5e755c908e)
@@ -0,0 +1,48 @@
+# Simplified build for Travic CI
+# No documentation is built
+export PATH=$PATH:/usr/local/bin/
+
+PYTHON=${PYTHON:-`which python`}
+EASY_INSTALL=${EASY_INSTALL:-`which easy_install`}
+
+export PYTHONPATH=$PYTHONPATH:$WORKSPACE/sasview/utils
+export PYTHONPATH=$PYTHONPATH:$WORKSPACE/sasview/sasview-install
+
+# SET SASVIEW GITHASH
+cd $WORKSPACE/sasview/sasview
+githash=$( git rev-parse HEAD )
+sed -i.bak s/GIT_COMMIT/$githash/g __init__.py
+
+# SASMODELS
+cd $WORKSPACE/sasmodels
+rm -rf build
+rm -rf dist
+$PYTHON setup.py clean
+$PYTHON setup.py build
+$PYTHON setup.py bdist_egg
+
+# SASVIEW
+cd $WORKSPACE/sasview
+rm -rf sasview-install
+mkdir  sasview-install
+rm -rf utils
+mkdir  utils
+rm -rf dist
+rm -rf build
+
+# INSTALL SASMODELS
+cd $WORKSPACE/sasmodels/dist
+$EASY_INSTALL -d $WORKSPACE/sasview/utils sasmodels*.egg
+
+# BUILD SASVIEW
+cd $WORKSPACE/sasview
+$PYTHON setup.py clean
+$PYTHON setup.py build docs bdist_egg
+
+# INSTALL SASVIEW
+cd $WORKSPACE/sasview/dist
+$EASY_INSTALL -d $WORKSPACE/sasview/sasview-install sasview*.egg
+
+# TEST
+cd $WORKSPACE/sasview/test
+$PYTHON utest_sasview.py
Index: docs/sphinx-docs/source/conf.py
===================================================================
--- docs/sphinx-docs/source/conf.py	(revision efc27a73d92d41084f5e238c79a90b4bf1d91dcb)
+++ docs/sphinx-docs/source/conf.py	(revision 9a182b24778d8ca30e8e54968548156199dd1240)
@@ -60,7 +60,7 @@
 #
 # The short X.Y version.
-version = '4.0.0'
+version = '4.0'
 # The full version, including alpha/beta/rc tags.
-release = '4.0.0-alpha'
+release = '4.0.0'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
Index: docs/sphinx-docs/source/user/analysis.rst
===================================================================
--- docs/sphinx-docs/source/user/analysis.rst	(revision 8f46df726332df42af2bcc5ae02e1e0979df4753)
+++ docs/sphinx-docs/source/user/analysis.rst	(revision ec860a8f303938f6a9f5b6109d0b0ec4eb7ab109)
@@ -1,2 +1,4 @@
+.. _analysis:
+
 Types of Analysis
 =================
Index: docs/sphinx-docs/source/user/gpu_computations.rst
===================================================================
--- docs/sphinx-docs/source/user/gpu_computations.rst	(revision 6e0c7b2ea537e60b8568342795a7bdb68be60ac2)
+++ docs/sphinx-docs/source/user/gpu_computations.rst	(revision 6e0c7b2ea537e60b8568342795a7bdb68be60ac2)
@@ -0,0 +1,56 @@
+.. _models-complitation:
+
+****************
+GPU Computations
+****************
+SasView model evaluations can run on your graphics card (GPU) or they can run
+on the processor (CPU).
+
+To run on the GPU, your computer must have OpenCL drivers installed.
+For information about OpenCL installation see the
+:ref:`opencl-installation` documentation
+
+Where the model is evaluated is a little bit complicated.
+If the model has the line *single=False* then it requires double precision.
+If the GPU is single precision only, then it will try running via OpenCL
+on the CPU.  If the OpenCL driver is not available for the CPU then
+it will run as a normal program on the CPU.
+For models with a large number of parameters or with a lot of code,
+the GPU may be too small to run the program effectively.
+In this case, you should try simplifying the model, maybe breaking it
+into several different models so that you don't need if statements in your code.
+If it is still too big, you can set *opencl=False* in the model file and
+the model will only run as a normal program on the CPU.
+This will not usually be necessary.
+
+If you have multiple GPU devices you can tell SasView which device to use.
+By default, SasView looks for one GPU and one CPU device
+from available OpenCL platforms.
+
+It prefers AMD or NVIDIA drivers for GPU, and prefers Intel or
+Apple drivers for CPU.
+Both GPU and CPU are included on the assumption that CPU is always available
+and supports double precision.
+
+The device order is important: GPU is checked before CPU on the assumption that
+it will be faster. By examining ~/sasview.log you can see which device SasView
+chose to run the model.
+If you don't want to use OpenCL, you can set *SAS_OPENCL=None*
+in the environment, and it will only use normal programs.
+If you want to use one of the other devices, you can run the following
+from the python console in SasView::
+
+    import pyopencl as cl
+    cl.create_some_context()
+
+This will provide a menu of different OpenCL drivers available.
+When one is selected, it will say "set PYOPENCL_CTX=..."
+Use that value as the value of *SAS_OPENCL*.
+
+For models run as normal programs, you may need to specify a compiler.
+This is done using the SAS_COMPILER environment variable.
+Set it to *tinycc* for the tinycc compiler, *msvc* for the
+Microsoft Visual C compiler, or *mingw* for the MinGW compiler.
+TinyCC is provided with SasView so that is the default.
+If you want one of the other compilers, be sure to have it available
+on the path so SasView can find it.
Index: docs/sphinx-docs/source/user/menu_bar.rst
===================================================================
--- docs/sphinx-docs/source/user/menu_bar.rst	(revision ec860a8f303938f6a9f5b6109d0b0ec4eb7ab109)
+++ docs/sphinx-docs/source/user/menu_bar.rst	(revision ec860a8f303938f6a9f5b6109d0b0ec4eb7ab109)
@@ -0,0 +1,80 @@
+.. _menu_bar:
+
+Menu Bar
+========
+The menu bar at the top of the *SasView* window gives you access to additional features of the program:
+
+File
+----
+The File option allows you load data into *SasView* for analysis, or to save the work you have been doing.
+
+Data can be loaded one file at a time, or by selecting multiple files, or by loading an entire folder of 
+files (in which case *SasView* will attempt to make an intelligent guess as to what to load based on the 
+file formats it recognises in the folder!).
+
+A *SasView* session can also be saved and reloaded as an 'Analysis' (an individual model fit or invariant 
+calculation, etc), or as a 'Project' (everything you have done since starting your *SasView* session).
+
+Edit
+----
+The Edit option allows you to:
+
+- undo/redo your recent changes;
+- copy and paste parameters between *SasView* analysis windows;
+- copy parameters from a *SasView* analysis window to the Clipboard as either tab-delimited text (compatible with Microsoft Excel) or LaTex-wrapped text;
+- generate a summary 'Report' of the most recent analysis performed;
+- reset parameter values in the P(r) Inversion analysis page.
+
+View
+----
+The View option allows you to:
+
+- show the Batch Fitting Results Panel if it has been closed;
+- show/hide the Data Explorer Panel;
+- show/hide the Toolbar of icons below the Menu Bar;
+- select the default location that *SasView* looks in for data to analyse (the *SasView* installation directory, the initial default, or a custom folder). NB: any change only takes effect when *SasView* is restarted;
+- change the default assignment of categories (*Shapes*\, *Shape-independent*\, *Structure Factor*\) for fitting model functions.
+
+Tools
+-----
+The Tools option provides access to a comprehensive range of tools and utilities. See :ref:`tools` for more information.
+
+Window
+------
+The Window option allows you to select which *SasView* windows are visible.  
+
+Analysis
+--------
+The Analysis option provides access to the key functionality of *SasView*:
+
+- Fitting;
+- P(r) Inversion;
+- Invariant Analysis;
+- Correlation Function Analysis (*SasView* 4.1 and later)
+
+See :ref:`analysis` for more information.
+
+Fitting
+-------
+The Fitting option allows you to:
+
+- create a new FitPage;
+- change optimiser (under Fit Options);
+- view fit parameter correlations, distributions, and convergence traces (under Fit Results);
+- create/edit a Custom Model.
+
+Additional functionality is available under this menu option during particular types of model fitting, including:
+
+- setting up a Constrained or Simultaneous Fit;
+- combining a Batch Fit (an obscure capability);
+- setting up Chain Fitting.
+
+Help
+----
+The Help option provides access to:
+
+- this help documentation;
+- a :ref:`tutorial` on using *SasView* (in pdf format);
+- information on how to acknowledge *SasView* in publications;
+- information about the version of *SasView* you are using;
+- a check to see if there is a more recent version of *SasView*.
Index: docs/sphinx-docs/source/user/opencl_installation.rst
===================================================================
--- docs/sphinx-docs/source/user/opencl_installation.rst	(revision 6673d2f5c2a167cfee20ecd93f1cb5b9ceed6ef2)
+++ docs/sphinx-docs/source/user/opencl_installation.rst	(revision 6673d2f5c2a167cfee20ecd93f1cb5b9ceed6ef2)
@@ -0,0 +1,51 @@
+.. _opencl-installation:
+
+*******************
+OpenCL Installation
+*******************
+
+1. Check if you have OpenCL already installed
+=============================================
+
+Windows
+=========
+    The following instructions are based on
+    http://web.engr.oregonstate.edu/~mjb/cs475/DoIHaveOpenCL.pdf
+
+    * Go to: Start -> Control Panel -> Administrative Tools
+    * Double Click on Computer Management
+    * Click on Device Manager
+    * Click open Display Adapters
+    * Right-click on available adapter and select Properties
+    * Click on Driver
+    * Go to Driver Details
+    * Scroll down and see if OpenCL is installed (look for OpenCL*.dll files)
+
+Mac OSX
+=========
+    For OSXs higher than 10.6 OpenCL is shipped along with the system.
+
+
+2. Installation
+===============
+
+Windows
+=========
+    Depending on the graphic card on your system, drivers
+    can be obtained from different sources:
+
+    * Nvidia: https://developer.nvidia.com/opencl
+    * AMD: http://developer.amd.com/tools-and-sdks/opencl-zone/
+
+Mac OSX
+=========
+    N/A
+
+
+.. note::
+    Note that Intel provides an OpenCL drivers for Intel processors:
+    https://software.intel.com/en-us/articles/opencl-drivers
+    This can sometimes make use of special vector instructions across multiple
+    processors, so it is worth installing if the GPU does not support double
+    precision. You can install this driver alongside the GPU driver for NVIDIA
+    or AMD.
Index: docs/sphinx-docs/source/user/sasgui/guiframe/data_formats_help.rst
===================================================================
--- docs/sphinx-docs/source/user/sasgui/guiframe/data_formats_help.rst	(revision 49148bbc34832e06f4f05e8e4c4c32c0da92d133)
+++ docs/sphinx-docs/source/user/sasgui/guiframe/data_formats_help.rst	(revision 756f28841d840526d0f4c0fb0e04aa304386cdec)
@@ -3,4 +3,5 @@
 .. This is a port of the original SasView html help file to ReSTructured text
 .. by S King, ISIS, during SasView CodeCamp-III in Feb 2015.
+.. WG Bouwman, DUT, added during CodeCamp-V in Oct 2016 the SESANS data format
 
 .. _Formats:
@@ -9,10 +10,11 @@
 ============
 
-SasView reads several different 1D (I(Q) vs Q) and 2D (I(Qx,Qy) vs (Qx,Qy))
+SasView reads several different 1D (I(Q) vs Q), 2D SANS(I(Qx,Qy) vs (Qx,Qy))
+and SESANS (P(z) vs z)
 data files. But please note that SasView does not at present load data where
 the Q and I(Q) data are in separate files.
 
-1D Formats
-----------
+1D Formats SANS
+---------------
 
 SasView will read files with 2 to 4 columns of numbers in the following order: 
@@ -46,6 +48,6 @@
 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
 
-2D Formats
-----------
+2D Formats SANS
+---------------
 
 SasView will only read files in the NIST 2D format with the extensions 
@@ -60,3 +62,22 @@
 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
 
-.. note::  This help document was last changed by Steve King, 01May2015
+Format SESANS
+---------------
+
+The current file extension is .ses or .sesans (not case sensitive).
+
+The file format is to have a list of name-value pairs as a header at the top of the file, detailing general experimental parameters necessary for fitting and analyzing data. This list should contain all information necessary for the file to be 'portable' between users.
+
+Following that is a 6 column list of instrument experimental variables:
+
+- Spin echo length (z, in Angstroms)
+- Spin echo length error (:math:`\Delta` z, in Angstroms) (experimental resolution)
+- neutron wavelength (:math:`\lambda`, in Angstroms) (essential for ToF instruments)
+- neutron wavelength error (:math:`\Delta \lambda`, in Angstroms)
+- Normalized polarization (:math:`P/P_0`, unitless)
+- Normalized polarization error (:math:`\Delta(P/P_0)`, unitless) (measurement error)
+
+
+.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
+
+.. note::  This help document was last changed by Wim Bouwman, 05Oct2016
Index: cs/sphinx-docs/source/user/sasgui/guiframe/graph_help.copy
===================================================================
--- docs/sphinx-docs/source/user/sasgui/guiframe/graph_help.copy	(revision 49148bbc34832e06f4f05e8e4c4c32c0da92d133)
+++ 	(revision )
@@ -1,364 +1,0 @@
-.. graph_help.rst
-
-.. This is a port of the original SasView html help file to ReSTructured text
-.. by S King, ISIS, during SasView CodeCamp-III in Feb 2015.
-
-.. |delta| unicode:: U+03B4
-.. |phi| unicode:: U+03C6
-
-
-Plotting Data/Models
-====================
-
-SasView generates three different types of graph window: one that displays *1D data*
-(ie, I(Q) vs Q), one that displays *1D residuals* (ie, the difference between the
-experimental data and the theory at the same Q values), and *2D color maps*.
-
-Graph window options
---------------------
-
-.. _Invoking_the_graph_menu:
-
-Invoking the graph menu
-^^^^^^^^^^^^^^^^^^^^^^^
-
-To invoke the *Graph Menu* simply right-click on a data/theory plot, or click 
-the *Graph Menu* (bullet list) icon in the toolbar at the bottom of the plot. 
-Then select a menu item.
-
-How to Hide-Show-Delete a graph
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-To expand a plot window, click the *Maximise* (square) icon in the top-right 
-corner.
-
-To shrink a plot window, click the *Restore down* (square-on-square) icon in 
-the top-right corner.
-
-To hide a plot, click the *Minimise* (-) icon in the top-right corner of the 
-plot window.
-
-To show a hidden plot, select the *Restore up* (square-on-square) icon on the 
-minimised window.
-
-To delete a plot, click the *Close* (x) icon in the top-right corner of the 
-plot window.
-
-*NOTE! If a residuals graph (when fitting data) is hidden, it will not show up 
-after computation.*
-
-Dragging a plot
-^^^^^^^^^^^^^^^
-
-Select the *Pan* (crossed arrows) icon in the toolbar at the bottom of the plot 
-to activate this option. Move the mouse pointer to the plot. It will change to 
-a hand. Then left-click and drag the plot around. The axis values will adjust 
-accordingly.
- 
-To disable dragging mode, unselect the *crossed arrows* icon on the toolbar.
-
-Zooming In-Out on a plot
-^^^^^^^^^^^^^^^^^^^^^^^^
-
-Select the *Zoom* (magnifying glass) button in the toolbar at the bottom of 
-the plot to activate this option. Move the mouse pointer to the plot. It will 
-change to a cross-hair. Then left-click and drag the pointer around to generate 
-a region of interest. Release the mouse button to generate the new view.
-
-To disable zoom mode, unselect the *Zoom* button on the toolbar.
-
-After zooming in on a a region, the *left arrow* or *right arrow* buttons on 
-the toolbar will switch between recent views.
-
-*NOTE! If a wheel mouse is available scrolling the wheel will zoom in/out 
-on the current plot (changing both axes). Alternatively, point at the numbers 
-on one axis and scroll the wheel to zoom in/out on just that axis.*
-
-To return to the original view of the data, click the the *Reset* (home) icon 
-in the toolbar at the bottom of the plot (see Resetting_the_graph_ for further details).
-
-Saving a plot image
-^^^^^^^^^^^^^^^^^^^
-
-To save the current plot as an image file, right click on the plot to bring up 
-the *Graph Menu* (see Invoking_the_graph_menu_) and select *Save Image*.
-Alternatively, click on the *Save* (floppy disk) icon in the toolbar at the 
-bottom of the plot.
- 
-A dialog window will open. Select a folder, enter a filename, choose an output 
-image type, and click *Save*.
-
-The currently supported image types are:
-
-*  EPS (encapsulated postscript)
-*  EMF (enhanced metafile)
-*  JPG/JPEG (joint photographics experts group)
-*  PDF (portable documant format)
-*  PNG (portable network graphics)
-*  PS (postscript)
-*  RAW/RGBA (bitmap)
-*  SVG/SVGA (scalable vector graphics)
-*  TIF/TIFF (tagged iamge file)
-
-Printing a plot
-^^^^^^^^^^^^^^^
-
-To send the current plot to a printer, click on the *Print* (printer) icon in 
-the toolbar at the bottom of the plot.
-
-.. _Resetting_the_graph:
-
-Resetting the graph
-^^^^^^^^^^^^^^^^^^^
-
-To reset the axis range of a graph to its initial values select *Reset Graph 
-Range* on the *Graph Menu* (see Invoking_the_graph_menu_). Alternatively, use
-the *Reset* (home) icon in the toolbar at the bottom of the plot.
-
-Modifying the graph
-^^^^^^^^^^^^^^^^^^^
-
-From the *Graph Menu* (see Invoking_the_graph_menu_) it is also possible to
-make some custom modifications to plots, including:
-
-*  changing the plot window title
-*  changing the axis legend locations
-*  changing the axis legend label text
-*  changing the axis legend label units
-*  changing the axis legend label font & font colour
-*  adding/removing a text string
-*  adding a grid overlay
-
-Changing scales
-^^^^^^^^^^^^^^^
-
-This menu option is only available with 1D data.
-
-From the *Graph Menu* (see Invoking_the_graph_menu_) select *Change Scale*. A
-dialog window will appear in which it is possible to choose different 
-transformations of the x (usually Q) or y (usually I(Q)) axes, including:
-
-*  x, x^2, x^4, ln(x), log10(x), log10(x^4)
-*  y, 1/y, ln(y), y^2, y.(x^4), 1/sqrt(y),
-*  log10(y), ln(y.x), ln(y.x^2), ln(y.x^4), log10(y.x^4)
- 
-A *View* option includes short-cuts to common SAS transformations, such as:
-
-*  linear
-*  Guinier
-*  X-sectional Guinier
-*  Porod
-*  Kratky
-
-For properly corrected and scaled data, these SAS transformations can be used 
-to estimate, for example, Rg, rod diameter, or SANS incoherent background 
-levels, via a linear fit (see Making_a_linear_fit_).
-
-Toggling scales
-^^^^^^^^^^^^^^^
-
-This menu option is only available with 2D data.
-
-From the *Graph Menu* (see Invoking_the_graph_menu_) select *Toggle Linear/Log
-Scale* to switch between a linear to log intensity scale. The type of scale 
-selected is written alongside the colour scale.
-
-2D color maps
-^^^^^^^^^^^^^
-
-This menu option is only available with 2D data.
-
-From the *Graph Menu* (see Invoking_the_graph_menu_) select *2D Color Map* to
-choose a different color scale for the image and/or change the maximum or 
-minimum limits of the scale.
-
-Getting data coordinates
-^^^^^^^^^^^^^^^^^^^^^^^^
-
-Clicking anywhere in the plot window will cause the current coordinates to be 
-displayed in the status bar at the very bottom-left of the SasView window.
- 
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-Dataset menu options
---------------------
-
-.. _Invoking_the_dataset_menu:
-
-Invoking the dataset menu
-^^^^^^^^^^^^^^^^^^^^^^^^^
-
-From the *Graph Menu* (see Invoking_the_graph_menu_) highlight a plotted
-dataset.
-
-Getting data info
-^^^^^^^^^^^^^^^^^
-
-In the *Dataset Menu* (see Invoking_the_dataset_menu_), highlight a data set
-and select *DataInfo* to bring up a data information dialog panel for that 
-data set.
-
-Saving data
-^^^^^^^^^^^
-
-In the *Dataset Menu* (see Invoking_the_dataset_menu_), select *Save Points as
-a File* (if 1D data) or *Save as a file(DAT)* (if 2D data). A save dialog will 
-appear.
-
-1D data can be saved in either ASCII text (.TXT) or CanSAS/SASXML (.XML) 
-formats (see :ref:`Formats`).
-
-2D data can only be saved in the NIST 2D format (.DAT) (see :ref:`Formats`).
-
-.. _Making_a_linear_fit:
-
-Making a linear fit
-^^^^^^^^^^^^^^^^^^^
-
-Linear fit performs a simple ( y(x)=ax+b ) linear fit within the plot window.
-
-In the *Dataset Menu* (see Invoking_the_dataset_menu_), select *Linear Fit*. A
-fitting dialog will appear. Set some initial parameters and data limits and 
-click *Fit*. The fitted parameter values are displayed and the resulting line 
-calculated from them is added to the plot. 
-
-This option is most useful for performing simple Guinier, XS Guinier, and
-Porod type analyses, for example, to estimate Rg, a rod diameter, or incoherent 
-background level, respectively.
-
-The following figure shows an example of a Guinier analysis using this option
-
-.. image:: guinier_fit.png
-
-Removing data from the plot
-^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-In the *Dataset Menu* (see Invoking_the_dataset_menu_), select *Remove*. The
-selected data will be removed from the plot.
-
-*NOTE! This action cannot be undone.*
-
-Show-Hide error bars
-^^^^^^^^^^^^^^^^^^^^
-
-In the *Dataset Menu* (see Invoking_the_dataset_menu_), select *Show Error Bar*
-or *Hide Error Bar* to switch between showing/hiding the errors associated 
-with the chosen dataset. 
-
-Modify plot properties
-^^^^^^^^^^^^^^^^^^^^^^
-
-In the *Dataset Menu* (see Invoking_the_dataset_menu_), select *Modify Plot
-Property* to change the size, color, or shape of the displayed marker for the 
-chosen dataset, or to change the dataset label that appears on the plot.
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-2D data averaging
------------------
-
-Purpose
-^^^^^^^
-
-This feature is only available with 2D data.
-
-2D data averaging allows you to perform different types of averages on your 
-data. The region to be averaged is displayed in the plot window and its limits 
-can be modified by dragging the boundaries around.
-
-How to average
-^^^^^^^^^^^^^^
-
-In the *Dataset Menu* (see Invoking_the_dataset_menu_), select one of the
-following averages
-
-*  Perform Circular Average
-*  Sector [Q view]
-*  Annulus [Phi view]
-*  Box sum
-*  Box averaging in Qx
-*  Box averaging on Qy
-
-A 'slicer' will appear (except for *Perform Circular Average*) in the plot that 
-you can drag by clicking on a slicer's handle. When the handle is highlighted 
-in red, it means that the slicer can move/change size.
-
-*NOTE! The slicer size will reset if you try to select a region greater than 
-the size of the data.*
-
-Alternatively, once a 'slicer' is active you can also select the region to 
-average by bringing back the *Dataset Menu* and selecting *Edit Slicer 
-Parameters*. A dialog window will appear in which you can enter values to 
-define a region or select the number of points to plot (*nbins*).
-
-A separate plot window will also have appeared, displaying the requested 
-average.
-
-*NOTE! The displayed average only updates when input focus is moved back to 
-that window; ie, when the mouse pointer is moved onto that plot.*
-
-Selecting *Box Sum* automatically brings up the 'Slicer Parameters' dialog in 
-order to display the average numerically, rather than graphically.
-
-To remove a 'slicer', bring back the *Dataset menu* and select *Clear Slicer*.
-
-Unmasked circular average
-^^^^^^^^^^^^^^^^^^^^^^^^^
-
-This operation will perform an average in constant Q-rings around the (x,y) 
-pixel location of the beam center.
-
-Masked circular average
-^^^^^^^^^^^^^^^^^^^^^^^
-
-This operation is the same as 'Unmasked Circular Average' except that any 
-masked region is excluded.
-
-Sector average [Q View]
-^^^^^^^^^^^^^^^^^^^^^^^
-
-This operation averages in constant Q-arcs.
-
-The width of the sector is specified in degrees (+/- |delta|\|phi|\) each side 
-of the central angle (|phi|\).
-
-Annular average [|phi| View]
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-This operation performs an average between two Q-values centered on (0,0), 
-and averaged over a specified number of pixels.
-
-The data is returned as a function of angle (|phi|\) in degrees with zero 
-degrees at the 3 O'clock position.
-
-Box sum
-^^^^^^^
-
-This operation performs a sum of counts in a 2D region of interest.
-
-When editing the slicer parameters, the user can enter the length and the width 
-the rectangular slicer and the coordinates of the center of the rectangle.
-
-Box Averaging in Qx
-^^^^^^^^^^^^^^^^^^^
-
-This operation computes an average I(Qx) for the region of interest.
-
-When editing the slicer parameters, the user can control the length and the 
-width the rectangular slicer. The averaged output is calculated from constant 
-bins with rectangular shape. The resultant Q values are nominal values, that 
-is, the central value of each bin on the x-axis.
-
-Box Averaging in Qy
-^^^^^^^^^^^^^^^^^^^
-
-This operation computes an average I(Qy) for the region of interest.
-
-When editing the slicer parameters, the user can control the length and the 
-width the rectangular slicer. The averaged output is calculated from constant 
-bins with rectangular shape. The resultant Q values are nominal values, that 
-is, the central value of each bin on the x-axis.
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-.. note::  This help document was last changed by Steve King, 01May2015
Index: cs/sphinx-docs/source/user/sasgui/perspectives/calculator/kiessig_calculator_help.copy
===================================================================
--- docs/sphinx-docs/source/user/sasgui/perspectives/calculator/kiessig_calculator_help.copy	(revision 49148bbc34832e06f4f05e8e4c4c32c0da92d133)
+++ 	(revision )
@@ -1,32 +1,0 @@
-.. kiessig_calculator_help.rst
-
-.. This is a port of the original SasView html help file to ReSTructured text
-.. by S King, ISIS, during SasView CodeCamp-III in Feb 2015.
-
-.. |pi| unicode:: U+03C0
-.. |Ang| unicode:: U+212B
-
-Kiessig Thickness Calculator Tool
-=================================
-
-Description
------------
-
-This tool is approximately estimates the thickness of a layer or the diameter 
-of particles from the position of the Kiessig fringe/Bragg peak in NR/SAS data 
-using the relation
-
-(thickness *or* size) = 2 * |pi| / (fringe_width *or* peak position)
-  
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-Using the tool
---------------
-
-To get a rough thickness or particle size, simply type the fringe or peak 
-position (in units of 1/|Ang|\) and click on the *Compute* button.
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-.. note::  This help document was last changed by Steve King, 01May2015
-
Index: cs/sphinx-docs/source/user/sasgui/perspectives/calculator/resolution_calculator_help.copy
===================================================================
--- docs/sphinx-docs/source/user/sasgui/perspectives/calculator/resolution_calculator_help.copy	(revision 49148bbc34832e06f4f05e8e4c4c32c0da92d133)
+++ 	(revision )
@@ -1,107 +1,0 @@
-.. resolution_calculator_help.rst
-
-.. This is a port of the original SasView html help file to ReSTructured text
-.. by S King, ISIS, during SasView CodeCamp-III in Feb 2015.
-
-.. |pi| unicode:: U+03C0
-.. |lambda| unicode:: U+03BB
-.. |Ang| unicode:: U+212B
-
-Q Resolution Estimator Tool
-===========================
-
-Description
------------
-
-This tool is approximately estimates the resolution of Q from SAS instrumental 
-parameter values assuming that the detector is flat and normal to the 
-incident beam.
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-Using the tool
---------------
-
-1) Select *SAS Resolution Estimator* from the *Tool* menu on the SasView toolbar.
-
-2) Select the source (Neutron or Photon) and source type (Monochromatic or TOF).
-
-   *NOTE! The computational difference between the sources is only the 
-   gravitational contribution due to the mass of the particles.*
-
-3) Change the default values of the instrumental parameters as required. Be 
-   careful to note that distances are specified in cm!
-
-4) Enter values for the source wavelength(s), |lambda|\ , and its spread (= FWHM/|lambda|\ ).
-   
-   For monochromatic sources, the inputs are just one value. For TOF sources, 
-   the minimum and maximum values should be separated by a '-' to specify a 
-   range.
-   
-   Optionally, the wavelength (BUT NOT of the wavelength spread) can be extended 
-   by adding '; nn' where the 'nn' specifies the number of the bins for the 
-   numerical integration. The default value is nn = 10. The same number of bins 
-   will be used for the corresponding wavelength spread.
-
-5) For TOF, the default wavelength spectrum is flat. A custom spectral 
-   distribution file (2-column text: wavelength (|Ang|\) vs Intensity) can also 
-   be loaded by selecting *Add new* in the combo box.
-
-6) When ready, click the *Compute* button. Depending on the computation the 
-   calculation time will vary.
-
-7) 1D and 2D dQ values will be displayed at the bottom of the panel, and a 2D 
-   resolution weight distribution (a 2D elliptical Gaussian function) will also 
-   be displayed in the plot panel even if the Q inputs are outside of the 
-   detector limit (the red lines indicate the limits of the detector).
-   
-   TOF only: green lines indicate the limits of the maximum Q range accessible 
-   for the longest wavelength due to the size of the detector.
-    
-   Note that the effect from the beam block/stop is ignored, so in the small Q 
-   region near the beam block/stop 
-
-   [ie., Q < 2. |pi|\ .(beam block diameter) / (sample-to-detector distance) / |lambda|\_min] 
-
-   the variance is slightly under estimated.
-
-8) A summary of the calculation is written to the SasView *Console* at the 
-   bottom of the main SasView window.
-
-.. image:: resolution_tutor.gif
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-Theory
-------
-
-The scattering wave transfer vector is by definition
-
-.. image:: q.gif
-
-In the small-angle limit, the variance of Q is to a first-order 
-approximation
-
-.. image:: sigma_q.gif
-
-The geometric and gravitational contributions can then be summarised as
-
-.. image:: sigma_table.gif
-
-Finally, a Gaussian function is used to describe the 2D weighting distribution 
-of the uncertainty in Q.
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-References
-----------
-
-D.F.R. Mildner and J.M. Carpenter 
-*J. Appl. Cryst.* 17 (1984) 249-256
-
-D.F.R. Mildner, J.M. Carpenter and D.L. Worcester 
-*J. Appl. Cryst.* 19 (1986) 311-319
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-.. note::  This help document was last changed by Steve King, 01May2015
Index: cs/sphinx-docs/source/user/sasgui/perspectives/calculator/sas_calculator_help.copy
===================================================================
--- docs/sphinx-docs/source/user/sasgui/perspectives/calculator/sas_calculator_help.copy	(revision 49148bbc34832e06f4f05e8e4c4c32c0da92d133)
+++ 	(revision )
@@ -1,166 +1,0 @@
-.. sas_calculator_help.rst
-
-.. This is a port of the original SasView html help file to ReSTructured text
-.. by S King, ISIS, during SasView CodeCamp-III in Feb 2015.
-
-.. |beta| unicode:: U+03B2
-.. |gamma| unicode:: U+03B3
-.. |theta| unicode:: U+03B8
-.. |mu| unicode:: U+03BC
-.. |sigma| unicode:: U+03C3
-.. |phi| unicode:: U+03C6
-
-.. |equiv| unicode:: U+2261
-.. |noteql| unicode:: U+2260
-
-Generic SANS Calculator Tool
-============================
-
-Description
------------
-
-This tool attempts to simulate the SANS expected from a specified
-shape/structure or scattering length density profile. The tool can
-handle both nuclear and magnetic contributions to the scattering.
-
-Theory
-------
-
-In general, a particle with a volume *V* can be described by an ensemble 
-containing *N* 3-dimensional rectangular pixels where each pixel is much 
-smaller than *V*.
-
-Assuming that all the pixel sizes are the same, the elastic scattering 
-intensity from the particle is
-
-.. image:: gen_i.gif
-
-Equation 1.
-
-where |beta|\ :sub:`j` and *r*\ :sub:`j` are the scattering length density and 
-the position of the j'th pixel respectively.
-
-The total volume *V*
-
-.. image:: v_j.gif
-
-for |beta|\ :sub:`j` |noteql|\0 where *v*\ :sub:`j` is the volume of the j'th 
-pixel (or the j'th natural atomic volume (= atomic mass / (natural molar 
-density * Avogadro number) for the atomic structures).
-
-*V* can be corrected by users. This correction is useful especially for an 
-atomic structure (such as taken from a PDB file) to get the right normalization. 
-
-*NOTE!* |beta|\ :sub:`j` *displayed in the GUI may be incorrect but this will not 
-affect the scattering computation if the correction of the total volume V is made.*
-
-The scattering length density (SLD) of each pixel, where the SLD is uniform, is 
-a combination of the nuclear and magnetic SLDs and depends on the spin states 
-of the neutrons as follows.
-
-Magnetic Scattering
-^^^^^^^^^^^^^^^^^^^
-
-For magnetic scattering, only the magnetization component, *M*\ :sub:`perp`\ , 
-perpendicular to the scattering vector *Q* contributes to the magnetic 
-scattering length.
-
-.. image:: mag_vector.bmp
-
-The magnetic scattering length density is then
-
-.. image:: dm_eq.gif
-
-where the gyromagnetic ratio |gamma| = -1.913, |mu|\ :sub:`B` is the Bohr 
-magneton, *r*\ :sub:`0` is the classical radius of electron, and |sigma| is the 
-Pauli spin.
-
-For a polarized neutron, the magnetic scattering is depending on the spin states.
-
-Let us consider that the incident neutrons are polarised both parallel (+) and  
-anti-parallel (-) to the x' axis (see below). The possible states after 
-scattering from the sample are then 
-
-*  Non-spin flips: (+ +) and (- -)
-*  Spin flips:     (+ -) and (- +)
-
-.. image:: gen_mag_pic.bmp
-
-Now let us assume that the angles of the *Q* vector and the spin-axis (x') 
-to the x-axis are |phi| and |theta|\ :sub:`up` respectively (see above). Then, 
-depending upon the polarization (spin) state of neutrons, the scattering 
-length densities, including the nuclear scattering length density (|beta|\ :sub:`N`\ ) 
-are given as
-
-*  for non-spin-flips
-
-   .. image:: sld1.gif
-
-*  for spin-flips
-
-   .. image:: sld2.gif
-
-where
-
-.. image:: mxp.gif
-
-.. image:: myp.gif
-
-.. image:: mzp.gif
-
-.. image:: mqx.gif
-
-.. image:: mqy.gif
-
-Here the *M0*\ :sub:`x`\ , *M0*\ :sub:`y` and *M0*\ :sub:`z` are the x, y and z 
-components of the magnetisation vector in the laboratory xyz frame. 
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-Using the tool
---------------
-
-.. image:: gen_gui_help.bmp
-
-After computation the result will appear in the *Theory* box in the SasView  
-*Data Explorer* panel.
-
-*Up_frac_in* and *Up_frac_out* are the ratio 
-
-   (spin up) / (spin up + spin down)
-   
-of neutrons before the sample and at the analyzer, respectively.
-
-*NOTE 1. The values of* Up_frac_in *and* Up_frac_out *must be in the range 
-0.0 to 1.0. Both values are 0.5 for unpolarized neutrons.*
-
-*NOTE 2. This computation is totally based on the pixel (or atomic) data fixed 
-in xyz coordinates. No angular orientational averaging is considered.*
-
-*NOTE 3. For the nuclear scattering length density, only the real component 
-is taken account.*
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-Using PDB/OMF or SLD files
---------------------------
-
-The SANS Calculator tool can read some PDB, OMF or SLD files but ignores
-polarized/magnetic scattering when doing so, thus related parameters such as 
-*Up_frac_in*, etc, will be ignored.
-
-The calculation for fixed orientation uses Equation 1 above resulting in a 2D 
-output, whereas the scattering calculation averaged over all the orientations 
-uses the Debye equation below providing a 1D output
-
-.. image:: gen_debye_eq.gif
-
-where *v*\ :sub:`j` |beta|\ :sub:`j` |equiv| *b*\ :sub:`j` is the scattering 
-length of the j'th atom. The calculation output is passed to the *Data Explorer* 
-for further use.
-
-.. image:: pdb_combo.jpg
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-.. note::  This help document was last changed by Steve King, 01May2015
Index: cs/sphinx-docs/source/user/sasgui/perspectives/calculator/sld_calculator_help.copy
===================================================================
--- docs/sphinx-docs/source/user/sasgui/perspectives/calculator/sld_calculator_help.copy	(revision 49148bbc34832e06f4f05e8e4c4c32c0da92d133)
+++ 	(revision )
@@ -1,58 +1,0 @@
-.. sld_calculator_help.rst
-
-.. This is a port of the original SasView html help file to ReSTructured text
-.. by S King, ISIS, during SasView CodeCamp-III in Feb 2015.
-
-.. |Ang| unicode:: U+212B
-
-SLD Calculator Tool
-===================
-
-Description
------------
-
-The neutron scattering length density (SLD) is defined as
-
-  SLD = (b_c1 + b_c2 + ... + b_cn) / Vm
-
-where b_ci is the bound coherent scattering length of ith of n atoms in a molecule
-with the molecular volume Vm
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-Specifying the Compound Name
-----------------------------
-
-To calculate scattering length densities enter the empirical formula of a 
-compound and its mass density and click "Calculate".
-
-Entering a wavelength value is optional (a default value of 6.0 |Ang| will 
-be used).
-
-TIPS!
-
-*  Formula strings consist of atoms and the number of them, such as "CaCO3+6H2O".
-
-*  Groups can be separated by *'+'* or *space*, so "CaCO3 6H2O" works as well.
-
-*  Groups can be defined using parentheses, such as "CaCO3(H2O)6".
-
-*  Parentheses can be nested, such as "(CaCO3(H2O)6)1".
-
-*  Isotopes are represented by their atomic number in *square brackets*, such 
-   as "CaCO[18]3+6H2O", H[1], or H[2].
-
-*  Numbers of atoms can be integer or decimal, such as "CaCO3+(3HO0.5)2".
-
-*  The SLD of mixtures can be calculated as well. For example, for a 70-30 
-   mixture of H2O/D2O write "H14O7+D6O3" or more simply "H7D3O5" (i.e. this says
-   7 hydrogens, 3 deuteriums, and 5 oxygens) and enter a mass density calculated
-   on the percentages of H2O and D2O.
-
-*  Type "C[13]6 H[2]12 O[18]6" for C(13)6H(2)12O(18)6 (6 Carbon-13 atoms, 12 
-   deuterium atoms, and 6 Oxygen-18 atoms).
-   
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-.. note::  This help document was last changed by Steve King, 01May2015
-
Index: cs/sphinx-docs/source/user/sasgui/perspectives/calculator/slit_calculator_help.copy
===================================================================
--- docs/sphinx-docs/source/user/sasgui/perspectives/calculator/slit_calculator_help.copy	(revision 49148bbc34832e06f4f05e8e4c4c32c0da92d133)
+++ 	(revision )
@@ -1,43 +1,0 @@
-.. slit_calculator_help.rst
-
-.. This is a port of the original SasView html help file to ReSTructured text
-.. by S King, ISIS, during SasView CodeCamp-III in Feb 2015.
-
-.. |Ang| unicode:: U+212B
-.. |TM| unicode:: U+2122
-
-Slit Size Calculator Tool
-=========================
-
-Description
------------
-
-This tool enables X-ray users to calculate the slit size (FWHM/2) for smearing 
-based on their half beam profile data.
-
-*NOTE! Whilst it may have some more generic applicability, the calculator has
-only been tested with beam profile data from Anton-Paar SAXSess*\ |TM|\  
-*software.*
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-Using the tool
---------------
-
-1) Select *Slit Size Calculator* from the *Tool* menu on the SasView toolbar.
-
-2) Load a beam profile file in the *Data* field using the *Browse* button.
-
-   *NOTE! To see an example of the beam profile file format, visit the file 
-   beam profile.DAT in your {installation_directory}/SasView/test folder.*
-
-3) Once a data is loaded, the slit size is automatically computed and displayed 
-   in the tool window.
-
-*NOTE! The beam profile file does not carry any information about the units of 
-the Q data. This calculator assumes the data has units of 1/\ |Ang|\ . If the
-data is not in these units it must be manually converted beforehand.*
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-.. note::  This help document was last changed by Steve King, 01May2015
Index: cs/sphinx-docs/source/user/sasgui/perspectives/fitting/fitting_help.copy
===================================================================
--- docs/sphinx-docs/source/user/sasgui/perspectives/fitting/fitting_help.copy	(revision 49148bbc34832e06f4f05e8e4c4c32c0da92d133)
+++ 	(revision )
@@ -1,628 +1,0 @@
-.. fitting_help.rst
-
-.. This is a port of the original SasView html help file to ReSTructured text
-.. by S King, ISIS, during SasView CodeCamp-III in Feb 2015.
-
-.. |beta| unicode:: U+03B2
-.. |gamma| unicode:: U+03B3
-.. |mu| unicode:: U+03BC
-.. |sigma| unicode:: U+03C3
-.. |phi| unicode:: U+03C6
-.. |theta| unicode:: U+03B8
-.. |chi| unicode:: U+03C7
-
-.. |inlineimage004| image:: sm_image004.gif
-.. |inlineimage005| image:: sm_image005.gif
-.. |inlineimage008| image:: sm_image008.gif
-.. |inlineimage009| image:: sm_image009.gif
-.. |inlineimage010| image:: sm_image010.gif
-.. |inlineimage011| image:: sm_image011.gif
-.. |inlineimage012| image:: sm_image012.gif
-.. |inlineimage018| image:: sm_image018.gif
-.. |inlineimage019| image:: sm_image019.gif
-
-
-Fitting Perspective
-===================
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-Preparing to fit data
----------------------
-
-To fit some data you must first load some data, activate one or more data sets,
-send those data sets to the fitting perspective, and select a model to fit to
-each data set.
-
-Instructions on how to load and activate data are in the section :ref:`Loading_data`.
-
-SasView can fit data in one of three ways:
-
-*  in *Single* fit mode - individual data sets are fitted independently one-by-one
-
-*  in *Simultaneous* fit mode - multiple data sets are fitted simultaneously to the *same* model with/without constrained parameters (this might be useful, for example, if you have measured the same sample at different contrasts)
-
-*  in *Batch* fit mode - multiple data sets are fitted sequentially to the *same* model (this might be useful, for example, if you have performed a kinetic or time-resolved experiment and have *lots* of data sets!)
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-Selecting a model
------------------
-
-By default, the models in SasView are grouped into five categories
-
-*  *Shapes* - models describing 'objects' (spheres, cylinders, etc)
-*  *Shape-Independent* - models describing structure in terms of density correlation functions, fractals, peaks, power laws, etc
-*  *Customized Models* - SasView- or User-created (non-library) Python models
-*  *Uncategorised* - other models (for reflectivity, etc)
-*  *Structure Factor* - S(Q) models
-
-Use the *Category* drop-down menu to chose a category of model, then select
-a model from the drop-down menu beneath. A graph of the chosen model, calculated
-using default parameter values, will appear. The graph will update dynamically
-as the parameter values are changed.
-
-You can decide your own model categorizations using the :ref:`Category_Manager`.
-
-Once you have selected a model you can read its help documentation by clicking
-on the *Description* button to the right.
-
-Show 1D/2D
-^^^^^^^^^^
-
-Models are normally fitted to 1D (ie, I(Q) vs Q) data sets, but some models in
-SasView can also be fitted to 2D (ie, I(Qx,Qy) vs Qx vs Qy) data sets.
-
-*NB: Magnetic scattering can only be fitted in SasView in 2D.*
-
-To activate 2D fitting mode, click the *Show 2D* button on the *Fit Page*. To
-return to 1D fitting model, click the same button (which will now say *Show 1D*).
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-.. _Category_Manager:
-
-Category Manager
-----------------
-
-To change the model categorizations, either choose *Category Manager* from the
-*View* option on the menubar, or click on the *Modify* button on the *Fit Page*.
-
-.. image:: cat_fig0.bmp
-
-The categorization of all models except the customized models can be reassigned,
-added to, and removed using *Category Manager*. Models can also be hidden from view
-in the drop-down menus.
-
-.. image:: cat_fig1.bmp
-
-Changing category
-^^^^^^^^^^^^^^^^^
-
-To change category, highlight a model in the list by left-clicking on its entry and
-then click the *Modify* button. Use the *Change Category* panel that appears to make
-the required changes.
-
-.. image:: cat_fig2.bmp
-
-To create a category for the selected model, click the *Add* button. In order
-to delete a category, select the category name and click the *Remove Selected*
-button. Then click *Done*.
-
-Showing/hiding models
-^^^^^^^^^^^^^^^^^^^^^
-
-Use the *Enable All / Disable All* buttons and the check boxes beside each model to
-select the models to show/hide. To apply the selection, click *Ok*. Otherwise click
-*Cancel*.
-
-*NB: It may be necessary to change to a different category and then back again*
-*before any changes take effect.*
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-Model Functions
----------------
-
-For a complete list of all the library models available in SasView, see the section
-:ref:`SasView_model_functions`.
-
-It is also possible to add your own models.
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-.. _Adding_your_own_models:
-
-Adding your own models
-----------------------
-
-There are currently two ways to add your own models to SasView:
-
-* Using the :ref:`Custom_Model_Editor`
-* By :ref:`Writing_a_Plugin`
-
-*NB: Because of the way these options are implemented, it is not possible for them*
-*to use the polydispersity algorithms in SasView. Only models in the model library*
-*can do this. At the time of writing (Release 3.1.0) work is in hand to make it*
-*easier to add new models to the model library.*
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-.. _Custom_Model_Editor:
-
-Custom Model Editor
--------------------
-
-From the *Fitting* option in the menu bar, select *Edit Custom Model*.
-
-.. image:: edit_model_menu.bmp
-
-and then one of the options
-
-*  *New* - to create a new custom model template
-*  *Sum|Multi(p1,p2)* - to create a new model by summing/multiplying existing models in the model library
-*  *Advanced* - to edit a new custom model
-*  *Delete* - to delete a custom model
-
-New
-^^^^
-
-.. image:: new_model.bmp
-
-A model template generated by this option can be viewed and further modified using
-the :ref:`Advanced` option.
-
-Sum|Multi(p1,p2)
-^^^^^^^^^^^^^^^^
-
-.. image:: sum_model.bmp
-
-This option creates a custom model of the form
-
-Custom Model = scale_factor \* (model1 +/\* model2)
-
-In the *Easy Sum/Multi Editor* give the new custom model a function name and brief
-description (to appear under the *Details* button on the *Fit Page*). Then select
-two existing models, as p1 and p2, and the required operator, '+' or '*' between
-them. Finally, click the *Apply* button to generate the model and then click *Close*.
-
-*NB: Any changes to a custom model generated in this way only become effective after*
-*it is re-selected from the model drop-down menu on the Fit Page.*
-
-.. _Advanced:
-
-Advanced
-^^^^^^^^
-
-Selecting this option shows all the custom models in the plugin model folder
-
-  *C:\\Users\\[username]\\.sasview\\plugin_models* - (on Windows)
-
-You can edit, modify, and save the Python code in any of these models using the
-*Advanced Custom Model Editor*.
-
-*NB: Unless you are confident about what you are doing, it is recommended that you*
-*only modify lines denoted with the ## <----- comments!*
-
-When editing is complete, select *Run -> Compile* from the *Model Editor* menu bar. An
-*Info* box will appear with the results of the compilation and model unit tests. The
-model will only be usable if the tests 'pass'.
-
-To use the model, go to the relevant *Fit Page*, select the *Customized Models*
-category and then select the model from the drop-down menu.
-
-*NB: Any changes to a custom model generated in this way only become effective after*
-*it is re-selected from the model drop-down menu on the Fit Page.*
-
-Delete
-^^^^^^
-
-Simply highlight the custom model to be removed. This operation is final!
-
-*NB: Custom models shipped with SasView cannot be removed in this way.*
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-.. _Writing_a_Plugin:
-
-Writing a Plugin
-----------------
-
-Advanced users can write their own model in Python and save it to the the SasView
-*plugin_models* folder
-
-  *C:\\Users\\[username]\\.sasview\\plugin_models* - (on Windows)
-
-in .py format. The next time SasView is started it will compile the plugin and add
-it to the list of *Customized Models*.
-
-It is recommended that existing plugin models be used as templates.
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-.. _Fitting_Options:
-
-Fitting Options
----------------
-
-It is possible to specify which optimiser SasView should use to fit the data, and
-to modify some of the configurational parameters for each optimiser.
-
-From *Fitting* in the menu bar select *Fit Options*, then select one of the following
-optimisers:
-
-*  DREAM
-*  Levenberg-Marquardt
-*  Quasi-Newton BFGS
-*  Differential Evolution
-*  Nelder-Mead Simplex
-
-The DREAM optimiser is the most sophisticated, but may not necessarily be the best
-option for fitting simple models. If uncertain, try the Levenberg-Marquardt optimiser
-initially.
-
-These optimisers form the *Bumps* package written by P Kienzle. For more information
-on each optimiser, see the :ref:`Fitting_Documentation`.
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-Fitting Limits
---------------
-
-By default, *SasView* will attempt to model fit the full range of the data; ie,
-across all *Q* values. If necessary, however, it is possible to specify only a
-sub-region of the data for fitting.
-
-In a *FitPage* or *BatchPage* change the *Q* values in the *Min* and/or *Max*
-text boxes. Vertical coloured bars will appear on the graph with the data and
-'theory' indicating the current *Q* limits (red = *Qmin*, purple = *Qmax*).
-
-To return to including all data in the fit, click the *Reset* button.
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-
-Shortcuts
----------
-
-Copy/Paste Parameters
-^^^^^^^^^^^^^^^^^^^^^
-
-It is possible to copy the parameters from one *Fit Page* and to paste them into
-another *Fit Page* using the same model.
-
-To *copy* parameters, either:
-
-*  Select *Edit -> Copy Params* from the menu bar, or
-*  Use Ctrl(Cmd on Mac) + Left Mouse Click on the *Fit Page*.
-
-To *paste* parameters, either:
-
-*  Select *Edit -> Paste Params* from the menu bar, or
-*  Use Ctrl(Cmd on Mac) + Shift + Left-click on the *Fit Page*.
-
-If either operation is successful a message will appear in the info line at the
-bottom of the SasView window.
-
-Bookmark
-^^^^^^^^
-
-To *Bookmark* a *Fit Page* either:
-
-*  Select a *Fit Page* and then click on *Bookmark* in the tool bar, or
-*  Right-click and select the *Bookmark* in the popup menu.
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-.. _Status_bar:
-
-Status Bar & Console
---------------------
-
-The status bar is located at the bottom of the SasView window and displays
-messages, hints, warnings and errors.
-
-At the right-hand side of the status bar is a button marked *Console*. The *Console*
-displays available message history and some run-time traceback information.
-
-During a long task the *Console* can also be used to monitor the progress.
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-.. _Single_Fit_Mode:
-
-Single Fit Mode
----------------
-
-*NB: Before proceeding, ensure that the Single Mode radio button at the bottom of*
-*the Data Explorer is checked (see the section* :ref:`Loading_data` *).*
-
-This mode fits one data set.
-
-When data is sent to the fitting perspective it is plotted in a graph window as
-markers.
-
-If a graph does not appear, or a graph window appears but is empty, then the data
-has not loaded correctly. Check to see if there is a message in the :ref:`Status_Bar`
-or in the *Console* window.
-
-Assuming the data has loaded correctly, when a model is selected a green model
-calculation (or what SasView calls a 'Theory') line will appear in the earlier graph
-window, and a second graph window will appear displaying the residuals (the
-difference between the experimental data and the theory) at the same X-data values.
-See :ref:`Assessing_Fit_Quality`.
-
-The objective of model-fitting is to find a *physically-plausible* model, and set
-of model parameters, that generate a theory that reproduces the experimental data
-and gives residual values as close to zero as possible.
-
-Change the default values of the model parameters by hand until the theory line
-starts to represent the experimental data. Then uncheck the tick boxes alongside
-all parameters *except* the 'background' and the 'scale'. Click the *Fit* button.
-SasView will optimise the values of the 'background' and 'scale' and also display
-the corresponding uncertainties on the optimised values.
-
-*NB: If no uncertainty is shown it generally means that the model is not very*
-*dependent on the corresponding parameter (or that one or more parameters are*
-*'correlated').*
-
-In the bottom left corner of the *Fit Page* is a box displaying the normalised value
-of the statistical |chi|\  :sup:`2` parameter returned by the optimiser.
-
-Now check the box for another model parameter and click *Fit* again. Repeat this
-process until most or all parameters are checked and have been optimised. As the
-fit of the theory to the experimental data improves the value of 'chi2/Npts' will
-decrease. A good model fit should easily produce values of 'chi2/Npts' that are
-close to zero, and certainly <100. See :ref:`Assessing_Fit_Quality`.
-
-SasView has a number of different optimisers (see the section :ref:`Fitting_Options`).
-The DREAM optimiser is the most sophisticated, but may not necessarily be the best
-option for fitting simple models. If uncertain, try the Levenberg-Marquardt optimiser
-initially.
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-Simultaneous Fit Mode
----------------------
-
-*NB: Before proceeding, ensure that the Single Mode radio button at the bottom of*
-*the Data Explorer is checked (see the section* :ref:`Loading_data` *).*
-
-This mode is an extension of the :ref:`Single_Fit_Mode` that fits two or more data
-sets *to the same model* simultaneously. If necessary it is possible to constrain 
-fit parameters between data sets (eg, to fix a background level, or radius, etc).
-
-If the data to be fit are in multiple files, load each file, then select each file
-in the *Data Explorer*, and *Send To Fitting*. If multiple data sets are in one file,
-load that file, *Unselect All Data*, select just those data sets to be fitted, and
-*Send To Fitting*. Either way, the result should be that for *n* data sets you have
-2\ *n* graphs (*n* of the data and model fit, and *n* of the resulting residuals). But
-it may be helpful to minimise the residuals plots for clarity. Also see
-:ref:`Assessing_Fit_Quality`.
-
-*NB: If you need to use a customized model, you must ensure that model is available*
-*first (see* :ref:`Adding_your_own_models` *).*
-
-Method
-^^^^^^
-
-Now go to each *FitPage* in turn and:
-
-  Select the required category and model;
-
-  Unselect all the model parameters;
-
-  Enter some starting guesses for the parameters;
-
-  Enter any parameter limits (recommended);
-
-  Select which parameters will refine (selecting all is generally a bad idea...);
-
-When done, select *Constrained or Simultaneous Fit* under *Fitting* in the menu bar.
-
-In the *Const & Simul Fit* page that appears, select which data sets are to be
-simultaneously fitted (this will probably be all of them or you would not have loaded
-them in the first place!).
-
-To tie parameters between the data sets with constraints, check the 'yes' radio button
-next to *Add Constraint?* in the *Fit Constraints* box.
-
-*NB: You can only constrain parameters that are set to refine.*
-
-When ready, click the *Fit* button on the *Const & Simul Fit* page, NOT the *Fit*
-button on the individual *FitPage*'s.
-
-Simultaneous Fits without Constraints
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-The results of the model-fitting will be returned to each of the individual
-*FitPage*'s.
-
-Note that the chi2/Npts value returned is the SUM of the chi2/Npts of each fit. To
-see the chi2/Npts value for a specific *FitPage*, click the *Compute* button at the
-bottom of that *FitPage* to recalculate. Also see :ref:`Assessing_Fit_Quality`.
-
-Simultaneous Fits with Constraints
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-Use the *Easy Setup* drop-down buttons in the *Const & Simul Fit* page to set
-up constraints between *FitPage*'s.
-
-Constraints will generally be of the form
-
-  Mi Parameter1 = Mj.Parameter1
-
-however the text box after the '=' sign can be used to adjust this
-relationship; for example
-
-  Mi Parameter1 = scalar \* Mj.Parameter1
-
-A 'free-form' constraint box is also provided.
-
-Many constraints can be entered for a single fit.
-
-The results of the model-fitting will be returned to each of the individual
-*FitPage*'s.
-
-Note that the chi2/Npts value returned is the SUM of the chi2/Npts of each fit. To
-see the chi2/Npts value for a specific *FitPage*, click the *Compute* button at the
-bottom of that *FitPage* to recalculate. Also see :ref:`Assessing_Fit_Quality`.
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-Batch Fit Mode
---------------
-
-*NB: Before proceeding, ensure that the Single Mode radio button at the bottom of*
-*the Data Explorer is checked (see the section* :ref:`Loading_data` *). The Batch*
-*Mode button will be used later on!*
-
-This mode *sequentially* fits two or more data sets *to the same model*. Unlike in
-simultaneous fitting, in batch fitting it is not possible to constrain fit parameters
-between data sets.
-
-If the data to be fit are in multiple files, load each file in the *Data Explorer*.
-If multiple data sets are in one file, load just that file. *Unselect All Data*, then
-select a single initial data set to be fitted. Fit that selected data set as described
-above under :ref:`Single_Fit_Mode` .
-
-*NB: If you need to use a customized model, you must ensure that model is available*
-*first (see* :ref:`Adding_your_own_models` *).*
-
-Method
-^^^^^^
-
-Now *Select All Data* in the *Data Explorer*, check the *Batch Mode* radio button
-at the bottom of that panel and *Send To Fitting*. A *BatchPage* will be created.
-
-.. image:: batch_button_area.bmp
-
-*NB: The Batch Page can also be created by checking the Batch Mode radio button*
-*and selecting New Fit Page under Fitting in the menu bar.*
-
-Using the drop-down menus in the *BatchPage*, now set up the *same* data set
-with the *same* model that you just fitted in single fit mode. A quick way to
-set the model parameter values is to just copy them from the earlier Single
-Fit. To do this, go back to the Single Fit *FitPage*, select *Copy Params*
-under *Edit* in the menu bar, then go back to the *BatchPage* and *Paste Params*.
-
-When ready, use the *Fit* button on the *BatchPage* to perform the fitting, NOT
-the *Fit* button on the individual *FitPage*'s.
-
-Unlike in single fit mode, the results of batch fits are not returned to
-the *BatchPage*. Instead, a spreadsheet-like :ref:`Grid_Window` will appear.
-
-If you want to visually check a graph of a particular fit, click on the name of
-a *Data set* in the *Grid Window* and then click the *View Fits* button. The
-data and the model fit will be displayed. If you select mutliple data sets they
-will all appear on one graph.
-
-.. image:: view_button.bmp
-
-*NB: In theory, returning to the BatchPage and changing the name of the I(Q)*
-*data source should also work, but at the moment whilst this does change the*
-*data set displayed it always superimposes the 'theory' corresponding to the*
-*starting parameters.*
-
-If you select a 'Chi2' value and click the *View Fits* button a graph of the
-residuals for that data set is displayed. Again, if you select multiple 'Chi2'
-values then all the residuals data will appear on one graph. Also see
-:ref:`Assessing_Fit_Quality`.
-
-Chain Fitting
-^^^^^^^^^^^^^
-
-By default, the *same* parameter values copied from the initial single fit into
-the *BatchPage* will be used as the starting parameters for all batch fits. It
-is, however, possible to get *SasView* to use the results of a fit to a preceding
-data set as the starting parameters for the next fit in the sequence. This
-variation of batch fitting is called *Chain Fitting*, and will considerably speed
-up model-fitting if you have lots of very similar data sets where a few parameters
-are gradually changing. Do not use chain fitting on disparate data sets.
-
-To use chain fitting, select *Chain Fitting* under *Fitting* in the menu bar. It
-toggles on/off, so selecting it again will switch back to normal batch fitting.
-
-.. _Grid_Window:
-
-Grid Window
-^^^^^^^^^^^
-
-The *Grid Window* provides an easy way to view the results from batch fitting.
-It will be displayed automatically when a batch fit completes, but may be
-opened at any time by selecting *Show Grid Window* under *View* in the menu
-bar.
-
-.. image:: restore_batch_window.bmp
-
-Once a batch fit is completed, all model parameters are displayed but *not*
-their uncertainties. To view the uncertainties, click on a given column then
-go to *Edit* in the menu bar, select *Insert Column Before* and choose the
-required data from the list. An empty column can be inserted in the same way.
-
-To remove a column from the grid, click on the column header and choose
-*Remove Column* under *Edit* in the menu bar. The same functionality also
-allows you to re-order columns.
-
-*NB: You cannot insert/remove/re-order the rows in the Grid Window.*
-
-All of the above functions are also available by right-clicking on a column
-label.
-
-.. image:: edit_menu.bmp
-
-*NB: If there is an existing Grid Window and another batch fit is performed,*
-*an additional 'Table' tab will be added to the Grid Window.*
-
-The parameter values in the *currently selected* table of the *Grid Window*
-can be output to a CSV file by choosing *Save As* under *File* in the (*Grid*
-*Window*) menu bar. The default filename includes the date and time that the
-batch fit was performed.
-
-Saved CSV files can be reloaded by choosing *Open* under *File* in the *Grid*
-*Window* menu bar. The loaded parameters will appear in a new table tab.
-
-.. image:: file_menu.bmp
-
-*NB: Saving the Grid Window does not save any experimental data, residuals*
-*or actual model fits. Consequently if you reload a saved CSV file the*
-*ability to View Fits will be lost.*
-
-Parameter Plots
-^^^^^^^^^^^^^^^
-
-Any column of *numeric* parameter values can be plotted against another using
-the *Grid Window*. Simply select one column at the time and click the *Add*
-button next to the required *X/Y-axis Selection Range* text box. When both
-the X and Y axis boxes have been completed, click the *Plot* button.
-
-When the *Add* button is clicked, *SasView* also automatically completes the
-*X/Y-axis Label* text box with the heading from Row 1 of the selected table,
-but different labels and units can be entered manually.
-
-.. image:: plot_button.bmp
-
-The *X/Y-axis Selection Range* can be edited manually. The text control box
-recognises the operators +, -, \*, /, or 'pow', and allows the following
-types of expression :
- 
-  1) if an axis label range is a function of 1 or more *columns*, write
-     this type of expression
-
-     constant1 * column_name1 [minimum row index :  maximum  row index]
-     operator constant2 * column_name2 [minimum row index :  maximum  row index]
-
-     Example: radius [2 : 5] -3 * scale [2 : 5]
-
-  2) if only some *values* of a given column are needed but the range between
-     the first row and the last row used is not continuous, write this type of
-     expression
-
-     column_name1 [minimum row index1 :  maximum  row index1] , column_name1
-     [minimum row index2 :  maximum  row index2]
-
-     Example: radius [2 : 5] , radius [10 : 25]
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-.. note::  This help document was last changed by Steve King, 04Jun2015
Index: cs/sphinx-docs/source/user/sasgui/perspectives/fitting/mag_help.copy
===================================================================
--- docs/sphinx-docs/source/user/sasgui/perspectives/fitting/mag_help.copy	(revision 49148bbc34832e06f4f05e8e4c4c32c0da92d133)
+++ 	(revision )
@@ -1,115 +1,0 @@
-.. mag_help.rst
-
-.. This is a port of text from the original SasView html help file to ReSTructured text
-.. by S King, ISIS, during SasView CodeCamp-III in Feb 2015.
-
-.. |beta| unicode:: U+03B2
-.. |gamma| unicode:: U+03B3
-.. |mu| unicode:: U+03BC
-.. |sigma| unicode:: U+03C3
-.. |phi| unicode:: U+03C6
-.. |theta| unicode:: U+03B8
-.. |chi| unicode:: U+03C7
-
-.. |inlineimage004| image:: sm_image004.gif
-.. |inlineimage005| image:: sm_image005.gif
-.. |inlineimage008| image:: sm_image008.gif
-.. |inlineimage009| image:: sm_image009.gif
-.. |inlineimage010| image:: sm_image010.gif
-.. |inlineimage011| image:: sm_image011.gif
-.. |inlineimage012| image:: sm_image012.gif
-.. |inlineimage018| image:: sm_image018.gif
-.. |inlineimage019| image:: sm_image019.gif
-
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-Polarisation/Magnetic Scattering
---------------------------------
-
-Magnetic scattering is implemented in five (2D) models 
-
-*  *SphereModel*
-*  *CoreShellModel*
-*  *CoreMultiShellModel*
-*  *CylinderModel*
-*  *ParallelepipedModel*
-
-In general, the scattering length density (SLD, = |beta|) in each region where the
-SLD is uniform, is a combination of the nuclear and magnetic SLDs and, for polarised
-neutrons, also depends on the spin states of the neutrons.
-
-For magnetic scattering, only the magnetization component, *M*\ :sub:`perp`,
-perpendicular to the scattering vector *Q* contributes to the the magnetic
-scattering length.
-
-.. image:: mag_vector.bmp
-
-The magnetic scattering length density is then
-
-.. image:: dm_eq.gif
-
-where |gamma| = -1.913 is the gyromagnetic ratio, |mu|\ :sub:`B` is the
-Bohr magneton, *r*\ :sub:`0` is the classical radius of electron, and |sigma|
-is the Pauli spin.
-
-Assuming that incident neutrons are polarized parallel (+) and anti-parallel (-)
-to the *x'* axis, the possible spin states after the sample are then
-
-No spin-flips (+ +) and (- -)
-
-Spin-flips    (+ -) and (- +)
-
-.. image:: M_angles_pic.bmp
-
-If the angles of the *Q* vector and the spin-axis (*x'*) to the *x*-axis are |phi|
-and |theta|\ :sub:`up`, respectively, then, depending on the spin state of the
-neutrons, the scattering length densities, including the nuclear scattering
-length density (|beta|\ :sub:`N`) are
-
-.. image:: sld1.gif
-
-when there are no spin-flips, and
-
-.. image:: sld2.gif
-
-when there are, and
-
-.. image:: mxp.gif
-
-.. image:: myp.gif
-
-.. image:: mzp.gif
-
-.. image:: mqx.gif
-
-.. image:: mqy.gif
-
-Here, *M*\ :sub:`0x`, *M*\ :sub:`0y` and *M*\ :sub:`0z` are the x, y and z components
-of the magnetization vector given in the laboratory xyz frame given by
-
-.. image:: m0x_eq.gif
-
-.. image:: m0y_eq.gif
-
-.. image:: m0z_eq.gif
-
-and the magnetization angles |theta|\ :sub:`M` and |phi|\ :sub:`M` are defined in
-the figure above.
-
-The user input parameters are:
-
-===========   ================================================================
- M0_sld        = *D*\ :sub:`M` *M*\ :sub:`0`
- Up_theta      = |theta|\ :sub:`up`
- M_theta       = |theta|\ :sub:`M`
- M_phi         = |phi|\ :sub:`M`
- Up_frac_i     = (spin up)/(spin up + spin down) neutrons *before* the sample
- Up_frac_f     = (spin up)/(spin up + spin down) neutrons *after* the sample
-===========   ================================================================
-
-*Note:* The values of the 'Up_frac_i' and 'Up_frac_f' must be in the range 0 to 1.
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-.. note::  This help document was last changed by Steve King, 02May2015
Index: cs/sphinx-docs/source/user/sasgui/perspectives/fitting/pd_help.copy
===================================================================
--- docs/sphinx-docs/source/user/sasgui/perspectives/fitting/pd_help.copy	(revision 49148bbc34832e06f4f05e8e4c4c32c0da92d133)
+++ 	(revision )
@@ -1,203 +1,0 @@
-.. pd_help.rst
-
-.. This is a port of the original SasView html help file to ReSTructured text
-.. by S King, ISIS, during SasView CodeCamp-III in Feb 2015.
-
-.. |beta| unicode:: U+03B2
-.. |gamma| unicode:: U+03B3
-.. |mu| unicode:: U+03BC
-.. |sigma| unicode:: U+03C3
-.. |phi| unicode:: U+03C6
-.. |theta| unicode:: U+03B8
-.. |chi| unicode:: U+03C7
-.. |Ang| unicode:: U+212B
-
-.. |inlineimage004| image:: sm_image004.gif
-.. |inlineimage005| image:: sm_image005.gif
-.. |inlineimage008| image:: sm_image008.gif
-.. |inlineimage009| image:: sm_image009.gif
-.. |inlineimage010| image:: sm_image010.gif
-.. |inlineimage011| image:: sm_image011.gif
-.. |inlineimage012| image:: sm_image012.gif
-.. |inlineimage018| image:: sm_image018.gif
-.. |inlineimage019| image:: sm_image019.gif
-
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-Polydispersity Distributions
-----------------------------
-
-With some models SasView can calculate the average form factor for a population
-of particles that exhibit size and/or orientational polydispersity. The resultant
-form factor is normalized by the average particle volume such that
-
-*P(q) = scale* * \ <F*\F> / *V + bkg*
-
-where F is the scattering amplitude and the \<\> denote an average over the size
-distribution.
-
-Users should note that this computation is very intensive. Applying polydispersion
-to multiple parameters at the same time, or increasing the number of *Npts* values
-in the fit, will require patience! However, the calculations are generally more
-robust with more data points or more angles.
-
-SasView uses the term *PD* for a size distribution (and not to be confused with a
-molecular weight distributions in polymer science) and the term *Sigma* for an
-angular distribution.
-
-The following five distribution functions are provided:
-
-*  *Rectangular Distribution*
-*  *Gaussian Distribution*
-*  *Lognormal Distribution*
-*  *Schulz Distribution*
-*  *Array Distribution*
-
-These are all implemented in SasView as *number-average* distributions.
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-Rectangular Distribution
-^^^^^^^^^^^^^^^^^^^^^^^^
-
-The Rectangular Distribution is defined as
-
-.. image:: pd_image001.png
-
-where *xmean* is the mean of the distribution, *w* is the half-width, and *Norm* is a
-normalization factor which is determined during the numerical calculation.
-
-Note that the standard deviation and the half width *w* are different!
-
-The standard deviation is
-
-.. image:: pd_image002.png
-
-whilst the polydispersity is
-
-.. image:: pd_image003.png
-
-.. image:: pd_image004.jpg
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-Gaussian Distribution
-^^^^^^^^^^^^^^^^^^^^^
-
-The Gaussian Distribution is defined as
-
-.. image:: pd_image005.png
-
-where *xmean* is the mean of the distribution and *Norm* is a normalization factor
-which is determined during the numerical calculation.
-
-The polydispersity is
-
-.. image:: pd_image003.png
-
-
-.. image:: pd_image006.jpg
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-Lognormal Distribution
-^^^^^^^^^^^^^^^^^^^^^^
-
-The Lognormal Distribution is defined as
-
-.. image:: pd_image007.png
-
-where |mu|\ =ln(*xmed*), *xmed* is the median value of the distribution, and
-*Norm* is a normalization factor which will be determined during the numerical
-calculation.
-
-The median value for the distribution will be the value given for the respective
-size parameter in the *Fitting Perspective*, for example, radius = 60.
-
-The polydispersity is given by |sigma|
-
-.. image:: pd_image008.png
-
-For the angular distribution
-
-.. image:: pd_image009.png
-
-The mean value is given by *xmean*\ =exp(|mu|\ +p\ :sup:`2`\ /2). The peak value
-is given by *xpeak*\ =exp(|mu|-p\ :sup:`2`\ ).
-
-.. image:: pd_image010.jpg
-
-This distribution function spreads more, and the peak shifts to the left, as *p*
-increases, requiring higher values of Nsigmas and Npts.
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-Schulz Distribution
-^^^^^^^^^^^^^^^^^^^
-
-The Schulz distribution is defined as
-
-.. image:: pd_image011.png
-
-where *xmean* is the mean of the distribution and *Norm* is a normalization factor
-which is determined during the numerical calculation, and *z* is a measure of the
-width of the distribution such that
-
-z = (1-p\ :sup:`2`\ ) / p\ :sup:`2`
-
-The polydispersity is
-
-.. image:: pd_image012.png
-
-Note that larger values of PD might need larger values of Npts and Nsigmas.
-For example, at PD=0.7 and radius=60 |Ang|, Npts>=160 and Nsigmas>=15 at least.
-
-.. image:: pd_image013.jpg
-
-For further information on the Schulz distribution see:
-M Kotlarchyk & S-H Chen, *J Chem Phys*, (1983), 79, 2461.
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-Array Distribution
-^^^^^^^^^^^^^^^^^^
-
-This user-definable distribution should be given as as a simple ASCII text file
-where the array is defined by two columns of numbers: *x* and *f(x)*. The *f(x)*
-will be normalized by SasView during the computation.
-
-Example of what an array distribution file should look like:
-
-====  =====
- 30    0.1
- 32    0.3
- 35    0.4
- 36    0.5
- 37    0.6
- 39    0.7
- 41    0.9
-====  =====
-
-SasView only uses these array values during the computation, therefore any mean
-value of the parameter represented by *x* present in the *Fitting Perspective*
-will be ignored.
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-Note about DLS polydispersity
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-Many commercial Dynamic Light Scattering (DLS) instruments produce a size
-polydispersity parameter, sometimes even given the symbol *p*! This parameter is
-defined as the relative standard deviation coefficient of variation of the size
-distribution and is NOT the same as the polydispersity parameters in the Lognormal
-and Schulz distributions above (though they all related) except when the DLS
-polydispersity parameter is <0.13.
-
-For more information see:
-S King, C Washington & R Heenan, *Phys Chem Chem Phys*, (2005), 7, 143
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-.. note::  This help document was last changed by Steve King, 01May2015
Index: cs/sphinx-docs/source/user/sasgui/perspectives/fitting/residuals_help.copy
===================================================================
--- docs/sphinx-docs/source/user/sasgui/perspectives/fitting/residuals_help.copy	(revision 49148bbc34832e06f4f05e8e4c4c32c0da92d133)
+++ 	(revision )
@@ -1,66 +1,0 @@
-.. residuals_help.rst
-
-.. |chi| unicode:: U+03C7
-
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-.. _Assessing_Fit_Quality:
-
-Assessing Fit Quality
----------------------
-
-When performing model-fits to some experimental data it is helpful to be able to
-gauge how good an individual fit is, how it compares to a fit of the *same model*
-*to another set of data*, or how it compares to a fit of a *different model to the*
-*same data*.
-
-One way is obviously to just inspect the graph of the experimental data and to
-see how closely (or not!) the 'theory' calculation matches it. But *SasView*
-also provides two other measures of the quality of a fit:
-
-*  |chi|\  :sup:`2` (or 'Chi2'; pronounced 'chi-squared')
-*  *Residuals*
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-Chi2
-^^^^
-
-Chi2 is a statistical parameter that quantifies the differences between an observed
-data set and an expected dataset (or 'theory').
-
-*SasView* actually returns this parameter normalized to the number of data points,
-*Npts* such that
-
-  *Chi2/Npts* = { SUM[(*Y_i* - *Y_theory_i*)^2 / (*Y_error_i*)^2] } / *Npts*
-
-This differs slightly from what is sometimes called the 'reduced chi-squared'
-because it does not take into account the number of fitting parameters (to
-calculate the number of 'degrees of freedom'), but the 'normalized chi-squared'
-and the 'reduced chi-squared' are very close to each other when *Npts* >> number of
-parameters.
-
-For a good fit, *Chi2/Npts* tends to 0.
-
-*Chi2/Npts* is sometimes referred to as the 'goodness-of-fit' parameter.
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-Residuals
-^^^^^^^^^
-
-A residual is the difference between an observed value and an estimate of that
-value, such as a 'theory' calculation (whereas the difference between an observed
-value and its *true* value is its error).
-
-*SasView* calculates 'normalized residuals', *R_i*, for each data point in the
-fit:
-
-  *R_i* = (*Y_i* - *Y_theory_i*) / (*Y_err_i*)
-
-For a good fit, *R_i* ~ 0.
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-.. note::  This help document was last changed by Steve King, 08Jun2015
Index: cs/sphinx-docs/source/user/sasgui/perspectives/fitting/sm_help.copy
===================================================================
--- docs/sphinx-docs/source/user/sasgui/perspectives/fitting/sm_help.copy	(revision 49148bbc34832e06f4f05e8e4c4c32c0da92d133)
+++ 	(revision )
@@ -1,229 +1,0 @@
-.. sm_help.rst
-
-.. This is a port of the original SasView html help file to ReSTructured text
-.. by S King, ISIS, during SasView CodeCamp-III in Feb 2015.
-
-.. |beta| unicode:: U+03B2
-.. |gamma| unicode:: U+03B3
-.. |mu| unicode:: U+03BC
-.. |sigma| unicode:: U+03C3
-.. |phi| unicode:: U+03C6
-.. |theta| unicode:: U+03B8
-.. |chi| unicode:: U+03C7
-.. |bigdelta| unicode:: U+0394
-
-.. |inlineimage004| image:: sm_image004.gif
-.. |inlineimage005| image:: sm_image005.gif
-.. |inlineimage008| image:: sm_image008.gif
-.. |inlineimage009| image:: sm_image009.gif
-.. |inlineimage010| image:: sm_image010.gif
-.. |inlineimage011| image:: sm_image011.gif
-.. |inlineimage012| image:: sm_image012.gif
-.. |inlineimage018| image:: sm_image018.gif
-.. |inlineimage019| image:: sm_image019.gif
-
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-Smearing Functions
-==================
-
-Sometimes it will be necessary to correct reduced experimental data for the
-physical effects of the instrumental geometry in use. This process is called
-*desmearing*. However, calculated/simulated data - which by definition will be
-perfect/exact - can be *smeared* to make it more representative of what might
-actually be measured experimentally.
-
-SasView provides the following three smearing algorithms:
-
-*  *Slit Smearing*
-*  *Pinhole Smearing*
-*  *2D Smearing*
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-Slit Smearing
--------------
-
-**This type of smearing is normally only encountered with data from X-ray Kratky**
-**cameras or X-ray/neutron Bonse-Hart USAXS/USANS instruments.**
-
-The slit-smeared scattering intensity is defined by
-
-.. image:: sm_image002.gif
-
-where *Norm* is given by
-
-.. image:: sm_image003.gif
-
-**[Equation 1]**
-
-The functions |inlineimage004| and |inlineimage005|
-refer to the slit width weighting function and the slit height weighting 
-determined at the given *q* point, respectively. It is assumed that the weighting
-function is described by a rectangular function, such that
-
-.. image:: sm_image006.gif
-
-**[Equation 2]**
-
-and
-
-.. image:: sm_image007.gif
-
-**[Equation 3]**
-
-so that |inlineimage008| |inlineimage009| for |inlineimage010| and *u*\ .
-
-Here |inlineimage011| and |inlineimage012| stand for
-the slit height (FWHM/2) and the slit width (FWHM/2) in *q* space.
-
-This simplifies the integral in Equation 1 to
-
-.. image:: sm_image013.gif
-
-**[Equation 4]**
-
-which may be solved numerically, depending on the nature of |inlineimage011| and |inlineimage012| .
-
-Solution 1
-^^^^^^^^^^
-
-**For** |inlineimage012| **= 0 and** |inlineimage011| **= constant.**
-
-.. image:: sm_image016.gif
-
-For discrete *q* values, at the *q* values of the data points and at the *q*
-values extended up to *q*\ :sub:`N`\ = *q*\ :sub:`i` + |inlineimage011| the smeared
-intensity can be approximately calculated as
-
-.. image:: sm_image017.gif
-
-**[Equation 5]**
-
-where |inlineimage018| = 0 for *I*\ :sub:`s` when *j* < *i* or *j* > *N-1*.
-
-Solution 2
-^^^^^^^^^^
-
-**For** |inlineimage012| **= constant and** |inlineimage011| **= 0.**
-
-Similar to Case 1
-
-|inlineimage019| for *q*\ :sub:`p` = *q*\ :sub:`i` - |inlineimage012| and *q*\ :sub:`N` = *q*\ :sub:`i` + |inlineimage012|
-
-**[Equation 6]**
-
-where |inlineimage018| = 0 for *I*\ :sub:`s` when *j* < *p* or *j* > *N-1*.
-
-Solution 3
-^^^^^^^^^^
-
-**For** |inlineimage011| **= constant and** |inlineimage011| **= constant.**
-
-In this case, the best way is to perform the integration of Equation 1
-numerically for both slit height and slit width. However, the numerical
-integration is imperfect unless a large number of iterations, say, at
-least 10000 by 10000 for each element of the matrix *W*, is performed.
-This is usually too slow for routine use.
-
-An alternative approach is used in SasView which assumes
-slit width << slit height. This method combines Solution 1 with the
-numerical integration for the slit width. Then
-
-.. image:: sm_image020.gif
-
-**[Equation 7]**
-
-for *q*\ :sub:`p` = *q*\ :sub:`i` - |inlineimage012| and *q*\ :sub:`N` = *q*\ :sub:`i` + |inlineimage012|
-
-where |inlineimage018| = 0 for *I*\ :sub:`s` when *j* < *p* or *j* > *N-1*.
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-Pinhole Smearing
-----------------
-
-**This is the type of smearing normally encountered with data from synchrotron**
-**SAXS cameras and SANS instruments.**
-
-The pinhole smearing computation is performed in a similar fashion to the slit-
-smeared case above except that the weight function used is a Gaussian. Thus
-Equation 6 becomes
-
-.. image:: sm_image021.gif
-
-**[Equation 8]**
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-2D Smearing
------------
-
-The 2D smearing computation is performed in a similar fashion to the 1D pinhole
-smearing above except that the weight function used is a 2D elliptical Gaussian.
-Thus
-
-.. image:: sm_image022.gif
-
-**[Equation 9]**
-
-In Equation 9, *x*\ :sub:`0` = *q* cos(|theta|), *y*\ :sub:`0` = *q* sin(|theta|), and
-the primed axes, are all in the coordinate rotated by an angle |theta| about
-the z-axis (see the figure below) so that *x'*\ :sub:`0` = *x*\ :sub:`0` cos(|theta|) +
-*y*\ :sub:`0` sin(|theta|) and *y'*\ :sub:`0` = -*x*\ :sub:`0` sin(|theta|) +
-*y*\ :sub:`0` cos(|theta|). Note that the rotation angle is zero for a x-y symmetric
-elliptical Gaussian distribution. The *A* is a normalization factor.
-
-.. image:: sm_image023.gif
-
-Now we consider a numerical integration where each of the bins in |theta| and *R* are
-*evenly* (this is to simplify the equation below) distributed by |bigdelta|\ |theta|
-and |bigdelta|\ R, respectively, and it is further assumed that *I(x',y')* is constant
-within the bins. Then
-
-.. image:: sm_image024.gif
-
-**[Equation 10]**
-
-Since the weighting factor on each of the bins is known, it is convenient to
-transform *x'-y'* back to *x-y* coordinates (by rotating it by -|theta| around the
-*z* axis).
-
-Then, for a polar symmetric smear
-
-.. image:: sm_image025.gif
-
-**[Equation 11]**
-
-where
-
-.. image:: sm_image026.gif
-
-while for a *x-y* symmetric smear
-
-.. image:: sm_image027.gif
-
-**[Equation 12]**
-
-where
-
-.. image:: sm_image028.gif
-
-The current version of the SasView uses Equation 11 for 2D smearing, assuming
-that all the Gaussian weighting functions are aligned in the polar coordinate.
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-Weighting & Normalization
--------------------------
-
-In all the cases above, the weighting matrix *W* is calculated on the first call
-to a smearing function, and includes ~60 *q* values (finely and evenly binned)
-below (>0) and above the *q* range of data in order to smear all data points for
-a given model and slit/pinhole size. The *Norm*  factor is found numerically with the
-weighting matrix and applied on the computation of *I*\ :sub:`s`.
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-.. note::  This help document was last changed by Steve King, 01May2015
Index: cs/sphinx-docs/source/user/sasgui/perspectives/invariant/invariant_help.copy
===================================================================
--- docs/sphinx-docs/source/user/sasgui/perspectives/invariant/invariant_help.copy	(revision 49148bbc34832e06f4f05e8e4c4c32c0da92d133)
+++ 	(revision )
@@ -1,128 +1,0 @@
-.. invariant_help.rst
-
-.. This is a port of the original SasView html help file to ReSTructured text
-.. by S King, ISIS, during SasView CodeCamp-III in Feb 2015.
-
-.. |Ang| unicode:: U+212B
-.. |pi| unicode:: U+03C0
-.. |bigdelta| unicode:: U+0394
-.. |rho| unicode:: U+03C1
-.. |phi| unicode:: U+03C6
-
-Invariant Calculation Perspective
-=================================
-
-Description
------------
-
-The scattering, or Porod, invariant (Q*\) is a model-independent quantity that 
-can be easily calculated from scattering data.
-
-For two phase systems, the scattering invariant is defined as the integral of 
-the square of the wave transfer (Q) multiplied by the scattering cross section 
-over the full range of Q from zero to infinity, that is
-
-.. image:: image001.gif
-
-where *g = Q* for pinhole geometry (SAS) and *g = Qv* (the slit height) for  
-slit geometry (USAS).
-
-The worth of Q*\  is that it can be used to determine the volume fraction and 
-the specific area of a sample. Whilst these quantities are useful in their own 
-right they can also be used in further analysis.
-
-The difficulty with using Q*\  arises from the fact that experimental data is 
-never measured over the range 0 =< *Q* =< infinity. At best, combining USAS and 
-WAS data might cover the range 1e-5 =< *Q* =< 10 1/\ |Ang| . Thus it is usually 
-necessary to extrapolate the experimental data to low and high *Q*. For this
-
-High-*Q* region (>= *Qmax* in data)
-
-*  The power law function *C*/*Q*\ :sup:`4` is used where the constant 
-   *C* (= 2.\ |pi|\ .(\ |bigdelta|\ |rho|\ ).\ *Sv*\ ) is to be found by fitting part of data 
-   within the range *Q*\ :sub:`N-m` to *Q*\ :sub:`N` (where m < N).
-
-Low-*Q* region (<= *Qmin* in data)
-
-*  The Guinier function *I0.exp(-Rg*\ :sup:`2`\ *Q*\ :sup:`2`\ */3)* where *I0* 
-   and *Rg* are obtained by fitting as for the high-*Q* region above. 
-   Alternatively a power law can be used.
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-Using the perspective
----------------------
-
-1) Select *Invariant* from the *Analysis* menu on the SasView toolbar.
-
-2) Load some data with the *Data Explorer*.
-
-3) Select a dataset and use the *Send To* button on the *Data Explorer* to load 
-   the dataset into the *Invariant* perspective.
-
-4) Use the *Customised Input* boxes on the *Invariant* perspective to subtract 
-   any background, specify the contrast (i.e. difference in SLDs - this must be 
-   specified for the eventual value of Q*\  to be on an absolute scale), or to 
-   rescale the data.
-
-5) Adjust the extrapolation range as necessary. In most cases the default 
-   values will suffice.
-
-6) Click the *Compute* button.
-
-7) To include a lower and/or higher Q range, check the relevant *Enable 
-   Extrapolate* check boxes.
-   
-   If power law extrapolations are chosen, the exponent can be either held 
-   fixed or fitted. The number of points, Npts, to be used for the basis of the 
-   extrapolation can also be specified.
-
-8) If the value of Q*\  calculated with the extrapolated regions is invalid, a 
-   red warning will appear at the top of the *Invariant* perspective panel.
-
-   The details of the calculation are available by clicking the *Details* 
-   button in the middle of the panel.
-
-.. image:: image005.gif
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-Parameters
-----------
-
-Volume Fraction
-^^^^^^^^^^^^^^^
-
-The volume fraction |phi| is related to Q*\  by
-
-.. image:: image002.gif
-
-where |bigdelta|\ |rho| is the SLD contrast.
-
-.. image:: image003.gif
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-Specific Surface Area
-^^^^^^^^^^^^^^^^^^^^^
-
-The specific surface area *Sv* is related to Q*\  by
-
-.. image:: image004.gif
-
-where *Cp* is the Porod constant.
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-Reference
----------
-
-O. Glatter and O. Kratky
-Chapter 2 in *Small Angle X-Ray Scattering*
-Academic Press, New York, 1982
-
-http://physchem.kfunigraz.ac.at/sm/
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-.. note::  This help document was last changed by Steve King, 01May2015
Index: docs/sphinx-docs/source/user/sasgui/perspectives/invariant/invariant_help.rst
===================================================================
--- docs/sphinx-docs/source/user/sasgui/perspectives/invariant/invariant_help.rst	(revision 5f5c5965f23ac2cbcb5f353269eb3c3db1c065a0)
+++ docs/sphinx-docs/source/user/sasgui/perspectives/invariant/invariant_help.rst	(revision 9bbc0746d460d36edd233363e4474810ed181b3a)
@@ -4,6 +4,6 @@
 .. by S King, ISIS, during SasView CodeCamp-III in Feb 2015.
 
-Invariant Calculation Perspective
-=================================
+Invariant Calculation
+=====================
 
 Description
@@ -19,5 +19,5 @@
 .. image:: image001.gif
 
-where *g = Q* for pinhole geometry (SAS) and *g = Qv* (the slit height) for  
+where *g = q* for pinhole geometry (SAS) and *g = q*\ :sub:`v` (the slit height) for  
 slit geometry (USAS).
 
@@ -45,6 +45,6 @@
 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
 
-Using the perspective
----------------------
+Using invariant analysis
+------------------------
 
 1) Select *Invariant* from the *Analysis* menu on the SasView toolbar.
@@ -53,7 +53,7 @@
 
 3) Select a dataset and use the *Send To* button on the *Data Explorer* to load 
-   the dataset into the *Invariant* perspective.
+   the dataset into the *Invariant* panel.
 
-4) Use the *Customised Input* boxes on the *Invariant* perspective to subtract 
+4) Use the *Customised Input* boxes on the *Invariant* panel to subtract 
    any background, specify the contrast (i.e. difference in SLDs - this must be 
    specified for the eventual value of Q*\  to be on an absolute scale), or to 
@@ -73,5 +73,5 @@
 
 8) If the value of Q*\  calculated with the extrapolated regions is invalid, a 
-   red warning will appear at the top of the *Invariant* perspective panel.
+   red warning will appear at the top of the *Invariant* panel.
 
    The details of the calculation are available by clicking the *Details* 
Index: cs/sphinx-docs/source/user/sasgui/perspectives/pr/pr_help.copy
===================================================================
--- docs/sphinx-docs/source/user/sasgui/perspectives/pr/pr_help.copy	(revision 49148bbc34832e06f4f05e8e4c4c32c0da92d133)
+++ 	(revision )
@@ -1,62 +1,0 @@
-.. pr_help.rst
-
-.. This is a port of the original SasView html help file to ReSTructured text
-.. by S King, ISIS, during SasView CodeCamp-III in Feb 2015.
-
-.. |pi| unicode:: U+03C0
-.. |bigphi| unicode:: U+03A6
-.. |bigsigma| unicode:: U+03A3
-.. |chi| unicode:: U+03C7
-
-P(r) Inversion Perspective
-==========================
-
-Description
------------
-
-This tool calculates a real-space distance distribution function, *P(r)*, using 
-the inversion approach (Moore, 1908).
-
-*P(r)* is set to be equal to an expansion of base functions of the type
-
-  |bigphi|\_n(r) = 2.r.sin(|pi|\ .n.r/D_max)
-
-The coefficient of each base function in the expansion is found by performing 
-a least square fit with the following fit function
-
-  |chi|\ :sup:`2` = |bigsigma|\ :sub:`i` [ I\ :sub:`meas`\ (Q\ :sub:`i`\ ) - I\ :sub:`th`\ (Q\ :sub:`i`\ ) ] :sup:`2` / (Error) :sup:`2` + Reg_term
-
-where I\ :sub:`meas`\ (Q) is the measured scattering intensity and 
-I\ :sub:`th`\ (Q) is the prediction from the Fourier transform of the *P(r)* 
-expansion. 
-
-The *Reg_term* term is a regularization term set to the second derivative 
-d\ :sup:`2`\ *P(r)* / dr\ :sup:`2` integrated over *r*. It is used to produce a 
-smooth *P(r)* output.
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-Using the perspective
----------------------
-
-The user must enter
-
-*  *Number of terms*: the number of base functions in the P(r) expansion.
-   
-*  *Regularization constant*: a multiplicative constant to set the size of
-   the regularization term.
-
-*  *Maximum distance*: the maximum distance between any two points in the
-   system.
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-Reference
----------
-
-P.B. Moore
-*J. Appl. Cryst.*, 13 (1980) 168-175
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-.. note::  This help document was last changed by Steve King, 01May2015
Index: docs/sphinx-docs/source/user/tools.rst
===================================================================
--- docs/sphinx-docs/source/user/tools.rst	(revision eb8da5f6d46ff9952df4b0fa31b3cf63ba4e1be8)
+++ docs/sphinx-docs/source/user/tools.rst	(revision ec860a8f303938f6a9f5b6109d0b0ec4eb7ab109)
@@ -1,2 +1,4 @@
+.. _tools:
+
 Tools
 =====
Index: docs/sphinx-docs/source/user/tutorial.rst
===================================================================
--- docs/sphinx-docs/source/user/tutorial.rst	(revision 13161acfcefd029e22a7a2c3790b42e4737efbd1)
+++ docs/sphinx-docs/source/user/tutorial.rst	(revision ec860a8f303938f6a9f5b6109d0b0ec4eb7ab109)
@@ -1,3 +1,5 @@
 .. tutorial.rst
+
+.. _tutorial:
 
 Tutorial
Index: docs/sphinx-docs/source/user/user.rst
===================================================================
--- docs/sphinx-docs/source/user/user.rst	(revision 5a71761895538afa4a68d669b093f8c4a2be0109)
+++ docs/sphinx-docs/source/user/user.rst	(revision bdae3178bba556f0cdefce0d7acc6cc6c260d321)
@@ -7,5 +7,7 @@
    :maxdepth: 1
 
-   SasView Model Documentation <index>
+   Model Documentation <index>
+   
+   Menu Bar <menu_bar>
 
    Analysis <analysis>
Index: docs/sphinx-docs/source/user/working.rst
===================================================================
--- docs/sphinx-docs/source/user/working.rst	(revision 3a6b10dad839b1b71060028ef2bdb047153c78cd)
+++ docs/sphinx-docs/source/user/working.rst	(revision c43953efb2e4acc613c7ebd6174b01e2351ffced)
@@ -16,2 +16,5 @@
       
    Tutorial <tutorial.rst>
+   
+   Computations with a GPU <gpu_computations>
+   
Index: sview.latestversion
===================================================================
--- sasview.latestversion	(revision 792e6be8e13f67657de88e5fb9a9afb91a750c30)
+++ 	(revision )
@@ -1,1 +1,0 @@
-3.1.2
Index: sasview/README.txt
===================================================================
--- sasview/README.txt	(revision 243fbc08b5507d76300536ef5949cadf6da173c0)
+++ sasview/README.txt	(revision 9a182b24778d8ca30e8e54968548156199dd1240)
@@ -4,4 +4,51 @@
 1- Features
 ===========
+    - New in Version 4.0
+      ------------------
+      This release fixes the various bugs found during the alpha and beta testing
+      - Improvements
+        - Support for reading data files from Anton Paar Saxess instruments
+        - Adds documentation on how to write custom models in the new framework
+      - Bug Fixes
+        - Fixes bug #604 Pringle model questions
+        - Fixes bug #472 Reparameterize Teubner-Strey
+        - Fixes bug #530 Numerical instabilities in Teubner Strey model
+        - Fixes bug #658 ASCII reader very broken
+
+
+    - New in Version 4.0 beta 1
+      --------------------
+      This beta adds support for the magnetic and multilevel models of 3.1.2
+      and along with a host of bug fixes found in the alpha.
+
+      - Model package changes and improvements
+         - All 3.1.2 models now available in new interface
+         - Old custom models should now still work
+            - '''NOTE:''' These will be deprecated in a future version. Old
+            custom models should be converted to the new model format which
+            is now the same as the built in models and offers much better
+            support.
+         - Custom model editor now creates new style models
+         - Custom model editor supports better error checking
+      - Documentation improvements
+        - Continued general cleanup
+      - Other improvements/additions
+         - Support for new canSAS 2D data files added
+         - Plot axes range can now be set manually as well as by zooming
+         - Plot annotations can now be moved around after being placed on plot.
+         - The active optimizer is now listed on the top of the fit panel.
+         - Linear fits now update qmin and max when the x scale limits are
+         changed.  Also the plot range no longer resets after a fit.
+      - Bug fixes
+         - Fixes bug #511 Errors in linearized fits and clean up of interface
+         including Kratky representation
+         - Fixes bug #186 Data operation Tool now executes when something is
+         entered in the text box and does not wait for the user to hit enter
+         - Fixes bug #459 plot context menu bug
+         - Fixes bug #559 copy to clipboard in graph menu broken
+         - Fixes bug #466 cannot remove a linear fit from graph
+         - Numerous bugs introduced in the alpha
+
+
 
     - New in Version 4.0.0-alpha
@@ -44,12 +91,12 @@
    - New in Version 3.1.2
      --------------------
-     This release is a major stability improvement, having fixed a serious bug 
+     This release is a major stability improvement, having fixed a serious bug
      that came to light since release 3.1.1. All users should upgrade.
 
-     - Fixes bug #468 broken remove constraint buttons in 
+     - Fixes bug #468 broken remove constraint buttons in
        simultaneous/constrained fitting panel
-     - Fixes bug #474 resulting from changes in 3.1.1 that had 
+     - Fixes bug #474 resulting from changes in 3.1.1 that had
        introduced an error in the high-Q of slit-smeared models.
-     - Fixes bug #478 which would cause wx to run out of IDs and result 
+     - Fixes bug #478 which would cause wx to run out of IDs and result
        in SasView crashing even if left alone.
      - Fixes bug #479 missing help button on simultaneous/constrained fit page
@@ -75,7 +122,7 @@
          documentation.
        - The model help has been split so that the Details button now brings up
-         a very short pop-up giving the equation being used while HELP goes to 
+         a very short pop-up giving the equation being used while HELP goes to
          the section in the full documentation describing the model.
-       - Extensive help has also been added for the new optimizer engine (see 
+       - Extensive help has also been added for the new optimizer engine (see
          below) including rules of thumb on how and when to choose a given
          optimizer and what the parameters do.
@@ -92,5 +139,5 @@
          - A Nelder-Mead Simplex optimizer
          - A Differential Evolution optimizer
-         - A Monte Carlo optimizer (DREAM) 
+         - A Monte Carlo optimizer (DREAM)
      - New models were added:
          - MicelleSphCoreModel (currently residing in the Uncategorized category)
@@ -101,5 +148,5 @@
          - RectangularHollowPrismInfThinWallsModel
      - Infrastructure to allow SESANS data to be fit with models was added. This
-       will become available in a future release but can currently be used from 
+       will become available in a future release but can currently be used from
        the command line with some caveats.
      - A number of bugs were fixed including a thread crashing issue and an
@@ -126,26 +173,26 @@
        floating.
      - Five new models have been added: PringlesModel, CoreShellEllipsoidXTModel,
-       RectangularPrismModel, RectangularHollowPrismModel and 
+       RectangularPrismModel, RectangularHollowPrismModel and
        RectangularHollowPrismInfThinWallsModel.
-     - The data loader now supports ILL DAT data files and reads the full meta 
+     - The data loader now supports ILL DAT data files and reads the full meta
        information from canSAS file formats.
      - Redefined convention for specifying angular parameters for anisotropic
        models.
-     - A number of minor features have been added such as permitting a log 
-       distribution of points when using a model to simulate data, and the 
+     - A number of minor features have been added such as permitting a log
+       distribution of points when using a model to simulate data, and the
        addition of a Kratky plot option to the linear plots.
      - A number of bugs have also been fixed.
      - Save Project and Save Analysis now work more reliably.
-     - BETA: Magnetic contrast supporting full polarization analysis has been 
+     - BETA: Magnetic contrast supporting full polarization analysis has been
        implemented for some spherical and cylindrical models.
      - BETA: Two new tools have been added:
-       - A generic scattering calculator which takes an atomic, magnetic or 
-         SLD distribution in space and generates the appropriate 2D 
-         scattering pattern. In some cases the orientationally averaged 
-         (powder) 1D scattering can also be computed. Supported formats 
-         include: SLD or text, PDB, and OMF magnetic moment distribution 
+       - A generic scattering calculator which takes an atomic, magnetic or
+         SLD distribution in space and generates the appropriate 2D
+         scattering pattern. In some cases the orientationally averaged
+         (powder) 1D scattering can also be computed. Supported formats
+         include: SLD or text, PDB, and OMF magnetic moment distribution
          file.
-       - An image viewer/converter for data in image format; this reads in 
-         an image file and will attempt to convert the image pixels to 
+       - An image viewer/converter for data in image format; this reads in
+         an image file and will attempt to convert the image pixels to
          data. Supported formats include: TIFF, TIF, PNG, BMP, JPG.
 
@@ -175,9 +222,9 @@
      - Added more plot symbols options for 1d plots
      - Added improved trapping of compiling errors to the 'New model editor'
-     - Added some intelligent outputs (e.g., Rg, background, or rod diameter 
+     - Added some intelligent outputs (e.g., Rg, background, or rod diameter
        depending on the choice of axis scale of the plot) to the linear fits
      - Added more models
-     
-   - Feature set from previous versions 	
+
+   - Feature set from previous versions
      -----------------------------------
      - Perspectives Available
@@ -185,10 +232,10 @@
          specific surface area.
        - P(r) inversion calculator: Indirect Fourier transformation method.
-       - Fitting: the tool used for modeling and fitting 1D and 2D data to 
+       - Fitting: the tool used for modeling and fitting 1D and 2D data to
          analytical model functions
        - Tools: provides a number of useful supplementary tools such as SLD
-         calculation  
-    
-     - Fitting 
+         calculation
+
+     - Fitting
        - Includes a large number of model functions, both form factors and structure factors.
        - Support P(Q)*S(Q) for form factors that flag they can be so multiplied.
@@ -198,8 +245,8 @@
        - Anisotropic shapes and magnetic moment modeling in 2D allow for a non-uniform
          distribution of orientations of a given axis leading to modeling and fitting
-         capabilities of non azimuthaly symmetric data.  
+         capabilities of non azimuthaly symmetric data.
        - User can choose to weight fits or not. If using weights, the user can choose
          the error bar on each point if provided in the file, the square root
-         of the intensity or the intensity itself. 
+         of the intensity or the intensity itself.
        - Instrumental resolution smearing of model or fits is provided with several
          options: read the resolution/point fromt he file. Input a pinhole resolution
@@ -214,6 +261,6 @@
          data set or several different sets simultaneously with the application
          of advanced constraints relating fit parameters to functions of other
-         parameters (including from a different set). For example thickness of 
-         shell = sin(30) times the length.  
+         parameters (including from a different set). For example thickness of
+         shell = sin(30) times the length.
        - Models that are the sum of two other models can be easily generated through the
          SUM Model menubar item.
@@ -224,11 +271,11 @@
          and the mathematical function of the model (box 2) and generating the
          necessary *.py file.  A separate advanced model editor provides a full Python
-         file editor.  Either way once saved the model becomes immediately available 
-         to the application. 
+         file editor.  Either way once saved the model becomes immediately available
+         to the application.
        - A batch fitting capability allows for the analysis of a series of data sets to
          a single model and provides the results in a tabular form suitable for saving
          or plotting the evolution of the fit parameters with error bars (from within
          the application).
- 
+
      - Tools
        - A scattering length density calculator,including some X-ray information
@@ -240,5 +287,5 @@
        - A slit size calculator optimized for Anton Paar Saxess is provided.
        - A kiessig fringe thickness calculator is provided
-         
+
      - Plots and plot management
        - A 3D graphing option (for 2d data/results) is provided with the view
@@ -254,8 +301,8 @@
        - Extensive context sensitive plot/fitting/manipulation options are available
          through a right mouse click pop-up menu on plots.
-           
+
      - Data management
        - Supports 2 + column 1D ASCII data, NIST 1D and 2D data, and canSAS data
-         via plug-in mechanism which can easily allow other readers as appropriate. 
+         via plug-in mechanism which can easily allow other readers as appropriate.
        - 2D data is expected in Q space but for historical reasons accepts the
          NIST 2D raw pixel format and will do conversion internally.
@@ -263,5 +310,5 @@
          right clicking on a data set and choosing Data Info in the DataExplorer
          or on the plots
-       - Supports loading a single file, multiple files, or a whole folder   
+       - Supports loading a single file, multiple files, or a whole folder
        - An optional Data Explorer is provided (default) which simplifies managing,
          plotting, deleting, or setup for computation. Most functions however do
@@ -269,5 +316,5 @@
          right click menus and the toolbar.  The data explorer can be re-started
          from the menu bar.
-           
+
      - Data manipulation
        - Support various 2D averaging methods : Circular, sectors, annular,
@@ -275,5 +322,5 @@
        - A 2D data maks editor is provided
        - 2D mask can be applied to the circular averaging.
-         
+
      - Miscellaneous features
        - limited reports can be generated in pdf format
@@ -296,5 +343,5 @@
 2- Downloading and Installing
 =============================
-	
+
    *** Note 1:  Much more information is available at www.sasview.org under links.
 	            Look in the 'For Developers' section and particularly the wiki at
@@ -335,5 +382,5 @@
         - The following modules are required (version numbers are what are used
           in the windows release build):
-          
+
           - Common Packages
             - reportlab 3.1.44
@@ -352,5 +399,5 @@
             - html5lib Version Installed: 0.99999
             - wx Version Installed: 3.0.2.0
-          
+
           - Windows Specific Packages
             - pywin 219
@@ -358,5 +405,5 @@
             - comtypes 1.1.1
             - MinGW w/ gcc version 4.6.1 (WIN)
-            - vcredist_x86.exe (version 9.0.21022.8  -microsoft visual C 2008 
+            - vcredist_x86.exe (version 9.0.21022.8  -microsoft visual C 2008
               re-distributable)
             - Innosetup (WIN - isetup 5.4.2-unicode) - used to create distributable
@@ -364,8 +411,8 @@
             *** Note: Windows build dependencies can be set up using anaconda. Instructions
                 can be found at http://trac.sasview.org/wiki/AnacondaSetup
-            
+
           - MAC Specifc Packages
             - py2app 0.7.1
-          
+
 
 3- Known Issues
@@ -377,14 +424,14 @@
           equations will render properly. Until then they will show in their
           original TeX format.
-        - If the documentation window remains stubbornly blank, try installing a 
+        - If the documentation window remains stubbornly blank, try installing a
           different browser and set that as your default browser. Issues have
           been noted with Internet Explorer 11.
-        - Check for Updates may fail (with the status bar message ' Cannot 
-          connect to the application server') if your internet connection uses 
-          a proxy server. Tested resolutions for this are described on the 
+        - Check for Updates may fail (with the status bar message ' Cannot
+          connect to the application server') if your internet connection uses
+          a proxy server. Tested resolutions for this are described on the
           website FAQ.
         - The copy and paste functions (^C, ^V) in the batch mode results grid
           require two clicks: one to select the cell and a second to select the
-          contents of the cell. 
+          contents of the cell.
         - The tutorial has not yet been updated and is somewhat out of date
         - Very old computers may struggle to run the 3.x and later releases
@@ -401,5 +448,5 @@
         - The angular distribution angles are not clearly defined and may in
           some cases lead to incorrect calculations(ticket #332)
-          
+
    3.2- Windows:
         - If installed to same directory as old version without first removing
@@ -408,10 +455,10 @@
           have the old name even though pointing to the new version.  Usually
           safest to uninstall old version prior to installing new version anyway.
-		
+
    3.3- MAC:
         - Application normally starts up hidden. Click icon in Dock to view/use
-          application. 
+          application.
         - Multiprocessing does not currently work on MAC OS
-		
+
    3.4- Linux:
         - Not well tested
@@ -421,5 +468,5 @@
 ==================
 
-   - www.sasview.org.  This main project site is the gateway to all 
+   - www.sasview.org.  This main project site is the gateway to all
      information about the sasview project.  It includes information
      about the project, a FAQ page and links to all developer and user
@@ -440,4 +487,2 @@
    - Latest developer builds
      - https://jenkins.esss.dk/sasview/view/Master-Builds/
-
-    
Index: sasview/__init__.py
===================================================================
--- sasview/__init__.py	(revision 801a2968ae0b500c87588ecf8a8bd3c52546b4ee)
+++ sasview/__init__.py	(revision 9a182b24778d8ca30e8e54968548156199dd1240)
@@ -1,14 +1,18 @@
-__version__ = "4.0.0-alpha"
+__version__ = "4.0"
 __build__ = "GIT_COMMIT"
 try:
+    import logging
     import subprocess
     import os
+    import platform
     FNULL = open(os.devnull, 'w')
-    git_revision = subprocess.check_output(['git', 'rev-parse', 'HEAD'],
+    if platform.system() == "Windows":
+        args = ['git', 'describe', '--tags']
+    else:
+        args = ['git describe --tags']
+    git_revision = subprocess.check_output(args,
                     stderr=FNULL,
                     shell=True)
     __build__ = str(git_revision).strip()
-except:
-    import logging
-    import sys
-    logging.warning("Error while determining build number\n  %s" % sys.exc_value)
+except subprocess.CalledProcessError as cpe:
+    logging.warning("Error while determining build number\n  Using command:\n %s \n Output:\n %s"% (cpe.cmd,cpe.output))
Index: sasview/default_categories.json
===================================================================
--- sasview/default_categories.json	(revision 53b9fc8fcd518c10a31e02bae32f9ce14a339f8e)
+++ sasview/default_categories.json	(revision a7567556686c0843621c2a1fa06625181c2875fe)
@@ -186,4 +186,8 @@
     "Shape-Independent": [
         [
+            "unified_power_Rg",
+            true
+        ],
+        [
             "guinier_porod",
             true
Index: sasview/installer_generator.py
===================================================================
--- sasview/installer_generator.py	(revision 09afe905cc9186fc6fe30cdfb86e1fd68ebe2949)
+++ sasview/installer_generator.py	(revision 525aaa231efcdef4de8d468033aeb8e7b49dad96)
@@ -199,4 +199,6 @@
     msg += """Source: "dist\plugin_models\*";\tDestDir: "{userdesktop}\..\.sasview\plugin_models";\t"""
     msg += """Flags: recursesubdirs createallsubdirs\n""" 
+    msg += """Source: "dist\compiled_models\*";\tDestDir: "{userdesktop}\..\.sasmodels\compiled_models";\t"""
+    msg += """Flags: recursesubdirs createallsubdirs\n"""
     msg += """Source: "dist\config\custom_config.py";\tDestDir: "{userdesktop}\..\.sasview\config";\t""" 
     msg += """Flags: recursesubdirs createallsubdirs\n"""
Index: sasview/local_config.py
===================================================================
--- sasview/local_config.py	(revision d85c194ea2f78cb2b9b3de9c969e1b8ebea6b6d2)
+++ sasview/local_config.py	(revision c1fdf8485e681ba1145937521615515e6c3be688)
@@ -31,23 +31,24 @@
 _acknowledgement_preamble =\
 '''To ensure the long term support and development of this software please''' +\
-''' remember to do the following.'''
+''' remember to:'''
 _acknowledgement_preamble_bullet1 =\
-'''Acknowledge its use in your publications as suggested below'''
+'''Acknowledge its use in your publications as suggested below;'''
 _acknowledgement_preamble_bullet2 =\
-'''Reference the following website: http://www.sasview.org'''
+'''Reference SasView as : M. Doucet, et al. SasView Version 4.0, Zenodo''' +\
+''', http://doi.org/10.5281/zenodo.159083;'''
 _acknowledgement_preamble_bullet3 =\
-'''Reference the model you used if appropriate (see documentation for refs)'''
+'''Reference the model you used if appropriate (see documentation for refs);'''
 _acknowledgement_preamble_bullet4 =\
 '''Send us your reference for our records: developers@sasview.org'''
 _acknowledgement_publications = \
-'''This work benefited from the use of the SasView application, originally
-developed under NSF award DMR-0520547.
-'''
+'''This work benefited from the use of the SasView application, originally developed under NSF Award 
+DMR-0520547. SasView also contains code developed with funding from the EU Horizon 2020 research 
+and innovation programme under the SINE2020 project Grant No 654000.'''
+
 _acknowledgement =  \
-'''This work originally developed as part of the DANSE project funded by the NSF
-under grant DMR-0520547, and currently maintained by NIST, UMD, ORNL, ISIS, ESS
-and ILL.
+'''This work was originally developed as part of the DANSE project funded by the US NSF under Award DMR-0520547, but is currently maintained by a 
+collaboration between UTK, UMD, NIST, ORNL, ISIS, ESS, ILL and ANSTO. SasView also contains code developed with funding from the EU Horizon 2020 
+research and innovation programme under the SINE2020 project (Grant No 654000).'''
 
-'''
 _homepage = "http://www.sasview.org"
 _download = __download_page__
@@ -65,7 +66,9 @@
 _umd_logo = os.path.join(icon_path, "umd_logo.png")
 _sns_logo = os.path.join(icon_path, "sns_logo.png")
+_ornl_logo = os.path.join(icon_path, "ornl_logo.png")
 _isis_logo = os.path.join(icon_path, "isis_logo.png")
 _ess_logo = os.path.join(icon_path, "ess_logo.png")
 _ill_logo = os.path.join(icon_path, "ill_logo.png")
+_ansto_logo = os.path.join(icon_path, "ansto_logo.png")
 _nsf_logo = os.path.join(icon_path, "nsf_logo.png")
 _danse_logo = os.path.join(icon_path, "danse_logo.png")
@@ -74,13 +77,15 @@
 _umd_url = "http://www.umd.edu/"
 _sns_url = "http://neutrons.ornl.gov/"
+_ornl_url = "http://neutrons.ornl.gov/"
 _nsf_url = "http://www.nsf.gov"
 _isis_url = "http://www.isis.stfc.ac.uk/"
 _ess_url = "http://ess-scandinavia.eu/"
 _ill_url = "http://www.ill.eu/"
+_ansto_url = "http://www.ansto.gov.au/"
 _danse_url = "http://www.cacr.caltech.edu/projects/danse/release/index.html"
 _inst_url = "http://www.utk.edu"
 _corner_image = os.path.join(icon_path, "angles_flat.png")
 _welcome_image = os.path.join(icon_path, "SVwelcome.png")
-_copyright = "(c) 2009 - 2013, UTK, UMD, NIST, ORNL, ISIS, ESS and ILL"
+_copyright = "(c) 2009 - 2016, UTK, UMD, NIST, ORNL, ISIS, ESS, ILL and ANSTO"
 
 
Index: sasview/setup_exe.py
===================================================================
--- sasview/setup_exe.py	(revision 09afe905cc9186fc6fe30cdfb86e1fd68ebe2949)
+++ sasview/setup_exe.py	(revision 9bbc0746d460d36edd233363e4474810ed181b3a)
@@ -165,5 +165,5 @@
         self.version = local_config.__version__
         self.company_name = "SasView.org"
-        self.copyright = "copyright 2009 - 2013"
+        self.copyright = "copyright 2009 - 2016"
         self.name = "SasView"
         
@@ -208,4 +208,14 @@
 import sas.sasgui.guiframe as guiframe
 data_files += guiframe.data_files()
+
+# precompile sas models into the sasview build path; doesn't matter too much
+# where it is so long as it is a place that will get cleaned up afterwards.
+import sasmodels.core
+dll_path = os.path.join(build_path, 'compiled_models')
+compiled_dlls = sasmodels.core.precompile_dlls(dll_path, dtype='double')
+
+# include the compiled models as data; coordinate the target path for the
+# data with installer_generator.py
+data_files.append(('compiled_models', compiled_dlls))
 
 import sasmodels
Index: sasview/test/1d_data/rpa_igor.txt
===================================================================
--- sasview/test/1d_data/rpa_igor.txt	(revision d1863191dcb407735ad886fa6024bceb068c8ef6)
+++ sasview/test/1d_data/rpa_igor.txt	(revision d1863191dcb407735ad886fa6024bceb068c8ef6)
@@ -0,0 +1,101 @@
+xwave_rpa	ywave_rpa
+0.001	0.07168626925075851
+0.001064117780747373	0.0716856413573938
+0.001132346651302715	0.07168493030814455
+0.001204950205620966	0.07168412508180971
+0.001282208938716473	0.07168321319399358
+0.001364421330321418	0.07168218050233569
+0.001451904998026007	0.07168101098546385
+0.001544997924355454	0.07167968649221848
+0.001644059762524425	0.07167818645713674
+0.001749473225913545	0.0716764875775549
+0.001861645566636069	0.07167456344702462
+0.001981010148906961	0.0716723841389624
+0.002108028123292898	0.07166991573369859
+0.002243190208311491	0.07166711978089996
+0.002387018586262662	0.07166395268835914
+0.002540068920616557	0.07166036502661252
+0.002702932502751866	0.07165630073742939
+0.00287623853633826	0.07165169623226372
+0.003060656568188345	0.07164647936468646
+0.003256899074970453	0.07164056825826785
+0.003465724215775732	0.07163386996847262
+0.003687938761173703	0.07162627895363945
+0.003924401210072378	0.07161767532607596
+0.004176025106424529	0.07160792284948068
+0.004443782568593783	0.07159686664324522
+0.004728708045015879	0.07158433054747737
+0.005031902310664547	0.07157011409466472
+0.005354536719761938	0.07155398902452134
+0.0056978577311634	0.07153569526749293
+0.00606319172389986	0.07151493630936183
+0.00645195012148216	0.07149137383410067
+0.006865634844764342	0.07146462152429117
+0.007305844114432468	0.07143423787781071
+0.007774278625536145	0.07139971787595621
+0.008272748117917261	0.07136048331177156
+0.008803178367920125	0.07131587155848847
+0.009367618628394449	0.07126512252765335
+0.009968249545734853	0.07120736353659575
+0.01060739158454339	0.07114159177868211
+0.01128751399246268	0.07106665407265171
+0.01201124433981431	0.07098122356757139
+0.01278137867089766	0.07088377310999594
+0.01360089230616743	0.07077254505763607
+0.01447295133702291	0.07064551747379136
+0.01540092485761756	0.07050036689115366
+0.01638839798094505	0.07033442823150102
+0.01743918568948799	0.07014465305200397
+0.01855734757393931	0.06992756809682003
+0.01974720351693796	0.06967923717926586
+0.02101335038241075	0.06939523066874713
+0.0223606797749979	0.0690706081793277
+0.02379439693817345	0.06869992118669545
+0.02532004086407122	0.06827724280195649
+0.02694350569270829	0.06779623122650313
+0.02867106348327896	0.06725023092445773
+0.03050938844549387	0.06663241100530941
+0.0324655827245785	0.0659359341782422
+0.03454720383954873	0.06515414349942344
+0.03676229388076776	0.06428075057887213
+0.03911941057958532	0.06331001060561323
+0.04162766037009365	0.06223687746307689
+0.04429673357072946	0.06105714401626844
+0.0471369418216423	0.05976758284266592
+0.05015925792246408	0.05836610525739253
+0.05337535822438758	0.05685194898227711
+0.05679766774033138	0.05522589039354298
+0.06043940814746813	0.05349046275820364
+0.06431464886756851	0.05165015303718731
+0.06843836142250359	0.04971154826987741
+0.07282647727490117	0.04768340623609461
+0.07749594937741686	0.04557663131088652
+0.08246481766840764	0.04340414380006791
+0.08775227876704272	0.04118063938294951
+0.0933787601371104	0.03892224452609307
+0.0993659990060432	0.03664608326695898
+0.1057371263440564	0.03436977949708752
+0.1125167562278419	0.03211092554433342
+0.1197310809340645	0.02988655140751474
+0.1274079721300408	0.02771262884566038
+0.1355770885525422	0.02560364068517685
+0.1442699905907213	0.02357223880139767
+0.1535202622158428	0.02162900533711904
+0.1633636407288777	0.01978232214689331
+0.1738381548272245	0.01803834447252984
+0.1849842715239644	0.01640106747421053
+0.1968450524872505	0.01487246908128304
+0.2094663204038333	0.01345270988063479
+0.2228968360094455	0.01214037025417984
+0.2371884864699824	0.01093270628048201
+0.252396485841266	0.009825908473089276
+0.2685795883818438	0.008815350673780271
+0.2858003155429307	0.007895819859778832
+0.3041251975124427	0.007061720885930349
+0.3236250302462971	0.006307253022656068
+0.3443751489799913	0.005626557444416178
+0.3664557192771343	0.005013836542304299
+0.389952046739367	0.004463447114838636
+0.4149549065741913	0.003969970208181551
+0.441560894293962	0.003528260722786747
+0.4698727989009163	0.003133479970812901
Index: src/sas/sascalc/dataloader/readers/anton_paar_saxs_reader.py
===================================================================
--- src/sas/sascalc/dataloader/readers/anton_paar_saxs_reader.py	(revision 80c5d4645fc45af0c2a06ead98749184616799ef)
+++ src/sas/sascalc/dataloader/readers/anton_paar_saxs_reader.py	(revision a235f71571822c52f74fd1221fcd542805cf1277)
@@ -45,5 +45,5 @@
     output = None
 
-    def __init__(self):
+    def reset_state(self):
         self.current_dataset = Data1D(np.empty(0), np.empty(0),
                                             np.empty(0), np.empty(0))
@@ -72,5 +72,5 @@
 
         ## Reinitialize the class when loading a new data file to reset all class variables
-        self.__init__()
+        self.reset_state()
         ## Check that the file exists
         if os.path.isfile(filename):
@@ -84,7 +84,4 @@
                 self.raw_data = buff.splitlines()
                 self.read_data()
-                xml_intermediate = self.raw_data[self.upper:]
-                xml = ''.join(xml_intermediate)
-                self.set_xml_file(xml)
         return self.output
 
@@ -100,19 +97,82 @@
         self.lower = 5
         self.upper = self.lower + self.data_points
-        self.detector.distance = float(line4[1])
+        self.source.radiation = 'x-ray'
+        normal = float(line4[3])
         self.current_dataset.source.radiation = "x-ray"
         self.current_dataset.source.name = "Anton Paar SAXSess Instrument"
         self.current_dataset.source.wavelength = float(line4[4])
-        normal = line4[3]
+        xvals = []
+        yvals = []
+        dyvals = []
         for i in range(self.lower, self.upper):
+            index = i - self.lower
             data = self.raw_data[i].split()
-            x_val = [float(data[0])]
-            y_val = [float(data[1])]
-            dy_val = [float(data[2])]
-            self.current_dataset.x = np.append(self.current_dataset.x, x_val)
-            self.current_dataset.y = np.append(self.current_dataset.y, y_val)
-            self.current_dataset.dy = np.append(self.current_dataset.dy, dy_val)
-        self.current_dataset.xaxis("Q (%s)" % (q_unit), q_unit)
-        self.current_dataset.yaxis("Intensity (%s)" % (i_unit), i_unit)
-        self.current_dataset.detector.append(self.detector)
+            xvals.insert(index, normal * float(data[0]))
+            yvals.insert(index, normal * float(data[1]))
+            dyvals.insert(index, normal * float(data[2]))
+        self.current_dataset.x = np.append(self.current_dataset.x, xvals)
+        self.current_dataset.y = np.append(self.current_dataset.y, yvals)
+        self.current_dataset.dy = np.append(self.current_dataset.dy, dyvals)
+        if self.data_points != self.current_dataset.x.size:
+            self.errors.add("Not all data was loaded properly.")
+        if self.current_dataset.dx.size != self.current_dataset.x.size:
+            dxvals = np.zeros(self.current_dataset.x.size)
+            self.current_dataset.dx = dxvals
+        if self.current_dataset.x.size != self.current_dataset.y.size:
+            self.errors.add("The x and y data sets are not the same size.")
+        if self.current_dataset.y.size != self.current_dataset.dy.size:
+            self.errors.add("The y and dy datasets are not the same size.")
+        self.current_dataset.errors = self.errors
+        self.current_dataset.xaxis("Q", q_unit)
+        self.current_dataset.yaxis("Intensity", i_unit)
+        xml_intermediate = self.raw_data[self.upper:]
+        xml = ''.join(xml_intermediate)
+        self.set_xml_string(xml)
+        dom = self.xmlroot.xpath('/fileinfo')
+        self._parse_child(dom)
         self.output.append(self.current_dataset)
+
+    def _parse_child(self, dom, parent=''):
+        """
+        Recursive method for stepping through the embedded XML
+        :param dom: XML node with or without children
+        """
+        for node in dom:
+            tagname = node.tag
+            value = node.text
+            attr = node.attrib
+            key = attr.get("key", '')
+            if len(node.getchildren()) > 1:
+                self._parse_child(node, key)
+                if key == "SampleDetector":
+                    self.current_dataset.detector.append(self.detector)
+                    self.detector = Detector()
+            else:
+                if key == "value":
+                    if parent == "Wavelength":
+                        self.current_dataset.source.wavelength = value
+                    elif parent == "SampleDetector":
+                        self.detector.distance = value
+                    elif parent == "Temperature":
+                        self.current_dataset.sample.temperature = value
+                    elif parent == "CounterSlitLength":
+                        self.detector.slit_length = value
+                elif key == "unit":
+                    value = value.replace("_", "")
+                    if parent == "Wavelength":
+                        self.current_dataset.source.wavelength_unit = value
+                    elif parent == "SampleDetector":
+                        self.detector.distance_unit = value
+                    elif parent == "X":
+                        self.current_dataset.xaxis(self.current_dataset._xaxis, value)
+                    elif parent == "Y":
+                        self.current_dataset.yaxis(self.current_dataset._yaxis, value)
+                    elif parent == "Temperature":
+                        self.current_dataset.sample.temperature_unit = value
+                    elif parent == "CounterSlitLength":
+                        self.detector.slit_length_unit = value
+                elif key == "quantity":
+                    if parent == "X":
+                        self.current_dataset.xaxis(value, self.current_dataset._xunit)
+                    elif parent == "Y":
+                        self.current_dataset.yaxis(value, self.current_dataset._yunit)
Index: src/sas/sascalc/dataloader/readers/ascii_reader.py
===================================================================
--- src/sas/sascalc/dataloader/readers/ascii_reader.py	(revision b699768550de9d4b35b087234ec1d2a461922bab)
+++ src/sas/sascalc/dataloader/readers/ascii_reader.py	(revision 7d94915074e1688fc87991152ae32ccfce9987f4)
@@ -33,5 +33,5 @@
     ## File type
     type_name = "ASCII"
-    
+
     ## Wildcards
     type = ["ASCII files (*.txt)|*.txt",
@@ -41,16 +41,15 @@
     ## List of allowed extensions
     ext = ['.txt', '.TXT', '.dat', '.DAT', '.abs', '.ABS', 'csv', 'CSV']
-    
+
     ## Flag to bypass extension check
     allow_all = True
-    
+
     def read(self, path):
         """
         Load data file
-        
+
         :param path: file path
-        
         :return: Data1D object, or None
-        
+
         :raise RuntimeError: when the file can't be opened
         :raise ValueError: when the length of the data vectors are inconsistent
@@ -62,5 +61,5 @@
                 try:
                     # Read in binary mode since GRASP frequently has no-ascii
-                    # characters that brakes the open operation
+                    # characters that breaks the open operation
                     input_f = open(path,'rb')
                 except:
@@ -68,255 +67,132 @@
                 buff = input_f.read()
                 lines = buff.splitlines()
-                 
-                x  = numpy.zeros(0)
-                y  = numpy.zeros(0)
-                dy = numpy.zeros(0)
-                dx = numpy.zeros(0)
-                
-                #temp. space to sort data
-                tx  = numpy.zeros(0)
-                ty  = numpy.zeros(0)
+
+                # Arrays for data storage
+                tx = numpy.zeros(0)
+                ty = numpy.zeros(0)
                 tdy = numpy.zeros(0)
                 tdx = numpy.zeros(0)
-                
-                output = Data1D(x, y, dy=dy, dx=dx)
-                self.filename = output.filename = basename
-           
-                data_conv_q = None
-                data_conv_i = None
-                
-                if has_converter == True and output.x_unit != '1/A':
-                    data_conv_q = Converter('1/A')
-                    # Test it
-                    data_conv_q(1.0, output.x_unit)
-                    
-                if has_converter == True and output.y_unit != '1/cm':
-                    data_conv_i = Converter('1/cm')
-                    # Test it
-                    data_conv_i(1.0, output.y_unit)
-           
+
                 # The first good line of data will define whether
                 # we have 2-column or 3-column ascii
                 has_error_dx = None
                 has_error_dy = None
-                
+
                 #Initialize counters for data lines and header lines.
-                is_data = False  # Has more than 5 lines
+                is_data = False
                 # More than "5" lines of data is considered as actual
                 # data unless that is the only data
-                mum_data_lines = 5
+                min_data_pts = 5
                 # To count # of current data candidate lines
-                i = -1
+                candidate_lines = 0
                 # To count total # of previous data candidate lines
-                i1 = -1
-                # To count # of header lines
-                j = -1
-                # Helps to count # of header lines
-                j1 = -1
-                #minimum required number of columns of data; ( <= 4).
+                candidate_lines_previous = 0
+                #minimum required number of columns of data
                 lentoks = 2
                 for line in lines:
-                    # Initial try for CSV (split on ,)
-                    toks = line.split(',')
-                    # Now try SCSV (split on ;)
-                    if len(toks) < 2:
-                        toks = line.split(';')
-                    # Now go for whitespace                    
-                    if len(toks) < 2:
-                        toks = line.split()
+                    toks = self.splitline(line)
+                    # To remember the # of columns in the current line of data
+                    new_lentoks = len(toks)
                     try:
+                        if new_lentoks == 1 and not is_data:
+                            ## If only one item in list, no longer data
+                            raise ValueError
+                        elif new_lentoks == 0:
+                            ## If the line is blank, skip and continue on
+                            ## In case of breaks within data sets.
+                            continue
+                        elif new_lentoks != lentoks and is_data:
+                            ## If a footer is found, break the loop and save the data
+                            break
+                        elif new_lentoks != lentoks and not is_data:
+                            ## If header lines are numerical
+                            candidate_lines = 0
+                            candidate_lines_previous = 0
+
                         #Make sure that all columns are numbers.
                         for colnum in range(len(toks)):
+                            # Any non-floating point values throw ValueError
                             float(toks[colnum])
-                            
+
+                        candidate_lines += 1
                         _x = float(toks[0])
                         _y = float(toks[1])
-                        
-                        #Reset the header line counters
-                        if j == j1:
-                            j = 0
-                            j1 = 0
-                            
-                        if i > 1:
+                        _dx = None
+                        _dy = None
+
+                        #If 5 or more lines, this is considering the set data
+                        if candidate_lines >= min_data_pts:
                             is_data = True
-                        
-                        if data_conv_q is not None:
-                            _x = data_conv_q(_x, units=output.x_unit)
-                            
-                        if data_conv_i is not None:
-                            _y = data_conv_i(_y, units=output.y_unit)
-                        
-                        # If we have an extra token, check
-                        # whether it can be interpreted as a
-                        # third column.
-                        _dy = None
-                        if len(toks) > 2:
-                            try:
-                                _dy = float(toks[2])
-                                
-                                if data_conv_i is not None:
-                                    _dy = data_conv_i(_dy, units=output.y_unit)
-                                
-                            except:
-                                # The third column is not a float, skip it.
-                                pass
-                            
-                        # If we haven't set the 3rd column
-                        # flag, set it now.
-                        if has_error_dy == None:
-                            has_error_dy = False if _dy == None else True
-                            
-                        #Check for dx
-                        _dx = None
-                        if len(toks) > 3:
-                            try:
-                                _dx = float(toks[3])
-                                
-                                if data_conv_i is not None:
-                                    _dx = data_conv_i(_dx, units=output.x_unit)
-                                
-                            except:
-                                # The 4th column is not a float, skip it.
-                                pass
-                            
-                        # If we haven't set the 3rd column
-                        # flag, set it now.
-                        if has_error_dx == None:
-                            has_error_dx = False if _dx == None else True
-                        
-                        #After talked with PB, we decided to take care of only
-                        # 4 columns of data for now.
-                        #number of columns in the current line
-                        #To remember the # of columns in the current
-                        #line of data
-                        new_lentoks = len(toks)
-                        
-                        #If the previous columns not equal to the current,
-                        #mark the previous as non-data and reset the dependents.
-                        if lentoks != new_lentoks:
-                            if is_data == True:
-                                break
-                            else:
-                                i = -1
-                                i1 = 0
-                                j = -1
-                                j1 = -1
-                            
-                        #Delete the previously stored lines of data candidates
-                        # if is not data.
-                        if i < 0 and -1 < i1 < mum_data_lines and \
-                            is_data == False:
-                            try:
-                                x = numpy.zeros(0)
-                                y = numpy.zeros(0)
-                            except:
-                                pass
-                            
-                        x = numpy.append(x, _x)
-                        y = numpy.append(y, _y)
-                        
-                        if has_error_dy == True:
-                            #Delete the previously stored lines of
-                            # data candidates if is not data.
-                            if i < 0 and -1 < i1 < mum_data_lines and \
-                                is_data == False:
-                                try:
-                                    dy = numpy.zeros(0)
-                                except:
-                                    pass
-                            dy = numpy.append(dy, _dy)
-                            
-                        if has_error_dx == True:
-                            #Delete the previously stored lines of
-                            # data candidates if is not data.
-                            if i < 0 and -1 < i1 < mum_data_lines and \
-                                is_data == False:
-                                try:
-                                    dx = numpy.zeros(0)
-                                except:
-                                    pass
-                            dx = numpy.append(dx, _dx)
-                            
-                        #Same for temp.
-                        #Delete the previously stored lines of data candidates
-                        # if is not data.
-                        if i < 0 and -1 < i1 < mum_data_lines and\
+
+                        # If a 3rd row is present, consider it dy
+                        if new_lentoks > 2:
+                            _dy = float(toks[2])
+                        has_error_dy = False if _dy == None else True
+
+                        # If a 4th row is present, consider it dx
+                        if new_lentoks > 3:
+                            _dx = float(toks[3])
+                        has_error_dx = False if _dx == None else True
+
+                        # Delete the previously stored lines of data candidates if
+                        # the list is not data
+                        if candidate_lines == 1 and -1 < candidate_lines_previous < min_data_pts and \
                             is_data == False:
                             try:
                                 tx = numpy.zeros(0)
                                 ty = numpy.zeros(0)
+                                tdy = numpy.zeros(0)
+                                tdx = numpy.zeros(0)
                             except:
                                 pass
 
+                        if has_error_dy == True:
+                            tdy = numpy.append(tdy, _dy)
+                        if has_error_dx == True:
+                            tdx = numpy.append(tdx, _dx)
                         tx = numpy.append(tx, _x)
                         ty = numpy.append(ty, _y)
-                        
-                        if has_error_dy == True:
-                            #Delete the previously stored lines of
-                            # data candidates if is not data.
-                            if i < 0 and -1 < i1 < mum_data_lines and \
-                                is_data == False:
-                                try:
-                                    tdy = numpy.zeros(0)
-                                except:
-                                    pass
-                            tdy = numpy.append(tdy, _dy)
-                        if has_error_dx == True:
-                            #Delete the previously stored lines of
-                            # data candidates if is not data.
-                            if i < 0 and -1 < i1 < mum_data_lines and \
-                                is_data == False:
-                                try:
-                                    tdx = numpy.zeros(0)
-                                except:
-                                    pass
-                            tdx = numpy.append(tdx, _dx)
-
-                        #reset i1 and flag lentoks for the next
-                        if lentoks < new_lentoks:
-                            if is_data == False:
-                                i1 = -1
+
                         #To remember the # of columns on the current line
                         # for the next line of data
-                        lentoks = len(toks)
-                        
-                        #Reset # of header lines and counts #
-                        # of data candidate lines
-                        if j == 0 and j1 == 0:
-                            i1 = i + 1
-                        i += 1
-                    except:
+                        lentoks = new_lentoks
+                        candidate_lines_previous = candidate_lines
+                    except ValueError:
                         # It is data and meet non - number, then stop reading
                         if is_data == True:
                             break
                         lentoks = 2
-                        #Counting # of header lines
-                        j += 1
-                        if j == j1 + 1:
-                            j1 = j
-                        else:
-                            j = -1
+                        has_error_dx = None
+                        has_error_dy = None
                         #Reset # of lines of data candidates
-                        i = -1
-                        
-                        # Couldn't parse this line, skip it
+                        candidate_lines = 0
+                    except:
                         pass
-                    
+
                 input_f.close()
+                if not is_data:
+                    return None
                 # Sanity check
-                if has_error_dy == True and not len(y) == len(dy):
+                if has_error_dy == True and not len(ty) == len(tdy):
                     msg = "ascii_reader: y and dy have different length"
                     raise RuntimeError, msg
-                if has_error_dx == True and not len(x) == len(dx):
+                if has_error_dx == True and not len(tx) == len(tdx):
                     msg = "ascii_reader: y and dy have different length"
                     raise RuntimeError, msg
                 # If the data length is zero, consider this as
                 # though we were not able to read the file.
-                if len(x) == 0:
+                if len(tx) == 0:
                     raise RuntimeError, "ascii_reader: could not load file"
-                
+
                 #Let's re-order the data to make cal.
                 # curve look better some cases
                 ind = numpy.lexsort((ty, tx))
+                x = numpy.zeros(len(tx))
+                y = numpy.zeros(len(ty))
+                dy = numpy.zeros(len(tdy))
+                dx = numpy.zeros(len(tdx))
+                output = Data1D(x, y, dy=dy, dx=dx)
+                self.filename = output.filename = basename
+
                 for i in ind:
                     x[i] = tx[ind[i]]
@@ -338,14 +214,8 @@
                 output.dx = dx[x != 0] if has_error_dx == True\
                     else numpy.zeros(len(output.x))
-                                
-                if data_conv_q is not None:
-                    output.xaxis("\\rm{Q}", output.x_unit)
-                else:
-                    output.xaxis("\\rm{Q}", 'A^{-1}')
-                if data_conv_i is not None:
-                    output.yaxis("\\rm{Intensity}", output.y_unit)
-                else:
-                    output.yaxis("\\rm{Intensity}", "cm^{-1}")
-                    
+
+                output.xaxis("\\rm{Q}", 'A^{-1}')
+                output.yaxis("\\rm{Intensity}", "cm^{-1}")
+
                 # Store loading process information
                 output.meta_data['loader'] = self.type_name
@@ -353,6 +223,22 @@
                     raise RuntimeError, "%s is empty" % path
                 return output
-            
+
         else:
             raise RuntimeError, "%s is not a file" % path
         return None
+
+    def splitline(self, line):
+        """
+        Splits a line into pieces based on common delimeters
+        :param line: A single line of text
+        :return: list of values
+        """
+        # Initial try for CSV (split on ,)
+        toks = line.split(',')
+        # Now try SCSV (split on ;)
+        if len(toks) < 2:
+            toks = line.split(';')
+        # Now go for whitespace
+        if len(toks) < 2:
+            toks = line.split()
+        return toks
Index: src/sas/sascalc/dataloader/readers/cansas_reader.py
===================================================================
--- src/sas/sascalc/dataloader/readers/cansas_reader.py	(revision 5f26aa48a5e34765d73c20fa10024d5319567854)
+++ src/sas/sascalc/dataloader/readers/cansas_reader.py	(revision 654e8e066dda6b98c221cad28e05fa6996e7fc11)
@@ -62,4 +62,5 @@
     type_name = "canSAS"
     invalid = True
+    frm = ""
     ## Log messages and errors
     logging = None
@@ -138,5 +139,4 @@
                     for entry in entry_list:
                         # Create a new DataInfo object for every <SASentry>
-
 
                         # Set the file name and then parse the entry.
@@ -183,5 +183,5 @@
         return self.output
 
-    def _parse_entry(self, dom):
+    def _parse_entry(self, dom, recurse=False):
         """
         Parse a SASEntry - new recursive method for parsing the dom of
@@ -192,6 +192,5 @@
         """
 
-        frm = inspect.stack()[1]
-        if not self._is_call_local(frm):
+        if not self._is_call_local() and not recurse:
             self.reset_state()
             self.add_data_set()
@@ -201,6 +200,4 @@
         self.base_ns = "{0}{1}{2}".format("{", \
                             CANSAS_NS.get(self.cansas_version).get("ns"), "}")
-        tagname = ''
-        tagname_original = ''
 
         # Go through each child in the parent element
@@ -225,5 +222,5 @@
                     self._initialize_new_data_set()
                 ## Recursion step to access data within the group
-                self._parse_entry(node)
+                self._parse_entry(node, True)
                 if tagname == "SASsample":
                     self.current_datainfo.sample.name = name
@@ -437,5 +434,6 @@
                 length = len(self.names) - 1
             self.parent_class = self.names[length]
-        if not self._is_call_local(frm):
+        if not self._is_call_local() and not recurse:
+            self.frm = ""
             self.add_data_set()
             empty = None
@@ -448,12 +446,12 @@
 
 
-    def _is_call_local(self, frm=""):
-        """
-
-        :return:
-        """
-        if frm == "":
-            frm = inspect.stack()[1]
-        mod_name = frm[1].replace("\\", "/").replace(".pyc", "")
+    def _is_call_local(self):
+        """
+
+        """
+        if self.frm == "":
+            inter = inspect.stack()
+            self.frm = inter[2]
+        mod_name = self.frm[1].replace("\\", "/").replace(".pyc", "")
         mod_name = mod_name.replace(".py", "")
         mod = mod_name.split("sas/")
@@ -836,6 +834,6 @@
         # If the calling function was not the cansas reader, return a minidom
         #      object rather than an lxml object.
-        frm = inspect.stack()[1]
-        doc, entry_node = self._check_origin(entry_node, doc, frm)
+        self.frm = inspect.stack()[1]
+        doc, entry_node = self._check_origin(entry_node, doc)
         return doc, entry_node
 
@@ -1232,5 +1230,5 @@
                 self.append(node, entry_node)
 
-    def _check_origin(self, entry_node, doc, frm):
+    def _check_origin(self, entry_node, doc):
         """
         Return the document, and the SASentry node associated with
@@ -1242,7 +1240,7 @@
         :param doc: entire xml tree
         """
-        if not frm:
-            frm = inspect.stack()[1]
-        mod_name = frm[1].replace("\\", "/").replace(".pyc", "")
+        if not self.frm:
+            self.frm = inspect.stack()[1]
+        mod_name = self.frm[1].replace("\\", "/").replace(".pyc", "")
         mod_name = mod_name.replace(".py", "")
         mod = mod_name.split("sas/")
Index: src/sas/sascalc/dataloader/readers/xml_reader.py
===================================================================
--- src/sas/sascalc/dataloader/readers/xml_reader.py	(revision b699768550de9d4b35b087234ec1d2a461922bab)
+++ src/sas/sascalc/dataloader/readers/xml_reader.py	(revision a235f71571822c52f74fd1221fcd542805cf1277)
@@ -70,4 +70,21 @@
             self.xmldoc = etree.parse(self.xml, parser=PARSER)
             self.xmlroot = self.xmldoc.getroot()
+        except etree.XMLSyntaxError as xml_error:
+            logging.info(xml_error)
+        except Exception:
+            self.xml = None
+            self.xmldoc = None
+            self.xmlroot = None
+
+    def set_xml_string(self, tag_soup):
+        """
+        Set an XML string as the working XML.
+
+        :param tag_soup: XML formatted string
+        """
+        try:
+            self.xml = tag_soup
+            self.xmldoc = tag_soup
+            self.xmlroot = etree.fromstring(tag_soup)
         except etree.XMLSyntaxError as xml_error:
             logging.info(xml_error)
Index: src/sas/sascalc/pr/invertor.py
===================================================================
--- src/sas/sascalc/pr/invertor.py	(revision b699768550de9d4b35b087234ec1d2a461922bab)
+++ src/sas/sascalc/pr/invertor.py	(revision 2c60f30436c786afaf7a16a8d82389832d5c6637)
@@ -154,4 +154,8 @@
             return self.set_err(value2)
         elif name == 'd_max':
+            if value <= 0.0:
+                msg = "Invertor: d_max must be greater than zero."
+                msg += "Correct that entry before proceeding"
+                raise ValueError, msg
             return self.set_dmax(value)
         elif name == 'q_min':
Index: src/sas/sasgui/guiframe/aboutbox.py
===================================================================
--- src/sas/sasgui/guiframe/aboutbox.py	(revision d85c194ea2f78cb2b9b3de9c969e1b8ebea6b6d2)
+++ src/sas/sasgui/guiframe/aboutbox.py	(revision e0f28e6ff06f5e12fc7aa2e057964cd67a3ba8f8)
@@ -106,5 +106,6 @@
         self.bitmap_button_nist = wx.BitmapButton(self, -1, wx.NullBitmap)
         self.bitmap_button_umd = wx.BitmapButton(self, -1, wx.NullBitmap)
-        self.bitmap_button_sns = wx.BitmapButton(self, -1, wx.NullBitmap)
+        self.bitmap_button_ornl = wx.BitmapButton(self, -1, wx.NullBitmap)
+        #self.bitmap_button_sns = wx.BitmapButton(self, -1, wx.NullBitmap)
         #self.bitmap_button_nsf = wx.BitmapButton(self, -1,
         #                                         wx.NullBitmap)
@@ -115,4 +116,5 @@
         self.bitmap_button_ess = wx.BitmapButton(self, -1, wx.NullBitmap)
         self.bitmap_button_ill = wx.BitmapButton(self, -1, wx.NullBitmap)
+        self.bitmap_button_ansto = wx.BitmapButton(self, -1, wx.NullBitmap)
         
         self.static_line_3 = wx.StaticLine(self, -1)
@@ -124,5 +126,6 @@
         self.Bind(wx.EVT_BUTTON, self.onNistLogo, self.bitmap_button_nist)
         self.Bind(wx.EVT_BUTTON, self.onUmdLogo, self.bitmap_button_umd)
-        self.Bind(wx.EVT_BUTTON, self.onSnsLogo, self.bitmap_button_sns)
+        #self.Bind(wx.EVT_BUTTON, self.onSnsLogo, self.bitmap_button_sns)
+        self.Bind(wx.EVT_BUTTON, self.onOrnlLogo, self.bitmap_button_ornl)
         #self.Bind(wx.EVT_BUTTON, self.onNsfLogo, self.bitmap_button_nsf)
         #self.Bind(wx.EVT_BUTTON, self.onDanseLogo, self.bitmap_button_danse)
@@ -131,4 +134,5 @@
         self.Bind(wx.EVT_BUTTON, self.onEssLogo, self.bitmap_button_ess)
         self.Bind(wx.EVT_BUTTON, self.onIllLogo, self.bitmap_button_ill)
+        self.Bind(wx.EVT_BUTTON, self.onAnstoLogo, self.bitmap_button_ansto)
         # end wxGlade
         # fill in acknowledgements
@@ -163,5 +167,11 @@
         self.bitmap_button_umd.SetBitmapLabel(logo)
 
-        
+        image = file_dir + "/images/ornl_logo.png"
+        if os.path.isfile(config._ornl_logo):
+            image = config._ornl_logo
+        logo = wx.Bitmap(image)        
+        self.bitmap_button_ornl.SetBitmapLabel(logo)
+
+        """
         image = file_dir + "/images/sns_logo.png"
         if os.path.isfile(config._sns_logo):
@@ -170,5 +180,4 @@
         self.bitmap_button_sns.SetBitmapLabel(logo)
         
-        """
         image = file_dir + "/images/nsf_logo.png"
         if os.path.isfile(config._nsf_logo):
@@ -206,4 +215,10 @@
         logo = wx.Bitmap(image)
         self.bitmap_button_ill.SetBitmapLabel(logo)
+        
+        image = file_dir + "/images/ansto_logo.png"
+        if os.path.isfile(config._ansto_logo):
+            image = config._ansto_logo
+        logo = wx.Bitmap(image)
+        self.bitmap_button_ansto.SetBitmapLabel(logo)
                 
         # resize dialog window to fit version number nicely
@@ -227,5 +242,6 @@
         self.bitmap_button_nist.SetSize(self.bitmap_button_nist.GetBestSize())
         self.bitmap_button_umd.SetSize(self.bitmap_button_umd.GetBestSize())
-        self.bitmap_button_sns.SetSize(self.bitmap_button_sns.GetBestSize())
+        self.bitmap_button_ornl.SetSize(self.bitmap_button_ornl.GetBestSize())
+        #self.bitmap_button_sns.SetSize(self.bitmap_button_sns.GetBestSize())
         #self.bitmap_button_nsf.SetSize(self.bitmap_button_nsf.GetBestSize())
         #self.bitmap_button_danse.SetSize(self.bitmap_button_danse.GetBestSize())
@@ -234,4 +250,5 @@
         self.bitmap_button_ess.SetSize(self.bitmap_button_ess.GetBestSize())
         self.bitmap_button_ill.SetSize(self.bitmap_button_ill.GetBestSize())
+        self.bitmap_button_ansto.SetSize(self.bitmap_button_ansto.GetBestSize())
         # end wxGlade
 
@@ -285,5 +302,7 @@
         sizer_logos.Add(self.bitmap_button_nist, 0, 
                         wx.LEFT|wx.ADJUST_MINSIZE, 2)
-        sizer_logos.Add(self.bitmap_button_sns, 0, 
+        #sizer_logos.Add(self.bitmap_button_sns, 0, 
+        #                wx.LEFT|wx.ADJUST_MINSIZE, 2)
+        sizer_logos.Add(self.bitmap_button_ornl, 0, 
                         wx.LEFT|wx.ADJUST_MINSIZE, 2)
         sizer_logos.Add(self.bitmap_button_isis, 0, 
@@ -292,4 +311,6 @@
                         wx.LEFT|wx.ADJUST_MINSIZE, 2)
         sizer_logos.Add(self.bitmap_button_ill, 0, 
+                        wx.LEFT|wx.ADJUST_MINSIZE, 2)
+        sizer_logos.Add(self.bitmap_button_ansto, 0, 
                         wx.LEFT|wx.ADJUST_MINSIZE, 2)
                 
@@ -321,4 +342,11 @@
         event.Skip()
         
+    def onOrnlLogo(self, event): 
+        """
+        """
+        # wxGlade: DialogAbout.<event_handler>
+        launchBrowser(config._ornl_url)
+        event.Skip()
+        
     def onSnsLogo(self, event): 
         """
@@ -368,4 +396,11 @@
         # wxGlade: DialogAbout.<event_handler>
         launchBrowser(config._ill_url)
+        event.Skip()
+
+    def onAnstoLogo(self, event):
+        """
+        """ 
+        # wxGlade: DialogAbout.<event_handler>
+        launchBrowser(config._ansto_url)
         event.Skip()
 
Index: src/sas/sasgui/guiframe/acknowledgebox.py
===================================================================
--- src/sas/sasgui/guiframe/acknowledgebox.py	(revision d85c194ea2f78cb2b9b3de9c969e1b8ebea6b6d2)
+++ src/sas/sasgui/guiframe/acknowledgebox.py	(revision c1fdf8485e681ba1145937521615515e6c3be688)
@@ -68,5 +68,6 @@
         self.preamble.SetFont(wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, ""))
         self.SetTitle("Acknowledging SasView")
-        self.SetSize((525, 225))
+        #Increased size of box from (525, 225), SMK, 04/10/16
+        self.SetSize((600, 300))
         # end wxGlade
 
Index: src/sas/sasgui/guiframe/gui_manager.py
===================================================================
--- src/sas/sasgui/guiframe/gui_manager.py	(revision c8a641e878a6209ec6a298efe68269f170645bed)
+++ src/sas/sasgui/guiframe/gui_manager.py	(revision 3fac0df814fa16cb4e81b12f38998515162dd09a)
@@ -1345,21 +1345,27 @@
         self._help_menu.Append(wx_id, '&Documentation', '')
         wx.EVT_MENU(self, wx_id, self._onSphinxDocs)
+        self._help_menu.AppendSeparator()
 
         if config._do_tutorial and (IS_WIN or sys.platform == 'darwin'):
-            self._help_menu.AppendSeparator()
             wx_id = wx.NewId()
             self._help_menu.Append(wx_id, '&Tutorial', 'Software tutorial')
             wx.EVT_MENU(self, wx_id, self._onTutorial)
+            self._help_menu.AppendSeparator()
+
 
         if config._do_acknowledge:
-            self._help_menu.AppendSeparator()
             wx_id = wx.NewId()
             self._help_menu.Append(wx_id, '&Acknowledge', 'Acknowledging SasView')
             wx.EVT_MENU(self, wx_id, self._onAcknowledge)
+            self._help_menu.AppendSeparator()
+
 
         if config._do_aboutbox:
+            logging.info("Doing help menu")
+            wx_id = wx.NewId()
+            self._help_menu.Append(wx_id, '&About', 'Software information')
+            wx.EVT_MENU(self, wx_id, self._onAbout)
             self._help_menu.AppendSeparator()
-            self._help_menu.Append(wx.ID_ABOUT, '&About', 'Software information')
-            wx.EVT_MENU(self, wx.ID_ABOUT, self._onAbout)
+
 
         # Checking for updates
Index: src/sas/sasgui/guiframe/gui_statusbar.py
===================================================================
--- src/sas/sasgui/guiframe/gui_statusbar.py	(revision d85c194ea2f78cb2b9b3de9c969e1b8ebea6b6d2)
+++ src/sas/sasgui/guiframe/gui_statusbar.py	(revision 3a22ce7eba1200abb7dc9bd39b61eba90f2cce03)
@@ -6,4 +6,5 @@
 import sys
 import logging
+import datetime
 from wx import StatusBar as wxStatusB
 from wx.lib import newevent
@@ -46,5 +47,7 @@
 
         self.msg_txt.SetEditable(False)
-        self.msg_txt.SetValue('No message available')
+        timestamp = datetime.datetime.now()
+        status = '{:%Y-%m-%d %H:%M:%S} : No message available'.format(timestamp)
+        self.msg_txt.SetValue(status)
         self.sizer.Add(self.msg_txt, 1, wx.EXPAND|wx.ALL, 10)
         self.SetSizer(self.sizer)
@@ -60,4 +63,7 @@
         if status.strip() == "":
             return
+        # Add timestamp
+        timestamp = datetime.datetime.now()
+        status = '{:%Y-%m-%d %H:%M:%S} : '.format(timestamp) + status
         color = (0, 0, 0) #black
         icon_bmp = wx.ArtProvider.GetBitmap(wx.ART_INFORMATION, wx.ART_TOOLBAR)
Index: src/sas/sasgui/guiframe/media/data_formats_help.rst
===================================================================
--- src/sas/sasgui/guiframe/media/data_formats_help.rst	(revision d85c194ea2f78cb2b9b3de9c969e1b8ebea6b6d2)
+++ src/sas/sasgui/guiframe/media/data_formats_help.rst	(revision 280f929c9b628eb5ce8a21b7a5072a29ccaec43a)
@@ -3,4 +3,5 @@
 .. This is a port of the original SasView html help file to ReSTructured text
 .. by S King, ISIS, during SasView CodeCamp-III in Feb 2015.
+.. WG Bouwman, DUT, added during CodeCamp-V in Oct 2016 the SESANS data format
 
 .. _Formats:
@@ -9,10 +10,11 @@
 ============
 
-SasView reads several different 1D (I(Q) vs Q) and 2D (I(Qx,Qy) vs (Qx,Qy))
+SasView reads several different 1D (I(Q) vs Q), 2D SANS(I(Qx,Qy) vs (Qx,Qy))
+and SESANS (P(z) vs z)
 data files. But please note that SasView does not at present load data where
 the Q and I(Q) data are in separate files.
 
-1D Formats
-----------
+1D Formats SANS
+---------------
 
 SasView will read files with 2 to 4 columns of numbers in the following order: 
@@ -46,6 +48,6 @@
 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
 
-2D Formats
-----------
+2D Formats SANS
+---------------
 
 SasView will only read files in the NIST 2D format with the extensions 
@@ -60,3 +62,22 @@
 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
 
-.. note::  This help document was last changed by Steve King, 01May2015
+SESANS Format
+-------------
+
+The current file extension is .ses or .sesans (not case sensitive).
+
+The file format is to have a list of name-value pairs as a header at the top of the file, detailing general experimental parameters necessary for fitting and analyzing data. This list should contain all information necessary for the file to be 'portable' between users.
+
+Following that is a 6 column list of instrument experimental variables:
+
+- Spin echo length (z, in Angstroms)
+- Spin echo length error (:math:`\Delta` z, in Angstroms) (experimental resolution)
+- neutron wavelength (:math:`\lambda`, in Angstroms) (essential for ToF instruments)
+- neutron wavelength error (:math:`\Delta \lambda`, in Angstroms)
+- Normalized polarization (:math:`P/P_0`, unitless)
+- Normalized polarization error (:math:`\Delta(P/P_0)`, unitless) (measurement error)
+
+
+.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
+
+.. note::  This help document was last changed by Wim Bouwman, 05Oct2016
Index: c/sas/sasgui/guiframe/media/graph_help.copy
===================================================================
--- src/sas/sasgui/guiframe/media/graph_help.copy	(revision 65dfa99759ad82a7c7023ae9209b69fc461475dc)
+++ 	(revision )
@@ -1,364 +1,0 @@
-.. graph_help.rst
-
-.. This is a port of the original SasView html help file to ReSTructured text
-.. by S King, ISIS, during SasView CodeCamp-III in Feb 2015.
-
-.. |delta| unicode:: U+03B4
-.. |phi| unicode:: U+03C6
-
-
-Plotting Data/Models
-====================
-
-SasView generates three different types of graph window: one that displays *1D data*
-(ie, I(Q) vs Q), one that displays *1D residuals* (ie, the difference between the
-experimental data and the theory at the same Q values), and *2D color maps*.
-
-Graph window options
---------------------
-
-.. _Invoking_the_graph_menu:
-
-Invoking the graph menu
-^^^^^^^^^^^^^^^^^^^^^^^
-
-To invoke the *Graph Menu* simply right-click on a data/theory plot, or click 
-the *Graph Menu* (bullet list) icon in the toolbar at the bottom of the plot. 
-Then select a menu item.
-
-How to Hide-Show-Delete a graph
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-To expand a plot window, click the *Maximise* (square) icon in the top-right 
-corner.
-
-To shrink a plot window, click the *Restore down* (square-on-square) icon in 
-the top-right corner.
-
-To hide a plot, click the *Minimise* (-) icon in the top-right corner of the 
-plot window.
-
-To show a hidden plot, select the *Restore up* (square-on-square) icon on the 
-minimised window.
-
-To delete a plot, click the *Close* (x) icon in the top-right corner of the 
-plot window.
-
-*NOTE! If a residuals graph (when fitting data) is hidden, it will not show up 
-after computation.*
-
-Dragging a plot
-^^^^^^^^^^^^^^^
-
-Select the *Pan* (crossed arrows) icon in the toolbar at the bottom of the plot 
-to activate this option. Move the mouse pointer to the plot. It will change to 
-a hand. Then left-click and drag the plot around. The axis values will adjust 
-accordingly.
- 
-To disable dragging mode, unselect the *crossed arrows* icon on the toolbar.
-
-Zooming In-Out on a plot
-^^^^^^^^^^^^^^^^^^^^^^^^
-
-Select the *Zoom* (magnifying glass) button in the toolbar at the bottom of 
-the plot to activate this option. Move the mouse pointer to the plot. It will 
-change to a cross-hair. Then left-click and drag the pointer around to generate 
-a region of interest. Release the mouse button to generate the new view.
-
-To disable zoom mode, unselect the *Zoom* button on the toolbar.
-
-After zooming in on a a region, the *left arrow* or *right arrow* buttons on 
-the toolbar will switch between recent views.
-
-*NOTE! If a wheel mouse is available scrolling the wheel will zoom in/out 
-on the current plot (changing both axes). Alternatively, point at the numbers 
-on one axis and scroll the wheel to zoom in/out on just that axis.*
-
-To return to the original view of the data, click the the *Reset* (home) icon 
-in the toolbar at the bottom of the plot (see Resetting_the_graph_ for further details).
-
-Saving a plot image
-^^^^^^^^^^^^^^^^^^^
-
-To save the current plot as an image file, right click on the plot to bring up 
-the *Graph Menu* (see Invoking_the_graph_menu_) and select *Save Image*.
-Alternatively, click on the *Save* (floppy disk) icon in the toolbar at the 
-bottom of the plot.
- 
-A dialog window will open. Select a folder, enter a filename, choose an output 
-image type, and click *Save*.
-
-The currently supported image types are:
-
-*  EPS (encapsulated postscript)
-*  EMF (enhanced metafile)
-*  JPG/JPEG (joint photographics experts group)
-*  PDF (portable documant format)
-*  PNG (portable network graphics)
-*  PS (postscript)
-*  RAW/RGBA (bitmap)
-*  SVG/SVGA (scalable vector graphics)
-*  TIF/TIFF (tagged iamge file)
-
-Printing a plot
-^^^^^^^^^^^^^^^
-
-To send the current plot to a printer, click on the *Print* (printer) icon in 
-the toolbar at the bottom of the plot.
-
-.. _Resetting_the_graph:
-
-Resetting the graph
-^^^^^^^^^^^^^^^^^^^
-
-To reset the axis range of a graph to its initial values select *Reset Graph 
-Range* on the *Graph Menu* (see Invoking_the_graph_menu_). Alternatively, use
-the *Reset* (home) icon in the toolbar at the bottom of the plot.
-
-Modifying the graph
-^^^^^^^^^^^^^^^^^^^
-
-From the *Graph Menu* (see Invoking_the_graph_menu_) it is also possible to
-make some custom modifications to plots, including:
-
-*  changing the plot window title
-*  changing the axis legend locations
-*  changing the axis legend label text
-*  changing the axis legend label units
-*  changing the axis legend label font & font colour
-*  adding/removing a text string
-*  adding a grid overlay
-
-Changing scales
-^^^^^^^^^^^^^^^
-
-This menu option is only available with 1D data.
-
-From the *Graph Menu* (see Invoking_the_graph_menu_) select *Change Scale*. A
-dialog window will appear in which it is possible to choose different 
-transformations of the x (usually Q) or y (usually I(Q)) axes, including:
-
-*  x, x^2, x^4, ln(x), log10(x), log10(x^4)
-*  y, 1/y, ln(y), y^2, y.(x^4), 1/sqrt(y),
-*  log10(y), ln(y.x), ln(y.x^2), ln(y.x^4), log10(y.x^4)
- 
-A *View* option includes short-cuts to common SAS transformations, such as:
-
-*  linear
-*  Guinier
-*  X-sectional Guinier
-*  Porod
-*  Kratky
-
-For properly corrected and scaled data, these SAS transformations can be used 
-to estimate, for example, Rg, rod diameter, or SANS incoherent background 
-levels, via a linear fit (see Making_a_linear_fit_).
-
-Toggling scales
-^^^^^^^^^^^^^^^
-
-This menu option is only available with 2D data.
-
-From the *Graph Menu* (see Invoking_the_graph_menu_) select *Toggle Linear/Log
-Scale* to switch between a linear to log intensity scale. The type of scale 
-selected is written alongside the colour scale.
-
-2D color maps
-^^^^^^^^^^^^^
-
-This menu option is only available with 2D data.
-
-From the *Graph Menu* (see Invoking_the_graph_menu_) select *2D Color Map* to
-choose a different color scale for the image and/or change the maximum or 
-minimum limits of the scale.
-
-Getting data coordinates
-^^^^^^^^^^^^^^^^^^^^^^^^
-
-Clicking anywhere in the plot window will cause the current coordinates to be 
-displayed in the status bar at the very bottom-left of the SasView window.
- 
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-Dataset menu options
---------------------
-
-.. _Invoking_the_dataset_menu:
-
-Invoking the dataset menu
-^^^^^^^^^^^^^^^^^^^^^^^^^
-
-From the *Graph Menu* (see Invoking_the_graph_menu_) highlight a plotted
-dataset.
-
-Getting data info
-^^^^^^^^^^^^^^^^^
-
-In the *Dataset Menu* (see Invoking_the_dataset_menu_), highlight a data set
-and select *DataInfo* to bring up a data information dialog panel for that 
-data set.
-
-Saving data
-^^^^^^^^^^^
-
-In the *Dataset Menu* (see Invoking_the_dataset_menu_), select *Save Points as
-a File* (if 1D data) or *Save as a file(DAT)* (if 2D data). A save dialog will 
-appear.
-
-1D data can be saved in either ASCII text (.TXT) or CanSAS/SASXML (.XML) 
-formats (see :ref:`Formats`).
-
-2D data can only be saved in the NIST 2D format (.DAT) (see :ref:`Formats`).
-
-.. _Making_a_linear_fit:
-
-Making a linear fit
-^^^^^^^^^^^^^^^^^^^
-
-Linear fit performs a simple ( y(x)=ax+b ) linear fit within the plot window.
-
-In the *Dataset Menu* (see Invoking_the_dataset_menu_), select *Linear Fit*. A
-fitting dialog will appear. Set some initial parameters and data limits and 
-click *Fit*. The fitted parameter values are displayed and the resulting line 
-calculated from them is added to the plot. 
-
-This option is most useful for performing simple Guinier, XS Guinier, and
-Porod type analyses, for example, to estimate Rg, a rod diameter, or incoherent 
-background level, respectively.
-
-The following figure shows an example of a Guinier analysis using this option
-
-.. image:: guinier_fit.png
-
-Removing data from the plot
-^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-In the *Dataset Menu* (see Invoking_the_dataset_menu_), select *Remove*. The
-selected data will be removed from the plot.
-
-*NOTE! This action cannot be undone.*
-
-Show-Hide error bars
-^^^^^^^^^^^^^^^^^^^^
-
-In the *Dataset Menu* (see Invoking_the_dataset_menu_), select *Show Error Bar*
-or *Hide Error Bar* to switch between showing/hiding the errors associated 
-with the chosen dataset. 
-
-Modify plot properties
-^^^^^^^^^^^^^^^^^^^^^^
-
-In the *Dataset Menu* (see Invoking_the_dataset_menu_), select *Modify Plot
-Property* to change the size, color, or shape of the displayed marker for the 
-chosen dataset, or to change the dataset label that appears on the plot.
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-2D data averaging
------------------
-
-Purpose
-^^^^^^^
-
-This feature is only available with 2D data.
-
-2D data averaging allows you to perform different types of averages on your 
-data. The region to be averaged is displayed in the plot window and its limits 
-can be modified by dragging the boundaries around.
-
-How to average
-^^^^^^^^^^^^^^
-
-In the *Dataset Menu* (see Invoking_the_dataset_menu_), select one of the
-following averages
-
-*  Perform Circular Average
-*  Sector [Q view]
-*  Annulus [Phi view]
-*  Box sum
-*  Box averaging in Qx
-*  Box averaging on Qy
-
-A 'slicer' will appear (except for *Perform Circular Average*) in the plot that 
-you can drag by clicking on a slicer's handle. When the handle is highlighted 
-in red, it means that the slicer can move/change size.
-
-*NOTE! The slicer size will reset if you try to select a region greater than 
-the size of the data.*
-
-Alternatively, once a 'slicer' is active you can also select the region to 
-average by bringing back the *Dataset Menu* and selecting *Edit Slicer 
-Parameters*. A dialog window will appear in which you can enter values to 
-define a region or select the number of points to plot (*nbins*).
-
-A separate plot window will also have appeared, displaying the requested 
-average.
-
-*NOTE! The displayed average only updates when input focus is moved back to 
-that window; ie, when the mouse pointer is moved onto that plot.*
-
-Selecting *Box Sum* automatically brings up the 'Slicer Parameters' dialog in 
-order to display the average numerically, rather than graphically.
-
-To remove a 'slicer', bring back the *Dataset menu* and select *Clear Slicer*.
-
-Unmasked circular average
-^^^^^^^^^^^^^^^^^^^^^^^^^
-
-This operation will perform an average in constant Q-rings around the (x,y) 
-pixel location of the beam center.
-
-Masked circular average
-^^^^^^^^^^^^^^^^^^^^^^^
-
-This operation is the same as 'Unmasked Circular Average' except that any 
-masked region is excluded.
-
-Sector average [Q View]
-^^^^^^^^^^^^^^^^^^^^^^^
-
-This operation averages in constant Q-arcs.
-
-The width of the sector is specified in degrees (+/- |delta|\|phi|\) each side 
-of the central angle (|phi|\).
-
-Annular average [|phi| View]
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-This operation performs an average between two Q-values centered on (0,0), 
-and averaged over a specified number of pixels.
-
-The data is returned as a function of angle (|phi|\) in degrees with zero 
-degrees at the 3 O'clock position.
-
-Box sum
-^^^^^^^
-
-This operation performs a sum of counts in a 2D region of interest.
-
-When editing the slicer parameters, the user can enter the length and the width 
-the rectangular slicer and the coordinates of the center of the rectangle.
-
-Box Averaging in Qx
-^^^^^^^^^^^^^^^^^^^
-
-This operation computes an average I(Qx) for the region of interest.
-
-When editing the slicer parameters, the user can control the length and the 
-width the rectangular slicer. The averaged output is calculated from constant 
-bins with rectangular shape. The resultant Q values are nominal values, that 
-is, the central value of each bin on the x-axis.
-
-Box Averaging in Qy
-^^^^^^^^^^^^^^^^^^^
-
-This operation computes an average I(Qy) for the region of interest.
-
-When editing the slicer parameters, the user can control the length and the 
-width the rectangular slicer. The averaged output is calculated from constant 
-bins with rectangular shape. The resultant Q values are nominal values, that 
-is, the central value of each bin on the x-axis.
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-.. note::  This help document was last changed by Steve King, 01May2015
Index: src/sas/sasgui/guiframe/media/graph_help.rst
===================================================================
--- src/sas/sasgui/guiframe/media/graph_help.rst	(revision e68c9bf288ff7df58f530665fe0f348055904d17)
+++ src/sas/sasgui/guiframe/media/graph_help.rst	(revision f9b0c81e56a680c4cdbca2d3251ba73fc4b903cd)
@@ -42,6 +42,7 @@
 plot window.
 
-*NOTE! If a residuals graph (when fitting data) is hidden, it will not show up
-after computation.*
+.. note:: 
+    *If a residuals graph (when fitting data) is hidden, it will not show up
+    after computation.*
 
 Dragging a plot
@@ -67,4 +68,8 @@
 After zooming in on a a region, the *left arrow* or *right arrow* buttons on
 the toolbar will switch between recent views.
+
+The axis range can also be specified manually.  To do so go to the *Graph Menu*
+(see Invoking_the_graph_menu_ for further details), choose the *Set Graph Range*
+option and enter the limits in the pop box.
 
 *NOTE! If a wheel mouse is available scrolling the wheel will zoom in/out
@@ -116,14 +121,22 @@
 ^^^^^^^^^^^^^^^^^^^
 
-From the *Graph Menu* (see Invoking_the_graph_menu_) it is also possible to
-make some custom modifications to plots, including:
+It is possible to make custom modifications to plots including:
 
 *  changing the plot window title
-*  changing the axis legend locations
-*  changing the axis legend label text
-*  changing the axis legend label units
-*  changing the axis legend label font & font colour
+*  changing the default legend location and toggling it on/off
+*  changing the axis label text
+*  changing the axis label units
+*  changing the axis label font & font colour
 *  adding/removing a text string
 *  adding a grid overlay
+
+The legend and text strings can be drag and dropped around the plot
+
+These options are accessed through the *Graph Menu* (see Invoking_the_graph_menu_)
+and selecting *Modify Graph Appearance* (for axis labels, grid overlay and
+legend position) or *Add Text* to add textual annotations, selecting font, color,
+style and size. *Remove Text* will remove the last annotation added. To change
+the legend. *Window Title* allows a custom title to be entered instead of Graph
+x. 
 
 Changing scales
@@ -234,5 +247,6 @@
 selected data will be removed from the plot.
 
-*NOTE! This action cannot be undone.*
+.. note::
+    The Remove data set action cannot be undone.
 
 Show-Hide error bars
@@ -248,5 +262,6 @@
 In the *Dataset Menu* (see Invoking_the_dataset_menu_), select *Modify Plot
 Property* to change the size, color, or shape of the displayed marker for the
-chosen dataset, or to change the dataset label that appears on the plot.
+chosen dataset, or to change the dataset label that appears in the plot legend
+box.
 
 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
@@ -292,6 +307,7 @@
 average.
 
-*NOTE! The displayed average only updates when input focus is moved back to
-that window; ie, when the mouse pointer is moved onto that plot.*
+.. note::
+    The displayed average only updates when input focus is moved back to
+    that window; ie, when the mouse pointer is moved onto that plot.
 
 Selecting *Box Sum* automatically brings up the 'Slicer Parameters' dialog in
@@ -359,3 +375,3 @@
 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
 
-.. note::  This help document was last changed by Steve King, 01May2015
+.. note::  This help document was last modified by Paul Butler, 05 September, 2016
Index: src/sas/sasgui/guiframe/utils.py
===================================================================
--- src/sas/sasgui/guiframe/utils.py	(revision d85c194ea2f78cb2b9b3de9c969e1b8ebea6b6d2)
+++ src/sas/sasgui/guiframe/utils.py	(revision a0373d5a680d6dd4bbb571a7d08e588ec9a11040)
@@ -46,5 +46,21 @@
     return flag
 
-    
+
+def check_int(item):
+    """
+    :param item: txtcrtl containing a value
+    """
+    flag = True
+    try:
+        mini = int(item.GetValue())
+        item.SetBackgroundColour(wx.WHITE)
+        item.Refresh()
+    except:
+        flag = False
+        item.SetBackgroundColour("pink")
+        item.Refresh()
+    return flag
+
+
 class PanelMenu(wx.Menu):
     """
Index: c/sas/sasgui/perspectives/calculator/media/kiessig_calculator_help.copy
===================================================================
--- src/sas/sasgui/perspectives/calculator/media/kiessig_calculator_help.copy	(revision 65dfa99759ad82a7c7023ae9209b69fc461475dc)
+++ 	(revision )
@@ -1,32 +1,0 @@
-.. kiessig_calculator_help.rst
-
-.. This is a port of the original SasView html help file to ReSTructured text
-.. by S King, ISIS, during SasView CodeCamp-III in Feb 2015.
-
-.. |pi| unicode:: U+03C0
-.. |Ang| unicode:: U+212B
-
-Kiessig Thickness Calculator Tool
-=================================
-
-Description
------------
-
-This tool is approximately estimates the thickness of a layer or the diameter 
-of particles from the position of the Kiessig fringe/Bragg peak in NR/SAS data 
-using the relation
-
-(thickness *or* size) = 2 * |pi| / (fringe_width *or* peak position)
-  
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-Using the tool
---------------
-
-To get a rough thickness or particle size, simply type the fringe or peak 
-position (in units of 1/|Ang|\) and click on the *Compute* button.
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-.. note::  This help document was last changed by Steve King, 01May2015
-
Index: c/sas/sasgui/perspectives/calculator/media/resolution_calculator_help.copy
===================================================================
--- src/sas/sasgui/perspectives/calculator/media/resolution_calculator_help.copy	(revision 65dfa99759ad82a7c7023ae9209b69fc461475dc)
+++ 	(revision )
@@ -1,107 +1,0 @@
-.. resolution_calculator_help.rst
-
-.. This is a port of the original SasView html help file to ReSTructured text
-.. by S King, ISIS, during SasView CodeCamp-III in Feb 2015.
-
-.. |pi| unicode:: U+03C0
-.. |lambda| unicode:: U+03BB
-.. |Ang| unicode:: U+212B
-
-Q Resolution Estimator Tool
-===========================
-
-Description
------------
-
-This tool is approximately estimates the resolution of Q from SAS instrumental 
-parameter values assuming that the detector is flat and normal to the 
-incident beam.
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-Using the tool
---------------
-
-1) Select *SAS Resolution Estimator* from the *Tool* menu on the SasView toolbar.
-
-2) Select the source (Neutron or Photon) and source type (Monochromatic or TOF).
-
-   *NOTE! The computational difference between the sources is only the 
-   gravitational contribution due to the mass of the particles.*
-
-3) Change the default values of the instrumental parameters as required. Be 
-   careful to note that distances are specified in cm!
-
-4) Enter values for the source wavelength(s), |lambda|\ , and its spread (= FWHM/|lambda|\ ).
-   
-   For monochromatic sources, the inputs are just one value. For TOF sources, 
-   the minimum and maximum values should be separated by a '-' to specify a 
-   range.
-   
-   Optionally, the wavelength (BUT NOT of the wavelength spread) can be extended 
-   by adding '; nn' where the 'nn' specifies the number of the bins for the 
-   numerical integration. The default value is nn = 10. The same number of bins 
-   will be used for the corresponding wavelength spread.
-
-5) For TOF, the default wavelength spectrum is flat. A custom spectral 
-   distribution file (2-column text: wavelength (|Ang|\) vs Intensity) can also 
-   be loaded by selecting *Add new* in the combo box.
-
-6) When ready, click the *Compute* button. Depending on the computation the 
-   calculation time will vary.
-
-7) 1D and 2D dQ values will be displayed at the bottom of the panel, and a 2D 
-   resolution weight distribution (a 2D elliptical Gaussian function) will also 
-   be displayed in the plot panel even if the Q inputs are outside of the 
-   detector limit (the red lines indicate the limits of the detector).
-   
-   TOF only: green lines indicate the limits of the maximum Q range accessible 
-   for the longest wavelength due to the size of the detector.
-    
-   Note that the effect from the beam block/stop is ignored, so in the small Q 
-   region near the beam block/stop 
-
-   [ie., Q < 2. |pi|\ .(beam block diameter) / (sample-to-detector distance) / |lambda|\_min] 
-
-   the variance is slightly under estimated.
-
-8) A summary of the calculation is written to the SasView *Console* at the 
-   bottom of the main SasView window.
-
-.. image:: resolution_tutor.gif
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-Theory
-------
-
-The scattering wave transfer vector is by definition
-
-.. image:: q.gif
-
-In the small-angle limit, the variance of Q is to a first-order 
-approximation
-
-.. image:: sigma_q.gif
-
-The geometric and gravitational contributions can then be summarised as
-
-.. image:: sigma_table.gif
-
-Finally, a Gaussian function is used to describe the 2D weighting distribution 
-of the uncertainty in Q.
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-References
-----------
-
-D.F.R. Mildner and J.M. Carpenter 
-*J. Appl. Cryst.* 17 (1984) 249-256
-
-D.F.R. Mildner, J.M. Carpenter and D.L. Worcester 
-*J. Appl. Cryst.* 19 (1986) 311-319
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-.. note::  This help document was last changed by Steve King, 01May2015
Index: c/sas/sasgui/perspectives/calculator/media/sas_calculator_help.copy
===================================================================
--- src/sas/sasgui/perspectives/calculator/media/sas_calculator_help.copy	(revision 65dfa99759ad82a7c7023ae9209b69fc461475dc)
+++ 	(revision )
@@ -1,166 +1,0 @@
-.. sas_calculator_help.rst
-
-.. This is a port of the original SasView html help file to ReSTructured text
-.. by S King, ISIS, during SasView CodeCamp-III in Feb 2015.
-
-.. |beta| unicode:: U+03B2
-.. |gamma| unicode:: U+03B3
-.. |theta| unicode:: U+03B8
-.. |mu| unicode:: U+03BC
-.. |sigma| unicode:: U+03C3
-.. |phi| unicode:: U+03C6
-
-.. |equiv| unicode:: U+2261
-.. |noteql| unicode:: U+2260
-
-Generic SANS Calculator Tool
-============================
-
-Description
------------
-
-This tool attempts to simulate the SANS expected from a specified
-shape/structure or scattering length density profile. The tool can
-handle both nuclear and magnetic contributions to the scattering.
-
-Theory
-------
-
-In general, a particle with a volume *V* can be described by an ensemble 
-containing *N* 3-dimensional rectangular pixels where each pixel is much 
-smaller than *V*.
-
-Assuming that all the pixel sizes are the same, the elastic scattering 
-intensity from the particle is
-
-.. image:: gen_i.gif
-
-Equation 1.
-
-where |beta|\ :sub:`j` and *r*\ :sub:`j` are the scattering length density and 
-the position of the j'th pixel respectively.
-
-The total volume *V*
-
-.. image:: v_j.gif
-
-for |beta|\ :sub:`j` |noteql|\0 where *v*\ :sub:`j` is the volume of the j'th 
-pixel (or the j'th natural atomic volume (= atomic mass / (natural molar 
-density * Avogadro number) for the atomic structures).
-
-*V* can be corrected by users. This correction is useful especially for an 
-atomic structure (such as taken from a PDB file) to get the right normalization. 
-
-*NOTE!* |beta|\ :sub:`j` *displayed in the GUI may be incorrect but this will not 
-affect the scattering computation if the correction of the total volume V is made.*
-
-The scattering length density (SLD) of each pixel, where the SLD is uniform, is 
-a combination of the nuclear and magnetic SLDs and depends on the spin states 
-of the neutrons as follows.
-
-Magnetic Scattering
-^^^^^^^^^^^^^^^^^^^
-
-For magnetic scattering, only the magnetization component, *M*\ :sub:`perp`\ , 
-perpendicular to the scattering vector *Q* contributes to the magnetic 
-scattering length.
-
-.. image:: mag_vector.bmp
-
-The magnetic scattering length density is then
-
-.. image:: dm_eq.gif
-
-where the gyromagnetic ratio |gamma| = -1.913, |mu|\ :sub:`B` is the Bohr 
-magneton, *r*\ :sub:`0` is the classical radius of electron, and |sigma| is the 
-Pauli spin.
-
-For a polarized neutron, the magnetic scattering is depending on the spin states.
-
-Let us consider that the incident neutrons are polarised both parallel (+) and  
-anti-parallel (-) to the x' axis (see below). The possible states after 
-scattering from the sample are then 
-
-*  Non-spin flips: (+ +) and (- -)
-*  Spin flips:     (+ -) and (- +)
-
-.. image:: gen_mag_pic.bmp
-
-Now let us assume that the angles of the *Q* vector and the spin-axis (x') 
-to the x-axis are |phi| and |theta|\ :sub:`up` respectively (see above). Then, 
-depending upon the polarization (spin) state of neutrons, the scattering 
-length densities, including the nuclear scattering length density (|beta|\ :sub:`N`\ ) 
-are given as
-
-*  for non-spin-flips
-
-   .. image:: sld1.gif
-
-*  for spin-flips
-
-   .. image:: sld2.gif
-
-where
-
-.. image:: mxp.gif
-
-.. image:: myp.gif
-
-.. image:: mzp.gif
-
-.. image:: mqx.gif
-
-.. image:: mqy.gif
-
-Here the *M0*\ :sub:`x`\ , *M0*\ :sub:`y` and *M0*\ :sub:`z` are the x, y and z 
-components of the magnetisation vector in the laboratory xyz frame. 
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-Using the tool
---------------
-
-.. image:: gen_gui_help.bmp
-
-After computation the result will appear in the *Theory* box in the SasView  
-*Data Explorer* panel.
-
-*Up_frac_in* and *Up_frac_out* are the ratio 
-
-   (spin up) / (spin up + spin down)
-   
-of neutrons before the sample and at the analyzer, respectively.
-
-*NOTE 1. The values of* Up_frac_in *and* Up_frac_out *must be in the range 
-0.0 to 1.0. Both values are 0.5 for unpolarized neutrons.*
-
-*NOTE 2. This computation is totally based on the pixel (or atomic) data fixed 
-in xyz coordinates. No angular orientational averaging is considered.*
-
-*NOTE 3. For the nuclear scattering length density, only the real component 
-is taken account.*
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-Using PDB/OMF or SLD files
---------------------------
-
-The SANS Calculator tool can read some PDB, OMF or SLD files but ignores
-polarized/magnetic scattering when doing so, thus related parameters such as 
-*Up_frac_in*, etc, will be ignored.
-
-The calculation for fixed orientation uses Equation 1 above resulting in a 2D 
-output, whereas the scattering calculation averaged over all the orientations 
-uses the Debye equation below providing a 1D output
-
-.. image:: gen_debye_eq.gif
-
-where *v*\ :sub:`j` |beta|\ :sub:`j` |equiv| *b*\ :sub:`j` is the scattering 
-length of the j'th atom. The calculation output is passed to the *Data Explorer* 
-for further use.
-
-.. image:: pdb_combo.jpg
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-.. note::  This help document was last changed by Steve King, 01May2015
Index: c/sas/sasgui/perspectives/calculator/media/sld_calculator_help.copy
===================================================================
--- src/sas/sasgui/perspectives/calculator/media/sld_calculator_help.copy	(revision 65dfa99759ad82a7c7023ae9209b69fc461475dc)
+++ 	(revision )
@@ -1,58 +1,0 @@
-.. sld_calculator_help.rst
-
-.. This is a port of the original SasView html help file to ReSTructured text
-.. by S King, ISIS, during SasView CodeCamp-III in Feb 2015.
-
-.. |Ang| unicode:: U+212B
-
-SLD Calculator Tool
-===================
-
-Description
------------
-
-The neutron scattering length density (SLD) is defined as
-
-  SLD = (b_c1 + b_c2 + ... + b_cn) / Vm
-
-where b_ci is the bound coherent scattering length of ith of n atoms in a molecule
-with the molecular volume Vm
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-Specifying the Compound Name
-----------------------------
-
-To calculate scattering length densities enter the empirical formula of a 
-compound and its mass density and click "Calculate".
-
-Entering a wavelength value is optional (a default value of 6.0 |Ang| will 
-be used).
-
-TIPS!
-
-*  Formula strings consist of atoms and the number of them, such as "CaCO3+6H2O".
-
-*  Groups can be separated by *'+'* or *space*, so "CaCO3 6H2O" works as well.
-
-*  Groups can be defined using parentheses, such as "CaCO3(H2O)6".
-
-*  Parentheses can be nested, such as "(CaCO3(H2O)6)1".
-
-*  Isotopes are represented by their atomic number in *square brackets*, such 
-   as "CaCO[18]3+6H2O", H[1], or H[2].
-
-*  Numbers of atoms can be integer or decimal, such as "CaCO3+(3HO0.5)2".
-
-*  The SLD of mixtures can be calculated as well. For example, for a 70-30 
-   mixture of H2O/D2O write "H14O7+D6O3" or more simply "H7D3O5" (i.e. this says
-   7 hydrogens, 3 deuteriums, and 5 oxygens) and enter a mass density calculated
-   on the percentages of H2O and D2O.
-
-*  Type "C[13]6 H[2]12 O[18]6" for C(13)6H(2)12O(18)6 (6 Carbon-13 atoms, 12 
-   deuterium atoms, and 6 Oxygen-18 atoms).
-   
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-.. note::  This help document was last changed by Steve King, 01May2015
-
Index: c/sas/sasgui/perspectives/calculator/media/slit_calculator_help.copy
===================================================================
--- src/sas/sasgui/perspectives/calculator/media/slit_calculator_help.copy	(revision 65dfa99759ad82a7c7023ae9209b69fc461475dc)
+++ 	(revision )
@@ -1,43 +1,0 @@
-.. slit_calculator_help.rst
-
-.. This is a port of the original SasView html help file to ReSTructured text
-.. by S King, ISIS, during SasView CodeCamp-III in Feb 2015.
-
-.. |Ang| unicode:: U+212B
-.. |TM| unicode:: U+2122
-
-Slit Size Calculator Tool
-=========================
-
-Description
------------
-
-This tool enables X-ray users to calculate the slit size (FWHM/2) for smearing 
-based on their half beam profile data.
-
-*NOTE! Whilst it may have some more generic applicability, the calculator has
-only been tested with beam profile data from Anton-Paar SAXSess*\ |TM|\  
-*software.*
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-Using the tool
---------------
-
-1) Select *Slit Size Calculator* from the *Tool* menu on the SasView toolbar.
-
-2) Load a beam profile file in the *Data* field using the *Browse* button.
-
-   *NOTE! To see an example of the beam profile file format, visit the file 
-   beam profile.DAT in your {installation_directory}/SasView/test folder.*
-
-3) Once a data is loaded, the slit size is automatically computed and displayed 
-   in the tool window.
-
-*NOTE! The beam profile file does not carry any information about the units of 
-the Q data. This calculator assumes the data has units of 1/\ |Ang|\ . If the
-data is not in these units it must be manually converted beforehand.*
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-.. note::  This help document was last changed by Steve King, 01May2015
Index: src/sas/sasgui/perspectives/fitting/basepage.py
===================================================================
--- src/sas/sasgui/perspectives/fitting/basepage.py	(revision e4c897b7e24c79352d6e923b47adad24f96490b5)
+++ src/sas/sasgui/perspectives/fitting/basepage.py	(revision c65a265f903fc473c9bca504ea24f9bb02d98193)
@@ -17,7 +17,8 @@
 from wx.lib.scrolledpanel import ScrolledPanel
 
-import sasmodels.sasview_model
+from sasmodels.weights import MODELS as POLYDISPERSITY_MODELS
+
 from sas.sasgui.guiframe.panel_base import PanelBase
-from sas.sasgui.guiframe.utils import format_number, check_float, IdList
+from sas.sasgui.guiframe.utils import format_number, check_float, IdList, check_int
 from sas.sasgui.guiframe.events import PanelOnFocusEvent
 from sas.sasgui.guiframe.events import StatusEvent
@@ -626,5 +627,5 @@
         self.disp_help_bt.Bind(wx.EVT_BUTTON, self.on_pd_help_clicked,
                                id=self.disp_help_bt.GetId())
-        self.disp_help_bt.SetToolTipString("Helps for Polydispersion.")
+        self.disp_help_bt.SetToolTipString("Help for polydispersion.")
 
         self.Bind(wx.EVT_RADIOBUTTON, self._set_dipers_Param,
@@ -932,5 +933,5 @@
         if len(self._disp_obj_dict) > 0:
             for k, v in self._disp_obj_dict.iteritems():
-                self.state._disp_obj_dict[k] = v
+                self.state._disp_obj_dict[k] = v.type
 
             self.state.values = copy.deepcopy(self.values)
@@ -1009,5 +1010,5 @@
             if len(self._disp_obj_dict) > 0:
                 for k, v in self._disp_obj_dict.iteritems():
-                    self.state._disp_obj_dict[k] = v
+                    self.state._disp_obj_dict[k] = v.type
 
             self.state.values = copy.deepcopy(self.values)
@@ -1123,6 +1124,5 @@
                                                     state.disp_cb_dict[item])
                         # Create the dispersion objects
-                        from sas.models.dispersion_models import ArrayDispersion
-                        disp_model = ArrayDispersion()
+                        disp_model = POLYDISPERSITY_MODELS['array']()
                         if hasattr(state, "values") and \
                                  self.disp_cb_dict[item].GetValue() == True:
@@ -1379,14 +1379,7 @@
         self.weights = copy.deepcopy(state.weights)
 
-        for key, disp in state._disp_obj_dict.iteritems():
-            # From saved file, disp_model can not be sent in model obj.
-            # it will be sent as a string here, then converted to model object.
-            if disp.__class__.__name__ == 'str':
-                disp_model = None
-                com_str = "from sasmodels.weights "
-                com_str += "import %s as disp_func \ndisp_model = disp_func()"
-                exec com_str % disp
-            else:
-                disp_model = disp
+        for key, disp_type in state._disp_obj_dict.iteritems():
+            #disp_model = disp
+            disp_model = POLYDISPERSITY_MODELS[disp_type]()
             self._disp_obj_dict[key] = disp_model
             param_name = key.split('.')[0]
@@ -1504,13 +1497,7 @@
             is_2Ddata = True
         if self.model != None:
-            try:
-                is_modified = self._check_value_enter(self.fittable_param,
-                                                      is_modified)
-                is_modified = self._check_value_enter(self.fixed_param,
-                                                      is_modified)
-                is_modified = self._check_value_enter(self.parameters,
-                                                      is_modified)
-            except Exception:
-                logging.error(traceback.format_exc())
+            is_modified = (self._check_value_enter(self.fittable_param)
+                           or self._check_value_enter(self.fixed_param)
+                           or self._check_value_enter(self.parameters))
 
             # Here we should check whether the boundaries have been modified.
@@ -1533,7 +1520,4 @@
             else:
                 self.fitrange = False
-
-            if not self.data.is_data:
-                is_modified = True
 
             ## if any value is modify draw model with new value
@@ -1552,4 +1536,6 @@
                 self._draw_model()
                 self.Refresh()
+
+        logging.info("is_modified flag set to %g",is_modified)
         return is_modified
 
@@ -1561,5 +1547,4 @@
         flag = True
         self.fitrange = True
-        is_modified = False
 
         #wx.PostEvent(self._manager.parent, StatusEvent(status=" \
@@ -1574,7 +1559,7 @@
                                                                 [self.data])
             ##Check the values
-            self._check_value_enter(self.fittable_param, is_modified)
-            self._check_value_enter(self.fixed_param, is_modified)
-            self._check_value_enter(self.parameters, is_modified)
+            self._check_value_enter(self.fittable_param)
+            self._check_value_enter(self.fixed_param)
+            self._check_value_enter(self.parameters)
 
             # If qmin and qmax have been modified, update qmin and qmax and
@@ -1660,10 +1645,4 @@
         return flag
 
-    def _is_modified(self, is_modified):
-        """
-        return to self._is_modified
-        """
-        return is_modified
-
     def _reset_parameters_state(self, listtorestore, statelist):
         """
@@ -1964,5 +1943,4 @@
         wx.PostEvent(self.parent, StatusEvent(status=msg))
         # Flag to register when a parameter has changed.
-        #is_modified = False
         if tcrtl.GetValue().lstrip().rstrip() != "":
             try:
@@ -1994,5 +1972,4 @@
                     if temp_npts != self.num_points:
                         self.num_points = temp_npts
-                        #is_modified = True
                 else:
                     msg = "Cannot plot: No points in Q range!!!  "
@@ -2170,4 +2147,5 @@
         self.Layout()
 
+
     def _validate_qrange(self, qmin_ctrl, qmax_ctrl):
         """
@@ -2276,5 +2254,5 @@
         return flag
 
-    def _check_value_enter(self, list, modified):
+    def _check_value_enter(self, list):
         """
         :param list: model parameter and panel info
@@ -2286,85 +2264,80 @@
                 parameter's maximum value ,
                 parameter's units]
-        """
-        is_modified = modified
-        if len(list) == 0:
-            return is_modified
+
+        Returns True if the model parameters have changed.
+        """
+        is_modified = False
         for item in list:
             #skip angle parameters for 1D
-            if not self.enable2D:
-                if item in self.orientation_params:
+            if not self.enable2D and item in self.orientation_params:
+                continue
+
+            value_ctrl = item[2]
+            if not value_ctrl.IsEnabled():
+                # ArrayDispersion disables PD, Min, Max, Npts, Nsigs
+                continue
+
+            name = item[1]
+            value_str = value_ctrl.GetValue().strip()
+            if name.endswith(".npts"):
+                validity = check_int(value_ctrl)
+                if not validity:
                     continue
-            #try:
-            name = str(item[1])
-
-            if string.find(name, ".npts") == -1 and \
-                                        string.find(name, ".nsigmas") == -1:
-                ## check model parameters range
-                param_min = None
-                param_max = None
-
-                ## check minimun value
-                if item[5] != None and item[5] != "":
-                    if item[5].GetValue().lstrip().rstrip() != "":
-                        try:
-                            param_min = float(item[5].GetValue())
-                            if not self._validate_qrange(item[5], item[2]):
-                                if numpy.isfinite(param_min):
-                                    item[2].SetValue(format_number(param_min))
-
-                            item[5].SetBackgroundColour(wx.WHITE)
-                            item[2].SetBackgroundColour(wx.WHITE)
-
-                        except:
-                            msg = "Wrong fit parameter range entered"
-                            wx.PostEvent(self._manager.parent,
-                                         StatusEvent(status=msg))
-                            raise ValueError, msg
-                        is_modified = True
-                ## check maximum value
-                if item[6] != None and item[6] != "":
-                    if item[6].GetValue().lstrip().rstrip() != "":
-                        try:
-                            param_max = float(item[6].GetValue())
-                            if not self._validate_qrange(item[2], item[6]):
-                                if numpy.isfinite(param_max):
-                                    item[2].SetValue(format_number(param_max))
-
-                            item[6].SetBackgroundColour(wx.WHITE)
-                            item[2].SetBackgroundColour(wx.WHITE)
-                        except:
-                            msg = "Wrong Fit parameter range entered "
-                            wx.PostEvent(self._manager.parent,
-                                         StatusEvent(status=msg))
-                            raise ValueError, msg
-                        is_modified = True
-
-                if param_min != None and param_max != None:
-                    if not self._validate_qrange(item[5], item[6]):
-                        msg = "Wrong Fit range entered for parameter "
-                        msg += "name %s of model %s " % (name, self.model.name)
-                        wx.PostEvent(self._manager.parent,
-                                     StatusEvent(status=msg))
-
-                if name in self.model.details.keys():
-                    self.model.details[name][1:3] = param_min, param_max
-                    is_modified = True
-                else:
-                    self.model.details[name] = ["", param_min, param_max]
-                    is_modified = True
-            try:
-                # Check if the textctr is enabled
-                if item[2].IsEnabled():
-                    value = float(item[2].GetValue())
-                    item[2].SetBackgroundColour("white")
-                    # If the value of the parameter has changed,
-                    # +update the model and set the is_modified flag
-                    if value != self.model.getParam(name) and \
-                                                numpy.isfinite(value):
-                        self.model.setParam(name, value)
-            except:
-                item[2].SetBackgroundColour("pink")
-                msg = "Wrong Fit parameter value entered "
-                wx.PostEvent(self._manager.parent, StatusEvent(status=msg))
+                value = int(value_str)
+
+            elif name.endswith(".nsigmas"):
+                validity = check_float(value_ctrl)
+                if not validity:
+                    continue
+                value = float(value_str)
+
+            else:  # value or polydispersity
+
+                # Check that min, max and value are floats
+                min_ctrl, max_ctrl = item[5], item[6]
+                min_str = min_ctrl.GetValue().strip()
+                max_str = max_ctrl.GetValue().strip()
+                validity = check_float(value_ctrl)
+                if min_str != "":
+                    validity = validity and check_float(min_ctrl)
+                if max_str != "":
+                    validity = validity and check_float(max_ctrl)
+                if not validity:
+                    continue
+
+                # Check that min is less than max
+                low = -numpy.inf if min_str == "" else float(min_str)
+                high = numpy.inf if max_str == "" else float(max_str)
+                if high < low:
+                    min_ctrl.SetBackgroundColour("pink")
+                    min_ctrl.Refresh()
+                    max_ctrl.SetBackgroundColour("pink")
+                    max_ctrl.Refresh()
+                    #msg = "Invalid fit range for %s: min must be smaller than max"%name
+                    #wx.PostEvent(self._manager.parent, StatusEvent(status=msg))
+                    continue
+
+                # Force value between min and max
+                value = float(value_str)
+                if value < low:
+                    value = low
+                    value_ctrl.SetValue(format_number(value))
+                elif value > high:
+                    value = high
+                    value_ctrl.SetValue(format_number(value))
+
+                if name not in self.model.details.keys():
+                    self.model.details[name] = ["", None, None]
+                old_low, old_high = self.model.details[name][1:3]
+                if old_low != low or old_high != high:
+                    # The configuration has changed but it won't change the
+                    # computed curve so no need to set is_modified to True
+                    #is_modified = True
+                    self.model.details[name][1:3] = low, high
+
+            # Update value in model if it has changed
+            if value != self.model.getParam(name):
+                self.model.setParam(name, value)
+                is_modified = True
 
         return is_modified
@@ -2539,5 +2512,5 @@
                 self._disp_obj_dict[name1] = disp_model
                 self.model.set_dispersion(param_name, disp_model)
-                self.state._disp_obj_dict[name1] = disp_model
+                self.state._disp_obj_dict[name1] = disp_model.type
 
                 value1 = str(format_number(self.model.getParam(name1), True))
@@ -2562,4 +2535,6 @@
                         item[0].Enable()
                         item[2].Enable()
+                        item[3].Show(True)
+                        item[4].Show(True)
                         item[5].Enable()
                         item[6].Enable()
@@ -2654,5 +2629,5 @@
         self._disp_obj_dict[name] = disp
         self.model.set_dispersion(name.split('.')[0], disp)
-        self.state._disp_obj_dict[name] = disp
+        self.state._disp_obj_dict[name] = disp.type
         self.values[name] = values
         self.weights[name] = weights
@@ -2722,15 +2697,11 @@
         :param disp_function: dispersion distr. function
         """
-        # List of the poly_model name in the combobox
-        list = ["RectangleDispersion", "ArrayDispersion",
-                "LogNormalDispersion", "GaussianDispersion",
-                "SchulzDispersion"]
-
         # Find the selection
-        try:
-            selection = list.index(disp_func.__class__.__name__)
-            return selection
-        except:
-            return 3
+        if disp_func is not None:
+            try:
+                return POLYDISPERSITY_MODELS.values().index(disp_func.__class__)
+            except ValueError:
+                pass  # Fall through to default class
+        return POLYDISPERSITY_MODELS.keys().index('gaussian')
 
     def on_reset_clicked(self, event):
@@ -3319,7 +3290,12 @@
                     pd = content[name][1]
                     if name.count('.') > 0:
+                        # If this is parameter.width, then pd may be a floating
+                        # point value or it may be an array distribution.
+                        # Nothing to do for parameter.npts or parameter.nsigmas.
                         try:
                             float(pd)
-                        except:
+                            if name.endswith('.npts'):
+                                pd = int(pd)
+                        except Exception:
                             #continue
                             if not pd and pd != '':
@@ -3329,4 +3305,6 @@
                         # Only array func has pd == '' case.
                         item[2].Enable(False)
+                    else:
+                        item[2].Enable(True)
                     if item[2].__class__.__name__ == "ComboBox":
                         if content[name][1] in self.model.fun_list:
@@ -3355,6 +3333,11 @@
                         pd = value[0]
                         if name.count('.') > 0:
+                            # If this is parameter.width, then pd may be a floating
+                            # point value or it may be an array distribution.
+                            # Nothing to do for parameter.npts or parameter.nsigmas.
                             try:
                                 pd = float(pd)
+                                if name.endswith('.npts'):
+                                    pd = int(pd)
                             except:
                                 #continue
@@ -3365,4 +3348,6 @@
                             # Only array func has pd == '' case.
                             item[2].Enable(False)
+                        else:
+                            item[2].Enable(True)
                         if item[2].__class__.__name__ == "ComboBox":
                             if value[0] in self.model.fun_list:
@@ -3384,62 +3369,84 @@
         Helps get paste for poly function
 
-        :param item: Gui param items
-        :param value: the values for parameter ctrols
-        """
-        is_array = False
-        if len(value[1]) > 0:
-            # Only for dispersion func.s
-            try:
-                item[7].SetValue(value[1])
-                selection = item[7].GetCurrentSelection()
-                name = item[7].Name
-                param_name = name.split('.')[0]
-                dispersity = item[7].GetClientData(selection)
-                disp_model = dispersity()
-                # Only for array disp
-                try:
-                    pd_vals = numpy.array(value[2])
-                    pd_weights = numpy.array(value[3])
-                    if len(pd_vals) > 0 and len(pd_vals) > 0:
-                        if len(pd_vals) == len(pd_weights):
-                            self._set_disp_array_cb(item=item)
-                            self._set_array_disp_model(name=name,
-                                                       disp=disp_model,
-                                                       values=pd_vals,
-                                                       weights=pd_weights)
-                            is_array = True
-                except Exception:
-                    logging.error(traceback.format_exc())
-                if not is_array:
-                    self._disp_obj_dict[name] = disp_model
-                    self.model.set_dispersion(name,
-                                              disp_model)
-                    self.state._disp_obj_dict[name] = \
-                                              disp_model
-                    self.model.set_dispersion(param_name, disp_model)
-                    self.state.values = self.values
-                    self.state.weights = self.weights
-                    self.model._persistency_dict[param_name] = \
-                                            [self.state.values,
-                                             self.state.weights]
-
-            except Exception:
-                logging.error(traceback.format_exc())
-                print "Error in BasePage._paste_poly_help: %s" % \
-                                        sys.exc_info()[1]
-
-    def _set_disp_array_cb(self, item):
+        *item* is the parameter name
+
+        *value* depends on which parameter is being processed, and whether it
+        has array polydispersity.
+
+        For parameters without array polydispersity:
+
+            parameter => ['FLOAT', '']
+            parameter.width => ['FLOAT', 'DISTRIBUTION', '']
+            parameter.npts => ['FLOAT', '']
+            parameter.nsigmas => ['FLOAT', '']
+
+        For parameters with array polydispersity:
+
+            parameter => ['FLOAT', '']
+            parameter.width => ['FILENAME', 'array', [x1, ...], [w1, ...]]
+            parameter.npts => ['FLOAT', '']
+            parameter.nsigmas => ['FLOAT', '']
+        """
+        # Do nothing if not setting polydispersity
+        if len(value[1]) == 0:
+            return
+
+        try:
+            name = item[7].Name
+            param_name = name.split('.')[0]
+            item[7].SetValue(value[1])
+            selection = item[7].GetCurrentSelection()
+            dispersity = item[7].GetClientData(selection)
+            disp_model = dispersity()
+
+            if value[1] == 'array':
+                pd_vals = numpy.array(value[2])
+                pd_weights = numpy.array(value[3])
+                if len(pd_vals) == 0 or len(pd_vals) != len(pd_weights):
+                    msg = ("bad array distribution parameters for %s"
+                           % param_name)
+                    raise ValueError(msg)
+                self._set_disp_cb(True, item=item)
+                self._set_array_disp_model(name=name,
+                                           disp=disp_model,
+                                           values=pd_vals,
+                                           weights=pd_weights)
+            else:
+                self._set_disp_cb(False, item=item)
+                self._disp_obj_dict[name] = disp_model
+                self.model.set_dispersion(param_name, disp_model)
+                self.state._disp_obj_dict[name] = disp_model.type
+                # TODO: It's not an array, why update values and weights?
+                self.model._persistency_dict[param_name] = \
+                    [self.values, self.weights]
+                self.state.values = self.values
+                self.state.weights = self.weights
+
+        except Exception:
+            logging.error(traceback.format_exc())
+            print "Error in BasePage._paste_poly_help: %s" % \
+                                    sys.exc_info()[1]
+
+    def _set_disp_cb(self, isarray, item):
         """
         Set cb for array disp
         """
-        item[0].SetValue(False)
-        item[0].Enable(False)
-        item[2].Enable(False)
-        item[3].Show(False)
-        item[4].Show(False)
-        item[5].SetValue('')
-        item[5].Enable(False)
-        item[6].SetValue('')
-        item[6].Enable(False)
+        if isarray:
+            item[0].SetValue(False)
+            item[0].Enable(False)
+            item[2].Enable(False)
+            item[3].Show(False)
+            item[4].Show(False)
+            item[5].SetValue('')
+            item[5].Enable(False)
+            item[6].SetValue('')
+            item[6].Enable(False)
+        else:
+            item[0].Enable()
+            item[2].Enable()
+            item[3].Show(True)
+            item[4].Show(True)
+            item[5].Enable()
+            item[6].Enable()
 
     def update_pinhole_smear(self):
Index: src/sas/sasgui/perspectives/fitting/batchfitpage.py
===================================================================
--- src/sas/sasgui/perspectives/fitting/batchfitpage.py	(revision fc18690cd84cc4dd6e33a9d344f47b08cef71290)
+++ src/sas/sasgui/perspectives/fitting/batchfitpage.py	(revision ee4b3cbc1850f87671526c54335834959ffdfe84)
@@ -256,7 +256,7 @@
 #         if self.model != None:           
 #             ##Check the values
-#             self._check_value_enter( self.fittable_param, is_modified)
-#             self._check_value_enter( self.fixed_param, is_modified)
-#             self._check_value_enter( self.parameters, is_modified)
+#             self._check_value_enter( self.fittable_param)
+#             self._check_value_enter( self.fixed_param)
+#             self._check_value_enter( self.parameters)
 # 
 #             # If qmin and qmax have been modified, update qmin and qmax and 
Index: src/sas/sasgui/perspectives/fitting/fitpage.py
===================================================================
--- src/sas/sasgui/perspectives/fitting/fitpage.py	(revision 934ce6493af6e904cf20f2500ef522b42192adfd)
+++ src/sas/sasgui/perspectives/fitting/fitpage.py	(revision 6c382da7a67e14f0ad75317f0696ce771b802d39)
@@ -10,4 +10,5 @@
 import math
 import time
+import traceback
 
 from sasmodels.weights import MODELS as POLYDISPERSITY_MODELS
@@ -1365,6 +1366,6 @@
             try:
                 tcrtl.SetBackgroundColour(wx.WHITE)
-                self._check_value_enter(self.fittable_param, is_modified)
-                self._check_value_enter(self.parameters, is_modified)
+                self._check_value_enter(self.fittable_param)
+                self._check_value_enter(self.parameters)
             except:
                 tcrtl.SetBackgroundColour("pink")
@@ -2058,5 +2059,5 @@
             msg = "Error: This model state has missing or outdated "
             msg += "information.\n"
-            msg += "%s" % (sys.exc_value)
+            msg += traceback.format_exc()
             wx.PostEvent(self._manager.parent,
                          StatusEvent(status=msg, info="error"))
Index: src/sas/sasgui/perspectives/fitting/fitting.py
===================================================================
--- src/sas/sasgui/perspectives/fitting/fitting.py	(revision 7673ecd9d5adcefdfa1fc6a6d1ff0649f8e63bc8)
+++ src/sas/sasgui/perspectives/fitting/fitting.py	(revision ca4d9854c75a5344e770dec25221dfeb5a270915)
@@ -313,5 +313,5 @@
         """
         event_id = event.GetId()
-        self.update_custom_combo()        
+        self.update_custom_combo()
 
     def update_custom_combo(self):
@@ -342,6 +342,5 @@
                                 page.formfactorbox.SetLabel(current_val)
         except:
-            pass
-
+            logging.error("update_custom_combo: %s", sys.exc_value)
 
     def set_edit_menu(self, owner):
@@ -1666,45 +1665,93 @@
         wx.PostEvent(self.parent, StatusEvent(status=msg, type="update"))
 
+    def create_theory_1D(self, x, y, page_id, model, data, state,
+                         data_description, data_id, dy=None):
+        """
+            Create a theory object associate with an existing Data1D
+            and add it to the data manager.
+            @param x: x-values of the data
+            @param y: y_values of the data
+            @param page_id: fit page ID
+            @param model: model used for fitting
+            @param data: Data1D object to create the theory for
+            @param state: model state
+            @param data_description: title to use in the data manager
+            @param data_id: unique data ID
+        """
+        new_plot = Data1D(x=x, y=y)
+        if dy is None:
+            new_plot.is_data = False
+            new_plot.dy = numpy.zeros(len(y))
+            # If this is a theory curve, pick the proper symbol to make it a curve
+            new_plot.symbol = GUIFRAME_ID.CURVE_SYMBOL_NUM
+        else:
+            new_plot.is_data = True
+            new_plot.dy = dy
+        new_plot.interactive = True
+        new_plot.dx = None
+        new_plot.dxl = None
+        new_plot.dxw = None
+        _yaxis, _yunit = data.get_yaxis()
+        _xaxis, _xunit = data.get_xaxis()
+        new_plot.title = data.name
+        new_plot.group_id = data.group_id
+        if new_plot.group_id == None:
+            new_plot.group_id = data.group_id
+        new_plot.id = data_id
+        # Find if this theory was already plotted and replace that plot given
+        # the same id
+        self.page_finder[page_id].get_theory_data(fid=data.id)
+
+        if data.is_data:
+            data_name = str(data.name)
+        else:
+            data_name = str(model.__class__.__name__)
+
+        new_plot.name = data_description + " [" + data_name + "]"
+        new_plot.xaxis(_xaxis, _xunit)
+        new_plot.yaxis(_yaxis, _yunit)
+        self.page_finder[page_id].set_theory_data(data=new_plot,
+                                                  fid=data.id)
+        self.parent.update_theory(data_id=data.id, theory=new_plot,
+                                   state=state)
+        return new_plot
+
     def _complete1D(self, x, y, page_id, elapsed, index, model,
                     weight=None, fid=None,
                     toggle_mode_on=False, state=None,
                     data=None, update_chisqr=True,
-                    source='model', plot_result=True):
-        """
-        Complete plotting 1D data
+                    source='model', plot_result=True,
+                    unsmeared_model=None, unsmeared_data=None,
+                    unsmeared_error=None, sq_model=None, pq_model=None):
+        """
+            Complete plotting 1D data
+            @param unsmeared_model: fit model, without smearing
+            @param unsmeared_data: data, rescaled to unsmeared model
+            @param unsmeared_error: data error, rescaled to unsmeared model
         """
         try:
             numpy.nan_to_num(y)
-
-            new_plot = Data1D(x=x, y=y)
-            new_plot.is_data = False
-            new_plot.dy = numpy.zeros(len(y))
-            new_plot.symbol = GUIFRAME_ID.CURVE_SYMBOL_NUM
-            _yaxis, _yunit = data.get_yaxis()
-            _xaxis, _xunit = data.get_xaxis()
-            new_plot.title = data.name
-
-            new_plot.group_id = data.group_id
-            if new_plot.group_id == None:
-                new_plot.group_id = data.group_id
-            new_plot.id = str(page_id) + " " + data.name
-            #if new_plot.id in self.color_dict:
-            #    new_plot.custom_color = self.color_dict[new_plot.id]
-            #find if this theory was already plotted and replace that plot given
-            #the same id
-            self.page_finder[page_id].get_theory_data(fid=data.id)
-
-            if data.is_data:
-                data_name = str(data.name)
-            else:
-                data_name = str(model.__class__.__name__)
-
-            new_plot.name = model.name + " [" + data_name + "]"
-            new_plot.xaxis(_xaxis, _xunit)
-            new_plot.yaxis(_yaxis, _yunit)
-            self.page_finder[page_id].set_theory_data(data=new_plot,
-                                                      fid=data.id)
-            self.parent.update_theory(data_id=data.id, theory=new_plot,
-                                       state=state)
+            new_plot = self.create_theory_1D(x, y, page_id, model, data, state,
+                                             data_description=model.name,
+                                             data_id=str(page_id) + " " + data.name)
+            if unsmeared_model is not None:
+                self.create_theory_1D(x, unsmeared_model, page_id, model, data, state,
+                                      data_description=model.name + " unsmeared",
+                                      data_id=str(page_id) + " " + data.name + " unsmeared")
+
+                self.create_theory_1D(x, unsmeared_data, page_id, model, data, state,
+                                      data_description="Data unsmeared",
+                                      data_id="Data  " + data.name + " unsmeared",
+                                      dy=unsmeared_error)
+                
+            if sq_model is not None and pq_model is not None:
+                self.create_theory_1D(x, sq_model, page_id, model, data, state,
+                                      data_description=model.name + " S(q)",
+                                      data_id=str(page_id) + " " + data.name + " S(q)")
+                self.create_theory_1D(x, pq_model, page_id, model, data, state,
+                                      data_description=model.name + " P(q)",
+                                      data_id=str(page_id) + " " + data.name + " P(q)")
+
+
             current_pg = self.fit_panel.get_page_by_id(page_id)
             title = new_plot.title
Index: src/sas/sasgui/perspectives/fitting/media/fitting.rst
===================================================================
--- src/sas/sasgui/perspectives/fitting/media/fitting.rst	(revision d85c194ea2f78cb2b9b3de9c969e1b8ebea6b6d2)
+++ src/sas/sasgui/perspectives/fitting/media/fitting.rst	(revision 05829fbf6c8e7aedd2487d48ac98978c2c7b06db)
@@ -18,3 +18,4 @@
 
    Information on the SasView Optimisers <optimizer.rst>
-   
+
+   Writing a Plugin <plugin.rst>
Index: c/sas/sasgui/perspectives/fitting/media/fitting_help.copy
===================================================================
--- src/sas/sasgui/perspectives/fitting/media/fitting_help.copy	(revision 65dfa99759ad82a7c7023ae9209b69fc461475dc)
+++ 	(revision )
@@ -1,628 +1,0 @@
-.. fitting_help.rst
-
-.. This is a port of the original SasView html help file to ReSTructured text
-.. by S King, ISIS, during SasView CodeCamp-III in Feb 2015.
-
-.. |beta| unicode:: U+03B2
-.. |gamma| unicode:: U+03B3
-.. |mu| unicode:: U+03BC
-.. |sigma| unicode:: U+03C3
-.. |phi| unicode:: U+03C6
-.. |theta| unicode:: U+03B8
-.. |chi| unicode:: U+03C7
-
-.. |inlineimage004| image:: sm_image004.gif
-.. |inlineimage005| image:: sm_image005.gif
-.. |inlineimage008| image:: sm_image008.gif
-.. |inlineimage009| image:: sm_image009.gif
-.. |inlineimage010| image:: sm_image010.gif
-.. |inlineimage011| image:: sm_image011.gif
-.. |inlineimage012| image:: sm_image012.gif
-.. |inlineimage018| image:: sm_image018.gif
-.. |inlineimage019| image:: sm_image019.gif
-
-
-Fitting Perspective
-===================
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-Preparing to fit data
----------------------
-
-To fit some data you must first load some data, activate one or more data sets,
-send those data sets to the fitting perspective, and select a model to fit to
-each data set.
-
-Instructions on how to load and activate data are in the section :ref:`Loading_data`.
-
-SasView can fit data in one of three ways:
-
-*  in *Single* fit mode - individual data sets are fitted independently one-by-one
-
-*  in *Simultaneous* fit mode - multiple data sets are fitted simultaneously to the *same* model with/without constrained parameters (this might be useful, for example, if you have measured the same sample at different contrasts)
-
-*  in *Batch* fit mode - multiple data sets are fitted sequentially to the *same* model (this might be useful, for example, if you have performed a kinetic or time-resolved experiment and have *lots* of data sets!)
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-Selecting a model
------------------
-
-By default, the models in SasView are grouped into five categories
-
-*  *Shapes* - models describing 'objects' (spheres, cylinders, etc)
-*  *Shape-Independent* - models describing structure in terms of density correlation functions, fractals, peaks, power laws, etc
-*  *Customized Models* - SasView- or User-created (non-library) Python models
-*  *Uncategorised* - other models (for reflectivity, etc)
-*  *Structure Factor* - S(Q) models
-
-Use the *Category* drop-down menu to chose a category of model, then select
-a model from the drop-down menu beneath. A graph of the chosen model, calculated
-using default parameter values, will appear. The graph will update dynamically
-as the parameter values are changed.
-
-You can decide your own model categorizations using the :ref:`Category_Manager`.
-
-Once you have selected a model you can read its help documentation by clicking
-on the *Description* button to the right.
-
-Show 1D/2D
-^^^^^^^^^^
-
-Models are normally fitted to 1D (ie, I(Q) vs Q) data sets, but some models in
-SasView can also be fitted to 2D (ie, I(Qx,Qy) vs Qx vs Qy) data sets.
-
-*NB: Magnetic scattering can only be fitted in SasView in 2D.*
-
-To activate 2D fitting mode, click the *Show 2D* button on the *Fit Page*. To
-return to 1D fitting model, click the same button (which will now say *Show 1D*).
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-.. _Category_Manager:
-
-Category Manager
-----------------
-
-To change the model categorizations, either choose *Category Manager* from the
-*View* option on the menubar, or click on the *Modify* button on the *Fit Page*.
-
-.. image:: cat_fig0.bmp
-
-The categorization of all models except the customized models can be reassigned,
-added to, and removed using *Category Manager*. Models can also be hidden from view
-in the drop-down menus.
-
-.. image:: cat_fig1.bmp
-
-Changing category
-^^^^^^^^^^^^^^^^^
-
-To change category, highlight a model in the list by left-clicking on its entry and
-then click the *Modify* button. Use the *Change Category* panel that appears to make
-the required changes.
-
-.. image:: cat_fig2.bmp
-
-To create a category for the selected model, click the *Add* button. In order
-to delete a category, select the category name and click the *Remove Selected*
-button. Then click *Done*.
-
-Showing/hiding models
-^^^^^^^^^^^^^^^^^^^^^
-
-Use the *Enable All / Disable All* buttons and the check boxes beside each model to
-select the models to show/hide. To apply the selection, click *Ok*. Otherwise click
-*Cancel*.
-
-*NB: It may be necessary to change to a different category and then back again*
-*before any changes take effect.*
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-Model Functions
----------------
-
-For a complete list of all the library models available in SasView, see the section
-:ref:`SasView_model_functions`.
-
-It is also possible to add your own models.
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-.. _Adding_your_own_models:
-
-Adding your own models
-----------------------
-
-There are currently two ways to add your own models to SasView:
-
-* Using the :ref:`Custom_Model_Editor`
-* By :ref:`Writing_a_Plugin`
-
-*NB: Because of the way these options are implemented, it is not possible for them*
-*to use the polydispersity algorithms in SasView. Only models in the model library*
-*can do this. At the time of writing (Release 3.1.0) work is in hand to make it*
-*easier to add new models to the model library.*
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-.. _Custom_Model_Editor:
-
-Custom Model Editor
--------------------
-
-From the *Fitting* option in the menu bar, select *Edit Custom Model*.
-
-.. image:: edit_model_menu.bmp
-
-and then one of the options
-
-*  *New* - to create a new custom model template
-*  *Sum|Multi(p1,p2)* - to create a new model by summing/multiplying existing models in the model library
-*  *Advanced* - to edit a new custom model
-*  *Delete* - to delete a custom model
-
-New
-^^^^
-
-.. image:: new_model.bmp
-
-A model template generated by this option can be viewed and further modified using
-the :ref:`Advanced` option.
-
-Sum|Multi(p1,p2)
-^^^^^^^^^^^^^^^^
-
-.. image:: sum_model.bmp
-
-This option creates a custom model of the form
-
-Custom Model = scale_factor \* (model1 +/\* model2)
-
-In the *Easy Sum/Multi Editor* give the new custom model a function name and brief
-description (to appear under the *Details* button on the *Fit Page*). Then select
-two existing models, as p1 and p2, and the required operator, '+' or '*' between
-them. Finally, click the *Apply* button to generate the model and then click *Close*.
-
-*NB: Any changes to a custom model generated in this way only become effective after*
-*it is re-selected from the model drop-down menu on the Fit Page.*
-
-.. _Advanced:
-
-Advanced
-^^^^^^^^
-
-Selecting this option shows all the custom models in the plugin model folder
-
-  *C:\\Users\\[username]\\.sasview\\plugin_models* - (on Windows)
-
-You can edit, modify, and save the Python code in any of these models using the
-*Advanced Custom Model Editor*.
-
-*NB: Unless you are confident about what you are doing, it is recommended that you*
-*only modify lines denoted with the ## <----- comments!*
-
-When editing is complete, select *Run -> Compile* from the *Model Editor* menu bar. An
-*Info* box will appear with the results of the compilation and model unit tests. The
-model will only be usable if the tests 'pass'.
-
-To use the model, go to the relevant *Fit Page*, select the *Customized Models*
-category and then select the model from the drop-down menu.
-
-*NB: Any changes to a custom model generated in this way only become effective after*
-*it is re-selected from the model drop-down menu on the Fit Page.*
-
-Delete
-^^^^^^
-
-Simply highlight the custom model to be removed. This operation is final!
-
-*NB: Custom models shipped with SasView cannot be removed in this way.*
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-.. _Writing_a_Plugin:
-
-Writing a Plugin
-----------------
-
-Advanced users can write their own model in Python and save it to the the SasView
-*plugin_models* folder
-
-  *C:\\Users\\[username]\\.sasview\\plugin_models* - (on Windows)
-
-in .py format. The next time SasView is started it will compile the plugin and add
-it to the list of *Customized Models*.
-
-It is recommended that existing plugin models be used as templates.
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-.. _Fitting_Options:
-
-Fitting Options
----------------
-
-It is possible to specify which optimiser SasView should use to fit the data, and
-to modify some of the configurational parameters for each optimiser.
-
-From *Fitting* in the menu bar select *Fit Options*, then select one of the following
-optimisers:
-
-*  DREAM
-*  Levenberg-Marquardt
-*  Quasi-Newton BFGS
-*  Differential Evolution
-*  Nelder-Mead Simplex
-
-The DREAM optimiser is the most sophisticated, but may not necessarily be the best
-option for fitting simple models. If uncertain, try the Levenberg-Marquardt optimiser
-initially.
-
-These optimisers form the *Bumps* package written by P Kienzle. For more information
-on each optimiser, see the :ref:`Fitting_Documentation`.
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-Fitting Limits
---------------
-
-By default, *SasView* will attempt to model fit the full range of the data; ie,
-across all *Q* values. If necessary, however, it is possible to specify only a
-sub-region of the data for fitting.
-
-In a *FitPage* or *BatchPage* change the *Q* values in the *Min* and/or *Max*
-text boxes. Vertical coloured bars will appear on the graph with the data and
-'theory' indicating the current *Q* limits (red = *Qmin*, purple = *Qmax*).
-
-To return to including all data in the fit, click the *Reset* button.
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-
-Shortcuts
----------
-
-Copy/Paste Parameters
-^^^^^^^^^^^^^^^^^^^^^
-
-It is possible to copy the parameters from one *Fit Page* and to paste them into
-another *Fit Page* using the same model.
-
-To *copy* parameters, either:
-
-*  Select *Edit -> Copy Params* from the menu bar, or
-*  Use Ctrl(Cmd on Mac) + Left Mouse Click on the *Fit Page*.
-
-To *paste* parameters, either:
-
-*  Select *Edit -> Paste Params* from the menu bar, or
-*  Use Ctrl(Cmd on Mac) + Shift + Left-click on the *Fit Page*.
-
-If either operation is successful a message will appear in the info line at the
-bottom of the SasView window.
-
-Bookmark
-^^^^^^^^
-
-To *Bookmark* a *Fit Page* either:
-
-*  Select a *Fit Page* and then click on *Bookmark* in the tool bar, or
-*  Right-click and select the *Bookmark* in the popup menu.
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-.. _Status_bar:
-
-Status Bar & Console
---------------------
-
-The status bar is located at the bottom of the SasView window and displays
-messages, hints, warnings and errors.
-
-At the right-hand side of the status bar is a button marked *Console*. The *Console*
-displays available message history and some run-time traceback information.
-
-During a long task the *Console* can also be used to monitor the progress.
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-.. _Single_Fit_Mode:
-
-Single Fit Mode
----------------
-
-*NB: Before proceeding, ensure that the Single Mode radio button at the bottom of*
-*the Data Explorer is checked (see the section* :ref:`Loading_data` *).*
-
-This mode fits one data set.
-
-When data is sent to the fitting perspective it is plotted in a graph window as
-markers.
-
-If a graph does not appear, or a graph window appears but is empty, then the data
-has not loaded correctly. Check to see if there is a message in the :ref:`Status_Bar`
-or in the *Console* window.
-
-Assuming the data has loaded correctly, when a model is selected a green model
-calculation (or what SasView calls a 'Theory') line will appear in the earlier graph
-window, and a second graph window will appear displaying the residuals (the
-difference between the experimental data and the theory) at the same X-data values.
-See :ref:`Assessing_Fit_Quality`.
-
-The objective of model-fitting is to find a *physically-plausible* model, and set
-of model parameters, that generate a theory that reproduces the experimental data
-and gives residual values as close to zero as possible.
-
-Change the default values of the model parameters by hand until the theory line
-starts to represent the experimental data. Then uncheck the tick boxes alongside
-all parameters *except* the 'background' and the 'scale'. Click the *Fit* button.
-SasView will optimise the values of the 'background' and 'scale' and also display
-the corresponding uncertainties on the optimised values.
-
-*NB: If no uncertainty is shown it generally means that the model is not very*
-*dependent on the corresponding parameter (or that one or more parameters are*
-*'correlated').*
-
-In the bottom left corner of the *Fit Page* is a box displaying the normalised value
-of the statistical |chi|\  :sup:`2` parameter returned by the optimiser.
-
-Now check the box for another model parameter and click *Fit* again. Repeat this
-process until most or all parameters are checked and have been optimised. As the
-fit of the theory to the experimental data improves the value of 'chi2/Npts' will
-decrease. A good model fit should easily produce values of 'chi2/Npts' that are
-close to zero, and certainly <100. See :ref:`Assessing_Fit_Quality`.
-
-SasView has a number of different optimisers (see the section :ref:`Fitting_Options`).
-The DREAM optimiser is the most sophisticated, but may not necessarily be the best
-option for fitting simple models. If uncertain, try the Levenberg-Marquardt optimiser
-initially.
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-Simultaneous Fit Mode
----------------------
-
-*NB: Before proceeding, ensure that the Single Mode radio button at the bottom of*
-*the Data Explorer is checked (see the section* :ref:`Loading_data` *).*
-
-This mode is an extension of the :ref:`Single_Fit_Mode` that fits two or more data
-sets *to the same model* simultaneously. If necessary it is possible to constrain 
-fit parameters between data sets (eg, to fix a background level, or radius, etc).
-
-If the data to be fit are in multiple files, load each file, then select each file
-in the *Data Explorer*, and *Send To Fitting*. If multiple data sets are in one file,
-load that file, *Unselect All Data*, select just those data sets to be fitted, and
-*Send To Fitting*. Either way, the result should be that for *n* data sets you have
-2\ *n* graphs (*n* of the data and model fit, and *n* of the resulting residuals). But
-it may be helpful to minimise the residuals plots for clarity. Also see
-:ref:`Assessing_Fit_Quality`.
-
-*NB: If you need to use a customized model, you must ensure that model is available*
-*first (see* :ref:`Adding_your_own_models` *).*
-
-Method
-^^^^^^
-
-Now go to each *FitPage* in turn and:
-
-  Select the required category and model;
-
-  Unselect all the model parameters;
-
-  Enter some starting guesses for the parameters;
-
-  Enter any parameter limits (recommended);
-
-  Select which parameters will refine (selecting all is generally a bad idea...);
-
-When done, select *Constrained or Simultaneous Fit* under *Fitting* in the menu bar.
-
-In the *Const & Simul Fit* page that appears, select which data sets are to be
-simultaneously fitted (this will probably be all of them or you would not have loaded
-them in the first place!).
-
-To tie parameters between the data sets with constraints, check the 'yes' radio button
-next to *Add Constraint?* in the *Fit Constraints* box.
-
-*NB: You can only constrain parameters that are set to refine.*
-
-When ready, click the *Fit* button on the *Const & Simul Fit* page, NOT the *Fit*
-button on the individual *FitPage*'s.
-
-Simultaneous Fits without Constraints
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-The results of the model-fitting will be returned to each of the individual
-*FitPage*'s.
-
-Note that the chi2/Npts value returned is the SUM of the chi2/Npts of each fit. To
-see the chi2/Npts value for a specific *FitPage*, click the *Compute* button at the
-bottom of that *FitPage* to recalculate. Also see :ref:`Assessing_Fit_Quality`.
-
-Simultaneous Fits with Constraints
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-Use the *Easy Setup* drop-down buttons in the *Const & Simul Fit* page to set
-up constraints between *FitPage*'s.
-
-Constraints will generally be of the form
-
-  Mi Parameter1 = Mj.Parameter1
-
-however the text box after the '=' sign can be used to adjust this
-relationship; for example
-
-  Mi Parameter1 = scalar \* Mj.Parameter1
-
-A 'free-form' constraint box is also provided.
-
-Many constraints can be entered for a single fit.
-
-The results of the model-fitting will be returned to each of the individual
-*FitPage*'s.
-
-Note that the chi2/Npts value returned is the SUM of the chi2/Npts of each fit. To
-see the chi2/Npts value for a specific *FitPage*, click the *Compute* button at the
-bottom of that *FitPage* to recalculate. Also see :ref:`Assessing_Fit_Quality`.
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-Batch Fit Mode
---------------
-
-*NB: Before proceeding, ensure that the Single Mode radio button at the bottom of*
-*the Data Explorer is checked (see the section* :ref:`Loading_data` *). The Batch*
-*Mode button will be used later on!*
-
-This mode *sequentially* fits two or more data sets *to the same model*. Unlike in
-simultaneous fitting, in batch fitting it is not possible to constrain fit parameters
-between data sets.
-
-If the data to be fit are in multiple files, load each file in the *Data Explorer*.
-If multiple data sets are in one file, load just that file. *Unselect All Data*, then
-select a single initial data set to be fitted. Fit that selected data set as described
-above under :ref:`Single_Fit_Mode` .
-
-*NB: If you need to use a customized model, you must ensure that model is available*
-*first (see* :ref:`Adding_your_own_models` *).*
-
-Method
-^^^^^^
-
-Now *Select All Data* in the *Data Explorer*, check the *Batch Mode* radio button
-at the bottom of that panel and *Send To Fitting*. A *BatchPage* will be created.
-
-.. image:: batch_button_area.bmp
-
-*NB: The Batch Page can also be created by checking the Batch Mode radio button*
-*and selecting New Fit Page under Fitting in the menu bar.*
-
-Using the drop-down menus in the *BatchPage*, now set up the *same* data set
-with the *same* model that you just fitted in single fit mode. A quick way to
-set the model parameter values is to just copy them from the earlier Single
-Fit. To do this, go back to the Single Fit *FitPage*, select *Copy Params*
-under *Edit* in the menu bar, then go back to the *BatchPage* and *Paste Params*.
-
-When ready, use the *Fit* button on the *BatchPage* to perform the fitting, NOT
-the *Fit* button on the individual *FitPage*'s.
-
-Unlike in single fit mode, the results of batch fits are not returned to
-the *BatchPage*. Instead, a spreadsheet-like :ref:`Grid_Window` will appear.
-
-If you want to visually check a graph of a particular fit, click on the name of
-a *Data set* in the *Grid Window* and then click the *View Fits* button. The
-data and the model fit will be displayed. If you select mutliple data sets they
-will all appear on one graph.
-
-.. image:: view_button.bmp
-
-*NB: In theory, returning to the BatchPage and changing the name of the I(Q)*
-*data source should also work, but at the moment whilst this does change the*
-*data set displayed it always superimposes the 'theory' corresponding to the*
-*starting parameters.*
-
-If you select a 'Chi2' value and click the *View Fits* button a graph of the
-residuals for that data set is displayed. Again, if you select multiple 'Chi2'
-values then all the residuals data will appear on one graph. Also see
-:ref:`Assessing_Fit_Quality`.
-
-Chain Fitting
-^^^^^^^^^^^^^
-
-By default, the *same* parameter values copied from the initial single fit into
-the *BatchPage* will be used as the starting parameters for all batch fits. It
-is, however, possible to get *SasView* to use the results of a fit to a preceding
-data set as the starting parameters for the next fit in the sequence. This
-variation of batch fitting is called *Chain Fitting*, and will considerably speed
-up model-fitting if you have lots of very similar data sets where a few parameters
-are gradually changing. Do not use chain fitting on disparate data sets.
-
-To use chain fitting, select *Chain Fitting* under *Fitting* in the menu bar. It
-toggles on/off, so selecting it again will switch back to normal batch fitting.
-
-.. _Grid_Window:
-
-Grid Window
-^^^^^^^^^^^
-
-The *Grid Window* provides an easy way to view the results from batch fitting.
-It will be displayed automatically when a batch fit completes, but may be
-opened at any time by selecting *Show Grid Window* under *View* in the menu
-bar.
-
-.. image:: restore_batch_window.bmp
-
-Once a batch fit is completed, all model parameters are displayed but *not*
-their uncertainties. To view the uncertainties, click on a given column then
-go to *Edit* in the menu bar, select *Insert Column Before* and choose the
-required data from the list. An empty column can be inserted in the same way.
-
-To remove a column from the grid, click on the column header and choose
-*Remove Column* under *Edit* in the menu bar. The same functionality also
-allows you to re-order columns.
-
-*NB: You cannot insert/remove/re-order the rows in the Grid Window.*
-
-All of the above functions are also available by right-clicking on a column
-label.
-
-.. image:: edit_menu.bmp
-
-*NB: If there is an existing Grid Window and another batch fit is performed,*
-*an additional 'Table' tab will be added to the Grid Window.*
-
-The parameter values in the *currently selected* table of the *Grid Window*
-can be output to a CSV file by choosing *Save As* under *File* in the (*Grid*
-*Window*) menu bar. The default filename includes the date and time that the
-batch fit was performed.
-
-Saved CSV files can be reloaded by choosing *Open* under *File* in the *Grid*
-*Window* menu bar. The loaded parameters will appear in a new table tab.
-
-.. image:: file_menu.bmp
-
-*NB: Saving the Grid Window does not save any experimental data, residuals*
-*or actual model fits. Consequently if you reload a saved CSV file the*
-*ability to View Fits will be lost.*
-
-Parameter Plots
-^^^^^^^^^^^^^^^
-
-Any column of *numeric* parameter values can be plotted against another using
-the *Grid Window*. Simply select one column at the time and click the *Add*
-button next to the required *X/Y-axis Selection Range* text box. When both
-the X and Y axis boxes have been completed, click the *Plot* button.
-
-When the *Add* button is clicked, *SasView* also automatically completes the
-*X/Y-axis Label* text box with the heading from Row 1 of the selected table,
-but different labels and units can be entered manually.
-
-.. image:: plot_button.bmp
-
-The *X/Y-axis Selection Range* can be edited manually. The text control box
-recognises the operators +, -, \*, /, or 'pow', and allows the following
-types of expression :
- 
-  1) if an axis label range is a function of 1 or more *columns*, write
-     this type of expression
-
-     constant1 * column_name1 [minimum row index :  maximum  row index]
-     operator constant2 * column_name2 [minimum row index :  maximum  row index]
-
-     Example: radius [2 : 5] -3 * scale [2 : 5]
-
-  2) if only some *values* of a given column are needed but the range between
-     the first row and the last row used is not continuous, write this type of
-     expression
-
-     column_name1 [minimum row index1 :  maximum  row index1] , column_name1
-     [minimum row index2 :  maximum  row index2]
-
-     Example: radius [2 : 5] , radius [10 : 25]
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-.. note::  This help document was last changed by Steve King, 04Jun2015
Index: src/sas/sasgui/perspectives/fitting/media/fitting_help.rst
===================================================================
--- src/sas/sasgui/perspectives/fitting/media/fitting_help.rst	(revision b64b87c874ab0edc565e9c415decc839e3214c8c)
+++ src/sas/sasgui/perspectives/fitting/media/fitting_help.rst	(revision 05829fbf6c8e7aedd2487d48ac98978c2c7b06db)
@@ -132,9 +132,4 @@
 * By :ref:`Writing_a_Plugin`
 
-*NB: Because of the way these options are implemented, it is not possible for them*
-*to use the polydispersity algorithms in SasView. Only models in the model library*
-*can do this. At the time of writing (Release 3.1.0) work is in hand to make it*
-*easier to add new models to the model library.*
-
 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
 
@@ -163,4 +158,8 @@
 the :ref:`Advanced` option.
 
+*NB: "Fit Parameters" has been split into two sections, those which can be
+polydisperse (shape and orientation parameters) and those which are not
+(scattering length densities, for example).*
+
 Sum|Multi(p1,p2)
 ^^^^^^^^^^^^^^^^
@@ -192,6 +191,9 @@
 *Advanced Custom Model Editor*.
 
-*NB: Unless you are confident about what you are doing, it is recommended that you*
-*only modify lines denoted with the ## <----- comments!*
+See :ref:`Writing_a_Plugin` for details on the plugin format.
+
+*NB: Sum/Product models are still using the SasView 3.x model format.  Unless
+you are confident about what you are doing, it is recommended that you
+only modify lines denoted with the ## <----- comments!*
 
 When editing is complete, select *Run -> Compile* from the *Model Editor* menu bar. An
@@ -211,21 +213,4 @@
 
 *NB: Custom models shipped with SasView cannot be removed in this way.*
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-.. _Writing_a_Plugin:
-
-Writing a Plugin
-----------------
-
-Advanced users can write their own model in Python and save it to the the SasView
-*plugin_models* folder
-
-  *C:\\Users\\[username]\\.sasview\\plugin_models* - (on Windows)
-
-in .py format. The next time SasView is started it will compile the plugin and add
-it to the list of *Customized Models*.
-
-It is recommended that existing plugin models be used as templates.
 
 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
Index: c/sas/sasgui/perspectives/fitting/media/mag_help.copy
===================================================================
--- src/sas/sasgui/perspectives/fitting/media/mag_help.copy	(revision 65dfa99759ad82a7c7023ae9209b69fc461475dc)
+++ 	(revision )
@@ -1,115 +1,0 @@
-.. mag_help.rst
-
-.. This is a port of text from the original SasView html help file to ReSTructured text
-.. by S King, ISIS, during SasView CodeCamp-III in Feb 2015.
-
-.. |beta| unicode:: U+03B2
-.. |gamma| unicode:: U+03B3
-.. |mu| unicode:: U+03BC
-.. |sigma| unicode:: U+03C3
-.. |phi| unicode:: U+03C6
-.. |theta| unicode:: U+03B8
-.. |chi| unicode:: U+03C7
-
-.. |inlineimage004| image:: sm_image004.gif
-.. |inlineimage005| image:: sm_image005.gif
-.. |inlineimage008| image:: sm_image008.gif
-.. |inlineimage009| image:: sm_image009.gif
-.. |inlineimage010| image:: sm_image010.gif
-.. |inlineimage011| image:: sm_image011.gif
-.. |inlineimage012| image:: sm_image012.gif
-.. |inlineimage018| image:: sm_image018.gif
-.. |inlineimage019| image:: sm_image019.gif
-
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-Polarisation/Magnetic Scattering
---------------------------------
-
-Magnetic scattering is implemented in five (2D) models 
-
-*  *SphereModel*
-*  *CoreShellModel*
-*  *CoreMultiShellModel*
-*  *CylinderModel*
-*  *ParallelepipedModel*
-
-In general, the scattering length density (SLD, = |beta|) in each region where the
-SLD is uniform, is a combination of the nuclear and magnetic SLDs and, for polarised
-neutrons, also depends on the spin states of the neutrons.
-
-For magnetic scattering, only the magnetization component, *M*\ :sub:`perp`,
-perpendicular to the scattering vector *Q* contributes to the the magnetic
-scattering length.
-
-.. image:: mag_vector.bmp
-
-The magnetic scattering length density is then
-
-.. image:: dm_eq.gif
-
-where |gamma| = -1.913 is the gyromagnetic ratio, |mu|\ :sub:`B` is the
-Bohr magneton, *r*\ :sub:`0` is the classical radius of electron, and |sigma|
-is the Pauli spin.
-
-Assuming that incident neutrons are polarized parallel (+) and anti-parallel (-)
-to the *x'* axis, the possible spin states after the sample are then
-
-No spin-flips (+ +) and (- -)
-
-Spin-flips    (+ -) and (- +)
-
-.. image:: M_angles_pic.bmp
-
-If the angles of the *Q* vector and the spin-axis (*x'*) to the *x*-axis are |phi|
-and |theta|\ :sub:`up`, respectively, then, depending on the spin state of the
-neutrons, the scattering length densities, including the nuclear scattering
-length density (|beta|\ :sub:`N`) are
-
-.. image:: sld1.gif
-
-when there are no spin-flips, and
-
-.. image:: sld2.gif
-
-when there are, and
-
-.. image:: mxp.gif
-
-.. image:: myp.gif
-
-.. image:: mzp.gif
-
-.. image:: mqx.gif
-
-.. image:: mqy.gif
-
-Here, *M*\ :sub:`0x`, *M*\ :sub:`0y` and *M*\ :sub:`0z` are the x, y and z components
-of the magnetization vector given in the laboratory xyz frame given by
-
-.. image:: m0x_eq.gif
-
-.. image:: m0y_eq.gif
-
-.. image:: m0z_eq.gif
-
-and the magnetization angles |theta|\ :sub:`M` and |phi|\ :sub:`M` are defined in
-the figure above.
-
-The user input parameters are:
-
-===========   ================================================================
- M0_sld        = *D*\ :sub:`M` *M*\ :sub:`0`
- Up_theta      = |theta|\ :sub:`up`
- M_theta       = |theta|\ :sub:`M`
- M_phi         = |phi|\ :sub:`M`
- Up_frac_i     = (spin up)/(spin up + spin down) neutrons *before* the sample
- Up_frac_f     = (spin up)/(spin up + spin down) neutrons *after* the sample
-===========   ================================================================
-
-*Note:* The values of the 'Up_frac_i' and 'Up_frac_f' must be in the range 0 to 1.
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-.. note::  This help document was last changed by Steve King, 02May2015
Index: c/sas/sasgui/perspectives/fitting/media/pd_help.copy
===================================================================
--- src/sas/sasgui/perspectives/fitting/media/pd_help.copy	(revision 65dfa99759ad82a7c7023ae9209b69fc461475dc)
+++ 	(revision )
@@ -1,203 +1,0 @@
-.. pd_help.rst
-
-.. This is a port of the original SasView html help file to ReSTructured text
-.. by S King, ISIS, during SasView CodeCamp-III in Feb 2015.
-
-.. |beta| unicode:: U+03B2
-.. |gamma| unicode:: U+03B3
-.. |mu| unicode:: U+03BC
-.. |sigma| unicode:: U+03C3
-.. |phi| unicode:: U+03C6
-.. |theta| unicode:: U+03B8
-.. |chi| unicode:: U+03C7
-.. |Ang| unicode:: U+212B
-
-.. |inlineimage004| image:: sm_image004.gif
-.. |inlineimage005| image:: sm_image005.gif
-.. |inlineimage008| image:: sm_image008.gif
-.. |inlineimage009| image:: sm_image009.gif
-.. |inlineimage010| image:: sm_image010.gif
-.. |inlineimage011| image:: sm_image011.gif
-.. |inlineimage012| image:: sm_image012.gif
-.. |inlineimage018| image:: sm_image018.gif
-.. |inlineimage019| image:: sm_image019.gif
-
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-Polydispersity Distributions
-----------------------------
-
-With some models SasView can calculate the average form factor for a population
-of particles that exhibit size and/or orientational polydispersity. The resultant
-form factor is normalized by the average particle volume such that
-
-*P(q) = scale* * \ <F*\F> / *V + bkg*
-
-where F is the scattering amplitude and the \<\> denote an average over the size
-distribution.
-
-Users should note that this computation is very intensive. Applying polydispersion
-to multiple parameters at the same time, or increasing the number of *Npts* values
-in the fit, will require patience! However, the calculations are generally more
-robust with more data points or more angles.
-
-SasView uses the term *PD* for a size distribution (and not to be confused with a
-molecular weight distributions in polymer science) and the term *Sigma* for an
-angular distribution.
-
-The following five distribution functions are provided:
-
-*  *Rectangular Distribution*
-*  *Gaussian Distribution*
-*  *Lognormal Distribution*
-*  *Schulz Distribution*
-*  *Array Distribution*
-
-These are all implemented in SasView as *number-average* distributions.
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-Rectangular Distribution
-^^^^^^^^^^^^^^^^^^^^^^^^
-
-The Rectangular Distribution is defined as
-
-.. image:: pd_image001.png
-
-where *xmean* is the mean of the distribution, *w* is the half-width, and *Norm* is a
-normalization factor which is determined during the numerical calculation.
-
-Note that the standard deviation and the half width *w* are different!
-
-The standard deviation is
-
-.. image:: pd_image002.png
-
-whilst the polydispersity is
-
-.. image:: pd_image003.png
-
-.. image:: pd_image004.jpg
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-Gaussian Distribution
-^^^^^^^^^^^^^^^^^^^^^
-
-The Gaussian Distribution is defined as
-
-.. image:: pd_image005.png
-
-where *xmean* is the mean of the distribution and *Norm* is a normalization factor
-which is determined during the numerical calculation.
-
-The polydispersity is
-
-.. image:: pd_image003.png
-
-
-.. image:: pd_image006.jpg
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-Lognormal Distribution
-^^^^^^^^^^^^^^^^^^^^^^
-
-The Lognormal Distribution is defined as
-
-.. image:: pd_image007.png
-
-where |mu|\ =ln(*xmed*), *xmed* is the median value of the distribution, and
-*Norm* is a normalization factor which will be determined during the numerical
-calculation.
-
-The median value for the distribution will be the value given for the respective
-size parameter in the *Fitting Perspective*, for example, radius = 60.
-
-The polydispersity is given by |sigma|
-
-.. image:: pd_image008.png
-
-For the angular distribution
-
-.. image:: pd_image009.png
-
-The mean value is given by *xmean*\ =exp(|mu|\ +p\ :sup:`2`\ /2). The peak value
-is given by *xpeak*\ =exp(|mu|-p\ :sup:`2`\ ).
-
-.. image:: pd_image010.jpg
-
-This distribution function spreads more, and the peak shifts to the left, as *p*
-increases, requiring higher values of Nsigmas and Npts.
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-Schulz Distribution
-^^^^^^^^^^^^^^^^^^^
-
-The Schulz distribution is defined as
-
-.. image:: pd_image011.png
-
-where *xmean* is the mean of the distribution and *Norm* is a normalization factor
-which is determined during the numerical calculation, and *z* is a measure of the
-width of the distribution such that
-
-z = (1-p\ :sup:`2`\ ) / p\ :sup:`2`
-
-The polydispersity is
-
-.. image:: pd_image012.png
-
-Note that larger values of PD might need larger values of Npts and Nsigmas.
-For example, at PD=0.7 and radius=60 |Ang|, Npts>=160 and Nsigmas>=15 at least.
-
-.. image:: pd_image013.jpg
-
-For further information on the Schulz distribution see:
-M Kotlarchyk & S-H Chen, *J Chem Phys*, (1983), 79, 2461.
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-Array Distribution
-^^^^^^^^^^^^^^^^^^
-
-This user-definable distribution should be given as as a simple ASCII text file
-where the array is defined by two columns of numbers: *x* and *f(x)*. The *f(x)*
-will be normalized by SasView during the computation.
-
-Example of what an array distribution file should look like:
-
-====  =====
- 30    0.1
- 32    0.3
- 35    0.4
- 36    0.5
- 37    0.6
- 39    0.7
- 41    0.9
-====  =====
-
-SasView only uses these array values during the computation, therefore any mean
-value of the parameter represented by *x* present in the *Fitting Perspective*
-will be ignored.
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-Note about DLS polydispersity
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-Many commercial Dynamic Light Scattering (DLS) instruments produce a size
-polydispersity parameter, sometimes even given the symbol *p*! This parameter is
-defined as the relative standard deviation coefficient of variation of the size
-distribution and is NOT the same as the polydispersity parameters in the Lognormal
-and Schulz distributions above (though they all related) except when the DLS
-polydispersity parameter is <0.13.
-
-For more information see:
-S King, C Washington & R Heenan, *Phys Chem Chem Phys*, (2005), 7, 143
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-.. note::  This help document was last changed by Steve King, 01May2015
Index: src/sas/sasgui/perspectives/fitting/media/plugin.rst
===================================================================
--- src/sas/sasgui/perspectives/fitting/media/plugin.rst	(revision cbbb6a465b6cb84cd0c143df039db2c3cb53adbe)
+++ src/sas/sasgui/perspectives/fitting/media/plugin.rst	(revision cbbb6a465b6cb84cd0c143df039db2c3cb53adbe)
@@ -0,0 +1,792 @@
+.. _Writing_a_Plugin:
+
+Writing a Plugin Model
+======================
+
+Overview
+^^^^^^^^
+
+You can write your own model and save it to the the SasView
+*plugin_models* folder
+
+  *C:\\Users\\[username]\\.sasview\\plugin_models* (on Windows)
+
+The next time SasView is started it will compile the plugin and add
+it to the list of *Customized Models* in a FitPage.  It is recommended that an
+existing model be used as a template.
+
+SasView has three ways of writing models:
+
+- As a pure python model : Example -
+  `broadpeak.py <https://github.com/SasView/sasmodels/blob/master/sasmodels/models/broad_peak.py>`_
+- As a python model with embedded C : Example -
+  `sphere.py <https://github.com/SasView/sasmodels/blob/master/sasmodels/models/sphere.py>`_
+- As a python wrapper with separate C code : Example -
+  `cylinder.py <https://github.com/SasView/sasmodels/blob/master/sasmodels/models/cylinder.py>`_,
+  `cylinder.c <https://github.com/SasView/sasmodels/blob/master/sasmodels/models/cylinder.c>`_
+
+The built-in modules are available in the *sasmodels-data\\models* subdirectory
+of your SasView installation folder.  On Windows, this will be something like
+*C:\\Program Files (x86)\\SasView\\sasmodels-data\\models*.  On Mac OSX, these will be within
+the application bundle as
+*/Applications/SasView 4.0.app/Contents/Resources/sasmodels-data/models*.
+
+Other models are available for download from our
+`Model Marketplace <http://marketplace.sasview.org/>`_. You can contribute your own models to the 
+Marketplace aswell.
+
+Create New Model Files
+^^^^^^^^^^^^^^^^^^^^^^
+
+In the *~\\.sasview\\plugin_models* directory, copy the appropriate files
+(using the examples above as templates) to mymodel.py (and mymodel.c, etc)
+as required, where "mymodel" is the name for the model you are creating.
+
+*Please follow these naming rules:*
+
+- No capitalization and thus no CamelCase
+- If necessary use underscore to separate words (i.e. barbell not BarBell or
+  broad_peak not BroadPeak)
+- Do not include Ã¢â¬ÅmodelÃ¢â¬ï¿œ in the name (i.e. barbell not BarBellModel)
+
+
+Edit New Model Files
+^^^^^^^^^^^^^^^^^^^^
+
+Model Contents
+..............
+
+The model interface definition is in the .py file.  This file contains:
+
+- a **model name**:
+   - this is the **name** string in the *.py* file
+   - titles should be:
+
+    - all in *lower* case
+    - without spaces (use underscores to separate words instead)
+    - without any capitalization or CamelCase
+    - without incorporating the word "model"
+    - examples: *barbell* **not** *BarBell*; *broad_peak* **not** *BroadPeak*; 
+      *barbell* **not** *BarBellModel*
+
+- a **model title**:
+   - this is the **title** string in the *.py* file
+   - this is a one or two line description of the model, which will appear
+     at the start of the model documentation and as a tooltip in the SasView GUI
+
+- a **short discription**:
+   - this is the **description** string in the *.py* file
+   - this is a medium length description which appears when you click
+     *Description* on the model FitPage
+
+- a **parameter table**:
+   - this will be auto-generated from the *parameters* in the *.py* file
+
+- a **long description**:
+   - this is ReStructuredText enclosed between the r""" and """ delimiters
+     at the top of the *.py* file
+   - what you write here is abstracted into the SasView help documentation
+   - this is what other users will refer to when they want to know what your model does; 
+     so please be helpful!
+
+- a **definition** of the model:
+   - as part of the **long description**
+
+- a **formula** defining the function the model calculates:
+   - as part of the **long description**
+
+- an **explanation of the parameters**:
+   - as part of the **long description**
+   - explaining how the symbols in the formula map to the model parameters
+
+- a **plot** of the function, with a **figure caption**:
+   - this is automatically generated from your default parameters
+
+- at least one **reference**:
+   - as part of the **long description**
+   - specifying where the reader can obtain more information about the model
+
+- the **name of the author**
+   - as part of the **long description**
+   - the *.py* file should also contain a comment identifying *who*
+     converted/created the model file
+
+Models that do not conform to these requirements will *never* be incorporated 
+into the built-in library.
+
+More complete documentation for the sasmodels package can be found at
+`<http://www.sasview.org/sasmodels>`_. In particular,
+`<http://www.sasview.org/sasmodels/api/generate.html#module-sasmodels.generate>`_
+describes the structure of a model.
+
+
+Model Documentation
+...................
+
+The *.py* file starts with an r (for raw) and three sets of quotes
+to start the doc string and ends with a second set of three quotes.
+For example::
+
+    r"""
+    Definition
+    ----------
+
+    The 1D scattering intensity of the sphere is calculated in the following
+    way (Guinier, 1955)
+
+    .. math::
+
+        I(q) = \frac{\text{scale}}{V} \cdot \left[
+            3V(\Delta\rho) \cdot \frac{\sin(qr) - qr\cos(qr))}{(qr)^3}
+            \right]^2 + \text{background}
+
+    where *scale* is a volume fraction, $V$ is the volume of the scatterer,
+    $r$ is the radius of the sphere and *background* is the background level.
+    *sld* and *sld_solvent* are the scattering length densities (SLDs) of the
+    scatterer and the solvent respectively, whose difference is $\Delta\rho$.
+
+    You can included figures in your documentation, as in the following
+    figure for the cylinder model.
+
+    .. figure:: img/cylinder_angle_definition.jpg
+
+        Definition of the angles for oriented cylinders.
+
+    References
+    ----------
+
+    A Guinier, G Fournet, *Small-Angle Scattering of X-Rays*,
+    John Wiley and Sons, New York, (1955)
+    """
+
+This is where the FULL documentation for the model goes (to be picked up by
+the automatic documentation system).  Although it feels odd, you
+should start the documentation immediately with the **definition**---the model
+name, a brief description and the parameter table are automatically inserted
+above the definition, and the a plot of the model is automatically inserted
+before the **reference**.
+
+Figures can be included using the *figure* command, with the name
+of the *.png* file containing the figure and a caption to appear below the
+figure.  Figure numbers will be added automatically.
+
+See this `Sphinx cheat sheet <http://matplotlib.org/sampledoc/cheatsheet.html>`_
+for a quick guide to the documentation layout commands, or the
+`Sphinx Documentation <http://www.sphinx-doc.org/en/stable/>`_ for
+complete details.
+
+The model should include a **formula** written using LaTeX markup.
+The example above uses the *math* command to make a displayed equation.  You
+can also use *\$formula\$* for an inline formula. This is handy for defining
+the relationship between the model parameters and formula variables, such
+as the phrase "\$r\$ is the radius" used above.  The live demo MathJax
+page `<http://www.mathjax.org/>`_ is handy for checking that the equations
+will look like you intend.
+
+Math layout uses the `amsmath <http://www.ams.org/publications/authors/tex/amslatex>`_
+package for aligning equations (see amsldoc.pdf on that page for complete documentation).
+You will automatically be in an aligned environment, with blank lines separating
+the lines of the equation.  Place an ampersand before the operator on which to
+align.  For example::
+
+    .. math::
+
+      x + y &= 1 \\
+      y &= x - 1
+
+produces
+
+.. math::
+
+      x + y &= 1 \\
+      y &= x - 1
+
+If you need more control, use::
+
+    .. math::
+        :nowrap:
+
+
+Model Definition
+................
+
+Following the documentation string, there are a series of definitions::
+
+    name = "sphere"  # optional: defaults to the filename without .py
+
+    title = "Spheres with uniform scattering length density"
+
+    description = """\
+    P(q)=(scale/V)*[3V(sld-sld_solvent)*(sin(qr)-qr cos(qr))
+                    /(qr)^3]^2 + background
+        r: radius of sphere
+        V: The volume of the scatter
+        sld: the SLD of the sphere
+        sld_solvent: the SLD of the solvent
+    """
+
+    category = "shape:sphere"
+
+    single = True   # optional: defaults to True
+
+    opencl = False  # optional: defaults to False
+
+    structure_factor = False  # optional: defaults to False
+
+**name = "mymodel"** defines the name of the model that is shown to the user.
+If it is not provided, it will use the name of the model file, with '_'
+replaced by spaces and the parts capitalized.  So *adsorbed_layer.py* will
+become *Adsorbed Layer*.  The predefined models all use the name of the
+model file as the name of the model, so the default may be changed.
+
+**title = "short description"** is short description of the model which
+is included after the model name in the automatically generated documentation.
+The title can also be used for a tooltip.
+
+**description = """doc string"""** is a longer description of the model. It
+shows up when you press the "Description" button of the SasView FitPage.
+It should give a brief description of the equation and the parameters
+without the need to read the entire model documentation. The triple quotes
+allow you to write the description over multiple lines. Keep the lines
+short since the GUI will wrap each one separately if they are too long.
+**Make sure the parameter names in the description match the model definition!**
+
+**category = "shape:sphere"** defines where the model will appear in the
+model documentation.  In this example, the model will appear alphabetically
+in the list of spheroid models in the *Shape* category.
+
+**single = True** indicates that the model can be run using single
+precision floating point values.  Set it to False if the numerical
+calculation for the model is unstable, which is the case for about 20 of
+the built in models.  It is worthwhile modifying the calculation to support
+single precision, allowing models to run up to 10 times faster.  The
+section `Test_Your_New_Model`_  describes how to compare model values for
+single vs. double precision so you can decide if you need to set
+single to False.
+
+**opencl = False** indicates that the model should not be run using OpenCL.
+This may be because the model definition includes code that cannot be
+compiled for the GPU (for example, goto statements).  It can also be used
+for large models which can't run on most GPUs.  This flag has not been
+used on any of the built in models; models which were failing were
+streamlined so this flag was not necessary.
+
+**structure_factor = True** indicates that the model can be used as a
+structure factor to account for interactions between particles.  See
+`Form_Factors`_ for more details.
+
+Model Parameters
+................
+
+Next comes the parameter table.  For example::
+
+    # pylint: disable=bad-whitespace, line-too-long
+    #   ["name",        "units", default, [min, max], "type",    "description"],
+    parameters = [
+        ["sld",         "1e-6/Ang^2",  1, [-inf, inf], "sld",    "Layer scattering length density"],
+        ["sld_solvent", "1e-6/Ang^2",  6, [-inf, inf], "sld",    "Solvent scattering length density"],
+        ["radius",      "Ang",        50, [0, inf],    "volume", "Sphere radius"],
+    ]
+    # pylint: enable=bad-whitespace, line-too-long
+
+**parameters = [["name", "units", default, [min,max], "type", "tooltip"],...]**
+defines the parameters that form the model.
+
+**Note: The order of the parameters in the definition will be the order of the 
+parameters in the user interface and the order of the parameters in Iq(), 
+Iqxy() and form_volume(). And** *scale* **and** *background* **parameters are 
+implicit to all models, so they do not need to be included in the parameter table.**
+
+- **"name"** is the name of the parameter shown on the FitPage.
+
+  - parameter names should follow the mathematical convention; e.g.,
+    *radius_core* not *core_radius*, or *sld_solvent* not *solvent_sld*.
+
+  - model parameter names should be consistent between different models,
+    so *sld_solvent*, for example, should have exactly the same name
+    in every model.
+
+  - to see all the parameter names currently in use, type the following in the
+    python shell/editor under the Tools menu::
+
+       import sasmodels.list_pars
+       sasmodels.list_pars.list_pars()
+
+    *re-use* as many as possible!!!
+
+  - use "name[n]" for multiplicity parameters, where *n* is the name of
+    the parameter defining the number of shells/layers/segments, etc.
+
+- **"units"** are displayed along with the parameter name
+
+  - every parameter should have units; use "None" if there are no units.
+
+  - **sld's should be given in units of 1e-6/Ang^2, and not simply
+    1/Ang^2 to be consistent with the builtin models.  Adjust your formulas
+    appropriately.**
+
+  - fancy units markup is available for some units, including::
+
+        Ang, 1/Ang, 1/Ang^2, 1e-6/Ang^2, degrees, 1/cm, Ang/cm, g/cm^3, mg/m^2
+
+  - the list of units is defined in the variable *RST_UNITS* within
+    `sasmodels/generate.py <https://github.com/SasView/sasmodels/tree/master/sasmodels/generate.py>`_
+
+    - new units can be added using the macros defined in *doc/rst_prolog*
+      in the sasmodels source.
+    - units should be properly formatted using sub-/super-scripts
+      and using negative exponents instead of the / operator, though
+      the unit name should use the / operator for consistency.
+    - please post a message to the SasView developers mailing list with your changes.
+
+- **default** is the initial value for the parameter.
+
+  - **the parameter default values are used to auto-generate a plot of
+    the model function in the documentation.**
+
+- **[min, max]** are the lower and upper limits on the parameter.
+
+  - lower and upper limits can be any number, or *-inf* or *inf*.
+
+  - the limits will show up as the default limits for the fit making it easy,
+    for example, to force the radius to always be greater than zero.
+
+- **"type"** can be one of: "", "sld", "volume", or "orientation".
+
+  - "sld" parameters can have magnetic moments when fitting magnetic models;
+    depending on the spin polarization of the beam and the $q$ value being
+    examined, the effective sld for that material will be used to compute the
+    scattered intensity.
+
+  - "volume" parameters are passed to Iq(), Iqxy(), and form_volume(), and
+    have polydispersity loops generated automatically.
+
+  - "orientation" parameters are only passed to Iqxy(), and have angular
+    dispersion.
+
+
+Model Computation
+.................
+
+Models can be defined as pure python models, or they can be a mixture of
+python and C models.  C models are run on the GPU if it is available,
+otherwise they are compiled and run on the CPU.
+
+Models are defined by the scattering kernel, which takes a set of parameter
+values defining the shape, orientation and material, and returns the
+expected scattering. Polydispersity and angular dispersion are defined
+by the computational infrastructure.  Any parameters defined as "volume"
+parameters are polydisperse, with polydispersity defined in proportion
+to their value.  "orientation" parameters use angular dispersion defined
+in degrees, and are not relative to the current angle.
+
+Based on a weighting function $G(x)$ and a number of points $n$, the
+computed value is
+
+.. math::
+
+     \hat I(q)
+     = \frac{\int G(x) I(q, x)\,dx}{\int G(x) V(x)\,dx}
+     \approx \frac{\sum_{i=1}^n G(x_i) I(q,x_i)}{\sum_{i=1}^n G(x_i) V(x_i)}
+
+That is, the indivdual models do not need to include polydispersity
+calculations, but instead rely on numerical integration to compute the
+appropriately smeared pattern.   Angular dispersion values over polar angle
+$\theta$ requires an additional $\cos \theta$ weighting due to decreased
+arc length for the equatorial angle $\phi$ with increasing latitude.
+
+Python Models
+.............
+
+For pure python models, define the *Iq* function::
+
+      import numpy as np
+      from numpy import cos, sin, ...
+
+      def Iq(q, par1, par2, ...):
+          return I(q, par1, par2, ...)
+      Iq.vectorized = True
+
+The parameters *par1, par2, ...* are the list of non-orientation parameters
+to the model in the order that they appear in the parameter table.
+**Note that the autogenerated model file uses** *x* **rather than** *q*.
+
+The *.py* file should import trigonometric and exponential functions from
+numpy rather than from math.  This lets us evaluate the model for the whole
+range of $q$ values at once rather than looping over each $q$ separately in
+python.  With $q$ as a vector, you cannot use if statements, but must instead
+do tricks like
+
+::
+
+     a = x*q*(q>0) + y*q*(q<=0)
+
+or
+
+::
+
+     a = np.empty_like(q)
+     index = q>0
+     a[index] = x*q[index]
+     a[~index] = y*q[~index]
+
+which sets $a$ to $q \cdot x$ if $q$ is positive or $q \cdot y$ if $q$
+is zero or negative. If you have not converted your function to use $q$
+vectors, you can set the following and it will only receive one $q$
+value at a time::
+
+    Iq.vectorized = False
+
+Return np.NaN if the parameters are not valid (e.g., cap_radius < radius in
+barbell).  If I(q; pars) is NaN for any $q$, then those parameters will be
+ignored, and not included in the calculation of the weighted polydispersity.
+
+Similar to *Iq*, you can define *Iqxy(qx, qy, par1, par2, ...)* where the
+parameter list includes any orientation parameters.  If *Iqxy* is not defined,
+then it will default to *Iqxy = Iq(sqrt(qx**2+qy**2), par1, par2, ...)*.
+
+Models should define *form_volume(par1, par2, ...)* where the parameter
+list includes the *volume* parameters in order.  This is used for a weighted
+volume normalization so that scattering is on an absolute scale.  If
+*form_volume* is not defined, then the default *form_volume = 1.0* will be
+used.
+
+Embedded C Models
+.................
+
+Like pure python models, inline C models need to define an *Iq* function::
+
+    Iq = """
+        return I(q, par1, par2, ...);
+    """
+
+This expands into the equivalent C code::
+
+    #include <math.h>
+    double Iq(double q, double par1, double par2, ...);
+    double Iq(double q, double par1, double par2, ...)
+    {
+        return I(q, par1, par2, ...);
+    }
+
+The C model operates on a single $q$ value at a time.  The code will be
+run in parallel across different $q$ values, either on the graphics card
+or the processor.
+
+Rather than returning NAN from Iq, you must define the *INVALID(v)*.  The
+*v* parameter lets you access all the parameters in the model using
+*v.par1*, *v.par2*, etc. For example::
+
+    #define INVALID(v) (v.bell_radius < v.radius)
+
+*Iqxy* is similar to *Iq*, except it uses parameters *qx, qy* instead of *q*,
+and it includes orientation parameters. As in python models, *form_volume*
+includes only the volume parameters.  *Iqxy* will default to
+*Iq(sqrt(qx**2 + qy**2), par1, ...)* and *form_volume* will default to 1.0.
+
+The C code follows the C99 standard, including the usual math functions,
+as defined in
+`OpenCL <https://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/mathFunctions.html>`_.
+
+The standard constants and functions include the following::
+
+    M_PI = pi
+    M_PI_2 = pi/2
+    M_PI_4 = pi/4
+    M_E = e
+    M_SQRT1_2 = 1/sqrt(2)
+    NAN = NaN
+    INFINITY = 1/0
+    erf(x) = error function
+    erfc(x) = 1-erf(x)
+    expm1(x) = exp(x) - 1
+    tgamma(x) = gamma function
+
+Some non-standard constants and functions are also provided::
+
+    M_PI_180 = pi/180
+    M_4PI_3 = 4pi/3
+    square(x) = x*x
+    cube(x) = x*x*x
+    sinc(x) = sin(x)/x, with sin(0)/0 -> 1
+    SINCOS(x, s, c) sets s=sin(angle) and c=cos(angle)
+    powr(x, y) = x^y for x >= 0
+    pown(x, n) = x^n for n integer
+
+**source=['lib/fn.c', ...]** includes the listed C source files in the
+program before *Iq* and *Iqxy* are defined. This allows you to extend the
+library of available C functions. Additional special functions and
+scattering calculations are defined in
+`sasmodels/models/lib <https://github.com/SasView/sasmodels/tree/master/sasmodels/models/lib>`_,
+including::
+
+    sph_j1c(x) = 3 j1(x)/x = 3 (sin(x) - x cos(x))/x^3  [spherical bessel function]
+    sas_J1c(x) = 2 J1(x)/x  [bessel function of the first kind]
+    sas_gamma(x) = gamma function  [tgamma is unstable below 1]
+    sas_erf(x) = error function [erf is broken on some Intel OpenCL drivers]
+    sas_erfc(x) = 1-erf(x)
+    sas_J0(x) = J0(x)
+    sas_J1(x) = J1(x)
+    sas_JN(x) = JN(x)
+    Si(x) = integral sin(z)/z from 0 to x
+    Gauss76Wt = gaussian quadrature weights for 76 point integral
+    Gauss76Z = gaussian quadrature values for 76 point integral
+
+These functions have been tuned to be fast and numerically stable down
+to $q=0$ even in single precision.  In some cases they work around bugs
+which appear on some platforms but not others. So use them where needed!!!
+
+Models are defined using double precision declarations for the
+parameters and return values.  Declarations and constants will be converted
+to float or long double depending on the precision requested.
+
+**Floating point constants must include the decimal point.**  This allows us
+to convert values such as 1.0 (double precision) to 1.0f (single precision)
+so that expressions that use these values are not promoted to double precision
+expressions.  Some graphics card drivers are confused when functions
+that expect floating point values are passed integers, such as 4*atan(1); it
+is safest to not use integers in floating point expressions.  Even better,
+use the builtin constant M_PI rather than 4*atan(1); it is faster and smaller!
+
+FLOAT_SIZE is the number of bytes in the converted variables. If your
+algorithm depends on precision (which is not uncommon for numerical
+algorithms), use the following::
+
+    #if FLOAT_SIZE>4
+    ... code for double precision ...
+    #else
+    ... code for single precision ...
+    #endif
+
+A value defined as SAS_DOUBLE will stay double precision; this should
+not be used since some graphics cards do not support double precision.
+
+
+External C Models
+.................
+
+External C models are very much like embedded C models, except that
+*Iq*, *Iqxy* and *form_volume* are defined in an external source file
+loaded using the *source=[...]*  method. You need to supply the function
+declarations for each of these that you need instead of building them
+automatically from the parameter table.
+
+
+.. _Form_Factors:
+
+Form Factors
+............
+
+Away from the dilute limit you can estimate scattering including
+particle-particle interactions using $I(q) = P(q)*S(q)$ where $P(q)$
+is the form factor and $S(q)$ is the structure factor.  The simplest
+structure factor is the *hardsphere* interaction, which
+uses the effective radius of the form factor as an input to the structure
+factor model.  The effective radius is the average radius of the
+form averaged over all the polydispersity values.
+
+::
+
+    def ER(radius, thickness):
+        """Effective radius of a core-shell sphere."""
+        return radius + thickness
+
+Now consider the *core_shell_sphere*, which has a simple effective radius
+equal to the radius of the core plus the thickness of the shell, as
+shown above. Given polydispersity over *(r1, r2, ..., rm)* in radius and
+*(t1, t2, ..., tn)* in thickness, *ER* is called with a mesh
+grid covering all possible combinations of radius and thickness.
+That is, *radius* is *(r1, r2, ..., rm, r1, r2, ..., rm, ...)*
+and *thickness* is *(t1, t1, ... t1, t2, t2, ..., t2, ...)*.
+The *ER* function returns one effective radius for each combination.
+The effective radius calculator weights each of these according to
+the polydispersity distributions and calls the structure factor
+with the average *ER*.
+
+::
+
+    def VR(radius, thickness):
+        """Sphere and shell volumes for a core-shell sphere."""
+        whole = 4.0/3.0 * pi * (radius + thickness)**3
+        core = 4.0/3.0 * pi * radius**3
+        return whole, whole - core
+
+Core-shell type models have an additional volume ratio which scales
+the structure factor.  The *VR* function returns the volume of
+the whole sphere and the volume of the shell. Like *ER*, there is
+one return value for each point in the mesh grid.
+
+*NOTE: we may be removing or modifying this feature soon. As of the 
+time of writing, core-shell sphere returns (1., 1.) for VR, giving a volume
+ratio of 1.0.*
+
+Unit Tests
+..........
+
+THESE ARE VERY IMPORTANT. Include at least one test for each model and
+PLEASE make sure that the answer value is correct (i.e. not a random number).
+
+::
+
+    tests = [
+        [{}, 0.2, 0.726362],
+        [{"scale": 1., "background": 0., "sld": 6., "sld_solvent": 1.,
+          "radius": 120., "radius_pd": 0.2, "radius_pd_n":45},
+         0.2, 0.228843],
+        [{"radius": 120., "radius_pd": 0.2, "radius_pd_n":45}, "ER", 120.],
+        [{"radius": 120., "radius_pd": 0.2, "radius_pd_n":45}, "VR", 1.],
+    ]
+
+
+**tests=[[{parameters}, q, result], ...]** is a list of lists.
+Each list is one test and contains, in order:
+
+- a dictionary of parameter values. This can be {} using the default
+  parameters, or filled with some parameters that will be different
+  from the default, such as {Ã¢â¬ËradiusÃ¢â¬â¢:10.0, Ã¢â¬ËsldÃ¢â¬â¢:4}. Unlisted parameters
+  will be given the default values.
+- the input $q$ value or tuple of $(q_x, q_y)$ values.
+- the output $I(q)$ or $I(q_x,q_y)$ expected of the model for the parameters
+  and input value given.
+- input and output values can themselves be lists if you have several
+  $q$ values to test for the same model parameters.
+- for testing *ER* and *VR*, give the inputs as "ER" and "VR" respectively;
+  the output for *VR* should be the sphere/shell ratio, not the individual
+  sphere and shell values.
+
+.. _Test_Your_New_Model:
+
+Test Your New Model
+^^^^^^^^^^^^^^^^^^^
+
+Installed SasView
+.................
+
+If you are editing your model from the SasView GUI, you can test it
+by selecting *Run > Check Model* from the *Model Editor* menu bar. An
+*Info* box will appear with the results of the compilation and a
+check that the model runs.
+
+
+Built SasView
+.............
+
+If the model compiles and runs, you can next run the unit tests that
+you have added using the **test =** values. Switch to the *Shell* tab
+and type the following::
+
+    from sasmodels.model_test import run_one
+    run_one("~/.sasview/plugin_models/model.py")
+
+This should print::
+
+    test_model_python (sasmodels.model_test.ModelTestCase) ... ok
+
+To check whether single precision is good enough, type the following::
+
+    from sasmodels.compare import main
+    main("~/.sasview/plugin_models/model.py")
+
+This will pop up a plot showing the difference between single precision
+and double precision on a range of $q$ values.
+
+::
+
+  demo = dict(scale=1, background=0,
+              sld=6, sld_solvent=1,
+              radius=120,
+              radius_pd=.2, radius_pd_n=45)
+
+**demo={'par': value, ...}** in the model file sets the default values for
+the comparison. You can include polydispersity parameters such as
+*radius_pd=0.2, radius_pd_n=45* which would otherwise be zero.
+
+The options to compare are quite extensive; type the following for help::
+
+    main()
+
+Options will need to be passed as separate strings.
+For example to run your model with a random set of parameters::
+
+    main("-random", "-pars", "~/.sasview/plugin_models/model.py")
+
+For the random models,
+
+- *sld* will be in the range (-0.5,10.5),
+- angles (*theta, phi, psi*) will be in the range (-180,180),
+- angular dispersion will be in the range (0,45),
+- polydispersity will be in the range (0,1)
+- other values will be in the range (0, 2\ *v*), where *v* is the value of the parameter in demo.
+
+Dispersion parameters *n*\, *sigma* and *type* will be unchanged from demo so that
+run times are predictable.
+
+If your model has 2D orientational calculation, then you should also
+test with::
+
+    main("-2d", "~/.sasview/plugin_models/model.py")
+
+
+Clean Lint - (Developer Version Only)
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+**NB: For now we are not providing pylint with the installer version of SasView; 
+so unless you have a SasView build environment available, you can ignore this section!**
+
+Run the lint check with::
+
+    python -m pylint --rcfile=extra/pylint.rc ~/.sasview/plugin_models/model.py
+
+We are not aiming for zero lint just yet, only keeping it to a minimum.
+For now, don't worry too much about *invalid-name*. If you really want a
+variable name *Rg* for example because $R_g$ is the right name for the model
+parameter then ignore the lint errors.  Also, ignore *missing-docstring*
+for standard model functions *Iq*, *Iqxy*, etc.
+
+We will have delinting sessions at the SasView Code Camps, where we can
+decide on standards for model files, parameter names, etc.
+
+For now, you can tell pylint to ignore things.  For example, to align your
+parameters in blocks::
+
+    # pylint: disable=bad-whitespace,line-too-long
+    #   ["name",                  "units", default, [lower, upper], "type", "description"],
+    parameters = [
+        ["contrast_factor",       "barns",    10.0,  [-inf, inf], "", "Contrast factor of the polymer"],
+        ["bjerrum_length",        "Ang",       7.1,  [0, inf],    "", "Bjerrum length"],
+        ["virial_param",          "1/Ang^2",  12.0,  [-inf, inf], "", "Virial parameter"],
+        ["monomer_length",        "Ang",      10.0,  [0, inf],    "", "Monomer length"],
+        ["salt_concentration",    "mol/L",     0.0,  [-inf, inf], "", "Concentration of monovalent salt"],
+        ["ionization_degree",     "",          0.05, [0, inf],    "", "Degree of ionization"],
+        ["polymer_concentration", "mol/L",     0.7,  [0, inf],    "", "Polymer molar concentration"],
+        ]
+    # pylint: enable=bad-whitespace,line-too-long
+
+Don't put in too many pylint statements, though, since they make the code ugly.
+
+Check The Docs - (Developer Version Only)
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+You can get a rough idea of how the documentation will look using the
+following::
+
+    from sasmodels.generate import view_html
+    view_html('~/.sasview/plugin_models/model.py')
+
+This does not use the same styling as the SasView docs, but it will allow
+you to check that your ReStructuredText and LaTeX formatting.  Here are
+some tools to help with the inevitable syntax errors:
+
+- `Sphinx cheat sheet <http://matplotlib.org/sampledoc/cheatsheet.html>`_
+- `Sphinx Documentation <http://www.sphinx-doc.org/en/stable/>`_
+- `MathJax <http://www.mathjax.org/>`_
+- `amsmath <http://www.ams.org/publications/authors/tex/amslatex>`_
+
+There is also a neat online WYSIWYG ReStructuredText editor at http://rst.ninjs.org\ .
+
+Share Your Model!
+^^^^^^^^^^^^^^^^^
+
+Once compare and the unit test(s) pass properly and everything is done,
+consider adding your model to the
+`Model Marketplace <http://marketplace.sasview.org/>`_ so that others may use it!
Index: c/sas/sasgui/perspectives/fitting/media/residuals_help.copy
===================================================================
--- src/sas/sasgui/perspectives/fitting/media/residuals_help.copy	(revision 65dfa99759ad82a7c7023ae9209b69fc461475dc)
+++ 	(revision )
@@ -1,66 +1,0 @@
-.. residuals_help.rst
-
-.. |chi| unicode:: U+03C7
-
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-.. _Assessing_Fit_Quality:
-
-Assessing Fit Quality
----------------------
-
-When performing model-fits to some experimental data it is helpful to be able to
-gauge how good an individual fit is, how it compares to a fit of the *same model*
-*to another set of data*, or how it compares to a fit of a *different model to the*
-*same data*.
-
-One way is obviously to just inspect the graph of the experimental data and to
-see how closely (or not!) the 'theory' calculation matches it. But *SasView*
-also provides two other measures of the quality of a fit:
-
-*  |chi|\  :sup:`2` (or 'Chi2'; pronounced 'chi-squared')
-*  *Residuals*
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-Chi2
-^^^^
-
-Chi2 is a statistical parameter that quantifies the differences between an observed
-data set and an expected dataset (or 'theory').
-
-*SasView* actually returns this parameter normalized to the number of data points,
-*Npts* such that
-
-  *Chi2/Npts* = { SUM[(*Y_i* - *Y_theory_i*)^2 / (*Y_error_i*)^2] } / *Npts*
-
-This differs slightly from what is sometimes called the 'reduced chi-squared'
-because it does not take into account the number of fitting parameters (to
-calculate the number of 'degrees of freedom'), but the 'normalized chi-squared'
-and the 'reduced chi-squared' are very close to each other when *Npts* >> number of
-parameters.
-
-For a good fit, *Chi2/Npts* tends to 0.
-
-*Chi2/Npts* is sometimes referred to as the 'goodness-of-fit' parameter.
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-Residuals
-^^^^^^^^^
-
-A residual is the difference between an observed value and an estimate of that
-value, such as a 'theory' calculation (whereas the difference between an observed
-value and its *true* value is its error).
-
-*SasView* calculates 'normalized residuals', *R_i*, for each data point in the
-fit:
-
-  *R_i* = (*Y_i* - *Y_theory_i*) / (*Y_err_i*)
-
-For a good fit, *R_i* ~ 0.
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-.. note::  This help document was last changed by Steve King, 08Jun2015
Index: c/sas/sasgui/perspectives/fitting/media/sm_help.copy
===================================================================
--- src/sas/sasgui/perspectives/fitting/media/sm_help.copy	(revision 65dfa99759ad82a7c7023ae9209b69fc461475dc)
+++ 	(revision )
@@ -1,229 +1,0 @@
-.. sm_help.rst
-
-.. This is a port of the original SasView html help file to ReSTructured text
-.. by S King, ISIS, during SasView CodeCamp-III in Feb 2015.
-
-.. |beta| unicode:: U+03B2
-.. |gamma| unicode:: U+03B3
-.. |mu| unicode:: U+03BC
-.. |sigma| unicode:: U+03C3
-.. |phi| unicode:: U+03C6
-.. |theta| unicode:: U+03B8
-.. |chi| unicode:: U+03C7
-.. |bigdelta| unicode:: U+0394
-
-.. |inlineimage004| image:: sm_image004.gif
-.. |inlineimage005| image:: sm_image005.gif
-.. |inlineimage008| image:: sm_image008.gif
-.. |inlineimage009| image:: sm_image009.gif
-.. |inlineimage010| image:: sm_image010.gif
-.. |inlineimage011| image:: sm_image011.gif
-.. |inlineimage012| image:: sm_image012.gif
-.. |inlineimage018| image:: sm_image018.gif
-.. |inlineimage019| image:: sm_image019.gif
-
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-Smearing Functions
-==================
-
-Sometimes it will be necessary to correct reduced experimental data for the
-physical effects of the instrumental geometry in use. This process is called
-*desmearing*. However, calculated/simulated data - which by definition will be
-perfect/exact - can be *smeared* to make it more representative of what might
-actually be measured experimentally.
-
-SasView provides the following three smearing algorithms:
-
-*  *Slit Smearing*
-*  *Pinhole Smearing*
-*  *2D Smearing*
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-Slit Smearing
--------------
-
-**This type of smearing is normally only encountered with data from X-ray Kratky**
-**cameras or X-ray/neutron Bonse-Hart USAXS/USANS instruments.**
-
-The slit-smeared scattering intensity is defined by
-
-.. image:: sm_image002.gif
-
-where *Norm* is given by
-
-.. image:: sm_image003.gif
-
-**[Equation 1]**
-
-The functions |inlineimage004| and |inlineimage005|
-refer to the slit width weighting function and the slit height weighting 
-determined at the given *q* point, respectively. It is assumed that the weighting
-function is described by a rectangular function, such that
-
-.. image:: sm_image006.gif
-
-**[Equation 2]**
-
-and
-
-.. image:: sm_image007.gif
-
-**[Equation 3]**
-
-so that |inlineimage008| |inlineimage009| for |inlineimage010| and *u*\ .
-
-Here |inlineimage011| and |inlineimage012| stand for
-the slit height (FWHM/2) and the slit width (FWHM/2) in *q* space.
-
-This simplifies the integral in Equation 1 to
-
-.. image:: sm_image013.gif
-
-**[Equation 4]**
-
-which may be solved numerically, depending on the nature of |inlineimage011| and |inlineimage012| .
-
-Solution 1
-^^^^^^^^^^
-
-**For** |inlineimage012| **= 0 and** |inlineimage011| **= constant.**
-
-.. image:: sm_image016.gif
-
-For discrete *q* values, at the *q* values of the data points and at the *q*
-values extended up to *q*\ :sub:`N`\ = *q*\ :sub:`i` + |inlineimage011| the smeared
-intensity can be approximately calculated as
-
-.. image:: sm_image017.gif
-
-**[Equation 5]**
-
-where |inlineimage018| = 0 for *I*\ :sub:`s` when *j* < *i* or *j* > *N-1*.
-
-Solution 2
-^^^^^^^^^^
-
-**For** |inlineimage012| **= constant and** |inlineimage011| **= 0.**
-
-Similar to Case 1
-
-|inlineimage019| for *q*\ :sub:`p` = *q*\ :sub:`i` - |inlineimage012| and *q*\ :sub:`N` = *q*\ :sub:`i` + |inlineimage012|
-
-**[Equation 6]**
-
-where |inlineimage018| = 0 for *I*\ :sub:`s` when *j* < *p* or *j* > *N-1*.
-
-Solution 3
-^^^^^^^^^^
-
-**For** |inlineimage011| **= constant and** |inlineimage011| **= constant.**
-
-In this case, the best way is to perform the integration of Equation 1
-numerically for both slit height and slit width. However, the numerical
-integration is imperfect unless a large number of iterations, say, at
-least 10000 by 10000 for each element of the matrix *W*, is performed.
-This is usually too slow for routine use.
-
-An alternative approach is used in SasView which assumes
-slit width << slit height. This method combines Solution 1 with the
-numerical integration for the slit width. Then
-
-.. image:: sm_image020.gif
-
-**[Equation 7]**
-
-for *q*\ :sub:`p` = *q*\ :sub:`i` - |inlineimage012| and *q*\ :sub:`N` = *q*\ :sub:`i` + |inlineimage012|
-
-where |inlineimage018| = 0 for *I*\ :sub:`s` when *j* < *p* or *j* > *N-1*.
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-Pinhole Smearing
-----------------
-
-**This is the type of smearing normally encountered with data from synchrotron**
-**SAXS cameras and SANS instruments.**
-
-The pinhole smearing computation is performed in a similar fashion to the slit-
-smeared case above except that the weight function used is a Gaussian. Thus
-Equation 6 becomes
-
-.. image:: sm_image021.gif
-
-**[Equation 8]**
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-2D Smearing
------------
-
-The 2D smearing computation is performed in a similar fashion to the 1D pinhole
-smearing above except that the weight function used is a 2D elliptical Gaussian.
-Thus
-
-.. image:: sm_image022.gif
-
-**[Equation 9]**
-
-In Equation 9, *x*\ :sub:`0` = *q* cos(|theta|), *y*\ :sub:`0` = *q* sin(|theta|), and
-the primed axes, are all in the coordinate rotated by an angle |theta| about
-the z-axis (see the figure below) so that *x'*\ :sub:`0` = *x*\ :sub:`0` cos(|theta|) +
-*y*\ :sub:`0` sin(|theta|) and *y'*\ :sub:`0` = -*x*\ :sub:`0` sin(|theta|) +
-*y*\ :sub:`0` cos(|theta|). Note that the rotation angle is zero for a x-y symmetric
-elliptical Gaussian distribution. The *A* is a normalization factor.
-
-.. image:: sm_image023.gif
-
-Now we consider a numerical integration where each of the bins in |theta| and *R* are
-*evenly* (this is to simplify the equation below) distributed by |bigdelta|\ |theta|
-and |bigdelta|\ R, respectively, and it is further assumed that *I(x',y')* is constant
-within the bins. Then
-
-.. image:: sm_image024.gif
-
-**[Equation 10]**
-
-Since the weighting factor on each of the bins is known, it is convenient to
-transform *x'-y'* back to *x-y* coordinates (by rotating it by -|theta| around the
-*z* axis).
-
-Then, for a polar symmetric smear
-
-.. image:: sm_image025.gif
-
-**[Equation 11]**
-
-where
-
-.. image:: sm_image026.gif
-
-while for a *x-y* symmetric smear
-
-.. image:: sm_image027.gif
-
-**[Equation 12]**
-
-where
-
-.. image:: sm_image028.gif
-
-The current version of the SasView uses Equation 11 for 2D smearing, assuming
-that all the Gaussian weighting functions are aligned in the polar coordinate.
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-Weighting & Normalization
--------------------------
-
-In all the cases above, the weighting matrix *W* is calculated on the first call
-to a smearing function, and includes ~60 *q* values (finely and evenly binned)
-below (>0) and above the *q* range of data in order to smear all data points for
-a given model and slit/pinhole size. The *Norm*  factor is found numerically with the
-weighting matrix and applied on the computation of *I*\ :sub:`s`.
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-.. note::  This help document was last changed by Steve King, 01May2015
Index: src/sas/sasgui/perspectives/fitting/model_thread.py
===================================================================
--- src/sas/sasgui/perspectives/fitting/model_thread.py	(revision 934ce6493af6e904cf20f2500ef522b42192adfd)
+++ src/sas/sasgui/perspectives/fitting/model_thread.py	(revision ca4d9854c75a5344e770dec25221dfeb5a270915)
@@ -7,4 +7,5 @@
 import math
 from sas.sascalc.data_util.calcthread import CalcThread
+from sas.sascalc.fit.MultiplicationModel import MultiplicationModel
 
 class Calc2D(CalcThread):
@@ -166,4 +167,8 @@
         index = (self.qmin <= self.data.x) & (self.data.x <= self.qmax)
 
+        # If we use a smearer, also return the unsmeared model
+        unsmeared_output = None
+        unsmeared_data = None
+        unsmeared_error = None
         ##smearer the ouput of the plot
         if self.smearer is not None:
@@ -171,8 +176,30 @@
                                                              self.qmax)
             mask = self.data.x[first_bin:last_bin+1]
-            output[first_bin:last_bin+1] = self.model.evalDistribution(mask)
-            output = self.smearer(output, first_bin, last_bin)
+            unsmeared_output = numpy.zeros((len(self.data.x)))
+            unsmeared_output[first_bin:last_bin+1] = self.model.evalDistribution(mask)
+            output = self.smearer(unsmeared_output, first_bin, last_bin)
+            
+            # Rescale data to unsmeared model
+            unsmeared_data = numpy.zeros((len(self.data.x)))
+            unsmeared_error = numpy.zeros((len(self.data.x)))
+            unsmeared_data[first_bin:last_bin+1] = self.data.y[first_bin:last_bin+1]\
+                                                    * unsmeared_output[first_bin:last_bin+1]\
+                                                    / output[first_bin:last_bin+1]
+            unsmeared_error[first_bin:last_bin+1] = self.data.dy[first_bin:last_bin+1]\
+                                                    * unsmeared_output[first_bin:last_bin+1]\
+                                                    / output[first_bin:last_bin+1]
+            unsmeared_output=unsmeared_output[index]
+            unsmeared_data=unsmeared_data[index]
+            unsmeared_error=unsmeared_error
         else:
             output[index] = self.model.evalDistribution(self.data.x[index])
+
+        sq_model = None
+        pq_model = None
+        if isinstance(self.model, MultiplicationModel):
+            sq_model = numpy.zeros((len(self.data.x)))
+            pq_model = numpy.zeros((len(self.data.x)))
+            sq_model[index] = self.model.s_model.evalDistribution(self.data.x[index])
+            pq_model[index] = self.model.p_model.evalDistribution(self.data.x[index])
 
         elapsed = time.time() - self.starttime
@@ -187,5 +214,10 @@
                       data=self.data,
                       update_chisqr=self.update_chisqr,
-                      source=self.source)
+                      source=self.source,
+                      unsmeared_model=unsmeared_output,
+                      unsmeared_data=unsmeared_data,
+                      unsmeared_error=unsmeared_error,
+                      pq_model=pq_model,
+                      sq_model=sq_model)
 
     def results(self):
Index: src/sas/sasgui/perspectives/fitting/pagestate.py
===================================================================
--- src/sas/sasgui/perspectives/fitting/pagestate.py	(revision 7673ecd9d5adcefdfa1fc6a6d1ff0649f8e63bc8)
+++ src/sas/sasgui/perspectives/fitting/pagestate.py	(revision 6c382da7a67e14f0ad75317f0696ce771b802d39)
@@ -24,4 +24,6 @@
 from xml.dom.minidom import parseString
 from lxml import etree
+
+import sasmodels.weights
 
 import sas.sascalc.dataloader
@@ -474,5 +476,6 @@
                 value = content[1]
             except Exception:
-                logging.error(traceback.format_exc())
+                msg = "Report string expected 'name: value' but got %r"%line
+                logging.error(msg)
             if name.count("State created"):
                 repo_time = "" + value
@@ -516,5 +519,6 @@
                         title_name = HEADER % title
                 except Exception:
-                    logging.error(traceback.format_exc())
+                    msg = "While parsing 'data: ...'\n"
+                    logging.error(msg + traceback.format_exc())
             if name == "model name ":
                 try:
@@ -531,5 +535,6 @@
                     q_range = CENTRE % q_name
                 except Exception:
-                    logging.error(traceback.format_exc())
+                    msg = "While parsing 'Plotting Range: ...'\n"
+                    logging.error(msg + traceback.format_exc())
         paramval = ""
         for lines in param_string.split(":"):
@@ -711,5 +716,4 @@
         # For self.values ={ disp_param_name: [vals,...],...}
         # and for self.weights ={ disp_param_name: [weights,...],...}
-        value_list = {}
         for item in LIST_OF_MODEL_ATTRIBUTES:
             element = newdoc.createElement(item[0])
@@ -725,9 +729,8 @@
 
         # Create doc for the dictionary of self._disp_obj_dic
-        for item in DISPERSION_LIST:
-            element = newdoc.createElement(item[0])
-            value_list = getattr(self, item[1])
-            for key, val in value_list.iteritems():
-                value = repr(val)
+        for tagname, varname, tagtype in DISPERSION_LIST:
+            element = newdoc.createElement(tagname)
+            value_list = getattr(self, varname)
+            for key, value in value_list.iteritems():
                 sub_element = newdoc.createElement(key)
                 sub_element.setAttribute('name', str(key))
@@ -847,32 +850,30 @@
                 # Recover _disp_obj_dict from xml file
                 self._disp_obj_dict = {}
-                for item in DISPERSION_LIST:
-                    # Get node
-                    node = get_content("ns:%s" % item[0], entry)
+                for tagname, varname, tagtype in DISPERSION_LIST:
+                    node = get_content("ns:%s" % tagname, entry)
                     for attr in node:
-                        name = str(attr.get('name'))
-                        val = attr.get('value')
-                        value = val.split(" instance")[0]
-                        disp_name = value.split("<")[1]
-                        try:
-                            # Try to recover disp_model object from strings
-                            com = "from sas.models.dispersion_models "
-                            com += "import %s as disp"
-                            com_name = disp_name.split(".")[3]
-                            exec com % com_name
-                            disp_model = disp()
-                            attribute = getattr(self, item[1])
-                            attribute[name] = com_name
-                        except Exception:
-                            logging.error(traceback.format_exc())
+                        parameter = str(attr.get('name'))
+                        value = attr.get('value')
+                        if value.startswith("<"):
+                            try:
+                                # <path.to.NamedDistribution object/instance...>
+                                cls_name = value[1:].split()[0].split('.')[-1]
+                                cls = getattr(sasmodels.weights, cls_name)
+                                value = cls.type
+                            except Exception:
+                                logging.error("unable to load distribution %r for %s"
+                                              % (value, parameter))
+                                continue
+                        _disp_obj_dict = getattr(self, varname)
+                        _disp_obj_dict[parameter] = value
 
                 # get self.values and self.weights dic. if exists
-                for item in LIST_OF_MODEL_ATTRIBUTES:
-                    node = get_content("ns:%s" % item[0], entry)
+                for tagname, varname in LIST_OF_MODEL_ATTRIBUTES:
+                    node = get_content("ns:%s" % tagname, entry)
                     dic = {}
                     value_list = []
                     for par in node:
                         name = par.get('name')
-                        values = par.text.split('\n')
+                        values = par.text.split()
                         # Get lines only with numbers
                         for line in values:
@@ -882,7 +883,9 @@
                             except Exception:
                                 # pass if line is empty (it happens)
-                                logging.error(traceback.format_exc())
+                                msg = ("Error reading %r from %s %s\n"
+                                       % (line, tagname, name))
+                                logging.error(msg + traceback.format_exc())
                         dic[name] = numpy.array(value_list)
-                    setattr(self, item[1], dic)
+                    setattr(self, varname, dic)
 
     def set_plot_state(self, figs, canvases):
@@ -1231,5 +1234,6 @@
 
         except:
-            logging.info("XML document does not contain fitting information.\n %s" % sys.exc_value)
+            logging.info("XML document does not contain fitting information.\n"
+                         + traceback.format_exc())
 
         return state
@@ -1569,5 +1573,8 @@
                     if output[ind].run_name is not None\
                         and len(output[ind].run_name) != 0:
-                        name = output[ind].run_name
+                        if isinstance(output[ind].run_name, dict):
+                            name = output[ind].run_name.keys()[0]
+                        else:
+                            name = output[ind].run_name
                     else:
                         name = original_fname
Index: src/sas/sasgui/perspectives/invariant/invariant_panel.py
===================================================================
--- src/sas/sasgui/perspectives/invariant/invariant_panel.py	(revision c12f9b402755d93d47add995041991b04f9687b4)
+++ src/sas/sasgui/perspectives/invariant/invariant_panel.py	(revision 654e8e066dda6b98c221cad28e05fa6996e7fc11)
@@ -250,7 +250,7 @@
 
             num = self.state.saved_state['state_num']
-            if num > 0:
+            if int(num) > 0:
                 self._set_undo_flag(True)
-            if num < len(state.state_list) - 1:
+            if int(num) < len(state.state_list) - 1:
                 self._set_redo_flag(True)
 
@@ -830,8 +830,13 @@
         """
         try:
-            attr = getattr(self, key)
+            if key in ['compute_num', 'file', 'is_time_machine', 'state_num']:
+                return
+            else:
+                attr = getattr(self, key)
             if attr.__class__.__name__ == "StaticText":
                 return
-            if type(value) is not bool:
+            if value in ["True", "False", True, False]:
+                value = bool(value)
+            else:
                 value = str(value)
             attr.SetValue(value)
@@ -1860,5 +1865,5 @@
                                    (self.button_calculate, 0,
                                     wx.RIGHT | wx.TOP | wx.BOTTOM, 10),
-                                   (self.button_help, 0, 
+                                   (self.button_help, 0,
                                     wx.RIGHT | wx.TOP | wx.BOTTOM, 10),])
     def _do_layout(self):
@@ -1882,8 +1887,8 @@
         self.SetSizer(self.main_sizer)
         self.SetAutoLayout(True)
-        
+
     def on_help(self, event):
         """
-        Bring up the Invariant Documentation whenever the HELP button is 
+        Bring up the Invariant Documentation whenever the HELP button is
         clicked.
 
Index: src/sas/sasgui/perspectives/invariant/invariant_state.py
===================================================================
--- src/sas/sasgui/perspectives/invariant/invariant_state.py	(revision c10d9d6c8667422d3db329ac32d0528a6cce3fc6)
+++ src/sas/sasgui/perspectives/invariant/invariant_state.py	(revision cb93b405a73e2c9eef55d1ac6f2bbcff2b0b9d6d)
@@ -426,5 +426,5 @@
                         if input_field is not None:
                             temp_state[item] = val
-                            self.state_list[ind] = temp_state
+                            self.state_list[str(ind)] = temp_state
 
             # Parse current state (ie, saved_state)
@@ -790,3 +790,2 @@
             doc = state.toXML(datainfo.name, doc=doc, entry_node=sasentry)
         return doc
-
Index: c/sas/sasgui/perspectives/invariant/media/invariant_help.copy
===================================================================
--- src/sas/sasgui/perspectives/invariant/media/invariant_help.copy	(revision 65dfa99759ad82a7c7023ae9209b69fc461475dc)
+++ 	(revision )
@@ -1,128 +1,0 @@
-.. invariant_help.rst
-
-.. This is a port of the original SasView html help file to ReSTructured text
-.. by S King, ISIS, during SasView CodeCamp-III in Feb 2015.
-
-.. |Ang| unicode:: U+212B
-.. |pi| unicode:: U+03C0
-.. |bigdelta| unicode:: U+0394
-.. |rho| unicode:: U+03C1
-.. |phi| unicode:: U+03C6
-
-Invariant Calculation Perspective
-=================================
-
-Description
------------
-
-The scattering, or Porod, invariant (Q*\) is a model-independent quantity that 
-can be easily calculated from scattering data.
-
-For two phase systems, the scattering invariant is defined as the integral of 
-the square of the wave transfer (Q) multiplied by the scattering cross section 
-over the full range of Q from zero to infinity, that is
-
-.. image:: image001.gif
-
-where *g = Q* for pinhole geometry (SAS) and *g = Qv* (the slit height) for  
-slit geometry (USAS).
-
-The worth of Q*\  is that it can be used to determine the volume fraction and 
-the specific area of a sample. Whilst these quantities are useful in their own 
-right they can also be used in further analysis.
-
-The difficulty with using Q*\  arises from the fact that experimental data is 
-never measured over the range 0 =< *Q* =< infinity. At best, combining USAS and 
-WAS data might cover the range 1e-5 =< *Q* =< 10 1/\ |Ang| . Thus it is usually 
-necessary to extrapolate the experimental data to low and high *Q*. For this
-
-High-*Q* region (>= *Qmax* in data)
-
-*  The power law function *C*/*Q*\ :sup:`4` is used where the constant 
-   *C* (= 2.\ |pi|\ .(\ |bigdelta|\ |rho|\ ).\ *Sv*\ ) is to be found by fitting part of data 
-   within the range *Q*\ :sub:`N-m` to *Q*\ :sub:`N` (where m < N).
-
-Low-*Q* region (<= *Qmin* in data)
-
-*  The Guinier function *I0.exp(-Rg*\ :sup:`2`\ *Q*\ :sup:`2`\ */3)* where *I0* 
-   and *Rg* are obtained by fitting as for the high-*Q* region above. 
-   Alternatively a power law can be used.
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-Using the perspective
----------------------
-
-1) Select *Invariant* from the *Analysis* menu on the SasView toolbar.
-
-2) Load some data with the *Data Explorer*.
-
-3) Select a dataset and use the *Send To* button on the *Data Explorer* to load 
-   the dataset into the *Invariant* perspective.
-
-4) Use the *Customised Input* boxes on the *Invariant* perspective to subtract 
-   any background, specify the contrast (i.e. difference in SLDs - this must be 
-   specified for the eventual value of Q*\  to be on an absolute scale), or to 
-   rescale the data.
-
-5) Adjust the extrapolation range as necessary. In most cases the default 
-   values will suffice.
-
-6) Click the *Compute* button.
-
-7) To include a lower and/or higher Q range, check the relevant *Enable 
-   Extrapolate* check boxes.
-   
-   If power law extrapolations are chosen, the exponent can be either held 
-   fixed or fitted. The number of points, Npts, to be used for the basis of the 
-   extrapolation can also be specified.
-
-8) If the value of Q*\  calculated with the extrapolated regions is invalid, a 
-   red warning will appear at the top of the *Invariant* perspective panel.
-
-   The details of the calculation are available by clicking the *Details* 
-   button in the middle of the panel.
-
-.. image:: image005.gif
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-Parameters
-----------
-
-Volume Fraction
-^^^^^^^^^^^^^^^
-
-The volume fraction |phi| is related to Q*\  by
-
-.. image:: image002.gif
-
-where |bigdelta|\ |rho| is the SLD contrast.
-
-.. image:: image003.gif
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-Specific Surface Area
-^^^^^^^^^^^^^^^^^^^^^
-
-The specific surface area *Sv* is related to Q*\  by
-
-.. image:: image004.gif
-
-where *Cp* is the Porod constant.
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-Reference
----------
-
-O. Glatter and O. Kratky
-Chapter 2 in *Small Angle X-Ray Scattering*
-Academic Press, New York, 1982
-
-http://physchem.kfunigraz.ac.at/sm/
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-.. note::  This help document was last changed by Steve King, 01May2015
Index: c/sas/sasgui/perspectives/pr/media/pr_help.copy
===================================================================
--- src/sas/sasgui/perspectives/pr/media/pr_help.copy	(revision 65dfa99759ad82a7c7023ae9209b69fc461475dc)
+++ 	(revision )
@@ -1,62 +1,0 @@
-.. pr_help.rst
-
-.. This is a port of the original SasView html help file to ReSTructured text
-.. by S King, ISIS, during SasView CodeCamp-III in Feb 2015.
-
-.. |pi| unicode:: U+03C0
-.. |bigphi| unicode:: U+03A6
-.. |bigsigma| unicode:: U+03A3
-.. |chi| unicode:: U+03C7
-
-P(r) Inversion Perspective
-==========================
-
-Description
------------
-
-This tool calculates a real-space distance distribution function, *P(r)*, using 
-the inversion approach (Moore, 1908).
-
-*P(r)* is set to be equal to an expansion of base functions of the type
-
-  |bigphi|\_n(r) = 2.r.sin(|pi|\ .n.r/D_max)
-
-The coefficient of each base function in the expansion is found by performing 
-a least square fit with the following fit function
-
-  |chi|\ :sup:`2` = |bigsigma|\ :sub:`i` [ I\ :sub:`meas`\ (Q\ :sub:`i`\ ) - I\ :sub:`th`\ (Q\ :sub:`i`\ ) ] :sup:`2` / (Error) :sup:`2` + Reg_term
-
-where I\ :sub:`meas`\ (Q) is the measured scattering intensity and 
-I\ :sub:`th`\ (Q) is the prediction from the Fourier transform of the *P(r)* 
-expansion. 
-
-The *Reg_term* term is a regularization term set to the second derivative 
-d\ :sup:`2`\ *P(r)* / dr\ :sup:`2` integrated over *r*. It is used to produce a 
-smooth *P(r)* output.
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-Using the perspective
----------------------
-
-The user must enter
-
-*  *Number of terms*: the number of base functions in the P(r) expansion.
-   
-*  *Regularization constant*: a multiplicative constant to set the size of
-   the regularization term.
-
-*  *Maximum distance*: the maximum distance between any two points in the
-   system.
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-Reference
----------
-
-P.B. Moore
-*J. Appl. Cryst.*, 13 (1980) 168-175
-
-.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
-
-.. note::  This help document was last changed by Steve King, 01May2015
Index: src/sas/sasgui/perspectives/pr/media/pr_help.rst
===================================================================
--- src/sas/sasgui/perspectives/pr/media/pr_help.rst	(revision b64b87c874ab0edc565e9c415decc839e3214c8c)
+++ src/sas/sasgui/perspectives/pr/media/pr_help.rst	(revision 0391dae728cc7e22bcc7ec329200722cd14f829f)
@@ -15,18 +15,20 @@
 *P(r)* is set to be equal to an expansion of base functions of the type
 
-  |bigphi|\_n(r) = 2.r.sin(|pi|\ .n.r/D_max)
+.. math::
+  \Phi_{n(r)} = 2 r sin(\frac{\pi n r}{D_{max}})
 
-The coefficient of each base function in the expansion is found by performing 
+The coefficient of each base function in the expansion is found by performing
 a least square fit with the following fit function
 
-  |chi|\ :sup:`2` = |bigsigma|\ :sub:`i` [ I\ :sub:`meas`\ (Q\ :sub:`i`\ ) - I\ :sub:`th`\ (Q\ :sub:`i`\ ) ] :sup:`2` / (Error) :sup:`2` + Reg_term
+.. math::
 
-where I\ :sub:`meas`\ (Q) is the measured scattering intensity and 
-I\ :sub:`th`\ (Q) is the prediction from the Fourier transform of the *P(r)* 
-expansion. 
+  \chi^2=\frac{\sum_i (I_{meas}(Q_i)-I_{th}(Q_i))^2}{error^2}+Reg\_term
+  
 
-The *Reg_term* term is a regularization term set to the second derivative 
-d\ :sup:`2`\ *P(r)* / dr\ :sup:`2` integrated over *r*. It is used to produce a 
-smooth *P(r)* output.
+where $I_{meas}(Q_i)$ is the measured scattering intensity and $I_{th}(Q_i)$ is
+the prediction from the Fourier transform of the *P(r)* expansion. 
+
+The $Reg\_term$ term is a regularization term set to the second derivative 
+$d^2P(r)/d^2r$ integrated over $r$. It is used to produce a smooth *P(r)* output.
 
 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
@@ -45,4 +47,21 @@
    system.
 
+P(r) inversion requires that the background be perfectly subtracted.  This is
+often difficult to do well and thus many data sets will include a background.
+For those cases, the user should check the "estimate background" box and the
+module will do its best to estimate it.
+
+The P(r) module is constantly computing in the background what the optimum
+*number of terms* should be as well as the optimum *regularization constant*.
+These are constantly updated in the buttons next to the entry boxes on the GUI.
+These are almost always close and unless the user has a good reason to choose
+differently they should just click on the buttons to accept both.  {D_max} must
+still be set by the user.  However, besides looking at the output, the user can
+click the explore button which will bring up a graph of chi^2 vs Dmax over a
+range around the current Dmax.  The user can change the range and the number of
+points to explore in that range.  They can also choose to plot several other
+parameters as a function of Dmax including: I0, Rg, Oscillation parameter,
+background, positive fraction, and 1-sigma positive fraction.
+
 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
 
@@ -55,3 +74,3 @@
 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
 
-.. note::  This help document was last changed by Steve King, 01May2015
+.. note::  This help document was last modified by Paul Butler, 05 September, 2016
Index: test/sasdataloader/test/utest_ascii.py
===================================================================
--- test/sasdataloader/test/utest_ascii.py	(revision b699768550de9d4b35b087234ec1d2a461922bab)
+++ test/sasdataloader/test/utest_ascii.py	(revision 7d94915074e1688fc87991152ae32ccfce9987f4)
@@ -94,7 +94,5 @@
         f = self.loader.load("ascii_test_6.txt")
         # The length of the data is 5
-        self.assertEqual(len(f.x), 4)
-        self.assertEqual(f.x[0],0.013534)
-        self.assertEqual(f.x[3],0.022254)
+        self.assertEqual(f, None)
         
 if __name__ == '__main__':
