source: sasview/docs/pre-sphinx-docs/fitting_help_v0.html @ c43953ef

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.1.1release-4.1.2release-4.2.2ticket-1009ticket-1094-headlessticket-1242-2d-resolutionticket-1243ticket-1249ticket885unittest-saveload
Last change on this file since c43953ef was b78707b0, checked in by smk78, 9 years ago

Moved from perspectives/fitting/media as now supercded by
fitting_help.rst

  • Property mode set to 100644
File size: 42.1 KB
Line 
1<?xml version="1.0" encoding="utf-8" ?>
2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6<meta name="generator" content="Docutils 0.12: http://docutils.sourceforge.net/" />
7<title>Fitting Perspective</title>
8<style type="text/css">
9
10/*
11:Author: David Goodger (goodger@python.org)
12:Id: $Id: html4css1.css 7614 2013-02-21 15:55:51Z milde $
13:Copyright: This stylesheet has been placed in the public domain.
14
15Default cascading style sheet for the HTML output of Docutils.
16
17See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
18customize this style sheet.
19*/
20
21/* used to remove borders from tables and images */
22.borderless, table.borderless td, table.borderless th {
23  border: 0 }
24
25table.borderless td, table.borderless th {
26  /* Override padding for "table.docutils td" with "! important".
27     The right padding separates the table cells. */
28  padding: 0 0.5em 0 0 ! important }
29
30.first {
31  /* Override more specific margin styles with "! important". */
32  margin-top: 0 ! important }
33
34.last, .with-subtitle {
35  margin-bottom: 0 ! important }
36
37.hidden {
38  display: none }
39
40a.toc-backref {
41  text-decoration: none ;
42  color: black }
43
44blockquote.epigraph {
45  margin: 2em 5em ; }
46
47dl.docutils dd {
48  margin-bottom: 0.5em }
49
50object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
51  overflow: hidden;
52}
53
54/* Uncomment (and remove this text!) to get bold-faced definition list terms
55dl.docutils dt {
56  font-weight: bold }
57*/
58
59div.abstract {
60  margin: 2em 5em }
61
62div.abstract p.topic-title {
63  font-weight: bold ;
64  text-align: center }
65
66div.admonition, div.attention, div.caution, div.danger, div.error,
67div.hint, div.important, div.note, div.tip, div.warning {
68  margin: 2em ;
69  border: medium outset ;
70  padding: 1em }
71
72div.admonition p.admonition-title, div.hint p.admonition-title,
73div.important p.admonition-title, div.note p.admonition-title,
74div.tip p.admonition-title {
75  font-weight: bold ;
76  font-family: sans-serif }
77
78div.attention p.admonition-title, div.caution p.admonition-title,
79div.danger p.admonition-title, div.error p.admonition-title,
80div.warning p.admonition-title, .code .error {
81  color: red ;
82  font-weight: bold ;
83  font-family: sans-serif }
84
85/* Uncomment (and remove this text!) to get reduced vertical space in
86   compound paragraphs.
87div.compound .compound-first, div.compound .compound-middle {
88  margin-bottom: 0.5em }
89
90div.compound .compound-last, div.compound .compound-middle {
91  margin-top: 0.5em }
92*/
93
94div.dedication {
95  margin: 2em 5em ;
96  text-align: center ;
97  font-style: italic }
98
99div.dedication p.topic-title {
100  font-weight: bold ;
101  font-style: normal }
102
103div.figure {
104  margin-left: 2em ;
105  margin-right: 2em }
106
107div.footer, div.header {
108  clear: both;
109  font-size: smaller }
110
111div.line-block {
112  display: block ;
113  margin-top: 1em ;
114  margin-bottom: 1em }
115
116div.line-block div.line-block {
117  margin-top: 0 ;
118  margin-bottom: 0 ;
119  margin-left: 1.5em }
120
121div.sidebar {
122  margin: 0 0 0.5em 1em ;
123  border: medium outset ;
124  padding: 1em ;
125  background-color: #ffffee ;
126  width: 40% ;
127  float: right ;
128  clear: right }
129
130div.sidebar p.rubric {
131  font-family: sans-serif ;
132  font-size: medium }
133
134div.system-messages {
135  margin: 5em }
136
137div.system-messages h1 {
138  color: red }
139
140div.system-message {
141  border: medium outset ;
142  padding: 1em }
143
144div.system-message p.system-message-title {
145  color: red ;
146  font-weight: bold }
147
148div.topic {
149  margin: 2em }
150
151h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
152h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
153  margin-top: 0.4em }
154
155h1.title {
156  text-align: center }
157
158h2.subtitle {
159  text-align: center }
160
161hr.docutils {
162  width: 75% }
163
164img.align-left, .figure.align-left, object.align-left {
165  clear: left ;
166  float: left ;
167  margin-right: 1em }
168
169img.align-right, .figure.align-right, object.align-right {
170  clear: right ;
171  float: right ;
172  margin-left: 1em }
173
174img.align-center, .figure.align-center, object.align-center {
175  display: block;
176  margin-left: auto;
177  margin-right: auto;
178}
179
180.align-left {
181  text-align: left }
182
183.align-center {
184  clear: both ;
185  text-align: center }
186
187.align-right {
188  text-align: right }
189
190/* reset inner alignment in figures */
191div.align-right {
192  text-align: inherit }
193
194/* div.align-center * { */
195/*   text-align: left } */
196
197ol.simple, ul.simple {
198  margin-bottom: 1em }
199
200ol.arabic {
201  list-style: decimal }
202
203ol.loweralpha {
204  list-style: lower-alpha }
205
206ol.upperalpha {
207  list-style: upper-alpha }
208
209ol.lowerroman {
210  list-style: lower-roman }
211
212ol.upperroman {
213  list-style: upper-roman }
214
215p.attribution {
216  text-align: right ;
217  margin-left: 50% }
218
219p.caption {
220  font-style: italic }
221
222p.credits {
223  font-style: italic ;
224  font-size: smaller }
225
226p.label {
227  white-space: nowrap }
228
229p.rubric {
230  font-weight: bold ;
231  font-size: larger ;
232  color: maroon ;
233  text-align: center }
234
235p.sidebar-title {
236  font-family: sans-serif ;
237  font-weight: bold ;
238  font-size: larger }
239
240p.sidebar-subtitle {
241  font-family: sans-serif ;
242  font-weight: bold }
243
244p.topic-title {
245  font-weight: bold }
246
247pre.address {
248  margin-bottom: 0 ;
249  margin-top: 0 ;
250  font: inherit }
251
252pre.literal-block, pre.doctest-block, pre.math, pre.code {
253  margin-left: 2em ;
254  margin-right: 2em }
255
256pre.code .ln { color: grey; } /* line numbers */
257pre.code, code { background-color: #eeeeee }
258pre.code .comment, code .comment { color: #5C6576 }
259pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
260pre.code .literal.string, code .literal.string { color: #0C5404 }
261pre.code .name.builtin, code .name.builtin { color: #352B84 }
262pre.code .deleted, code .deleted { background-color: #DEB0A1}
263pre.code .inserted, code .inserted { background-color: #A3D289}
264
265span.classifier {
266  font-family: sans-serif ;
267  font-style: oblique }
268
269span.classifier-delimiter {
270  font-family: sans-serif ;
271  font-weight: bold }
272
273span.interpreted {
274  font-family: sans-serif }
275
276span.option {
277  white-space: nowrap }
278
279span.pre {
280  white-space: pre }
281
282span.problematic {
283  color: red }
284
285span.section-subtitle {
286  /* font-size relative to parent (h1..h6 element) */
287  font-size: 80% }
288
289table.citation {
290  border-left: solid 1px gray;
291  margin-left: 1px }
292
293table.docinfo {
294  margin: 2em 4em }
295
296table.docutils {
297  margin-top: 0.5em ;
298  margin-bottom: 0.5em }
299
300table.footnote {
301  border-left: solid 1px black;
302  margin-left: 1px }
303
304table.docutils td, table.docutils th,
305table.docinfo td, table.docinfo th {
306  padding-left: 0.5em ;
307  padding-right: 0.5em ;
308  vertical-align: top }
309
310table.docutils th.field-name, table.docinfo th.docinfo-name {
311  font-weight: bold ;
312  text-align: left ;
313  white-space: nowrap ;
314  padding-left: 0 }
315
316/* "booktabs" style (no vertical lines) */
317table.docutils.booktabs {
318  border: 0px;
319  border-top: 2px solid;
320  border-bottom: 2px solid;
321  border-collapse: collapse;
322}
323table.docutils.booktabs * {
324  border: 0px;
325}
326table.docutils.booktabs th {
327  border-bottom: thin solid;
328  text-align: left;
329}
330
331h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
332h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
333  font-size: 100% }
334
335ul.auto-toc {
336  list-style-type: none }
337
338</style>
339</head>
340<body>
341<div class="document" id="fitting-perspective">
342<h1 class="title">Fitting Perspective</h1>
343
344<!-- fitting_help.rst -->
345<!-- This is a port of the original SasView html help file to ReSTructured text -->
346<!-- by S King, ISIS, during SasView CodeCamp-III in Feb 2015. -->
347<p><a class="reference internal" href="#load-a-file">Load_a_File</a></p>
348<p><a class="reference internal" href="#single-fit">Single_Fit</a></p>
349<p><a class="reference internal" href="#simultaneous-fitting">Simultaneous_Fitting</a></p>
350<p><a class="reference internal" href="#batch-fitting">Batch_Fitting</a></p>
351<p><a class="reference internal" href="#model-selection">Model_Selection</a></p>
352<p><a class="reference internal" href="#model-category-manager">Model_Category_Manager</a></p>
353<p><a class="reference internal" href="#model-functions">Model_Functions</a></p>
354<p><a class="reference internal" href="#custom-model-editor">Custom_Model_Editor</a></p>
355<p><a class="reference internal" href="#polydispersity-distributions">Polydispersity_Distributions</a></p>
356<p><a class="reference internal" href="#smearing-computation">Smearing_Computation</a></p>
357<p><a class="reference internal" href="#polarisation-magnetic-scattering">Polarisation_Magnetic_Scattering</a></p>
358<p><a class="reference internal" href="#key-combinations">Key_Combinations</a></p>
359<p><a class="reference internal" href="#status-bar-help">Status_Bar_Help</a></p>
360<!-- ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ -->
361<div class="section" id="id1">
362<span id="load-a-file"></span><h1>Load a File</h1>
363<p>From Menu go to <em>Data</em> -&gt; <em>Load Data File(or Folder)</em> . Select a file/folder
364from the menu bar and click on Open button. Data contained in the file will be
365displayed. To cancel the loading click on <em>cancel</em> . In case a file can not be
366loaded, an error message will be displayed on the statusbar.</p>
367<!-- ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ -->
368</div>
369<div class="section" id="id2">
370<span id="single-fit"></span><h1>Single Fit</h1>
371<p>One of two fit-engines can be chosen from the Fitting menu bar. The Simple Fit-
372engine uses Scipy's leasqr and the Complex Fit-Engine is a custom optimizer
373that provides a better chance to find the global minimum of the <a href="#id3"><span class="problematic" id="id4">|</span></a>chi|2 but that
374requires longer computation time. In order to set a data to a control panel
375(FitPage), see the &quot;DataLoader Help&quot;. Once a data set to the FiPage, select a
376model from the combo box. The default parameters of the model will be display.
377Set initial parameters if need. Check and uncheck parameters to fit/fix. Click
378the <em>'Fit'</em>  button. When the fitting is finished, the resultant parameter
379values will be displayed with the errors. If a error is missing, it generally
380means that the corresponding parameter is not very depending on the model. The
381chisq/Npt_fit and the plot associated with the fit operation will be also
382updated.</p>
383<div class="system-message" id="id3">
384<p class="system-message-title">System Message: WARNING/2 (<tt class="docutils">C:/Code/Eclipse_workspace/SasViewTrunk/src/sas/perspectives/fitting/media/fitting_help.rst</tt>, line 73); <em><a href="#id4">backlink</a></em></p>
385Inline substitution_reference start-string without end-string.</div>
386<!-- ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ -->
387</div>
388<div class="section" id="id5">
389<span id="simultaneous-fitting"></span><h1>Simultaneous Fitting</h1>
390<p>This fitting option enables to set a number of the constraints between the
391parameters of fitting(s). It requires one or more FitPages with a data and a
392model set for the fitting, and performs multiple fittings given by the
393FitPage(s). The Complex (ParkMC) FitEngine will be used automatically.</p>
394<p>Simultaneous Fit without Constraint</p>
395<p>Assuming some FitPages are already set up, check the checkboxes of the
396model_data rows to fit. And click the 'Fit' button. The results will return to
397each FitPages.</p>
398<p>Note that the chi2/Npts returned is the sum of the chi2/Npts of each fits. If
399one needs the chi2 value only for a page, click the 'Compute' button in the
400FitPage to recalculate.</p>
401<p>Simultaneous Fit with Constraint</p>
402<p>Enter constraint in the text control next to <em>constraint fit</em>  button.
403Constraint should be of type model1 parameter name = f(model2 parameter name)
404for example, M0.radius=2*M1.radius. Many constraints can be entered for a
405single fit. Each of them should be separated by a newline charater or &quot;;&quot;
406The easy setup can generate many constraint inputs easily when the selected
407two models are the same type.</p>
408<p>Note that the chi2/Npts returned is the sum of the chi2/Npts of each fits.
409If one needs the chi2 value only for one fit, click the 'Compute' button in
410the FitPage to recalculate.</p>
411<!-- ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ -->
412</div>
413<div class="section" id="id6">
414<span id="batch-fitting"></span><h1>Batch Fitting</h1>
415<p><a class="reference internal" href="#batch-fit">Batch_Fit</a></p>
416<p><a class="reference internal" href="#batch-window">Batch_Window</a></p>
417<p><a class="reference internal" href="#edit-grid">Edit_Grid</a></p>
418<p><a class="reference internal" href="#save-grid">Save_Grid</a></p>
419<p><a class="reference internal" href="#open-batch-results">Open_Batch_Results</a></p>
420<p><a class="reference internal" href="#plot">Plot</a></p>
421<p><a class="reference internal" href="#view-column-cell">View_Column_Cell</a></p>
422</div>
423<div class="section" id="id7">
424<span id="batch-fit"></span><h1>Batch Fit</h1>
425<p>Create a <em>Batch Page</em> by selecting the <em>Batch</em> radio button on the DataExplorer
426(see figure below) and for a new control page select 'New FitPage' in the
427Fitting menubar.</p>
428<img alt="batch_button_area.bmp" src="batch_button_area.bmp" />
429<p>Figure 1: MenuBar:</p>
430<p>Load Data to the DataExplorer if not already loaded.</p>
431<p>Select one or more data sets by checking the check boxes, and then make sure
432that &quot;Fitting&quot; is selected in the dropdown menu next to the &quot;Send To&quot; button.
433Once ready, click the 'Send To' button to set data to a BatchPage. If already
434an empty batch page exists, it will be set there. Otherwise it will create a
435new Batch Page. Set up the model and the parameter values as same as a single
436fitting (see Single Fit help) &lt;<a class="reference internal" href="#single-fit">Single_Fit</a>&gt;. Then use 'Fit' button to
437perform the fitting.</p>
438<p>Unlike a single fit, the results of the fittings will not return to the
439BatchPage'. Instead, a Grid window will be provided once the fitting is
440completed. The Grid window is also accessible from the 'View' menu
441(see Figure 2).</p>
442<p>Note that only one model is used for all the data. The initial parameter
443values given in the control page will be used all the data fittings. If one
444wants the FitEngine to use the initial values from the results of the
445previous data fitting (if any), choose the 'Chain Fitting' option in the
446Fitting menubar, which will speed up the fitting especially when you have
447lots of, and similar, data sets.</p>
448</div>
449<div class="section" id="id8">
450<span id="batch-window"></span><h1>Batch Window</h1>
451<p>Batch Window provides an easy way to view the fit results, i.e., plot data,
452fits, and residuals. Batch window will be automatically shown after a batch
453fit is finished.</p>
454<p>Once closed, it can be opened anytime from the &quot;View&quot; menubar item (see
455Figure 2).</p>
456<img alt="restore_batch_window.bmp" src="restore_batch_window.bmp" />
457<p>Figure 2: Edit Menu:</p>
458</div>
459<div class="section" id="id9">
460<span id="edit-grid"></span><h1>Edit Grid</h1>
461<p>Once a batch fit is completed, all fitted and fixed model parameters are
462displayed to the current sheet of the batch window except the errors of the
463parameters. To view the errors, click on a given column then under <em>Edit</em>
464menubar item, and insert the desired parameter by selecting a menu item with
465the appropriated label. Empty column can be inserted in the same way. A
466column value can be customized by editing an existing empty column.</p>
467<p>To Remove column from the grid, select it, choose edit menu, and click the
468<em>'remove'</em>  menu item. Any removed column should reinserted whenever needed.</p>
469<p>All above options are also available when right clicking on a given column
470label(see Figure 3).</p>
471<p><em>Note:</em>  A column always needs to be selected in order to remove or insert a
472column in the grid.</p>
473<img alt="edit_menu.bmp" src="edit_menu.bmp" />
474<p>Figure 3: Edit Menu:</p>
475</div>
476<div class="section" id="id10">
477<span id="save-grid"></span><h1>Save Grid</h1>
478<p>To save the current page on the batch window, select the <em>'File'</em>  menubar
479item(see Figure 4), then choose the <em>'Save as'</em>  menu item to save it as a
480.csv file.</p>
481<p><em>Note:</em> The grid doesn't save the data array, fits, and the array residuals.
482As a result, the 'View (fit) Results' functionality will be lost when
483reloading the saved file.</p>
484<p>Warning! To ensure accuracy of saved fit results, it is recommended to save
485the current grid before modifying it .</p>
486</div>
487<div class="section" id="id11">
488<span id="open-batch-results"></span><h1>Open Batch Results</h1>
489<p>Any <em>csv</em>  file can be opened in the grid by selecting the <em>'Open'</em>  under
490the <em>'File'</em>  menu in the Grid Window(see Figure 4). All columns in the file
491will be displayed but insertion will not available. Insertion will be
492available only when at least one column will be removed from the grid.</p>
493<img alt="file_menu.bmp" src="file_menu.bmp" />
494<p>Figure 4: MenuBar:</p>
495</div>
496<div class="section" id="id12">
497<span id="plot"></span><h1>Plot</h1>
498<p>To <em>plot</em>  a column versus another, select one column at the time, click the
499<em>'Add'</em>  button next to the text control of X/Y -axis <em>Selection Range</em>  to
500plot the value of this column on the X/Y axis. Alternatively, all available
501range can be selected by clicking the column letter (eg. B). Repeat the same
502procedure the next axis. Finally, click the <em>'Plot'</em>  button. When clicking
503on <em>Add</em>  button, the grid will automatically fill the axis label, but
504different labels and units can be entered in the correct controls before
505clicking on the plot button.</p>
506<p><em>X/Y -Axis Selection Range</em> can be edited manually. These text controls
507allow the following types of expression (operation can be + - * /, or pow)</p>
508<p>1) if the current axis label range is a function of 1 or more columns, write
509this type of expression</p>
510<p>constant1  * column_name1 [minimum row index :  maximum  row index] operator
511constant2 * column_name2 [minimum row index :  maximum  row index]</p>
512<p>Example: radius [2 : 5] -3 * scale [2 : 5]</p>
513<p>2) if only some values of a given column are need but the range between the
514first row and the last row used is not continuous, write the following
515expression in the text control</p>
516<p>column_name1 [minimum row index1 :  maximum  row index1] , column_name1
517[minimum row index2 :  maximum  row index2]</p>
518<p>Example : radius [2 : 5] , radius [10 : 25]</p>
519<p>Note: Both text controls ( X and Y-axis Selection Ranges) need to be filled
520with valid entries for plotting to work. The dY-bar is optional (see Figure 5).</p>
521<img alt="plot_button.bmp" src="plot_button.bmp" />
522<p>Figure 5: Plotting</p>
523</div>
524<div class="section" id="view-column-cell-s">
525<span id="view-column-cell"></span><h1>View Column/Cell(s)</h1>
526<p>Select 1 or more cells from the same column, click the 'View Fits' button to
527display available curves.</p>
528<p>For example, select the cells of the  'Chi2'  column, then click the  'View Fits'
529button. The plots generates will represent the residuals  plots.</p>
530<p>If you select any cells of the 'Data' column and click the 'View Fits' button.
531It generates both  data and fits in the graph (see Figure 6).</p>
532<p>Alternatively, just click the column letter (eg. B) to choose all the
533available data sets, then simply click the 'View Fits' button to plot the
534data and fits.</p>
535<img alt="view_button.bmp" src="view_button.bmp" />
536<p>Figure 6: View Fits</p>
537<!-- ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ -->
538<p id="model-selection"><a class="reference internal" href="#model-type">Model_Type</a></p>
539<p><a class="reference internal" href="#change-model-parameters">Change_Model_Parameters</a></p>
540<p><a class="reference internal" href="#write-your-own-model">Write_your_Own_Model</a></p>
541</div>
542<div class="section" id="id13">
543<span id="model-type"></span><h1>Model Type</h1>
544<p>Models are grouped into three classes</p>
545<ul class="simple">
546<li><em>Shapes</em></li>
547<li><em>Shape-Independent</em></li>
548<li><em>Uncategorised</em></li>
549<li><em>Customized Models</em></li>
550<li><em>Structure Factor</em></li>
551</ul>
552</div>
553<div class="section" id="id14">
554<span id="change-model-parameters"></span><h1>Change Model Parameters</h1>
555<p>To visualize model in a different window, from menu click on <em>Model</em>. Select
556a type of model and then the name of your model.A new window will appear with
557the plot of your model with default values. Change model's parameters on
558<em>model view</em>  tab and view the plotted model with its new parameters.</p>
559</div>
560<div class="section" id="id15">
561<span id="write-your-own-model"></span><h1>Write your Own Model</h1>
562<p>The custom model editors are provided from 'Fitting' menu in the menu bar.
563See 'Custom model editor' in the side menu on left. Advanced users can write
564your own model and save it (in .py format) into <em>plugin_models</em>  directory in
565.sasview of your home directory (eg., username.sasview&gt;plugin_models). Your
566plugin model will be added into &quot;&lt;&gt;Customized Models&quot; on the next model
567selection.</p>
568<!-- ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ -->
569</div>
570<div class="section" id="id16">
571<span id="model-category-manager"></span><h1>Model Category Manager</h1>
572<p>Our SAS models are, by default, classified into 5 categories; shapes,
573shape-independent, structure factor, and customized models, where these
574categories (except the customized models) can be reassigned, added, and
575removed using 'Category Manager'. Each models can also be enabled(shown)/
576disabled(hidden) from the category that they belong. The Category Manager
577panel is accessible from the model category 'Modify' button in the fitting
578panel or the 'View/Category Manager' menu in the menu bar (Fig. 1).</p>
579<p>1) Enable/Disable models: Check/uncheck the check boxes to enable/disable the
580models (Fig. 2).</p>
581<p>2) Change category: Highlight a model in the list by left-clicking and click
582the 'Modify' button. In the 'Change Category' panel, one can create/use a
583category for the model, then click the 'Add' button. In order to delete a
584category, select a category name and click the 'Remove Selected' button
585(Fig. 3).</p>
586<p>3) To apply the changes made, hit the OK button. Otherwise, click the 'Cancel'
587button (Fig. 2).</p>
588<img alt="cat_fig0.bmp" src="cat_fig0.bmp" />
589<p>Fig.1</p>
590<img alt="cat_fig1.bmp" src="cat_fig1.bmp" />
591<p>Fig.2</p>
592<img alt="cat_fig2.bmp" src="cat_fig2.bmp" />
593<p>Fig.3</p>
594<!-- ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ -->
595</div>
596<div class="section" id="id17">
597<span id="model-functions"></span><h1>Model Functions</h1>
598<p>Model Documentation &lt;models/model_functions&gt;</p>
599<!-- ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ -->
600</div>
601<div class="section" id="id18">
602<span id="custom-model-editor"></span><h1>Custom Model Editor</h1>
603<p><a class="reference internal" href="#description">Description</a></p>
604<p><a class="reference internal" href="#new">New</a></p>
605<p><a class="reference internal" href="#sum-multi-p1-p2">Sum_Multi_p1_p2</a></p>
606<p><a class="reference internal" href="#advanced">Advanced</a></p>
607<p><a class="reference internal" href="#delete">Delete</a></p>
608<!-- ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ -->
609</div>
610<div class="section" id="id19">
611<span id="description"></span><h1>Description</h1>
612<p>This menu (Fitting/Edit Custom Model in the menu bar) interface is to provide
613you an easy way to write your own custom models. The changes in a model
614function are effective after it is re-selected from the combo-box menu.</p>
615<img alt="edit_model_menu.bmp" src="edit_model_menu.bmp" />
616</div>
617<div class="section" id="id20">
618<span id="new"></span><h1>New</h1>
619<p>This option is used to make a new model. A model code generated by this option
620can be viewed and further modified by the 'Advanced' option below.</p>
621<img alt="new_model.bmp" src="new_model.bmp" />
622</div>
623<div class="section" id="id21">
624<span id="sum-multi-p1-p2"></span><h1>Sum|Multi(p1,p2)</h1>
625<p>This option create a new sum (or multiplication) model. Fill up the (sum
626model function) name and the description. The description will show up on
627details button in the application. Then select the p1 or p2 model for the
628sum/multi model, select an operator as necessary and click the Apply button
629for activation. Hit the 'Close' button when it's done.</p>
630<img alt="sum_model.bmp" src="sum_model.bmp" />
631</div>
632<div class="section" id="id22">
633<span id="advanced"></span><h1>Advanced</h1>
634<p>The menu option shows all the files in the plugin_models folder. You can edit,
635modify, and save it. It is recommended to modify only the lines with arrow
636(-------). In the end of edit, 'Compile' and 'Run' from the menu bar to
637activate or to see the model working properly.</p>
638</div>
639<div class="section" id="id23">
640<span id="delete"></span><h1>Delete</h1>
641<p>The menu option is to delete the custom models. Just select the file name to
642delete.</p>
643<!-- ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ -->
644</div>
645<div class="section" id="id24">
646<span id="polydispersity-distributions"></span><h1>Polydispersity Distributions</h1>
647<p>Calculates the form factor for a polydisperse and/or angular population of
648particles with uniform scattering length density. The resultant form factor
649is normalized by the average particle volume such that</p>
650<p>P(q) = scale*&lt;F*F&gt;/Vol + bkg</p>
651<p>where F is the scattering amplitude and the&lt;&gt;denote an average over the size
652distribution.  Users should use PD (polydispersity: this definition is
653different from the typical definition in polymer science) for a size
654distribution and Sigma for an angular distribution (see below).</p>
655<p>Note that this computation is very time intensive thus applying polydispersion/
656angular distrubtion for more than one paramters or increasing Npts values
657might need extensive patience to complete the computation. Also note that
658even though it is time consuming, it is safer to have larger values of Npts
659and Nsigmas.</p>
660<p>The following five distribution functions are provided</p>
661<ul class="simple">
662<li><em>Rectangular_Distribution_</em></li>
663<li><em>Array_Distribution_</em></li>
664<li><em>Gaussian_Distribution_</em></li>
665<li><em>Lognormal_Distribution_</em></li>
666<li><em>Schulz_Distribution_</em></li>
667</ul>
668</div>
669<div class="section" id="id25">
670<span id="rectangular-distribution"></span><h1>Rectangular Distribution</h1>
671<img alt="pd_image001.png" src="pd_image001.png" />
672<p>The xmean is the mean of the distribution, w is the half-width, and Norm is a
673normalization factor which is determined during the numerical calculation.
674Note that the Sigma and the half width <em>w</em>  are different.</p>
675<p>The standard deviation is</p>
676<img alt="pd_image002.png" src="pd_image002.png" />
677<p>The PD (polydispersity) is</p>
678<img alt="pd_image003.png" src="pd_image003.png" />
679<img alt="pd_image004.jpg" src="pd_image004.jpg" />
680</div>
681<div class="section" id="id26">
682<span id="array-distribution"></span><h1>Array Distribution</h1>
683<p>This distribution is to be given by users as a txt file where the array
684should be defined by two columns in the order of x and f(x) values. The f(x)
685will be normalized by SasView during the computation.</p>
686<p>Example of an array in the file</p>
687<p>30        0.1
68832        0.3
68935        0.4
69036        0.5
69137        0.6
69239        0.7
69341        0.9</p>
694<p>We use only these array values in the computation, therefore the mean value
695given in the control panel, for example ‘radius = 60’, will be ignored.</p>
696</div>
697<div class="section" id="id27">
698<span id="gaussian-distribution"></span><h1>Gaussian Distribution</h1>
699<img alt="pd_image005.png" src="pd_image005.png" />
700<p>The xmean is the mean of the distribution and Norm is a normalization factor
701which is determined during the numerical calculation.</p>
702<p>The PD (polydispersity) is</p>
703<img alt="pd_image003.png" src="pd_image003.png" />
704<img alt="pd_image006.jpg" src="pd_image006.jpg" />
705</div>
706<div class="section" id="id28">
707<span id="lognormal-distribution"></span><h1>Lognormal Distribution</h1>
708<img alt="pd_image007.png" src="pd_image007.png" />
709<p>The /mu/=ln(xmed), xmed is the median value of the distribution, and Norm is a
710normalization factor which will be determined during the numerical calculation.
711The median value is the value given in the size parameter in the control panel,
712for example, “radius = 60â€ᅵ.</p>
713<p>The PD (polydispersity) is given by /sigma/</p>
714<img alt="pd_image008.png" src="pd_image008.png" />
715<p>For the angular distribution</p>
716<img alt="pd_image009.png" src="pd_image009.png" />
717<p>The mean value is given by xmean=exp(/mu/+p2/2). The peak value is given by
718xpeak=exp(/mu/-p2).</p>
719<img alt="pd_image010.jpg" src="pd_image010.jpg" />
720<p>This distribution function spreads more and the peak shifts to the left as the
721p increases, requiring higher values of Nsigmas and Npts.</p>
722</div>
723<div class="section" id="id29">
724<span id="schulz-distribution"></span><h1>Schulz Distribution</h1>
725<img alt="pd_image011.png" src="pd_image011.png" />
726<p>The xmean is the mean of the distribution and Norm is a normalization factor
727which is determined during the numerical calculation.</p>
728<p>The z = 1/p2– 1.</p>
729<p>The PD (polydispersity) is</p>
730<img alt="pd_image012.png" src="pd_image012.png" />
731<p>Note that the higher PD (polydispersity) might need higher values of Npts and
732Nsigmas. For example, at PD = 0.7 and radisus = 60 A, Npts &gt;= 160, and
733Nsigmas &gt;= 15 at least.</p>
734<img alt="pd_image013.jpg" src="pd_image013.jpg" />
735<!-- ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ -->
736</div>
737<div class="section" id="id30">
738<span id="smearing-computation"></span><h1>Smearing Computation</h1>
739<p><a class="reference internal" href="#slit-smearing">Slit_Smearing</a></p>
740<p><a class="reference internal" href="#pinhole-smearing">Pinhole_Smearing</a></p>
741<p><a class="reference internal" href="#d-smearing">2D_Smearing</a></p>
742</div>
743<div class="section" id="id31">
744<span id="slit-smearing"></span><h1>Slit Smearing</h1>
745<p>The sit smeared scattering intensity for SAS is defined by</p>
746<img alt="sm_image002.gif" src="sm_image002.gif" />
747<p>where Norm =</p>
748<img alt="sm_image003.gif" src="sm_image003.gif" />
749<p>Equation 1</p>
750<p>The functions <img alt="inlineimage004" src="sm_image004.gif" /> and <img alt="inlineimage005" src="sm_image005.gif" />
751refer to the slit width weighting function and the slit height weighting
752determined at the q point, respectively. Here, we assumes that the weighting
753function is described by a rectangular function, i.e.,</p>
754<img alt="sm_image006.gif" src="sm_image006.gif" />
755<p>Equation 2</p>
756<p>and</p>
757<img alt="sm_image007.gif" src="sm_image007.gif" />
758<p>Equation 3</p>
759<p>so that <img alt="inlineimage008" src="sm_image008.gif" /> <img alt="inlineimage009" src="sm_image009.gif" /> for <img alt="inlineimage010" src="sm_image010.gif" /> and u.</p>
760<p>The <img alt="inlineimage011" src="sm_image011.gif" /> and <img alt="inlineimage012" src="sm_image012.gif" /> stand for
761the slit height (FWHM/2) and the slit width (FWHM/2) in the q space. Now the
762integral of Equation 1 is simplified to</p>
763<img alt="sm_image013.gif" src="sm_image013.gif" />
764<p>Equation 4</p>
765</div>
766<div class="section" id="numerical-implementation-of-equation-4">
767<h1>Numerical Implementation of Equation 4</h1>
768</div>
769<div class="section" id="case-1">
770<h1>Case 1</h1>
771<p>For <img alt="inlineimage012" src="sm_image012.gif" /> = 0 and <img alt="inlineimage011" src="sm_image011.gif" /> = constant.</p>
772<img alt="sm_image016.gif" src="sm_image016.gif" />
773<p>For discrete q values, at the q values from the data points and at the q
774values extended up to qN= qi + <img alt="inlineimage011" src="sm_image011.gif" /> the smeared
775intensity can be calculated approximately</p>
776<img alt="sm_image017.gif" src="sm_image017.gif" />
777<p>Equation 5</p>
778<p><img alt="inlineimage018" src="sm_image018.gif" /> = 0 for <em>Is</em> in <em>j</em> &lt; <em>i</em> or <em>j</em> &gt; N-1*.</p>
779</div>
780<div class="section" id="case-2">
781<h1>Case 2</h1>
782<p>For <img alt="inlineimage012" src="sm_image012.gif" /> = constant and <img alt="inlineimage011" src="sm_image011.gif" /> = 0.</p>
783<p>Similarly to Case 1, we get</p>
784<p><img alt="inlineimage019" src="sm_image019.gif" /> for qp= qi- <img alt="inlineimage012" src="sm_image012.gif" /> and qN= qi+ <img alt="inlineimage012" src="sm_image012.gif" />. <img alt="inlineimage018" src="sm_image018.gif" /> = 0
785for <em>Is</em> in <em>j</em> &lt; <em>p</em> or <em>j</em> &gt; <em>N-1</em>.</p>
786</div>
787<div class="section" id="case-3">
788<h1>Case 3</h1>
789<p>For <img alt="inlineimage011" src="sm_image011.gif" /> = constant and
790<img alt="inlineimage011" src="sm_image011.gif" /> = constant.</p>
791<p>In this case, the best way is to perform the integration, Equation 1,
792numerically for both slit height and width. However, the numerical integration
793is not correct enough unless given a large number of iteration, say at least
79410000 by 10000 for each element of the matrix, W, which will take minutes and
795minutes to finish the calculation for a set of typical SAS data. An
796alternative way which is correct for slit width &lt;&lt; slit hight, is used in
797SasView. This method is a mixed method that combines method 1 with the
798numerical integration for the slit width.</p>
799<img alt="sm_image020.gif" src="sm_image020.gif" />
800<p>Equation 7</p>
801<p>for qp= qi- <img alt="inlineimage012" src="sm_image012.gif" /> and
802qN= qi+ <img alt="inlineimage012" src="sm_image012.gif" />. <img alt="inlineimage018" src="sm_image018.gif" /> = 0 for
803<em>Is</em> in <em>j</em> &lt; <em>p</em> or <em>j</em> &gt; <em>N-1</em>.</p>
804</div>
805<div class="section" id="id32">
806<span id="pinhole-smearing"></span><h1>Pinhole Smearing</h1>
807<p>The pinhole smearing computation is done similar to the case above except
808that the weight function used is the Gaussian function, so that the Equation 6
809for this case becomes</p>
810<img alt="sm_image021.gif" src="sm_image021.gif" />
811<p>Equation 8</p>
812<p>For all the cases above, the weighting matrix <em>W</em> is calculated when the
813smearing is called at the first time, and it includes the ~ 60 q values
814(finely binned evenly) below (&gt;0) and above the q range of data in order
815to cover all data points of the smearing computation for a given model and
816for a given slit size. The <em>Norm</em>  factor is found numerically with the
817weighting matrix, and considered on <em>Is</em> computation.</p>
818</div>
819<div class="section" id="id33">
820<span id="d-smearing"></span><h1>2D Smearing</h1>
821<p>The 2D smearing computation is done similar to the 1D pinhole smearing above
822except that the weight function used was the 2D elliptical Gaussian function</p>
823<img alt="sm_image022.gif" src="sm_image022.gif" />
824<p>Equation 9</p>
825<p>In Equation 9, x0 = qcos/theta/ and y0 = qsin/theta/, and the primed axes
826are in the coordinate rotated by an angle /theta/ around the z-axis (below)
827so that x’0= x0cos/theta/+y0sin/theta/ and y’0= -x0sin/theta/+y0cos/theta/.</p>
828<p>Note that the rotation angle is zero for x-y symmetric elliptical Gaussian
829distribution. The A is a normalization factor.</p>
830<img alt="sm_image023.gif" src="sm_image023.gif" />
831<p>Now we consider a numerical integration where each bins in /theta/ and R are
832<em>evenly</em> (this is to simplify the equation below) distributed by /delta//theta/
833and /delta/R, respectively, and it is assumed that I(x’, y’) is constant
834within the bins which in turn becomes</p>
835<img alt="sm_image024.gif" src="sm_image024.gif" />
836<p>Equation 10</p>
837<p>Since we have found the weighting factor on each bin points, it is convenient
838to transform x’-y’ back to x-y coordinate (rotating it by -/theta/ around z
839axis). Then, for the polar symmetric smear</p>
840<img alt="sm_image025.gif" src="sm_image025.gif" />
841<p>Equation 11</p>
842<p>where</p>
843<img alt="sm_image026.gif" src="sm_image026.gif" />
844<p>while for the x-y symmetric smear</p>
845<img alt="sm_image027.gif" src="sm_image027.gif" />
846<p>Equation 12</p>
847<p>where</p>
848<img alt="sm_image028.gif" src="sm_image028.gif" />
849<p>Here, the current version of the SasView uses Equation 11 for 2D smearing
850assuming that all the Gaussian weighting functions are aligned in the polar
851coordinate.</p>
852<p>In the control panel, the higher accuracy indicates more and finer binnng
853points so that it costs more in time.</p>
854<!-- ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ -->
855</div>
856<div class="section" id="id34">
857<span id="polarisation-magnetic-scattering"></span><h1>Polarisation/Magnetic Scattering</h1>
858<p>Magnetic scattering is implemented in five (2D) models</p>
859<ul class="simple">
860<li><em>SphereModel</em></li>
861<li><em>CoreShellModel</em></li>
862<li><em>CoreMultiShellModel</em></li>
863<li><em>CylinderModel</em></li>
864<li><em>ParallelepipedModel</em></li>
865</ul>
866<p>In general, the scattering length density (SLD) in each regions where the
867SLD (=/beta/) is uniform, is a combination of the nuclear and magnetic SLDs and
868depends on the spin states of the neutrons as follows. For magnetic scattering,
869only the magnetization component, <em>M*perp, perpendicular to the scattering
870vector *Q</em> contributes to the the magnetic scattering length.</p>
871<img alt="mag_vector.bmp" src="mag_vector.bmp" />
872<p>The magnetic scattering length density is then</p>
873<img alt="dm_eq.gif" src="dm_eq.gif" />
874<p>where /gamma/ = -1.913 the gyromagnetic ratio, /mu/B is the Bohr magneton, r0
875is the classical radius of electron, and <em>/sigma/</em> is the Pauli spin. For
876polarised neutron, the magnetic scattering is depending on the spin states.</p>
877<p>Let's consider that the incident neutrons are polarized parallel (+)/
878anti-parallel (-) to the x' axis (See both Figures above). The possible
879out-coming states then are + and - states for both incident states</p>
880<p>Non-spin flips: (+ +) and (- -)
881Spin flips:     (+ -) and (- +)</p>
882<img alt="M_angles_pic.bmp" src="M_angles_pic.bmp" />
883<p>Now, let's assume that the angles of the <em>Q</em>  vector and the spin-axis (x')
884against x-axis are /phi/ and /theta/up, respectively (See Figure above). Then,
885depending upon the polarisation (spin) state of neutrons, the scattering length
886densities, including the nuclear scattering length density (/beta/N) are given
887as, for non-spin-flips</p>
888<img alt="sld1.gif" src="sld1.gif" />
889<p>for spin-flips</p>
890<img alt="sld2.gif" src="sld2.gif" />
891<p>where</p>
892<img alt="mxp.gif" src="mxp.gif" />
893<img alt="myp.gif" src="myp.gif" />
894<img alt="mzp.gif" src="mzp.gif" />
895<img alt="mqx.gif" src="mqx.gif" />
896<img alt="mqy.gif" src="mqy.gif" />
897<p>Here, the M0x, M0y and M0z are the x, y and z components of the magnetization
898vector given in the xyz lab frame. The angles of the magnetization, /theta/M
899and /phi/M as defined in the Figure (above)</p>
900<img alt="m0x_eq.gif" src="m0x_eq.gif" />
901<img alt="m0y_eq.gif" src="m0y_eq.gif" />
902<img alt="m0z_eq.gif" src="m0z_eq.gif" />
903<p>The user input parameters are M0_sld = DMM0, Up_theta = /theta/up,
904M_theta = /theta/M, and M_phi = /phi/M. The 'Up_frac_i' and 'Up_frac_f' are
905the ratio</p>
906<p>(spin up)/(spin up + spin down)</p>
907<p>neutrons before the sample and at the analyzer, respectively.</p>
908<p><em>Note:</em> The values of the 'Up_frac_i' and 'Up_frac_f' must be in the range
909between 0 and 1.</p>
910<!-- ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ -->
911</div>
912<div class="section" id="id35">
913<span id="key-combinations"></span><h1>Key Combinations</h1>
914<p><a class="reference internal" href="#copy-paste">Copy_Paste</a></p>
915<p><a class="reference internal" href="#bookmark">Bookmark</a></p>
916<p><a class="reference internal" href="#graph-context-menu">Graph_Context_Menu</a></p>
917<p><a class="reference internal" href="#ftolerance">FTolerance</a></p>
918</div>
919<div class="section" id="id36">
920<span id="copy-paste"></span><h1>Copy &amp; Paste</h1>
921<p>To copy the parameter values in a Fit(Model) panel to the clipboard:</p>
922<p><em>Ctrl(Cmd on MAC) + Left(Mouse)Click</em>  on the panel.</p>
923<p>To paste the parameter values to a Fit(Model)panel from the clipboard:</p>
924<p><em>Ctrl(Cmd on MAC) + Shift + Left(Mouse)Click</em>  on the panel.</p>
925<p>If this operation is successful, it will say so in the info line at the
926bottom of the SasView window.</p>
927</div>
928<div class="section" id="id37">
929<span id="bookmark"></span><h1>Bookmark</h1>
930<p>Bookmark of a fit-panel or model-panel status:</p>
931<p><em>(Mouse)Right-Click</em>  and select the bookmark in the popup list.</p>
932</div>
933<div class="section" id="id38">
934<span id="graph-context-menu"></span><h1>Graph Context Menu</h1>
935<p>To get the graph context menu to print, copy, save data, (2D)average, etc.:</p>
936<p><em>Locate the mouse point on the plot to highlight and *(Mouse) Right Click</em>
937to bring up the full menu.</p>
938</div>
939<div class="section" id="ftolerance-scipy">
940<span id="ftolerance"></span><h1>FTolerance (SciPy)</h1>
941<p>To change the ftol value of the Scipy FitEngine (leastsq):</p>
942<p>First, make sure that the Fit panel has data and a model selected.</p>
943<p><em>Ctrl(Cmd on MAC) + Shift + Alt + Right(Mouse)Click</em>  on the panel.</p>
944<p>Then, set up the value in the dialog panel.</p>
945<p>If this operation is successful, the new ftol value will be displayed in the
946info line at the bottom of the SV window.Note that increasing the ftol value
947may cause for the fitting to terminate with higher <a href="#id39"><span class="problematic" id="id40">|</span></a>chi|sq.</p>
948<div class="system-message" id="id39">
949<p class="system-message-title">System Message: WARNING/2 (<tt class="docutils">C:/Code/Eclipse_workspace/SasViewTrunk/src/sas/perspectives/fitting/media/fitting_help.rst</tt>, line 947); <em><a href="#id40">backlink</a></em></p>
950Inline substitution_reference start-string without end-string.</div>
951<!-- ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ -->
952</div>
953<div class="section" id="id41">
954<span id="status-bar-help"></span><h1>Status Bar Help</h1>
955<p><a class="reference internal" href="#message-warning-hint">Message_Warning_Hint</a></p>
956<p><a class="reference internal" href="#console">Console</a></p>
957</div>
958<div class="section" id="id42">
959<span id="message-warning-hint"></span><h1>Message/Warning/Hint</h1>
960<p>The status bar located at the bottom of the application frame, displays
961messages, hints, warnings and errors.</p>
962</div>
963<div class="section" id="id43">
964<span id="console"></span><h1>Console</h1>
965<p>Select <em>light bulb/info icon</em>  button in the status bar at the bottom of the
966application window to display available history. During a long task, the
967console can also help users to understand the status in progressing.</p>
968</div>
969</div>
970</body>
971</html>
Note: See TracBrowser for help on using the repository browser.