[da53353] | 1 | .. sm_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 |
---|
| 12 | .. |chi| unicode:: U+03C7 |
---|
[f256d9b] | 13 | .. |bigdelta| unicode:: U+0394 |
---|
[da53353] | 14 | |
---|
| 15 | .. |inlineimage004| image:: sm_image004.gif |
---|
| 16 | .. |inlineimage005| image:: sm_image005.gif |
---|
| 17 | .. |inlineimage008| image:: sm_image008.gif |
---|
| 18 | .. |inlineimage009| image:: sm_image009.gif |
---|
| 19 | .. |inlineimage010| image:: sm_image010.gif |
---|
| 20 | .. |inlineimage011| image:: sm_image011.gif |
---|
| 21 | .. |inlineimage012| image:: sm_image012.gif |
---|
| 22 | .. |inlineimage018| image:: sm_image018.gif |
---|
| 23 | .. |inlineimage019| image:: sm_image019.gif |
---|
| 24 | |
---|
| 25 | |
---|
| 26 | .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ |
---|
| 27 | |
---|
[f256d9b] | 28 | Smearing Functions |
---|
| 29 | ================== |
---|
[da53353] | 30 | |
---|
[f256d9b] | 31 | Sometimes it will be necessary to correct reduced experimental data for the |
---|
| 32 | physical effects of the instrumental geometry in use. This process is called |
---|
| 33 | *desmearing*. However, calculated/simulated data - which by definition will be |
---|
| 34 | perfect/exact - can be *smeared* to make it more representative of what might |
---|
| 35 | actually be measured experimentally. |
---|
| 36 | |
---|
| 37 | SasView provides the following three smearing algorithms: |
---|
[da53353] | 38 | |
---|
[a0637de] | 39 | * *Slit Smearing* |
---|
| 40 | * *Pinhole Smearing* |
---|
| 41 | * *2D Smearing* |
---|
[da53353] | 42 | |
---|
[a0637de] | 43 | .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ |
---|
[da53353] | 44 | |
---|
| 45 | Slit Smearing |
---|
[f256d9b] | 46 | ------------- |
---|
| 47 | |
---|
| 48 | **This type of smearing is normally only encountered with data from X-ray Kratky** |
---|
| 49 | **cameras or X-ray/neutron Bonse-Hart USAXS/USANS instruments.** |
---|
[da53353] | 50 | |
---|
[f256d9b] | 51 | The slit-smeared scattering intensity is defined by |
---|
[da53353] | 52 | |
---|
| 53 | .. image:: sm_image002.gif |
---|
| 54 | |
---|
[f256d9b] | 55 | where *Norm* is given by |
---|
[da53353] | 56 | |
---|
| 57 | .. image:: sm_image003.gif |
---|
| 58 | |
---|
[f256d9b] | 59 | **[Equation 1]** |
---|
[da53353] | 60 | |
---|
| 61 | The functions |inlineimage004| and |inlineimage005| |
---|
| 62 | refer to the slit width weighting function and the slit height weighting |
---|
[f256d9b] | 63 | determined at the given *q* point, respectively. It is assumed that the weighting |
---|
| 64 | function is described by a rectangular function, such that |
---|
[da53353] | 65 | |
---|
| 66 | .. image:: sm_image006.gif |
---|
| 67 | |
---|
[f256d9b] | 68 | **[Equation 2]** |
---|
[da53353] | 69 | |
---|
| 70 | and |
---|
| 71 | |
---|
| 72 | .. image:: sm_image007.gif |
---|
| 73 | |
---|
[f256d9b] | 74 | **[Equation 3]** |
---|
[da53353] | 75 | |
---|
[f256d9b] | 76 | so that |inlineimage008| |inlineimage009| for |inlineimage010| and *u*\ . |
---|
[da53353] | 77 | |
---|
[f256d9b] | 78 | Here |inlineimage011| and |inlineimage012| stand for |
---|
| 79 | the slit height (FWHM/2) and the slit width (FWHM/2) in *q* space. |
---|
| 80 | |
---|
| 81 | This simplifies the integral in Equation 1 to |
---|
[da53353] | 82 | |
---|
| 83 | .. image:: sm_image013.gif |
---|
| 84 | |
---|
[f256d9b] | 85 | **[Equation 4]** |
---|
| 86 | |
---|
| 87 | which may be solved numerically, depending on the nature of |inlineimage011| and |inlineimage012| . |
---|
[da53353] | 88 | |
---|
[f256d9b] | 89 | Solution 1 |
---|
| 90 | ^^^^^^^^^^ |
---|
[da53353] | 91 | |
---|
[f256d9b] | 92 | **For** |inlineimage012| **= 0 and** |inlineimage011| **= constant.** |
---|
[da53353] | 93 | |
---|
| 94 | .. image:: sm_image016.gif |
---|
| 95 | |
---|
[f256d9b] | 96 | For discrete *q* values, at the *q* values of the data points and at the *q* |
---|
| 97 | values extended up to *q*\ :sub:`N`\ = *q*\ :sub:`i` + |inlineimage011| the smeared |
---|
| 98 | intensity can be approximately calculated as |
---|
[da53353] | 99 | |
---|
| 100 | .. image:: sm_image017.gif |
---|
| 101 | |
---|
[f256d9b] | 102 | **[Equation 5]** |
---|
[da53353] | 103 | |
---|
[f256d9b] | 104 | where |inlineimage018| = 0 for *I*\ :sub:`s` when *j* < *i* or *j* > *N-1*. |
---|
[da53353] | 105 | |
---|
[f256d9b] | 106 | Solution 2 |
---|
| 107 | ^^^^^^^^^^ |
---|
[da53353] | 108 | |
---|
[f256d9b] | 109 | **For** |inlineimage012| **= constant and** |inlineimage011| **= 0.** |
---|
[da53353] | 110 | |
---|
[f256d9b] | 111 | Similar to Case 1 |
---|
[da53353] | 112 | |
---|
[f256d9b] | 113 | |inlineimage019| for *q*\ :sub:`p` = *q*\ :sub:`i` - |inlineimage012| and *q*\ :sub:`N` = *q*\ :sub:`i` + |inlineimage012| |
---|
[da53353] | 114 | |
---|
[f256d9b] | 115 | **[Equation 6]** |
---|
[da53353] | 116 | |
---|
[f256d9b] | 117 | where |inlineimage018| = 0 for *I*\ :sub:`s` when *j* < *p* or *j* > *N-1*. |
---|
[da53353] | 118 | |
---|
[f256d9b] | 119 | Solution 3 |
---|
| 120 | ^^^^^^^^^^ |
---|
| 121 | |
---|
| 122 | **For** |inlineimage011| **= constant and** |inlineimage011| **= constant.** |
---|
| 123 | |
---|
| 124 | In this case, the best way is to perform the integration of Equation 1 |
---|
| 125 | numerically for both slit height and slit width. However, the numerical |
---|
| 126 | integration is imperfect unless a large number of iterations, say, at |
---|
| 127 | least 10000 by 10000 for each element of the matrix *W*, is performed. |
---|
| 128 | This is usually too slow for routine use. |
---|
| 129 | |
---|
| 130 | An alternative approach is used in SasView which assumes |
---|
| 131 | slit width << slit height. This method combines Solution 1 with the |
---|
| 132 | numerical integration for the slit width. Then |
---|
[da53353] | 133 | |
---|
| 134 | .. image:: sm_image020.gif |
---|
| 135 | |
---|
[f256d9b] | 136 | **[Equation 7]** |
---|
| 137 | |
---|
| 138 | for *q*\ :sub:`p` = *q*\ :sub:`i` - |inlineimage012| and *q*\ :sub:`N` = *q*\ :sub:`i` + |inlineimage012| |
---|
[da53353] | 139 | |
---|
[f256d9b] | 140 | where |inlineimage018| = 0 for *I*\ :sub:`s` when *j* < *p* or *j* > *N-1*. |
---|
[da53353] | 141 | |
---|
[a0637de] | 142 | .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ |
---|
[da53353] | 143 | |
---|
| 144 | Pinhole Smearing |
---|
[f256d9b] | 145 | ---------------- |
---|
[da53353] | 146 | |
---|
[f256d9b] | 147 | **This is the type of smearing normally encountered with data from synchrotron** |
---|
| 148 | **SAXS cameras and SANS instruments.** |
---|
[da53353] | 149 | |
---|
[f256d9b] | 150 | The pinhole smearing computation is performed in a similar fashion to the slit- |
---|
| 151 | smeared case above except that the weight function used is a Gaussian. Thus |
---|
| 152 | Equation 6 becomes |
---|
[da53353] | 153 | |
---|
[f256d9b] | 154 | .. image:: sm_image021.gif |
---|
[da53353] | 155 | |
---|
[f256d9b] | 156 | **[Equation 8]** |
---|
[da53353] | 157 | |
---|
[a0637de] | 158 | .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ |
---|
[da53353] | 159 | |
---|
| 160 | 2D Smearing |
---|
[f256d9b] | 161 | ----------- |
---|
[da53353] | 162 | |
---|
[f256d9b] | 163 | The 2D smearing computation is performed in a similar fashion to the 1D pinhole |
---|
| 164 | smearing above except that the weight function used is a 2D elliptical Gaussian. |
---|
| 165 | Thus |
---|
[da53353] | 166 | |
---|
| 167 | .. image:: sm_image022.gif |
---|
| 168 | |
---|
[f256d9b] | 169 | **[Equation 9]** |
---|
[da53353] | 170 | |
---|
[f256d9b] | 171 | In Equation 9, *x*\ :sub:`0` = *q* cos(|theta|), *y*\ :sub:`0` = *q* sin(|theta|), and |
---|
| 172 | the primed axes, are all in the coordinate rotated by an angle |theta| about |
---|
| 173 | the z-axis (see the figure below) so that *x'*\ :sub:`0` = *x*\ :sub:`0` cos(|theta|) + |
---|
| 174 | *y*\ :sub:`0` sin(|theta|) and *y'*\ :sub:`0` = -*x*\ :sub:`0` sin(|theta|) + |
---|
| 175 | *y*\ :sub:`0` cos(|theta|). Note that the rotation angle is zero for a x-y symmetric |
---|
| 176 | elliptical Gaussian distribution. The *A* is a normalization factor. |
---|
[da53353] | 177 | |
---|
| 178 | .. image:: sm_image023.gif |
---|
| 179 | |
---|
[f256d9b] | 180 | Now we consider a numerical integration where each of the bins in |theta| and *R* are |
---|
| 181 | *evenly* (this is to simplify the equation below) distributed by |bigdelta|\ |theta| |
---|
| 182 | and |bigdelta|\ R, respectively, and it is further assumed that *I(x',y')* is constant |
---|
| 183 | within the bins. Then |
---|
[da53353] | 184 | |
---|
| 185 | .. image:: sm_image024.gif |
---|
| 186 | |
---|
[f256d9b] | 187 | **[Equation 10]** |
---|
| 188 | |
---|
| 189 | Since the weighting factor on each of the bins is known, it is convenient to |
---|
| 190 | transform *x'-y'* back to *x-y* coordinates (by rotating it by -|theta| around the |
---|
| 191 | *z* axis). |
---|
[da53353] | 192 | |
---|
[f256d9b] | 193 | Then, for a polar symmetric smear |
---|
[da53353] | 194 | |
---|
| 195 | .. image:: sm_image025.gif |
---|
| 196 | |
---|
[f256d9b] | 197 | **[Equation 11]** |
---|
[da53353] | 198 | |
---|
| 199 | where |
---|
| 200 | |
---|
| 201 | .. image:: sm_image026.gif |
---|
| 202 | |
---|
[f256d9b] | 203 | while for a *x-y* symmetric smear |
---|
[da53353] | 204 | |
---|
| 205 | .. image:: sm_image027.gif |
---|
| 206 | |
---|
[f256d9b] | 207 | **[Equation 12]** |
---|
[da53353] | 208 | |
---|
| 209 | where |
---|
| 210 | |
---|
| 211 | .. image:: sm_image028.gif |
---|
| 212 | |
---|
[f256d9b] | 213 | The current version of the SasView uses Equation 11 for 2D smearing, assuming |
---|
| 214 | that all the Gaussian weighting functions are aligned in the polar coordinate. |
---|
[da53353] | 215 | |
---|
[f256d9b] | 216 | .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ |
---|
| 217 | |
---|
| 218 | Weighting & Normalization |
---|
| 219 | ------------------------- |
---|
| 220 | |
---|
| 221 | In all the cases above, the weighting matrix *W* is calculated on the first call |
---|
| 222 | to a smearing function, and includes ~60 *q* values (finely and evenly binned) |
---|
| 223 | below (>0) and above the *q* range of data in order to smear all data points for |
---|
| 224 | a given model and slit/pinhole size. The *Norm* factor is found numerically with the |
---|
| 225 | weighting matrix and applied on the computation of *I*\ :sub:`s`. |
---|
[da53353] | 226 | |
---|
| 227 | .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ |
---|
[f256d9b] | 228 | |
---|
| 229 | .. note:: This help document was last changed by Steve King, 01May2015 |
---|