source: sasview/src/sas/sasgui/perspectives/fitting/media/fitting_help.rst @ dceff6e

ESS_GUIESS_GUI_DocsESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_iss959ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalccostrafo411magnetic_scattrelease-4.2.2ticket-1009ticket-1094-headlessticket-1242-2d-resolutionticket-1243ticket-1249ticket885unittest-saveload
Last change on this file since dceff6e was b64b87c, checked in by smk78, 8 years ago

Word 'perspective' removed as per #513

  • Property mode set to 100644
File size: 23.0 KB
RevLine 
[ec392464]1.. fitting_help.rst
2
3.. This is a port of the original SasView html help file to ReSTructured text
4.. by S King, ISIS, during SasView CodeCamp-III in Feb 2015.
5
[98b30b4]6.. |inlineimage004| image:: sm_image004.gif
7.. |inlineimage005| image:: sm_image005.gif
8.. |inlineimage008| image:: sm_image008.gif
9.. |inlineimage009| image:: sm_image009.gif
10.. |inlineimage010| image:: sm_image010.gif
11.. |inlineimage011| image:: sm_image011.gif
12.. |inlineimage012| image:: sm_image012.gif
13.. |inlineimage018| image:: sm_image018.gif
14.. |inlineimage019| image:: sm_image019.gif
15
[ec392464]16
[b64b87c]17Fitting
18=======
[ec392464]19
[a6f3613]20.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
21
22Preparing to fit data
23---------------------
24
25To fit some data you must first load some data, activate one or more data sets,
[b64b87c]26send those data sets to fitting, and select a model to fit to each data set.
[a6f3613]27
[f3377b8]28Instructions on how to load and activate data are in the section :ref:`Loading_data`.
[ec392464]29
[a6f3613]30SasView can fit data in one of three ways:
[ec392464]31
[a6f3613]32*  in *Single* fit mode - individual data sets are fitted independently one-by-one
[ec392464]33
[f3377b8]34*  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)
[ec392464]35
[f3377b8]36*  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!)
[a6f3613]37
38.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
[ec392464]39
[a6f3613]40Selecting a model
41-----------------
[ec392464]42
[a6f3613]43By default, the models in SasView are grouped into five categories
[ec392464]44
[a6f3613]45*  *Shapes* - models describing 'objects' (spheres, cylinders, etc)
[f3377b8]46*  *Shape-Independent* - models describing structure in terms of density correlation functions, fractals, peaks, power laws, etc
[8570246]47*  *Customized Models* - SasView- or User-created (non-library) Python models
[a6f3613]48*  *Uncategorised* - other models (for reflectivity, etc)
49*  *Structure Factor* - S(Q) models
[ec392464]50
[a6f3613]51Use the *Category* drop-down menu to chose a category of model, then select
[f3377b8]52a model from the drop-down menu beneath. A graph of the chosen model, calculated
53using default parameter values, will appear. The graph will update dynamically
54as the parameter values are changed.
55
56You can decide your own model categorizations using the :ref:`Category_Manager`.
[ce62e75]57
[a6f3613]58Once you have selected a model you can read its help documentation by clicking
59on the *Description* button to the right.
60
61Show 1D/2D
62^^^^^^^^^^
63
64Models are normally fitted to 1D (ie, I(Q) vs Q) data sets, but some models in
65SasView can also be fitted to 2D (ie, I(Qx,Qy) vs Qx vs Qy) data sets.
66
67*NB: Magnetic scattering can only be fitted in SasView in 2D.*
68
69To activate 2D fitting mode, click the *Show 2D* button on the *Fit Page*. To
70return to 1D fitting model, click the same button (which will now say *Show 1D*).
[ce62e75]71
[ec392464]72.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
73
[a6f3613]74.. _Category_Manager:
[a0637de]75
[a6f3613]76Category Manager
77----------------
78
[f3377b8]79To change the model categorizations, either choose *Category Manager* from the
80*View* option on the menubar, or click on the *Modify* button on the *Fit Page*.
[a6f3613]81
[f3377b8]82.. image:: cat_fig0.bmp
[a6f3613]83
[f3377b8]84The categorization of all models except the customized models can be reassigned,
85added to, and removed using *Category Manager*. Models can also be hidden from view
86in the drop-down menus.
[a6f3613]87
[f3377b8]88.. image:: cat_fig1.bmp
[a6f3613]89
[f3377b8]90Changing category
91^^^^^^^^^^^^^^^^^
[a6f3613]92
[f3377b8]93To change category, highlight a model in the list by left-clicking on its entry and
94then click the *Modify* button. Use the *Change Category* panel that appears to make
95the required changes.
[a6f3613]96
[f3377b8]97.. image:: cat_fig2.bmp
[a6f3613]98
[f3377b8]99To create a category for the selected model, click the *Add* button. In order
100to delete a category, select the category name and click the *Remove Selected*
101button. Then click *Done*.
[a6f3613]102
[f3377b8]103Showing/hiding models
104^^^^^^^^^^^^^^^^^^^^^
[a6f3613]105
[8570246]106Use the *Enable All / Disable All* buttons and the check boxes beside each model to
[f3377b8]107select the models to show/hide. To apply the selection, click *Ok*. Otherwise click
108*Cancel*.
[a6f3613]109
[8570246]110*NB: It may be necessary to change to a different category and then back again*
[f3377b8]111*before any changes take effect.*
[a6f3613]112
113.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
114
[f3377b8]115Model Functions
116---------------
[a6f3613]117
[20846be]118For a complete list of all the library models available in SasView, see the Model Documentation.
[a6f3613]119
[f3377b8]120It is also possible to add your own models.
[a6f3613]121
[f3377b8]122.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
[a6f3613]123
[b5846a10]124.. _Adding_your_own_models:
125
[f3377b8]126Adding your own models
127----------------------
[a6f3613]128
[f3377b8]129There are currently two ways to add your own models to SasView:
130
[8570246]131* Using the :ref:`Custom_Model_Editor`
132* By :ref:`Writing_a_Plugin`
[f3377b8]133
134*NB: Because of the way these options are implemented, it is not possible for them*
135*to use the polydispersity algorithms in SasView. Only models in the model library*
136*can do this. At the time of writing (Release 3.1.0) work is in hand to make it*
137*easier to add new models to the model library.*
[a6f3613]138
139.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
140
[f3377b8]141.. _Custom_Model_Editor:
142
[a6f3613]143Custom Model Editor
144-------------------
145
[f3377b8]146From the *Fitting* option in the menu bar, select *Edit Custom Model*.
[a6f3613]147
148.. image:: edit_model_menu.bmp
149
[f3377b8]150and then one of the options
151
152*  *New* - to create a new custom model template
153*  *Sum|Multi(p1,p2)* - to create a new model by summing/multiplying existing models in the model library
154*  *Advanced* - to edit a new custom model
155*  *Delete* - to delete a custom model
[a6f3613]156
[f3377b8]157New
158^^^^
[a6f3613]159
160.. image:: new_model.bmp
161
[f3377b8]162A model template generated by this option can be viewed and further modified using
163the :ref:`Advanced` option.
164
[a6f3613]165Sum|Multi(p1,p2)
166^^^^^^^^^^^^^^^^
167
168.. image:: sum_model.bmp
[a0637de]169
[f3377b8]170This option creates a custom model of the form
171
[8570246]172Custom Model = scale_factor \* (model1 +/\* model2)
[f3377b8]173
174In the *Easy Sum/Multi Editor* give the new custom model a function name and brief
175description (to appear under the *Details* button on the *Fit Page*). Then select
176two existing models, as p1 and p2, and the required operator, '+' or '*' between
177them. Finally, click the *Apply* button to generate the model and then click *Close*.
178
179*NB: Any changes to a custom model generated in this way only become effective after*
180*it is re-selected from the model drop-down menu on the Fit Page.*
181
182.. _Advanced:
183
[a6f3613]184Advanced
185^^^^^^^^
[ec392464]186
[f3377b8]187Selecting this option shows all the custom models in the plugin model folder
188
[8570246]189  *C:\\Users\\[username]\\.sasview\\plugin_models* - (on Windows)
[f3377b8]190
191You can edit, modify, and save the Python code in any of these models using the
192*Advanced Custom Model Editor*.
193
194*NB: Unless you are confident about what you are doing, it is recommended that you*
195*only modify lines denoted with the ## <----- comments!*
196
197When editing is complete, select *Run -> Compile* from the *Model Editor* menu bar. An
198*Info* box will appear with the results of the compilation and model unit tests. The
199model will only be usable if the tests 'pass'.
200
201To use the model, go to the relevant *Fit Page*, select the *Customized Models*
202category and then select the model from the drop-down menu.
203
204*NB: Any changes to a custom model generated in this way only become effective after*
205*it is re-selected from the model drop-down menu on the Fit Page.*
[a6f3613]206
207Delete
208^^^^^^
209
[f3377b8]210Simply highlight the custom model to be removed. This operation is final!
211
212*NB: Custom models shipped with SasView cannot be removed in this way.*
[ec392464]213
214.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
215
[f3377b8]216.. _Writing_a_Plugin:
217
218Writing a Plugin
[a6f3613]219----------------
220
[f3377b8]221Advanced users can write their own model in Python and save it to the the SasView
222*plugin_models* folder
[a6f3613]223
[8570246]224  *C:\\Users\\[username]\\.sasview\\plugin_models* - (on Windows)
[a6f3613]225
[f3377b8]226in .py format. The next time SasView is started it will compile the plugin and add
227it to the list of *Customized Models*.
[a6f3613]228
[f3377b8]229It is recommended that existing plugin models be used as templates.
[a6f3613]230
[f3377b8]231.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
[ec392464]232
[4666660]233.. _Fitting_Options:
234
[f3377b8]235Fitting Options
236---------------
[a6f3613]237
[f3377b8]238It is possible to specify which optimiser SasView should use to fit the data, and
239to modify some of the configurational parameters for each optimiser.
240
241From *Fitting* in the menu bar select *Fit Options*, then select one of the following
242optimisers:
[a6f3613]243
[f3377b8]244*  DREAM
245*  Levenberg-Marquardt
246*  Quasi-Newton BFGS
247*  Differential Evolution
248*  Nelder-Mead Simplex
[a6f3613]249
[6af2785]250The DREAM optimiser is the most sophisticated, but may not necessarily be the best
251option for fitting simple models. If uncertain, try the Levenberg-Marquardt optimiser
252initially.
253
[f3377b8]254These optimisers form the *Bumps* package written by P Kienzle. For more information
[4666660]255on each optimiser, see the :ref:`Fitting_Documentation`.
[a6f3613]256
[f3377b8]257.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
[a6f3613]258
[5ac0a7a]259Fitting Limits
260--------------
261
262By default, *SasView* will attempt to model fit the full range of the data; ie,
263across all *Q* values. If necessary, however, it is possible to specify only a
264sub-region of the data for fitting.
265
266In a *FitPage* or *BatchPage* change the *Q* values in the *Min* and/or *Max*
267text boxes. Vertical coloured bars will appear on the graph with the data and
268'theory' indicating the current *Q* limits (red = *Qmin*, purple = *Qmax*).
269
270To return to including all data in the fit, click the *Reset* button.
271
272.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
273
274
[f3377b8]275Shortcuts
276---------
[a6f3613]277
[f3377b8]278Copy/Paste Parameters
279^^^^^^^^^^^^^^^^^^^^^
[a6f3613]280
[f3377b8]281It is possible to copy the parameters from one *Fit Page* and to paste them into
282another *Fit Page* using the same model.
[a6f3613]283
[f3377b8]284To *copy* parameters, either:
[a6f3613]285
[f3377b8]286*  Select *Edit -> Copy Params* from the menu bar, or
287*  Use Ctrl(Cmd on Mac) + Left Mouse Click on the *Fit Page*.
[a6f3613]288
[f3377b8]289To *paste* parameters, either:
290
291*  Select *Edit -> Paste Params* from the menu bar, or
292*  Use Ctrl(Cmd on Mac) + Shift + Left-click on the *Fit Page*.
293
294If either operation is successful a message will appear in the info line at the
295bottom of the SasView window.
296
297Bookmark
298^^^^^^^^
[a6f3613]299
[1fda506]300To *Bookmark* a *Fit Page* either:
[a6f3613]301
[f3377b8]302*  Select a *Fit Page* and then click on *Bookmark* in the tool bar, or
303*  Right-click and select the *Bookmark* in the popup menu.
[a6f3613]304
305.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
306
[4666660]307.. _Status_bar:
308
[1fda506]309Status Bar & Console
310--------------------
311
312The status bar is located at the bottom of the SasView window and displays
313messages, hints, warnings and errors.
314
315At the right-hand side of the status bar is a button marked *Console*. The *Console*
316displays available message history and some run-time traceback information.
317
318During a long task the *Console* can also be used to monitor the progress.
319
320.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
321
[6af2785]322.. _Single_Fit_Mode:
323
[a6f3613]324Single Fit Mode
325---------------
[ec392464]326
[4666660]327*NB: Before proceeding, ensure that the Single Mode radio button at the bottom of*
328*the Data Explorer is checked (see the section* :ref:`Loading_data` *).*
329
[63d314b]330This mode fits one data set.
331
[b64b87c]332When data is sent to the fitting it is plotted in a graph window as markers.
[4666660]333
334If a graph does not appear, or a graph window appears but is empty, then the data
335has not loaded correctly. Check to see if there is a message in the :ref:`Status_Bar`
336or in the *Console* window.
337
338Assuming the data has loaded correctly, when a model is selected a green model
339calculation (or what SasView calls a 'Theory') line will appear in the earlier graph
340window, and a second graph window will appear displaying the residuals (the
341difference between the experimental data and the theory) at the same X-data values.
[f9250dc]342See :ref:`Assessing_Fit_Quality`.
[4666660]343
344The objective of model-fitting is to find a *physically-plausible* model, and set
345of model parameters, that generate a theory that reproduces the experimental data
346and gives residual values as close to zero as possible.
347
348Change the default values of the model parameters by hand until the theory line
349starts to represent the experimental data. Then uncheck the tick boxes alongside
350all parameters *except* the 'background' and the 'scale'. Click the *Fit* button.
351SasView will optimise the values of the 'background' and 'scale' and also display
352the corresponding uncertainties on the optimised values.
353
354*NB: If no uncertainty is shown it generally means that the model is not very*
355*dependent on the corresponding parameter (or that one or more parameters are*
356*'correlated').*
357
358In the bottom left corner of the *Fit Page* is a box displaying the normalised value
359of the statistical |chi|\  :sup:`2` parameter returned by the optimiser.
360
361Now check the box for another model parameter and click *Fit* again. Repeat this
362process until most or all parameters are checked and have been optimised. As the
363fit of the theory to the experimental data improves the value of 'chi2/Npts' will
364decrease. A good model fit should easily produce values of 'chi2/Npts' that are
[ff42a26]365close to zero, and certainly <100. See :ref:`Assessing_Fit_Quality`.
[4666660]366
367SasView has a number of different optimisers (see the section :ref:`Fitting_Options`).
368The DREAM optimiser is the most sophisticated, but may not necessarily be the best
369option for fitting simple models. If uncertain, try the Levenberg-Marquardt optimiser
370initially.
[ec392464]371
372.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
373
[a6f3613]374Simultaneous Fit Mode
375---------------------
[ec392464]376
[63d314b]377*NB: Before proceeding, ensure that the Single Mode radio button at the bottom of*
378*the Data Explorer is checked (see the section* :ref:`Loading_data` *).*
[ec392464]379
[6af2785]380This mode is an extension of the :ref:`Single_Fit_Mode` that fits two or more data
[63d314b]381sets *to the same model* simultaneously. If necessary it is possible to constrain
382fit parameters between data sets (eg, to fix a background level, or radius, etc).
383
[b5846a10]384If the data to be fit are in multiple files, load each file, then select each file
385in the *Data Explorer*, and *Send To Fitting*. If multiple data sets are in one file,
386load that file, *Unselect All Data*, select just those data sets to be fitted, and
387*Send To Fitting*. Either way, the result should be that for *n* data sets you have
[6af2785]3882\ *n* graphs (*n* of the data and model fit, and *n* of the resulting residuals). But
[f9250dc]389it may be helpful to minimise the residuals plots for clarity. Also see
390:ref:`Assessing_Fit_Quality`.
[b5846a10]391
392*NB: If you need to use a customized model, you must ensure that model is available*
393*first (see* :ref:`Adding_your_own_models` *).*
394
[6af2785]395Method
396^^^^^^
397
[b5846a10]398Now go to each *FitPage* in turn and:
399
400  Select the required category and model;
401
402  Unselect all the model parameters;
403
404  Enter some starting guesses for the parameters;
405
406  Enter any parameter limits (recommended);
[63d314b]407
[b5846a10]408  Select which parameters will refine (selecting all is generally a bad idea...);
[63d314b]409
[b5846a10]410When done, select *Constrained or Simultaneous Fit* under *Fitting* in the menu bar.
411
412In the *Const & Simul Fit* page that appears, select which data sets are to be
413simultaneously fitted (this will probably be all of them or you would not have loaded
414them in the first place!).
415
416To tie parameters between the data sets with constraints, check the 'yes' radio button
417next to *Add Constraint?* in the *Fit Constraints* box.
418
419*NB: You can only constrain parameters that are set to refine.*
420
421When ready, click the *Fit* button on the *Const & Simul Fit* page, NOT the *Fit*
422button on the individual *FitPage*'s.
[63d314b]423
424Simultaneous Fits without Constraints
425^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[ec392464]426
[b5846a10]427The results of the model-fitting will be returned to each of the individual
428*FitPage*'s.
[ec392464]429
[b5846a10]430Note that the chi2/Npts value returned is the SUM of the chi2/Npts of each fit. To
[6af2785]431see the chi2/Npts value for a specific *FitPage*, click the *Compute* button at the
[f9250dc]432bottom of that *FitPage* to recalculate. Also see :ref:`Assessing_Fit_Quality`.
[ec392464]433
[63d314b]434Simultaneous Fits with Constraints
435^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[ec392464]436
[b5846a10]437Use the *Easy Setup* drop-down buttons in the *Const & Simul Fit* page to set
438up constraints between *FitPage*'s.
439
[6af2785]440Constraints will generally be of the form
441
442  Mi Parameter1 = Mj.Parameter1
443
444however the text box after the '=' sign can be used to adjust this
445relationship; for example
446
447  Mi Parameter1 = scalar \* Mj.Parameter1
448
449A 'free-form' constraint box is also provided.
[b5846a10]450
451Many constraints can be entered for a single fit.
452
453The results of the model-fitting will be returned to each of the individual
454*FitPage*'s.
[ec392464]455
[b5846a10]456Note that the chi2/Npts value returned is the SUM of the chi2/Npts of each fit. To
[6af2785]457see the chi2/Npts value for a specific *FitPage*, click the *Compute* button at the
[f9250dc]458bottom of that *FitPage* to recalculate. Also see :ref:`Assessing_Fit_Quality`.
[ec392464]459
460.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
461
[a6f3613]462Batch Fit Mode
463--------------
[ec392464]464
[6af2785]465*NB: Before proceeding, ensure that the Single Mode radio button at the bottom of*
466*the Data Explorer is checked (see the section* :ref:`Loading_data` *). The Batch*
467*Mode button will be used later on!*
[63d314b]468
[6af2785]469This mode *sequentially* fits two or more data sets *to the same model*. Unlike in
470simultaneous fitting, in batch fitting it is not possible to constrain fit parameters
471between data sets.
[ec392464]472
[6af2785]473If the data to be fit are in multiple files, load each file in the *Data Explorer*.
474If multiple data sets are in one file, load just that file. *Unselect All Data*, then
475select a single initial data set to be fitted. Fit that selected data set as described
476above under :ref:`Single_Fit_Mode` .
[ec392464]477
[6af2785]478*NB: If you need to use a customized model, you must ensure that model is available*
479*first (see* :ref:`Adding_your_own_models` *).*
[ec392464]480
[6af2785]481Method
482^^^^^^
[ec392464]483
[6af2785]484Now *Select All Data* in the *Data Explorer*, check the *Batch Mode* radio button
485at the bottom of that panel and *Send To Fitting*. A *BatchPage* will be created.
[ec392464]486
[6af2785]487.. image:: batch_button_area.bmp
[ec392464]488
[6af2785]489*NB: The Batch Page can also be created by checking the Batch Mode radio button*
490*and selecting New Fit Page under Fitting in the menu bar.*
[ec392464]491
[6af2785]492Using the drop-down menus in the *BatchPage*, now set up the *same* data set
493with the *same* model that you just fitted in single fit mode. A quick way to
494set the model parameter values is to just copy them from the earlier Single
495Fit. To do this, go back to the Single Fit *FitPage*, select *Copy Params*
496under *Edit* in the menu bar, then go back to the *BatchPage* and *Paste Params*.
[ec392464]497
[6af2785]498When ready, use the *Fit* button on the *BatchPage* to perform the fitting, NOT
499the *Fit* button on the individual *FitPage*'s.
[ec392464]500
[6af2785]501Unlike in single fit mode, the results of batch fits are not returned to
502the *BatchPage*. Instead, a spreadsheet-like :ref:`Grid_Window` will appear.
[ec392464]503
[6af2785]504If you want to visually check a graph of a particular fit, click on the name of
505a *Data set* in the *Grid Window* and then click the *View Fits* button. The
506data and the model fit will be displayed. If you select mutliple data sets they
507will all appear on one graph.
[ec392464]508
[6af2785]509.. image:: view_button.bmp
[ec392464]510
[6af2785]511*NB: In theory, returning to the BatchPage and changing the name of the I(Q)*
512*data source should also work, but at the moment whilst this does change the*
513*data set displayed it always superimposes the 'theory' corresponding to the*
514*starting parameters.*
[ec392464]515
[6af2785]516If you select a 'Chi2' value and click the *View Fits* button a graph of the
517residuals for that data set is displayed. Again, if you select multiple 'Chi2'
[f9250dc]518values then all the residuals data will appear on one graph. Also see
519:ref:`Assessing_Fit_Quality`.
[ec392464]520
[6af2785]521Chain Fitting
522^^^^^^^^^^^^^
[ec392464]523
[6af2785]524By default, the *same* parameter values copied from the initial single fit into
525the *BatchPage* will be used as the starting parameters for all batch fits. It
526is, however, possible to get *SasView* to use the results of a fit to a preceding
527data set as the starting parameters for the next fit in the sequence. This
528variation of batch fitting is called *Chain Fitting*, and will considerably speed
529up model-fitting if you have lots of very similar data sets where a few parameters
530are gradually changing. Do not use chain fitting on disparate data sets.
[ec392464]531
[6af2785]532To use chain fitting, select *Chain Fitting* under *Fitting* in the menu bar. It
533toggles on/off, so selecting it again will switch back to normal batch fitting.
[ec392464]534
[6af2785]535.. _Grid_Window:
[ec392464]536
[6af2785]537Grid Window
538^^^^^^^^^^^
[ec392464]539
[6af2785]540The *Grid Window* provides an easy way to view the results from batch fitting.
541It will be displayed automatically when a batch fit completes, but may be
542opened at any time by selecting *Show Grid Window* under *View* in the menu
543bar.
[ec392464]544
[6af2785]545.. image:: restore_batch_window.bmp
[ec392464]546
[6af2785]547Once a batch fit is completed, all model parameters are displayed but *not*
548their uncertainties. To view the uncertainties, click on a given column then
549go to *Edit* in the menu bar, select *Insert Column Before* and choose the
550required data from the list. An empty column can be inserted in the same way.
[ec392464]551
[6af2785]552To remove a column from the grid, click on the column header and choose
553*Remove Column* under *Edit* in the menu bar. The same functionality also
554allows you to re-order columns.
[ec392464]555
[6af2785]556*NB: You cannot insert/remove/re-order the rows in the Grid Window.*
[ec392464]557
[6af2785]558All of the above functions are also available by right-clicking on a column
559label.
[ec392464]560
[6af2785]561.. image:: edit_menu.bmp
[ec392464]562
[6af2785]563*NB: If there is an existing Grid Window and another batch fit is performed,*
564*an additional 'Table' tab will be added to the Grid Window.*
[ec392464]565
[6af2785]566The parameter values in the *currently selected* table of the *Grid Window*
567can be output to a CSV file by choosing *Save As* under *File* in the (*Grid*
568*Window*) menu bar. The default filename includes the date and time that the
569batch fit was performed.
[ec392464]570
[6af2785]571Saved CSV files can be reloaded by choosing *Open* under *File* in the *Grid*
572*Window* menu bar. The loaded parameters will appear in a new table tab.
[ec392464]573
[6af2785]574.. image:: file_menu.bmp
[ec392464]575
[6af2785]576*NB: Saving the Grid Window does not save any experimental data, residuals*
577*or actual model fits. Consequently if you reload a saved CSV file the*
578*ability to View Fits will be lost.*
[ec392464]579
[6af2785]580Parameter Plots
581^^^^^^^^^^^^^^^
[ec392464]582
[6af2785]583Any column of *numeric* parameter values can be plotted against another using
584the *Grid Window*. Simply select one column at the time and click the *Add*
585button next to the required *X/Y-axis Selection Range* text box. When both
586the X and Y axis boxes have been completed, click the *Plot* button.
[ec392464]587
[6af2785]588When the *Add* button is clicked, *SasView* also automatically completes the
589*X/Y-axis Label* text box with the heading from Row 1 of the selected table,
590but different labels and units can be entered manually.
[ec392464]591
592.. image:: plot_button.bmp
593
[6af2785]594The *X/Y-axis Selection Range* can be edited manually. The text control box
595recognises the operators +, -, \*, /, or 'pow', and allows the following
596types of expression :
597 
598  1) if an axis label range is a function of 1 or more *columns*, write
599     this type of expression
[ec392464]600
[6af2785]601     constant1 * column_name1 [minimum row index :  maximum  row index]
602     operator constant2 * column_name2 [minimum row index :  maximum  row index]
[ec392464]603
[6af2785]604     Example: radius [2 : 5] -3 * scale [2 : 5]
[ec392464]605
[6af2785]606  2) if only some *values* of a given column are needed but the range between
607     the first row and the last row used is not continuous, write this type of
608     expression
[ec392464]609
[6af2785]610     column_name1 [minimum row index1 :  maximum  row index1] , column_name1
611     [minimum row index2 :  maximum  row index2]
[ec392464]612
[6af2785]613     Example: radius [2 : 5] , radius [10 : 25]
[ec392464]614
615.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
[6af2785]616
617.. note::  This help document was last changed by Steve King, 04Jun2015
Note: See TracBrowser for help on using the repository browser.