Index: src/sas/sasgui/guiframe/media/graph_help.copy
===================================================================
--- src/sas/sasgui/guiframe/media/graph_help.copy	(revision 65dfa99759ad82a7c7023ae9209b69fc461475dc)
+++ src/sas/sasgui/guiframe/media/graph_help.copy	(revision 65dfa99759ad82a7c7023ae9209b69fc461475dc)
@@ -0,0 +1,364 @@
+.. 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/perspectives/calculator/media/kiessig_calculator_help.copy
===================================================================
--- src/sas/sasgui/perspectives/calculator/media/kiessig_calculator_help.copy	(revision 65dfa99759ad82a7c7023ae9209b69fc461475dc)
+++ src/sas/sasgui/perspectives/calculator/media/kiessig_calculator_help.copy	(revision 65dfa99759ad82a7c7023ae9209b69fc461475dc)
@@ -0,0 +1,32 @@
+.. 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: src/sas/sasgui/perspectives/calculator/media/resolution_calculator_help.copy
===================================================================
--- src/sas/sasgui/perspectives/calculator/media/resolution_calculator_help.copy	(revision 65dfa99759ad82a7c7023ae9209b69fc461475dc)
+++ src/sas/sasgui/perspectives/calculator/media/resolution_calculator_help.copy	(revision 65dfa99759ad82a7c7023ae9209b69fc461475dc)
@@ -0,0 +1,107 @@
+.. 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: src/sas/sasgui/perspectives/calculator/media/sas_calculator_help.copy
===================================================================
--- src/sas/sasgui/perspectives/calculator/media/sas_calculator_help.copy	(revision 65dfa99759ad82a7c7023ae9209b69fc461475dc)
+++ src/sas/sasgui/perspectives/calculator/media/sas_calculator_help.copy	(revision 65dfa99759ad82a7c7023ae9209b69fc461475dc)
@@ -0,0 +1,166 @@
+.. 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: src/sas/sasgui/perspectives/calculator/media/sld_calculator_help.copy
===================================================================
--- src/sas/sasgui/perspectives/calculator/media/sld_calculator_help.copy	(revision 65dfa99759ad82a7c7023ae9209b69fc461475dc)
+++ src/sas/sasgui/perspectives/calculator/media/sld_calculator_help.copy	(revision 65dfa99759ad82a7c7023ae9209b69fc461475dc)
@@ -0,0 +1,58 @@
+.. 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: src/sas/sasgui/perspectives/calculator/media/slit_calculator_help.copy
===================================================================
--- src/sas/sasgui/perspectives/calculator/media/slit_calculator_help.copy	(revision 65dfa99759ad82a7c7023ae9209b69fc461475dc)
+++ src/sas/sasgui/perspectives/calculator/media/slit_calculator_help.copy	(revision 65dfa99759ad82a7c7023ae9209b69fc461475dc)
@@ -0,0 +1,43 @@
+.. 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/media/fitting_help.copy
===================================================================
--- src/sas/sasgui/perspectives/fitting/media/fitting_help.copy	(revision 65dfa99759ad82a7c7023ae9209b69fc461475dc)
+++ src/sas/sasgui/perspectives/fitting/media/fitting_help.copy	(revision 65dfa99759ad82a7c7023ae9209b69fc461475dc)
@@ -0,0 +1,628 @@
+.. 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/mag_help.copy
===================================================================
--- src/sas/sasgui/perspectives/fitting/media/mag_help.copy	(revision 65dfa99759ad82a7c7023ae9209b69fc461475dc)
+++ src/sas/sasgui/perspectives/fitting/media/mag_help.copy	(revision 65dfa99759ad82a7c7023ae9209b69fc461475dc)
@@ -0,0 +1,115 @@
+.. 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: src/sas/sasgui/perspectives/fitting/media/pd_help.copy
===================================================================
--- src/sas/sasgui/perspectives/fitting/media/pd_help.copy	(revision 65dfa99759ad82a7c7023ae9209b69fc461475dc)
+++ src/sas/sasgui/perspectives/fitting/media/pd_help.copy	(revision 65dfa99759ad82a7c7023ae9209b69fc461475dc)
@@ -0,0 +1,203 @@
+.. 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/residuals_help.copy
===================================================================
--- src/sas/sasgui/perspectives/fitting/media/residuals_help.copy	(revision 65dfa99759ad82a7c7023ae9209b69fc461475dc)
+++ src/sas/sasgui/perspectives/fitting/media/residuals_help.copy	(revision 65dfa99759ad82a7c7023ae9209b69fc461475dc)
@@ -0,0 +1,66 @@
+.. 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: src/sas/sasgui/perspectives/fitting/media/sm_help.copy
===================================================================
--- src/sas/sasgui/perspectives/fitting/media/sm_help.copy	(revision 65dfa99759ad82a7c7023ae9209b69fc461475dc)
+++ src/sas/sasgui/perspectives/fitting/media/sm_help.copy	(revision 65dfa99759ad82a7c7023ae9209b69fc461475dc)
@@ -0,0 +1,229 @@
+.. 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/invariant/media/invariant_help.copy
===================================================================
--- src/sas/sasgui/perspectives/invariant/media/invariant_help.copy	(revision 65dfa99759ad82a7c7023ae9209b69fc461475dc)
+++ src/sas/sasgui/perspectives/invariant/media/invariant_help.copy	(revision 65dfa99759ad82a7c7023ae9209b69fc461475dc)
@@ -0,0 +1,128 @@
+.. 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: src/sas/sasgui/perspectives/pr/media/pr_help.copy
===================================================================
--- src/sas/sasgui/perspectives/pr/media/pr_help.copy	(revision 65dfa99759ad82a7c7023ae9209b69fc461475dc)
+++ src/sas/sasgui/perspectives/pr/media/pr_help.copy	(revision 65dfa99759ad82a7c7023ae9209b69fc461475dc)
@@ -0,0 +1,62 @@
+.. 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
