Ignore:
Timestamp:
Sep 18, 2017 2:19:13 PM (7 years ago)
Author:
Paul Kienzle <pkienzle@…>
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, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
1e6d9340
Parents:
1659f54 (diff), cfd27dd (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' into ticket-639-katex

Location:
src/sas/sasgui/perspectives/fitting/media
Files:
53 added
50 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sasgui/perspectives/fitting/media/fitting_help.rst

    r5ed76f8 rc5cfb20  
    195195the :ref:`Advanced_Plugin_Editor` . 
    196196 
     197**SasView version 4.2** made it possible to specify whether a plugin created with  
     198the *New Plugin Model* dialog is actually a form factor P(Q) or a structure factor  
     199S(Q). To do this, simply add one or other of the following lines under the *import*  
     200statements. 
     201 
     202For a form factor:: 
     203 
     204     form_factor = True 
     205          
     206or for a structure factor:: 
     207 
     208     structure_factor = True 
     209          
     210If the plugin is a structure factor it is *also* necessary to add two variables to  
     211the parameter list:: 
     212 
     213     parameters = [  
     214                     ['radius_effective', '', 1, [0.0, numpy.inf], 'volume', ''], 
     215                     ['volfraction', '', 1, [0.0, 1.0], '', ''], 
     216                     [...], 
     217 
     218and to the declarations of the functions Iq and Iqxy::: 
     219 
     220     def Iq(x , radius_effective, volfraction, ...): 
     221 
     222     def Iqxy(x, y, radius_effective, volfraction, ...): 
     223 
     224Such a plugin should then be available in the S(Q) drop-down box on a FitPage (once  
     225a P(Q) model has been selected). 
     226 
    197227Sum|Multi(p1,p2) 
    198228^^^^^^^^^^^^^^^^ 
     
    206236or:: 
    207237 
    208      Plugin Model = scale_factor * model_1 /* model_2 + background 
     238     Plugin Model = scale_factor * (model1 * model2) + background 
    209239 
    210240In the *Easy Sum/Multi Editor* give the new model a function name and brief 
    211241description (to appear under the *Details* button on the *FitPage*). Then select 
    212242two existing models, as p1 and p2, and the required operator, '+' or '*' between 
    213 them. Finally, click the *Apply* button to generate the model and then click *Close*. 
    214  
    215 Any changes to a plugin model generated in this way only become effective *after* it is re-selected from the model drop-down menu on the FitPage. 
     243them. Finally, click the *Apply* button to generate and test the model and then click *Close*. 
     244 
     245Any changes to a plugin model generated in this way only become effective *after* it is re-selected  
     246from the plugin models drop-down menu on the FitPage. If the model is not listed you can force a  
     247recompilation of the plugins by selecting *Fitting* > *Plugin Model Operations* > *Load Plugin Models*. 
     248 
     249**SasView version 4.2** introduced a much simplified and more extensible structure for plugin models  
     250generated through the Easy Sum/Multi Editor. For example, the code for a combination of a sphere model  
     251with a power law model now looks like this:: 
     252 
     253     from sasmodels.core import load_model_info 
     254     from sasmodels.sasview_model import make_model_from_info 
     255      
     256     model_info = load_model_info('sphere+power_law') 
     257     model_info.name = 'MyPluginModel' 
     258     model_info.description = 'sphere + power_law' 
     259     Model = make_model_from_info(model_info) 
     260 
     261To change the models or operators contributing to this plugin it is only necessary to edit the string  
     262in the brackets after *load_model_info*, though it would also be a good idea to update the model name  
     263and description too!!! 
     264 
     265The model specification string can handle multiple models and combinations of operators (+ or *) which  
     266are processed according to normal conventions. Thus 'model1+model2*model3' would be valid and would  
     267multiply model2 by model3 before adding model1. In this example, parameters in the *FitPage* would be  
     268prefixed A (for model2), B (for model3) and C (for model1). Whilst this might appear a little  
     269confusing, unless you were creating a plugin model from multiple instances of the same model the parameter  
     270assignments ought to be obvious when you load the plugin. 
     271 
     272If you need to include another plugin model in the model specification string, just prefix the name of  
     273that model with *custom*. For instance:: 
     274 
     275     sphere+custom.MyPluginModel 
     276 
     277To create a P(Q)*\S(Q) model use the @ symbol instead of * like this:: 
     278 
     279     sphere@hardsphere 
     280      
     281This streamlined approach to building complex plugin models from existing library models, or models  
     282available on the *Model Marketplace*, also permits the creation of P(Q)*\S(Q) plugin models, something  
     283that was not possible in earlier versions of SasView.  
    216284 
    217285.. _Advanced_Plugin_Editor: 
     
    484552.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
    485553 
     554.. _Batch_Fit_Mode: 
     555 
    486556Batch Fit Mode 
    487557-------------- 
     
    636706 
    637707     Example: radius [2 : 5] , radius [10 : 25] 
    638  
    639 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
    640  
    641 .. note::  This help document was last changed by Steve King, 10Oct2016 
     708      
     709.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     710 
     711Combined Batch Fit Mode 
     712----------------------- 
     713 
     714The purpose of the Combined Batch Fit is to allow running two or more batch 
     715fits in sequence without overwriting the output table of results.  This may be 
     716of interest for example if one is fitting a series of data sets where there is 
     717a shape change occurring in the series that requires changing the model part 
     718way through the series; for example a sphere to rod transition.  Indeed the 
     719regular batch mode does not allow for multiple models and requires all the 
     720files in the series to be fit with single model and set of parameters.  While 
     721it is of course possible to just run part of the series as a batch fit using 
     722model one followed by running another batch fit on the rest of the series with 
     723model two (and/or model three etc), doing so will overwrite the table of 
     724outputs from the previous batch fit(s).  This may not be desirable if one is 
     725interested in comparing the parameters: for example the sphere radius of set 
     726one and the cylinder radius of set two. 
     727 
     728Method 
     729^^^^^^ 
     730 
     731In order to use the *Combined Batch Fit*, first load all the data needed as 
     732described in :ref:`Loading_data`. Next start up two or more *BatchPage* fits 
     733following the instructions in :ref:`Batch_Fit_Mode` but **DO NOT PRESS FIT**. 
     734At this point the *Combine Batch Fit* menu item under the *Fitting menu* should 
     735be active (if there is one or no *BatchPage* the menu item will be greyed out 
     736and inactive).  Clicking on *Combine Batch Fit* will bring up a new panel, 
     737similar to the *Const & Simult Fit* panel. In this case there will be a 
     738checkbox for each *BatchPage* instead of each *FitPage* that should be included 
     739in the fit.  Once all are selected, click the Fit button on 
     740the *BatchPage* to run each batch fit in *sequence* 
     741 
     742.. image:: combine_batch_page.png 
     743 
     744The batch table will then pop up at the end as for the case of the simple Batch 
     745Fitting with the following caveats: 
     746 
     747.. note:: 
     748   The order matters.  The parameters in the table will be taken from the model 
     749   used in the first *BatchPage* of the list.  Any parameters from the 
     750   second and later *BatchPage* s that have the same name as a parameter in the 
     751   first will show up allowing for plotting of that parameter across the 
     752   models. The other parameters will not be available in the grid. 
     753.. note:: 
     754   a corralary of the above is that currently models created as a sum|multiply 
     755   model will not work as desired because the generated model parameters have a 
     756   p#_ appended to the beginning and thus radius and p1_radius will not be 
     757   recognized as the same parameter. 
     758    
     759.. image:: combine_batch_grid.png 
     760 
     761In the example shown above the data is a time series with a shifting peak. 
     762The first part of the series was fitted using the *broad_peak* model, while 
     763the rest of the data were fit using the *gaussian_peak* model. Unfortunately the 
     764time is not listed in the file but the file name contains the information. As 
     765described in :ref:`Grid_Window`, a column can be added manually, in this case 
     766called time, and the peak position plotted against time.  
     767 
     768.. image:: combine_batch_plot.png 
     769 
     770Note the discontinuity in the peak position.  This reflects the fact that the 
     771Gaussian fit is a rather poor model for the data and is not actually 
     772finding the peak. 
     773 
     774.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     775 
     776.. note::  This help document was last changed by Paul Butler, 10 September 
     777   2017 
  • src/sas/sasgui/perspectives/fitting/media/plugin.rst

    r96f00a0 rc5cfb20  
    1818* By writing a model from scratch outside of SasView (only recommended for 
    1919  code monkeys!) 
     20 
     21**What follows below is quite technical. If you just want a helping hand to get  
     22started creating your own models see** :ref:`Adding_your_own_models`. 
    2023 
    2124Overview 
  • src/sas/sasgui/perspectives/fitting/media/mag_help.rst

    reca66a1 r5ed76f8  
    44.. by S King, ISIS, during SasView CodeCamp-III in Feb 2015. 
    55 
    6 .. |inlineimage004| image:: sm_image004.gif 
    7 .. |inlineimage005| image:: sm_image005.gif 
    8 .. |inlineimage008| image:: sm_image008.gif 
    9 .. |inlineimage009| image:: sm_image009.gif 
    10 .. |inlineimage010| image:: sm_image010.gif 
    11 .. |inlineimage011| image:: sm_image011.gif 
    12 .. |inlineimage012| image:: sm_image012.gif 
    13 .. |inlineimage018| image:: sm_image018.gif 
    14 .. |inlineimage019| image:: sm_image019.gif 
     6.. |inlineimage004| image:: sm_image004.png 
     7.. |inlineimage005| image:: sm_image005.png 
     8.. |inlineimage008| image:: sm_image008.png 
     9.. |inlineimage009| image:: sm_image009.png 
     10.. |inlineimage010| image:: sm_image010.png 
     11.. |inlineimage011| image:: sm_image011.png 
     12.. |inlineimage012| image:: sm_image012.png 
     13.. |inlineimage018| image:: sm_image018.png 
     14.. |inlineimage019| image:: sm_image019.png 
    1515 
    1616 
     
    2020-------------------------------- 
    2121 
    22 Magnetic scattering is implemented in five (2D) models  
     22Magnetic scattering is implemented in five (2D) models 
    2323 
    2424*  *sphere* 
     
    2828*  *parallelepiped* 
    2929 
    30 In general, the scattering length density (SLD, = |beta|) in each region where the 
     30In general, the scattering length density (SLD, = $\beta$) in each region where the 
    3131SLD is uniform, is a combination of the nuclear and magnetic SLDs and, for polarised 
    3232neutrons, also depends on the spin states of the neutrons. 
    3333 
    34 For magnetic scattering, only the magnetization component, *M*\ :sub:`perp`, 
    35 perpendicular to the scattering vector *Q* contributes to the the magnetic 
     34For magnetic scattering, only the magnetization component, $M_\perp$, 
     35perpendicular to the scattering vector $Q$ contributes to the the magnetic 
    3636scattering length. 
    3737 
    38 .. image:: mag_vector.bmp 
     38.. image:: mag_vector.png 
    3939 
    4040The magnetic scattering length density is then 
    4141 
    42 .. image:: dm_eq.gif 
     42.. image:: dm_eq.png 
    4343 
    44 where |gamma| = -1.913 is the gyromagnetic ratio, |mu|\ :sub:`B` is the 
    45 Bohr magneton, *r*\ :sub:`0` is the classical radius of electron, and |sigma| 
     44where $\gamma = -1.913$ is the gyromagnetic ratio, $\mu_B$ is the 
     45Bohr magneton, $r_0$ is the classical radius of electron, and $\sigma$ 
    4646is the Pauli spin. 
    4747 
     
    5353Spin-flips    (+ -) and (- +) 
    5454 
    55 .. image:: M_angles_pic.bmp 
     55.. image:: M_angles_pic.png 
    5656 
    57 If the angles of the *Q* vector and the spin-axis (*x'*) to the *x*-axis are |phi| 
    58 and |theta|\ :sub:`up`, respectively, then, depending on the spin state of the 
     57If the angles of the $Q$ vector and the spin-axis (*x'*) to the *x*-axis are $\phi$ 
     58and $\theta_\text{up}$, respectively, then, depending on the spin state of the 
    5959neutrons, the scattering length densities, including the nuclear scattering 
    60 length density (|beta|\ :sub:`N`) are 
     60length density ($\beta_N$) are 
    6161 
    62 .. image:: sld1.gif 
     62.. image:: sld1.png 
    6363 
    6464when there are no spin-flips, and 
    6565 
    66 .. image:: sld2.gif 
     66.. image:: sld2.png 
    6767 
    6868when there are, and 
    6969 
    70 .. image:: mxp.gif 
     70.. image:: mxp.png 
    7171 
    72 .. image:: myp.gif 
     72.. image:: myp.png 
    7373 
    74 .. image:: mzp.gif 
     74.. image:: mzp.png 
    7575 
    76 .. image:: mqx.gif 
     76.. image:: mqx.png 
    7777 
    78 .. image:: mqy.gif 
     78.. image:: mqy.png 
    7979 
    80 Here, *M*\ :sub:`0x`, *M*\ :sub:`0y` and *M*\ :sub:`0z` are the x, y and z components 
    81 of the magnetization vector given in the laboratory xyz frame given by 
     80Here, $M_{0x}$, $M_{0y}$ and $M_{0z}$ are the $x$, $y$ and $z$ components 
     81of the magnetization vector given in the laboratory $xyz$ frame given by 
    8282 
    83 .. image:: m0x_eq.gif 
     83.. image:: m0x_eq.png 
    8484 
    85 .. image:: m0y_eq.gif 
     85.. image:: m0y_eq.png 
    8686 
    87 .. image:: m0z_eq.gif 
     87.. image:: m0z_eq.png 
    8888 
    89 and the magnetization angles |theta|\ :sub:`M` and |phi|\ :sub:`M` are defined in 
     89and the magnetization angles $\theta_M$ and $\phi_M$ are defined in 
    9090the figure above. 
    9191 
     
    9393 
    9494===========   ================================================================ 
    95  M0_sld        = *D*\ :sub:`M` *M*\ :sub:`0` 
    96  Up_theta      = |theta|\ :sub:`up` 
    97  M_theta       = |theta|\ :sub:`M` 
    98  M_phi         = |phi|\ :sub:`M` 
     95 M0_sld        = $D_M M_0$ 
     96 Up_theta      = $\theta_\text{up}$ 
     97 M_theta       = $\theta_M$ 
     98 M_phi         = $\phi_M$ 
    9999 Up_frac_i     = (spin up)/(spin up + spin down) neutrons *before* the sample 
    100100 Up_frac_f     = (spin up)/(spin up + spin down) neutrons *after* the sample 
  • src/sas/sasgui/perspectives/fitting/media/pd_help.rst

    rb64b87c r5ed76f8  
    44.. by S King, ISIS, during SasView CodeCamp-III in Feb 2015. 
    55 
    6 .. |inlineimage004| image:: sm_image004.gif 
    7 .. |inlineimage005| image:: sm_image005.gif 
    8 .. |inlineimage008| image:: sm_image008.gif 
    9 .. |inlineimage009| image:: sm_image009.gif 
    10 .. |inlineimage010| image:: sm_image010.gif 
    11 .. |inlineimage011| image:: sm_image011.gif 
    12 .. |inlineimage012| image:: sm_image012.gif 
    13 .. |inlineimage018| image:: sm_image018.gif 
    14 .. |inlineimage019| image:: sm_image019.gif 
     6.. |inlineimage004| image:: sm_image004.png 
     7.. |inlineimage005| image:: sm_image005.png 
     8.. |inlineimage008| image:: sm_image008.png 
     9.. |inlineimage009| image:: sm_image009.png 
     10.. |inlineimage010| image:: sm_image010.png 
     11.. |inlineimage011| image:: sm_image011.png 
     12.. |inlineimage012| image:: sm_image012.png 
     13.. |inlineimage018| image:: sm_image018.png 
     14.. |inlineimage019| image:: sm_image019.png 
    1515 
    1616 
     
    2424form factor is normalized by the average particle volume such that 
    2525 
    26 *P(q) = scale* * \ <F*\F> / *V + bkg* 
     26.. math:: 
    2727 
    28 where F is the scattering amplitude and the \<\> denote an average over the size 
    29 distribution. 
     28    P(q) = \text{scale} \langle F^*F rangle V + \text{background} 
     29 
     30where $F$ is the scattering amplitude and $\langle\cdot\rangle$ denotes an average 
     31over the size distribution. 
    3032 
    3133Users should note that this computation is very intensive. Applying polydispersion 
     
    5759.. image:: pd_image001.png 
    5860 
    59 where *xmean* is the mean of the distribution, *w* is the half-width, and *Norm* is a 
    60 normalization factor which is determined during the numerical calculation. 
     61where $x_{mean}$ is the mean of the distribution, $w$ is the half-width, and $Norm$ 
     62is a normalization factor which is determined during the numerical calculation. 
    6163 
    62 Note that the standard deviation and the half width *w* are different! 
     64Note that the standard deviation and the half width $w$ are different! 
    6365 
    6466The standard deviation is 
     
    8183.. image:: pd_image005.png 
    8284 
    83 where *xmean* is the mean of the distribution and *Norm* is a normalization factor 
     85where $x_{mean}$ is the mean of the distribution and $Norm$ is a normalization factor 
    8486which is determined during the numerical calculation. 
    8587 
     
    100102.. image:: pd_image007.png 
    101103 
    102 where |mu|\ =ln(*xmed*), *xmed* is the median value of the distribution, and 
    103 *Norm* is a normalization factor which will be determined during the numerical 
     104where $\mu=\ln(x_{med})$, $x_{med}$ is the median value of the distribution, and 
     105$Norm$ is a normalization factor which will be determined during the numerical 
    104106calculation. 
    105107 
     
    107109size parameter in the *FitPage*, for example, radius = 60. 
    108110 
    109 The polydispersity is given by |sigma| 
     111The polydispersity is given by $\sigma$ 
    110112 
    111113.. image:: pd_image008.png 
     
    115117.. image:: pd_image009.png 
    116118 
    117 The mean value is given by *xmean*\ =exp(|mu|\ +p\ :sup:`2`\ /2). The peak value 
    118 is given by *xpeak*\ =exp(|mu|-p\ :sup:`2`\ ). 
     119The mean value is given by $x_{mean} =\exp(\mu + p^2 /2)$. The peak value 
     120is given by $x_{peak} =\exp(\mu-p^2)$. 
    119121 
    120122.. image:: pd_image010.jpg 
    121123 
    122 This distribution function spreads more, and the peak shifts to the left, as *p* 
     124This distribution function spreads more, and the peak shifts to the left, as $p$ 
    123125increases, requiring higher values of Nsigmas and Npts. 
    124126 
     
    132134.. image:: pd_image011.png 
    133135 
    134 where *xmean* is the mean of the distribution and *Norm* is a normalization factor 
    135 which is determined during the numerical calculation, and *z* is a measure of the 
     136where $x_{mean}$ is the mean of the distribution and $Norm$ is a normalization factor 
     137which is determined during the numerical calculation, and $z$ is a measure of the 
    136138width of the distribution such that 
    137139 
    138 z = (1-p\ :sup:`2`\ ) / p\ :sup:`2` 
     140.. math:: 
     141 
     142    z = (1-p^2 ) / p^2 
    139143 
    140144The polydispersity is 
     
    156160 
    157161This user-definable distribution should be given as as a simple ASCII text file 
    158 where the array is defined by two columns of numbers: *x* and *f(x)*. The *f(x)* 
     162where the array is defined by two columns of numbers: $x$ and $f(x)$. The $f(x)$ 
    159163will be normalized by SasView during the computation. 
    160164 
     
    172176 
    173177SasView only uses these array values during the computation, therefore any mean 
    174 value of the parameter represented by *x* present in the *FitPage* 
     178value of the parameter represented by $x$ present in the *FitPage* 
    175179will be ignored. 
    176180 
     
    181185 
    182186Many commercial Dynamic Light Scattering (DLS) instruments produce a size 
    183 polydispersity parameter, sometimes even given the symbol *p*! This parameter is 
     187polydispersity parameter, sometimes even given the symbol $p$! This parameter is 
    184188defined as the relative standard deviation coefficient of variation of the size 
    185189distribution and is NOT the same as the polydispersity parameters in the Lognormal 
  • src/sas/sasgui/perspectives/fitting/media/residuals_help.rst

    r7805458 r940d034  
    1818also provides two other measures of the quality of a fit: 
    1919 
    20 |chi|\  :sup:`2` (or 'Chi2'; pronounced 'chi-squared') 
     20$\chi^2$ (or 'Chi2'; pronounced 'chi-squared') 
    2121*  *Residuals* 
    2222 
     
    3232*Npts* such that 
    3333 
    34   *Chi2/Npts* = { SUM[(*Y_i* - *Y_theory_i*)^2 / (*Y_error_i*)^2] } / *Npts* 
     34.. math:: 
    3535 
    36 This differs slightly from what is sometimes called the 'reduced chi-squared' 
     36  \chi^2/N_{pts} =  \sum[(Y_i - \mathrm{theory}_i)^2 / \mathrm{error}_i^2] / N_{pts} 
     37 
     38This differs slightly from what is sometimes called the 'reduced $\chi^2$' 
    3739because it does not take into account the number of fitting parameters (to 
    38 calculate the number of 'degrees of freedom'), but the 'normalized chi-squared' 
    39 and the 'reduced chi-squared' are very close to each other when *Npts* >> number of 
    40 parameters. 
     40calculate the number of 'degrees of freedom'), but the 'normalized $\chi^2$ 
     41and the 'reduced $\chi^2$ are very close to each other when $N_{pts} \gg 
     42\text{number of parameters}. 
    4143 
    42 For a good fit, *Chi2/Npts* tends to 0. 
     44For a good fit, $\chi^2/N_{pts}$ tends to 1. 
    4345 
    44 *Chi2/Npts* is sometimes referred to as the 'goodness-of-fit' parameter. 
     46$\chi^2/N_{pts}$ is sometimes referred to as the 'goodness-of-fit' parameter. 
    4547 
    4648.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     
    5355value and its *true* value is its error). 
    5456 
    55 *SasView* calculates 'normalized residuals', *R_i*, for each data point in the 
     57*SasView* calculates 'normalized residuals', $R_i$, for each data point in the 
    5658fit: 
    5759 
    58   *R_i* = (*Y_i* - *Y_theory_i*) / (*Y_err_i*) 
     60.. math:: 
    5961 
    60 For a good fit, *R_i* ~ 0. 
     62  R_i = (Y_i - Y_theory_i) / (Y_err_i) 
     63 
     64For a good fit, $R_i \sim 0$. 
    6165 
    6266.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
  • src/sas/sasgui/perspectives/fitting/media/sm_help.rst

    r27aabc1 r5ed76f8  
    44.. by S King, ISIS, during SasView CodeCamp-III in Feb 2015. 
    55 
    6 .. |inlineimage004| image:: sm_image004.gif 
    7 .. |inlineimage005| image:: sm_image005.gif 
    8 .. |inlineimage008| image:: sm_image008.gif 
    9 .. |inlineimage009| image:: sm_image009.gif 
    10 .. |inlineimage010| image:: sm_image010.gif 
    11 .. |inlineimage011| image:: sm_image011.gif 
    12 .. |inlineimage012| image:: sm_image012.gif 
    13 .. |inlineimage018| image:: sm_image018.gif 
    14 .. |inlineimage019| image:: sm_image019.gif 
     6.. |inlineimage004| image:: sm_image004.png 
     7.. |inlineimage005| image:: sm_image005.png 
     8.. |inlineimage008| image:: sm_image008.png 
     9.. |inlineimage009| image:: sm_image009.png 
     10.. |inlineimage010| image:: sm_image010.png 
     11.. |inlineimage011| image:: sm_image011.png 
     12.. |inlineimage012| image:: sm_image012.png 
     13.. |inlineimage018| image:: sm_image018.png 
     14.. |inlineimage019| image:: sm_image019.png 
    1515 
    1616 
     
    2020================== 
    2121 
    22 Sometimes the instrumental geometry used to acquire the experimental data has  
    23 an impact on the clarity of features in the reduced scattering curve. For  
    24 example, peaks or fringes might be slightly broadened. This is known as  
    25 *Q resolution smearing*. To compensate for this effect one can either try and  
    26 remove the resolution contribution - a process called *desmearing* - or add the  
    27 resolution contribution into a model calculation/simulation (which by definition  
    28 will be exact) to make it more representative of what has been measured  
     22Sometimes the instrumental geometry used to acquire the experimental data has 
     23an impact on the clarity of features in the reduced scattering curve. For 
     24example, peaks or fringes might be slightly broadened. This is known as 
     25*Q resolution smearing*. To compensate for this effect one can either try and 
     26remove the resolution contribution - a process called *desmearing* - or add the 
     27resolution contribution into a model calculation/simulation (which by definition 
     28will be exact) to make it more representative of what has been measured 
    2929experimentally - a process called *smearing*. SasView will do the latter. 
    3030 
    31 Both smearing and desmearing rely on functions to describe the resolution  
     31Both smearing and desmearing rely on functions to describe the resolution 
    3232effect. SasView provides three smearing algorithms: 
    3333 
     
    3636*  *2D Smearing* 
    3737 
    38 SasView also has an option to use Q resolution data (estimated at the time of  
     38SasView also has an option to use $Q$ resolution data (estimated at the time of 
    3939data reduction) supplied in a reduced data file: the *Use dQ data* radio button. 
    4040 
     
    4343dQ Smearing 
    4444----------- 
    45   
    46 If this option is checked, SasView will assume that the supplied dQ values  
     45 
     46If this option is checked, SasView will assume that the supplied $dQ$ values 
    4747represent the standard deviations of Gaussian functions. 
    4848 
     
    5757The slit-smeared scattering intensity is defined by 
    5858 
    59 .. image:: sm_image002.gif 
     59.. image:: sm_image002.png 
    6060 
    6161where *Norm* is given by 
    6262 
    63 .. image:: sm_image003.gif 
     63.. image:: sm_image003.png 
    6464 
    6565**[Equation 1]** 
    6666 
    67 The functions |inlineimage004| and |inlineimage005| 
    68 refer to the slit width weighting function and the slit height weighting  
    69 determined at the given *q* point, respectively. It is assumed that the weighting 
     67The functions $W_v(v)$ and $W_u(u)$ 
     68refer to the slit width weighting function and the slit height weighting 
     69determined at the given $q$ point, respectively. It is assumed that the weighting 
    7070function is described by a rectangular function, such that 
    7171 
    72 .. image:: sm_image006.gif 
     72.. image:: sm_image006.png 
    7373 
    7474**[Equation 2]** 
     
    7676and 
    7777 
    78 .. image:: sm_image007.gif 
     78.. image:: sm_image007.png 
    7979 
    8080**[Equation 3]** 
    8181 
    82 so that |inlineimage008| |inlineimage009| for |inlineimage010| and *u*\ . 
    83  
    84 Here |inlineimage011| and |inlineimage012| stand for 
    85 the slit height (FWHM/2) and the slit width (FWHM/2) in *q* space. 
     82so that $\Delta q_\alpha = \int_0^\infty d\alpha W_\alpha(\alpha)$ 
     83for $\alpha = v$ and $u$. 
     84 
     85Here $\Delta q_u$ and $\Delta q_v$ stand for 
     86the slit height (FWHM/2) and the slit width (FWHM/2) in $q$ space. 
    8687 
    8788This simplifies the integral in Equation 1 to 
    8889 
    89 .. image:: sm_image013.gif 
     90.. image:: sm_image013.png 
    9091 
    9192**[Equation 4]** 
    9293 
    93 which may be solved numerically, depending on the nature of |inlineimage011| and |inlineimage012| . 
     94which may be solved numerically, depending on the nature of 
     95$\Delta q_u$ and $\Delta q_v$. 
    9496 
    9597Solution 1 
    9698^^^^^^^^^^ 
    9799 
    98 **For** |inlineimage012| **= 0 and** |inlineimage011| **= constant.** 
    99  
    100 .. image:: sm_image016.gif 
    101  
    102 For discrete *q* values, at the *q* values of the data points and at the *q* 
    103 values extended up to *q*\ :sub:`N`\ = *q*\ :sub:`i` + |inlineimage011| the smeared 
     100**For $\Delta q_v= 0$ and $\Delta q_u = \text{constant}$.** 
     101 
     102.. image:: sm_image016.png 
     103 
     104For discrete $q$ values, at the $q$ values of the data points and at the $q$ 
     105values extended up to $q_N = q_i + \Delta q_u$ the smeared 
    104106intensity can be approximately calculated as 
    105107 
    106 .. image:: sm_image017.gif 
     108.. image:: sm_image017.png 
    107109 
    108110**[Equation 5]** 
    109111 
    110 where |inlineimage018| = 0 for *I*\ :sub:`s` when *j* < *i* or *j* > *N-1*. 
     112where |inlineimage018| = 0 for $I_s$ when $j < i$ or $j > N-1$. 
    111113 
    112114Solution 2 
    113115^^^^^^^^^^ 
    114116 
    115 **For** |inlineimage012| **= constant and** |inlineimage011| **= 0.** 
     117**For $\Delta q_v = \text{constant}$ and $\Delta q_u= 0$.** 
    116118 
    117119Similar to Case 1 
    118120 
    119 |inlineimage019| for *q*\ :sub:`p` = *q*\ :sub:`i` - |inlineimage012| and *q*\ :sub:`N` = *q*\ :sub:`i` + |inlineimage012| 
     121|inlineimage019| for $q_p = q_i - \Delta q_v$ and $q_N = q_i + \Delta q_v$ 
    120122 
    121123**[Equation 6]** 
    122124 
    123 where |inlineimage018| = 0 for *I*\ :sub:`s` when *j* < *p* or *j* > *N-1*. 
     125where |inlineimage018| = 0 for $I_s$ when $j < p$ or $j > N-1$. 
    124126 
    125127Solution 3 
    126128^^^^^^^^^^ 
    127129 
    128 **For** |inlineimage011| **= constant and** |inlineimage011| **= constant.** 
     130**For $\Delta q_u = \text{constant}$ and $\Delta q_v = \text{constant}$.** 
    129131 
    130132In this case, the best way is to perform the integration of Equation 1 
     
    138140numerical integration for the slit width. Then 
    139141 
    140 .. image:: sm_image020.gif 
     142.. image:: sm_image020.png 
    141143 
    142144**[Equation 7]** 
    143145 
    144 for *q*\ :sub:`p` = *q*\ :sub:`i` - |inlineimage012| and *q*\ :sub:`N` = *q*\ :sub:`i` + |inlineimage012| 
    145  
    146 where |inlineimage018| = 0 for *I*\ :sub:`s` when *j* < *p* or *j* > *N-1*. 
     146for *q_p = q_i - \Delta q_v$ and $q_N = q_i + \Delta q_v$ 
     147where |inlineimage018| = 0 for *I_s$ when $j < p$ or $j > N-1$. 
    147148 
    148149.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     
    158159Equation 6 becomes 
    159160 
    160 .. image:: sm_image021.gif 
     161.. image:: sm_image021.png 
    161162 
    162163**[Equation 8]** 
     
    171172Thus 
    172173 
    173 .. image:: sm_image022.gif 
     174.. image:: sm_image022.png 
    174175 
    175176**[Equation 9]** 
    176177 
    177 In Equation 9, *x*\ :sub:`0` = *q* cos(|theta|), *y*\ :sub:`0` = *q* sin(|theta|), and 
    178 the primed axes, are all in the coordinate rotated by an angle |theta| about 
    179 the z-axis (see the figure below) so that *x'*\ :sub:`0` = *x*\ :sub:`0` cos(|theta|) + 
    180 *y*\ :sub:`0` sin(|theta|) and *y'*\ :sub:`0` = -*x*\ :sub:`0` sin(|theta|) + 
    181 *y*\ :sub:`0` cos(|theta|). Note that the rotation angle is zero for a x-y symmetric 
    182 elliptical Gaussian distribution. The *A* is a normalization factor. 
    183  
    184 .. image:: sm_image023.gif 
    185  
    186 Now we consider a numerical integration where each of the bins in |theta| and *R* are 
    187 *evenly* (this is to simplify the equation below) distributed by |bigdelta|\ |theta| 
    188 and |bigdelta|\ R, respectively, and it is further assumed that *I(x',y')* is constant 
     178In Equation 9, $x_0 = q \cos(\theta)$, $y_0 = q \sin(\theta)$, and 
     179the primed axes, are all in the coordinate rotated by an angle $\theta$ about 
     180the z-axis (see the figure below) so that 
     181$x'_0 = x_0 \cos(\theta) + y_0 \sin(\theta)$ and 
     182$y'_0 = -x_0 \sin(\theta) + y_0 \cos(\theta)$. 
     183Note that the rotation angle is zero for a $xy$ symmetric 
     184elliptical Gaussian distribution. The $A$ is a normalization factor. 
     185 
     186.. image:: sm_image023.png 
     187 
     188Now we consider a numerical integration where each of the bins in $\theta$ and $R$ are 
     189*evenly* (this is to simplify the equation below) distributed by $\Delta \theta$ 
     190and $\Delta R$, respectively, and it is further assumed that $I(x',y')$ is constant 
    189191within the bins. Then 
    190192 
    191 .. image:: sm_image024.gif 
     193.. image:: sm_image024.png 
    192194 
    193195**[Equation 10]** 
    194196 
    195197Since the weighting factor on each of the bins is known, it is convenient to 
    196 transform *x'-y'* back to *x-y* coordinates (by rotating it by -|theta| around the 
    197 *z* axis). 
     198transform $x'y'$ back to $xy$ coordinates (by rotating it by $-\theta$ around the 
     199$z$ axis). 
    198200 
    199201Then, for a polar symmetric smear 
    200202 
    201 .. image:: sm_image025.gif 
     203.. image:: sm_image025.png 
    202204 
    203205**[Equation 11]** 
     
    205207where 
    206208 
    207 .. image:: sm_image026.gif 
    208  
    209 while for a *x-y* symmetric smear 
    210  
    211 .. image:: sm_image027.gif 
     209.. image:: sm_image026.png 
     210 
     211while for a $xy$ symmetric smear 
     212 
     213.. image:: sm_image027.png 
    212214 
    213215**[Equation 12]** 
     
    215217where 
    216218 
    217 .. image:: sm_image028.gif 
     219.. image:: sm_image028.png 
    218220 
    219221The current version of the SasView uses Equation 11 for 2D smearing, assuming 
     
    225227------------------------- 
    226228 
    227 In all the cases above, the weighting matrix *W* is calculated on the first call 
    228 to a smearing function, and includes ~60 *q* values (finely and evenly binned) 
    229 below (>0) and above the *q* range of data in order to smear all data points for 
    230 a given model and slit/pinhole size. The *Norm*  factor is found numerically with the 
    231 weighting matrix and applied on the computation of *I*\ :sub:`s`. 
     229In all the cases above, the weighting matrix $W$ is calculated on the first call 
     230to a smearing function, and includes ~60 $q$ values (finely and evenly binned) 
     231below (>0) and above the $q$ range of data in order to smear all data points for 
     232a given model and slit/pinhole size. The $Norm$  factor is found numerically with the 
     233weighting matrix and applied on the computation of $I_s$. 
    232234 
    233235.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
Note: See TracChangeset for help on using the changeset viewer.