Changeset 78f02c3 in sasview for src/sas/fit/media/fitting_help.rst


Ignore:
Timestamp:
Feb 14, 2015 10:12:40 AM (9 years ago)
Author:
smk78
Branches:
master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
898a8b9
Parents:
3e2ebbb
Message:

Level 1 sphinx-ready commit of remaining help files

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/fit/media/fitting_help.rst

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