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

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.2release_4.0.1ticket-1009ticket-1094-headlessticket-1242-2d-resolutionticket-1243ticket-1249ticket885unittest-saveload
Last change on this file since a3f125f0 was 98b30b4, checked in by smk78, 10 years ago

Dupilicate links resolved

  • Property mode set to 100644
File size: 27.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
6.. |beta| unicode:: U+03B2
7.. |gamma| unicode:: U+03B3
8.. |mu| unicode:: U+03BC
9.. |sigma| unicode:: U+03C3
10.. |phi| unicode:: U+03C6
11.. |theta| unicode:: U+03B8
[98b30b4]12.. |chi| unicode:: U+03C7
13
14.. |inlineimage004| image:: sm_image004.gif
15.. |inlineimage005| image:: sm_image005.gif
16.. |inlineimage008| image:: sm_image008.gif
17.. |inlineimage009| image:: sm_image009.gif
18.. |inlineimage010| image:: sm_image010.gif
19.. |inlineimage011| image:: sm_image011.gif
20.. |inlineimage012| image:: sm_image012.gif
21.. |inlineimage018| image:: sm_image018.gif
22.. |inlineimage019| image:: sm_image019.gif
23
[ec392464]24
25Fitting Perspective
26===================
27
28Load_a_File_
29
30Single_Fit_
31
32Simultaneous_Fitting_
33
34Batch_Fitting_
35
36Model_Selection_
37
38Model_Category_Manager_
39
40Model_Functions_
41
42Custom_Model_Editor_
43
44Polydispersity_Distributions_
45
46Smearing_Computation_
47
48Polarisation_Magnetic_Scattering_
49
50Key_Combinations_
51
52Status_Bar_Help_
53
54.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
55
56..  _Load_a_File:
57
58Load a File
59-----------
60
61From Menu go to *Data* -> *Load Data File(or Folder)* . Select a file/folder
62from the menu bar and click on Open button. Data contained in the file will be
63displayed. To cancel the loading click on *cancel* . In case a file can not be
64loaded, an error message will be displayed on the statusbar.
65
66.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
67
68.. _Single_Fit:
69
70Single Fit
71----------
72
73One of two fit-engines can be chosen from the Fitting menu bar. The Simple Fit-
74engine uses Scipy's leasqr and the Complex Fit-Engine is a custom optimizer
[98b30b4]75that provides a better chance to find the global minimum of the |chi| 2 but that
[ec392464]76requires longer computation time. In order to set a data to a control panel
77(FitPage), see the "DataLoader Help". Once a data set to the FiPage, select a
78model from the combo box. The default parameters of the model will be display.
79Set initial parameters if need. Check and uncheck parameters to fit/fix. Click
80the *'Fit'*  button. When the fitting is finished, the resultant parameter
81values will be displayed with the errors. If a error is missing, it generally
82means that the corresponding parameter is not very depending on the model. The
83chisq/Npt_fit and the plot associated with the fit operation will be also
84updated.
85
86.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
87
88..  _Simultaneous_Fitting:
89
90Simultaneous Fitting
91--------------------
92
93This fitting option enables to set a number of the constraints between the
94parameters of fitting(s). It requires one or more FitPages with a data and a
95model set for the fitting, and performs multiple fittings given by the
96FitPage(s). The Complex (ParkMC) FitEngine will be used automatically.
97
98Simultaneous Fit without Constraint
99
100Assuming some FitPages are already set up, check the checkboxes of the
101model_data rows to fit. And click the 'Fit' button. The results will return to
102each FitPages.
103
104Note that the chi2/Npts returned is the sum of the chi2/Npts of each fits. If
105one needs the chi2 value only for a page, click the 'Compute' button in the
106FitPage to recalculate.
107
108Simultaneous Fit with Constraint
109
110Enter constraint in the text control next to *constraint fit*  button.
111Constraint should be of type model1 parameter name = f(model2 parameter name)
112for example, M0.radius=2*M1.radius. Many constraints can be entered for a
113single fit. Each of them should be separated by a newline charater or ";"
114The easy setup can generate many constraint inputs easily when the selected
115two models are the same type.
116
117Note that the chi2/Npts returned is the sum of the chi2/Npts of each fits.
118If one needs the chi2 value only for one fit, click the 'Compute' button in
119the FitPage to recalculate.
120
121.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
122
123..  _Batch_Fitting:
124
125Batch Fitting
126-------------
127
128Batch_Fit_
129
130Batch_Window_
131
132Edit_Grid_
133
134Save_Grid_
135
136Open_Batch_Results_
137
138Plot_
139
140View_Column_Cell_
141
142.. _Batch_Fit:
143
144Batch Fit
145---------
146
147Create a *Batch Page* by selecting the *Batch* radio button on the DataExplorer
148(see figure below) and for a new control page select 'New FitPage' in the
149Fitting menubar.
150
151.. image:: batch_button_area.bmp
152
153Figure 1: MenuBar:
154
155Load Data to the DataExplorer if not already loaded.
156
157Select one or more data sets by checking the check boxes, and then make sure
158that "Fitting" is selected in the dropdown menu next to the "Send To" button.
159Once ready, click the 'Send To' button to set data to a BatchPage. If already
160an empty batch page exists, it will be set there. Otherwise it will create a
161new Batch Page. Set up the model and the parameter values as same as a single
162fitting (see Single Fit help) <Single_Fit_>. Then use 'Fit' button to
163perform the fitting.
164
165Unlike a single fit, the results of the fittings will not return to the
166BatchPage'. Instead, a Grid window will be provided once the fitting is
167completed. The Grid window is also accessible from the 'View' menu
168(see Figure 2).
169
170Note that only one model is used for all the data. The initial parameter
171values given in the control page will be used all the data fittings. If one
172wants the FitEngine to use the initial values from the results of the
173previous data fitting (if any), choose the 'Chain Fitting' option in the
174Fitting menubar, which will speed up the fitting especially when you have
175lots of, and similar, data sets.
176
177.. _Batch_Window:
178
179Batch Window
180------------
181Batch Window provides an easy way to view the fit results, i.e., plot data,
182fits, and residuals. Batch window will be automatically shown after a batch
183fit is finished.
184
185Once closed, it can be opened anytime from the "View" menubar item (see
186Figure 2).
187
188.. image:: restore_batch_window.bmp
189
190Figure 2: Edit Menu:
191
192.. _Edit_Grid:
193
194Edit Grid
195---------
196
197Once a batch fit is completed, all fitted and fixed model parameters are
198displayed to the current sheet of the batch window except the errors of the
199parameters. To view the errors, click on a given column then under *Edit* 
200menubar item, and insert the desired parameter by selecting a menu item with
201the appropriated label. Empty column can be inserted in the same way. A
202column value can be customized by editing an existing empty column.
203
204To Remove column from the grid, select it, choose edit menu, and click the
205*'remove'*  menu item. Any removed column should reinserted whenever needed.
206
207All above options are also available when right clicking on a given column
208label(see Figure 3).
209
210*Note:*  A column always needs to be selected in order to remove or insert a
211column in the grid.
212
213.. image:: edit_menu.bmp
214
215Figure 3: Edit Menu:
216
217.. _Save_Grid:
218
219Save Grid
220---------
221To save the current page on the batch window, select the *'File'*  menubar
222item(see Figure 4), then choose the *'Save as'*  menu item to save it as a
223.csv file.
224
225*Note:* The grid doesn't save the data array, fits, and the array residuals.
226As a result, the 'View (fit) Results' functionality will be lost when
227reloading the saved file.
228
229Warning! To ensure accuracy of saved fit results, it is recommended to save
230the current grid before modifying it .
231
232.. _Open_Batch_Results:
233
234Open Batch Results
235------------------
236
237Any *csv*  file can be opened in the grid by selecting the *'Open'*  under
238the *'File'*  menu in the Grid Window(see Figure 4). All columns in the file
239will be displayed but insertion will not available. Insertion will be
240available only when at least one column will be removed from the grid.
241
242.. image:: file_menu.bmp
243
244Figure 4: MenuBar:
245
246.. _Plot:
247
248Plot
249----
250
251To *plot*  a column versus another, select one column at the time, click the
252*'Add'*  button next to the text control of X/Y -axis *Selection Range*  to
253plot the value of this column on the X/Y axis. Alternatively, all available
254range can be selected by clicking the column letter (eg. B). Repeat the same
255procedure the next axis. Finally, click the *'Plot'*  button. When clicking
256on *Add*  button, the grid will automatically fill the axis label, but
257different labels and units can be entered in the correct controls before
258clicking on the plot button.
259
260*X/Y -Axis Selection Range* can be edited manually. These text controls
261allow the following types of expression (operation can be + - * /, or pow)
262 
2631) if the current axis label range is a function of 1 or more columns, write
264this type of expression
265
266constant1  * column_name1 [minimum row index :  maximum  row index] operator
267constant2 * column_name2 [minimum row index :  maximum  row index]
268
269Example: radius [2 : 5] -3 * scale [2 : 5]
270
2712) if only some values of a given column are need but the range between the
272first row and the last row used is not continuous, write the following
273expression in the text control
274
275column_name1 [minimum row index1 :  maximum  row index1] , column_name1
276[minimum row index2 :  maximum  row index2]
277
278Example : radius [2 : 5] , radius [10 : 25]
279
280Note: Both text controls ( X and Y-axis Selection Ranges) need to be filled
281with valid entries for plotting to work. The dY-bar is optional (see Figure 5).
282
283.. image:: plot_button.bmp
284
285Figure 5: Plotting
286
287.. _View_Column_Cell:
288
289View Column/Cell(s)
290-------------------
291
292Select 1 or more cells from the same column, click the 'View Fits' button to
293display available curves.
294
295For example, select the cells of the  'Chi2'  column, then click the  'View Fits' 
296button. The plots generates will represent the residuals  plots.
297 
298If you select any cells of the 'Data' column and click the 'View Fits' button.
299It generates both  data and fits in the graph (see Figure 6).
300
301Alternatively, just click the column letter (eg. B) to choose all the
302available data sets, then simply click the 'View Fits' button to plot the
303data and fits.
304
305.. image:: view_button.bmp
306
307Figure 6: View Fits
308
309.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
310
311..  _Model_Selection:
312
313Model_Type_
314
315Change_Model_Parameters_
316
317Write_your_Own_Model_
318
319.. _Model_Type:
320
321Model Type
322----------
323
324Models are grouped into three classes
325
326*  *Shapes* 
327*  *Shape-Independent* 
328*  *Uncategorised*
329*  *Customized Models* 
330*  *Structure Factor*
331
332.. _Change_Model_Parameters:
333
334Change Model Parameters
335-----------------------
336
337To visualize model in a different window, from menu click on *Model*. Select
338a type of model and then the name of your model.A new window will appear with
339the plot of your model with default values. Change model's parameters on
340*model view*  tab and view the plotted model with its new parameters.
341
342.. _Write_your_Own_Model:
343
344Write your Own Model
345--------------------
346
347The custom model editors are provided from 'Fitting' menu in the menu bar.
348See 'Custom model editor' in the side menu on left. Advanced users can write
349your own model and save it (in .py format) into *plugin_models*  directory in
350.sasview of your home directory (eg., username\.sasview>\plugin_models). Your
351plugin model will be added into "<>Customized Models" on the next model
352selection.
353
354.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
355
356..  _Model_Category_Manager:
357
358Model Category Manager
359----------------------
360
361Our SAS models are, by default, classified into 5 categories; shapes,
362shape-independent, structure factor, and customized models, where these
363categories (except the customized models) can be reassigned, added, and
364removed using 'Category Manager'. Each models can also be enabled(shown)/
365disabled(hidden) from the category that they belong. The Category Manager
366panel is accessible from the model category 'Modify' button in the fitting
367panel or the 'View/Category Manager' menu in the menu bar (Fig. 1).
368
3691) Enable/Disable models: Check/uncheck the check boxes to enable/disable the
370models (Fig. 2).
371
3722) Change category: Highlight a model in the list by left-clicking and click
373the 'Modify' button. In the 'Change Category' panel, one can create/use a
374category for the model, then click the 'Add' button. In order to delete a
375category, select a category name and click the 'Remove Selected' button
376(Fig. 3).
377
3783) To apply the changes made, hit the OK button. Otherwise, click the 'Cancel'
379button (Fig. 2).
380
381.. image:: cat_fig0.bmp
382
383Fig.1
384
385.. image:: cat_fig1.bmp
386
387Fig.2
388
389.. image:: cat_fig2.bmp
390
391Fig.3
392
393.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
394
395..  _Model_Functions:
396
397Model Functions
398---------------
399
400Model Documentation <models/model_functions>
401
402.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
403
404..  _Custom_Model_Editor:
405
406Custom Model Editor
407-------------------
408
409Description_
410
411New_
412
413Sum_Multi_p1_p2_
414
415Advanced_
416
417Delete_
418
419.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
420
421.. _Description:
422
423Description
424-----------
425
426This menu (Fitting/Edit Custom Model in the menu bar) interface is to provide
427you an easy way to write your own custom models. The changes in a model
428function are effective after it is re-selected from the combo-box menu.
429
430.. image:: edit_model_menu.bmp
431
432.. _New:
433
434New
435---
436
437This option is used to make a new model. A model code generated by this option
438can be viewed and further modified by the 'Advanced' option below.
439
440.. image:: new_model.bmp
441
442.. _Sum_Multi_p1_p2:
443
444Sum|Multi(p1,p2)
445----------------
446
447This option create a new sum (or multiplication) model. Fill up the (sum
448model function) name and the description. The description will show up on
449details button in the application. Then select the p1 or p2 model for the
450sum/multi model, select an operator as necessary and click the Apply button
451for activation. Hit the 'Close' button when it's done.
452
453.. image:: sum_model.bmp
454
455.. _Advanced:
456
457Advanced
458--------
459
460The menu option shows all the files in the plugin_models folder. You can edit,
461modify, and save it. It is recommended to modify only the lines with arrow
462(-------). In the end of edit, 'Compile' and 'Run' from the menu bar to
463activate or to see the model working properly.
464
465.. _Delete:
466
467Delete
468------
469
470The menu option is to delete the custom models. Just select the file name to
471delete.
472
473.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
474
475..  _Polydispersity_Distributions:
476
477Polydispersity Distributions
478----------------------------
479
480Calculates the form factor for a polydisperse and/or angular population of
481particles with uniform scattering length density. The resultant form factor
482is normalized by the average particle volume such that
483
484P(q) = scale*\<F*F\>/Vol + bkg
485
486where F is the scattering amplitude and the\<\>denote an average over the size
487distribution.  Users should use PD (polydispersity: this definition is
488different from the typical definition in polymer science) for a size
489distribution and Sigma for an angular distribution (see below).
490
491Note that this computation is very time intensive thus applying polydispersion/
492angular distrubtion for more than one paramters or increasing Npts values
493might need extensive patience to complete the computation. Also note that
494even though it is time consuming, it is safer to have larger values of Npts
495and Nsigmas.
496
497The following five distribution functions are provided
498
499*  *Rectangular_Distribution_*
500*  *Array_Distribution_*
501*  *Gaussian_Distribution_*
502*  *Lognormal_Distribution_*
503*  *Schulz_Distribution_*
504
505.. _Rectangular_Distribution:
506
507Rectangular Distribution
508------------------------
509
510.. image:: pd_image001.png
511
512The xmean is the mean of the distribution, w is the half-width, and Norm is a
513normalization factor which is determined during the numerical calculation.
514Note that the Sigma and the half width *w*  are different.
515
516The standard deviation is
517
518.. image:: pd_image002.png
519
520The PD (polydispersity) is
521
522.. image:: pd_image003.png
523
524.. image:: pd_image004.jpg
525
526.. _Array_Distribution:
527
528Array Distribution
529------------------
530
531This distribution is to be given by users as a txt file where the array
532should be defined by two columns in the order of x and f(x) values. The f(x)
533will be normalized by SasView during the computation.
534
535Example of an array in the file
536
53730        0.1
53832        0.3
53935        0.4
54036        0.5
54137        0.6
54239        0.7
54341        0.9
544
545We use only these array values in the computation, therefore the mean value
[98b30b4]546given in the control panel, for example ‘radius = 60’, will be ignored.
[ec392464]547
548.. _Gaussian_Distribution:
549
550Gaussian Distribution
551---------------------
552
553.. image:: pd_image005.png
554
555The xmean is the mean of the distribution and Norm is a normalization factor
556which is determined during the numerical calculation.
557
558The PD (polydispersity) is
559
560.. image:: pd_image003.png
561
562.. image:: pd_image006.jpg
563
564.. _Lognormal_Distribution:
565
566Lognormal Distribution
567----------------------
568
569.. image:: pd_image007.png
570
571The /mu/=ln(xmed), xmed is the median value of the distribution, and Norm is a
572normalization factor which will be determined during the numerical calculation.
573The median value is the value given in the size parameter in the control panel,
[98b30b4]574for example, “radius = 60â€ᅵ.
[ec392464]575
576The PD (polydispersity) is given by /sigma/
577
578.. image:: pd_image008.png
579
580For the angular distribution
581
582.. image:: pd_image009.png
583
584The mean value is given by xmean=exp(/mu/+p2/2). The peak value is given by
585xpeak=exp(/mu/-p2).
586
587.. image:: pd_image010.jpg
588
589This distribution function spreads more and the peak shifts to the left as the
590p increases, requiring higher values of Nsigmas and Npts.
591
592.. _Schulz_Distribution:
593
594Schulz Distribution
595-------------------
596
597.. image:: pd_image011.png
598
599The xmean is the mean of the distribution and Norm is a normalization factor
600which is determined during the numerical calculation.
601
[98b30b4]602The z = 1/p2– 1.
[ec392464]603
604The PD (polydispersity) is
605
606.. image:: pd_image012.png
607
608Note that the higher PD (polydispersity) might need higher values of Npts and
609Nsigmas. For example, at PD = 0.7 and radisus = 60 A, Npts >= 160, and
610Nsigmas >= 15 at least.
611
612.. image:: pd_image013.jpg
613
614.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
615
616.. _Smearing_Computation:
617
618Smearing Computation
619--------------------
620
621Slit_Smearing_
622
623Pinhole_Smearing_
624
6252D_Smearing_
626
627.. _Slit_Smearing:
628
629Slit Smearing
630-------------
631
632The sit smeared scattering intensity for SAS is defined by
633
634.. image:: sm_image002.gif
635
636where Norm =
637
638.. image:: sm_image003.gif
639
640Equation 1
641
[98b30b4]642The functions |inlineimage004| and |inlineimage005|
[ec392464]643refer to the slit width weighting function and the slit height weighting
644determined at the q point, respectively. Here, we assumes that the weighting
645function is described by a rectangular function, i.e.,
646
647.. image:: sm_image006.gif
648
649Equation 2
650
651and
652
653.. image:: sm_image007.gif
654
655Equation 3
656
[98b30b4]657so that |inlineimage008| |inlineimage009| for |inlineimage010| and u.
[ec392464]658
[98b30b4]659The |inlineimage011| and |inlineimage012| stand for
[ec392464]660the slit height (FWHM/2) and the slit width (FWHM/2) in the q space. Now the
661integral of Equation 1 is simplified to
662
663.. image:: sm_image013.gif
664
665Equation 4
666
667Numerical Implementation of Equation 4
668--------------------------------------
669
670Case 1
671------
672
[98b30b4]673For |inlineimage012| = 0 and |inlineimage011| = constant.
[ec392464]674
675.. image:: sm_image016.gif
676
677For discrete q values, at the q values from the data points and at the q
[98b30b4]678values extended up to qN= qi + |inlineimage011| the smeared
[ec392464]679intensity can be calculated approximately
680
681.. image:: sm_image017.gif
682
683Equation 5
684
[98b30b4]685|inlineimage018| = 0 for *Is* in *j* < *i* or *j* > N-1*.
[ec392464]686
687Case 2
688------
689
[98b30b4]690For |inlineimage012| = constant and |inlineimage011| = 0.
[ec392464]691
692Similarly to Case 1, we get
693
[98b30b4]694|inlineimage019| for qp= qi- |inlineimage012| and qN= qi+ |inlineimage012|. |inlineimage018| = 0
[ec392464]695for *Is* in *j* < *p* or *j* > *N-1*.
696
697Case 3
698------
699
[98b30b4]700For |inlineimage011| = constant and
701|inlineimage011| = constant.
[ec392464]702
703In this case, the best way is to perform the integration, Equation 1,
704numerically for both slit height and width. However, the numerical integration
705is not correct enough unless given a large number of iteration, say at least
70610000 by 10000 for each element of the matrix, W, which will take minutes and
707minutes to finish the calculation for a set of typical SAS data. An
708alternative way which is correct for slit width << slit hight, is used in
709SasView. This method is a mixed method that combines method 1 with the
710numerical integration for the slit width.
711
712.. image:: sm_image020.gif
713
714Equation 7
715
[98b30b4]716for qp= qi- |inlineimage012| and
717qN= qi+ |inlineimage012|. |inlineimage018| = 0 for
[ec392464]718*Is* in *j* < *p* or *j* > *N-1*.
719
720.. _Pinhole_Smearing:
721
722Pinhole Smearing
723----------------
724
725The pinhole smearing computation is done similar to the case above except
726that the weight function used is the Gaussian function, so that the Equation 6
727for this case becomes
728
729.. image:: sm_image021.gif
730
731Equation 8
732
733For all the cases above, the weighting matrix *W* is calculated when the
734smearing is called at the first time, and it includes the ~ 60 q values
735(finely binned evenly) below (\>0) and above the q range of data in order
736to cover all data points of the smearing computation for a given model and
737for a given slit size. The *Norm*  factor is found numerically with the
738weighting matrix, and considered on *Is* computation.
739
740.. _2D_Smearing:
741
7422D Smearing
743-----------
744
745The 2D smearing computation is done similar to the 1D pinhole smearing above
746except that the weight function used was the 2D elliptical Gaussian function
747
748.. image:: sm_image022.gif
749
750Equation 9
751
752In Equation 9, x0 = qcos/theta/ and y0 = qsin/theta/, and the primed axes
753are in the coordinate rotated by an angle /theta/ around the z-axis (below)
[98b30b4]754so that x’0= x0cos/theta/+y0sin/theta/ and y’0= -x0sin/theta/+y0cos/theta/.
[ec392464]755
756Note that the rotation angle is zero for x-y symmetric elliptical Gaussian
757distribution. The A is a normalization factor.
758
759.. image:: sm_image023.gif
760
761Now we consider a numerical integration where each bins in /theta/ and R are
762*evenly* (this is to simplify the equation below) distributed by /delta//theta/
[98b30b4]763and /delta/R, respectively, and it is assumed that I(x’, y’) is constant
[ec392464]764within the bins which in turn becomes
765
766.. image:: sm_image024.gif
767
768Equation 10
769
770Since we have found the weighting factor on each bin points, it is convenient
[98b30b4]771to transform x’-y’ back to x-y coordinate (rotating it by -/theta/ around z
[ec392464]772axis). Then, for the polar symmetric smear
773
774.. image:: sm_image025.gif
775
776Equation 11
777
778where
779
780.. image:: sm_image026.gif
781
782while for the x-y symmetric smear
783
784.. image:: sm_image027.gif
785
786Equation 12
787
788where
789
790.. image:: sm_image028.gif
791
792Here, the current version of the SasView uses Equation 11 for 2D smearing
793assuming that all the Gaussian weighting functions are aligned in the polar
794coordinate.
795
796In the control panel, the higher accuracy indicates more and finer binnng
797points so that it costs more in time.
798
799.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
800
801.. _Polarisation_Magnetic_Scattering:
802
803Polarisation/Magnetic Scattering
804--------------------------------
805
806Magnetic scattering is implemented in five (2D) models
807
808*  *SphereModel*
809*  *CoreShellModel*
810*  *CoreMultiShellModel*
811*  *CylinderModel*
812*  *ParallelepipedModel*
813
814In general, the scattering length density (SLD) in each regions where the
815SLD (=/beta/) is uniform, is a combination of the nuclear and magnetic SLDs and
816depends on the spin states of the neutrons as follows. For magnetic scattering,
817only the magnetization component, *M*perp, perpendicular to the scattering
818vector *Q* contributes to the the magnetic scattering length.
819
820.. image:: mag_vector.bmp
821
822The magnetic scattering length density is then
823
824.. image:: dm_eq.gif
825
826where /gamma/ = -1.913 the gyromagnetic ratio, /mu/B is the Bohr magneton, r0
827is the classical radius of electron, and */sigma/* is the Pauli spin. For
828polarised neutron, the magnetic scattering is depending on the spin states.
829
830Let's consider that the incident neutrons are polarized parallel (+)/
831anti-parallel (-) to the x' axis (See both Figures above). The possible
832out-coming states then are + and - states for both incident states
833
834Non-spin flips: (+ +) and (- -)
835Spin flips:     (+ -) and (- +)
836
837.. image:: M_angles_pic.bmp
838
839Now, let's assume that the angles of the *Q*  vector and the spin-axis (x')
840against x-axis are /phi/ and /theta/up, respectively (See Figure above). Then,
841depending upon the polarisation (spin) state of neutrons, the scattering length
842densities, including the nuclear scattering length density (/beta/N) are given
843as, for non-spin-flips
844
845.. image:: sld1.gif
846
847for spin-flips
848
849.. image:: sld2.gif
850
851where
852
853.. image:: mxp.gif
854
855.. image:: myp.gif
856
857.. image:: mzp.gif
858
859.. image:: mqx.gif
860
861.. image:: mqy.gif
862
863Here, the M0x, M0y and M0z are the x, y and z components of the magnetization
864vector given in the xyz lab frame. The angles of the magnetization, /theta/M
865and /phi/M as defined in the Figure (above)
866
867.. image:: m0x_eq.gif
868
869.. image:: m0y_eq.gif
870
871.. image:: m0z_eq.gif
872
873The user input parameters are M0_sld = DMM0, Up_theta = /theta/up,
874M_theta = /theta/M, and M_phi = /phi/M. The 'Up_frac_i' and 'Up_frac_f' are
875the ratio
876
877(spin up)/(spin up + spin down)
878
879neutrons before the sample and at the analyzer, respectively.
880
881*Note:* The values of the 'Up_frac_i' and 'Up_frac_f' must be in the range
882between 0 and 1.
883
884.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
885
886.. _Key_Combinations:
887
888Key Combinations
889----------------
890
891Copy_Paste_
892
893Bookmark_
894
895Graph_Context_Menu_
896
897FTolerance_
898
899.. _Copy_Paste:
900
901Copy & Paste
902------------
903
904To copy the parameter values in a Fit(Model) panel to the clipboard:
905
906*Ctrl(Cmd on MAC) + Left(Mouse)Click*  on the panel.
907
908To paste the parameter values to a Fit(Model)panel from the clipboard:
909
910*Ctrl(Cmd on MAC) + Shift + Left(Mouse)Click*  on the panel.
911
912If this operation is successful, it will say so in the info line at the
913bottom of the SasView window.
914
915.. _Bookmark:
916
917Bookmark
918--------
919
920Bookmark of a fit-panel or model-panel status:
921
922*(Mouse)Right-Click*  and select the bookmark in the popup list.
923
924.. _Graph_Context_Menu:
925
926Graph Context Menu
927------------------
928
929To get the graph context menu to print, copy, save data, (2D)average, etc.:
930
931*Locate the mouse point on the plot to highlight and *(Mouse) Right Click*
932to bring up the full menu.
933
934.. _FTolerance: 
935
936FTolerance (SciPy)
937------------------
938
939To change the ftol value of the Scipy FitEngine (leastsq):
940
941First, make sure that the Fit panel has data and a model selected.
942
943*Ctrl(Cmd on MAC) + Shift + Alt + Right(Mouse)Click*  on the panel.
944
945Then, set up the value in the dialog panel.
946
947If this operation is successful, the new ftol value will be displayed in the
948info line at the bottom of the SV window.Note that increasing the ftol value
[98b30b4]949may cause for the fitting to terminate with higher |chi| sq.
[ec392464]950
951.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
952
953.. _Status_Bar_Help:
954
955Status Bar Help
956---------------
957
958Message_Warning_Hint_
959
960Console_
961
962.. _Message_Warning_Hint:
963
964Message/Warning/Hint
965--------------------
966
967The status bar located at the bottom of the application frame, displays
968messages, hints, warnings and errors.
969
970.. _Console:
971
972Console
973-------
974
975Select *light bulb/info icon*  button in the status bar at the bottom of the
976application window to display available history. During a long task, the
977console can also help users to understand the status in progressing.
Note: See TracBrowser for help on using the repository browser.