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