Changeset 17a8c94 in sasmodels


Ignore:
Timestamp:
Mar 31, 2018 9:22:09 PM (6 years ago)
Author:
butler
Branches:
master, core_shell_microgels, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
9a7ef88
Parents:
5bc6d21 (diff), b3703f5 (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-896

Files:
22 edited

Legend:

Unmodified
Added
Removed
  • doc/guide/pd/polydispersity.rst

    r92d330fd rf4ae8c4  
    2323average over the size distribution. 
    2424 
    25 Each distribution is characterized by its center $\bar x$, its width $\sigma$, 
    26 the number of sigmas $N_\sigma$ to include from the tails, and the number of 
    27 points used to compute the average. The center of the distribution is set by the 
    28 value of the model parameter.  Volume parameters have polydispersity *PD* 
    29 (not to be confused with a molecular weight distributions in polymer science) 
    30 leading to a size distribution of width $\text{PD} = \sigma / \bar x$, but 
    31 orientation parameters use an angular distributions of width $\sigma$. 
    32 $N_\sigma$ determines how far into the tails to evaluate the distribution, with 
    33 larger values of $N_\sigma$ required for heavier tailed distributions. 
     25Each distribution is characterized by a center value $\bar x$ or 
     26$x_\text{med}$, a width parameter $\sigma$ (note this is *not necessarily* 
     27the standard deviation, so read the description carefully), the number of 
     28sigmas $N_\sigma$ to include from the tails of the distribution, and the 
     29number of points used to compute the average. The center of the distribution 
     30is set by the value of the model parameter. 
     31 
     32Volume parameters have polydispersity *PD* (not to be confused with a 
     33molecular weight distributions in polymer science), but orientation parameters 
     34use angular distributions of width $\sigma$. 
     35 
     36$N_\sigma$ determines how far into the tails to evaluate the distribution, 
     37with larger values of $N_\sigma$ required for heavier tailed distributions. 
    3438The scattering in general falls rapidly with $qr$ so the usual assumption 
    3539that $G(r - 3\sigma_r)$ is tiny and therefore $f(r - 3\sigma_r)G(r - 3\sigma_r)$ 
     
    4448The following distribution functions are provided: 
    4549 
     50*  *Uniform Distribution* 
    4651*  *Rectangular Distribution* 
    47 *  *Uniform Distribution* 
    4852*  *Gaussian Distribution* 
     53*  *Boltzmann Distribution* 
    4954*  *Lognormal Distribution* 
    5055*  *Schulz Distribution* 
    5156*  *Array Distribution* 
    52 *  *Boltzmann Distribution* 
    5357 
    5458These are all implemented as *number-average* distributions. 
     59 
     60Additional distributions are under consideration. 
     61 
     62Suggested Applications 
     63^^^^^^^^^^^^^^^^^^^^^^ 
     64 
     65If applying polydispersion to parameters describing particle sizes, use 
     66the Lognormal or Schulz distributions. 
     67 
     68If applying polydispersion to parameters describing interfacial thicknesses 
     69or angular orientations, use the Gaussian or Boltzmann distributions. 
     70 
     71The array distribution allows a user-defined distribution to be applied. 
     72 
     73.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     74 
     75Uniform Distribution 
     76^^^^^^^^^^^^^^^^^^^^ 
     77 
     78The Uniform Distribution is defined as 
     79 
     80.. math:: 
     81 
     82    f(x) = \frac{1}{\text{Norm}} 
     83    \begin{cases} 
     84        1 & \text{for } |x - \bar x| \leq \sigma \\ 
     85        0 & \text{for } |x - \bar x| > \sigma 
     86    \end{cases} 
     87 
     88where $\bar x$ ($x_\text{mean}$ in the figure) is the mean of the 
     89distribution, $\sigma$ is the half-width, and *Norm* is a normalization 
     90factor which is determined during the numerical calculation. 
     91 
     92The polydispersity in sasmodels is given by 
     93 
     94.. math:: \text{PD} = \sigma / \bar x 
     95 
     96.. figure:: pd_uniform.jpg 
     97 
     98    Uniform distribution. 
     99 
     100The value $N_\sigma$ is ignored for this distribution. 
    55101 
    56102.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     
    65111    f(x) = \frac{1}{\text{Norm}} 
    66112    \begin{cases} 
    67       1 & \text{for } |x - \bar x| \leq w \\ 
    68       0 & \text{for } |x - \bar x| > w 
     113        1 & \text{for } |x - \bar x| \leq w \\ 
     114        0 & \text{for } |x - \bar x| > w 
    69115    \end{cases} 
    70116 
    71 where $\bar x$ is the mean of the distribution, $w$ is the half-width, and 
    72 *Norm* is a normalization factor which is determined during the numerical 
    73 calculation. 
     117where $\bar x$ ($x_\text{mean}$ in the figure) is the mean of the 
     118distribution, $w$ is the half-width, and *Norm* is a normalization 
     119factor which is determined during the numerical calculation. 
    74120 
    75121Note that the standard deviation and the half width $w$ are different! 
     
    79125.. math:: \sigma = w / \sqrt{3} 
    80126 
    81 whilst the polydispersity is 
     127whilst the polydispersity in sasmodels is given by 
    82128 
    83129.. math:: \text{PD} = \sigma / \bar x 
     
    87133    Rectangular distribution. 
    88134 
    89  
    90  
    91 Uniform Distribution 
    92 ^^^^^^^^^^^^^^^^^^^^^^^^ 
    93  
    94 The Uniform Distribution is defined as 
    95  
    96     .. math:: 
    97  
    98         f(x) = \frac{1}{\text{Norm}} 
    99         \begin{cases} 
    100           1 & \text{for } |x - \bar x| \leq \sigma \\ 
    101           0 & \text{for } |x - \bar x| > \sigma 
    102         \end{cases} 
    103  
    104     where $\bar x$ is the mean of the distribution, $\sigma$ is the half-width, and 
    105     *Norm* is a normalization factor which is determined during the numerical 
    106     calculation. 
    107  
    108     Note that the polydispersity is given by 
    109  
    110     .. math:: \text{PD} = \sigma / \bar x 
    111  
    112     .. figure:: pd_uniform.jpg 
    113  
    114         Uniform distribution. 
    115  
    116 The value $N_\sigma$ is ignored for this distribution. 
     135.. note:: The Rectangular Distribution is deprecated in favour of the 
     136            Uniform Distribution above and is described here for backwards 
     137            compatibility with earlier versions of SasView only. 
    117138 
    118139.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     
    126147 
    127148    f(x) = \frac{1}{\text{Norm}} 
    128            \exp\left(-\frac{(x - \bar x)^2}{2\sigma^2}\right) 
    129  
    130 where $\bar x$ is the mean of the distribution and *Norm* is a normalization 
    131 factor which is determined during the numerical calculation. 
    132  
    133 The polydispersity is 
     149            \exp\left(-\frac{(x - \bar x)^2}{2\sigma^2}\right) 
     150 
     151where $\bar x$ ($x_\text{mean}$ in the figure) is the mean of the 
     152distribution and *Norm* is a normalization factor which is determined 
     153during the numerical calculation. 
     154 
     155The polydispersity in sasmodels is given by 
    134156 
    135157.. math:: \text{PD} = \sigma / \bar x 
     
    138160 
    139161    Normal distribution. 
     162 
     163.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     164 
     165Boltzmann Distribution 
     166^^^^^^^^^^^^^^^^^^^^^^ 
     167 
     168The Boltzmann Distribution is defined as 
     169 
     170.. math:: 
     171 
     172    f(x) = \frac{1}{\text{Norm}} 
     173            \exp\left(-\frac{ | x - \bar x | }{\sigma}\right) 
     174 
     175where $\bar x$ ($x_\text{mean}$ in the figure) is the mean of the 
     176distribution and *Norm* is a normalization factor which is determined 
     177during the numerical calculation. 
     178 
     179The width is defined as 
     180 
     181.. math:: \sigma=\frac{k T}{E} 
     182 
     183which is the inverse Boltzmann factor, where $k$ is the Boltzmann constant, 
     184$T$ the temperature in Kelvin and $E$ a characteristic energy per particle. 
     185 
     186.. figure:: pd_boltzmann.jpg 
     187 
     188    Boltzmann distribution. 
    140189 
    141190.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     
    144193^^^^^^^^^^^^^^^^^^^^^^ 
    145194 
     195The Lognormal Distribution describes a function of $x$ where $\ln (x)$ has 
     196a normal distribution. The result is a distribution that is skewed towards 
     197larger values of $x$. 
     198 
    146199The Lognormal Distribution is defined as 
    147200 
    148201.. math:: 
    149202 
    150     f(x) = \frac{1}{\text{Norm}} 
    151            \frac{1}{xp}\exp\left(-\frac{(\ln(x) - \mu)^2}{2p^2}\right) 
    152  
    153 where $\mu=\ln(x_\text{med})$ when $x_\text{med}$ is the median value of the 
    154 distribution, and *Norm* is a normalization factor which will be determined 
    155 during the numerical calculation. 
    156  
    157 The median value for the distribution will be the value given for the 
    158 respective size parameter, for example, *radius=60*. 
    159  
    160 The polydispersity is given by $\sigma$ 
    161  
    162 .. math:: \text{PD} = p 
    163  
    164 For the angular distribution 
    165  
    166 .. math:: p = \sigma / x_\text{med} 
    167  
    168 The mean value is given by $\bar x = \exp(\mu+ p^2/2)$. The peak value 
    169 is given by $\max x = \exp(\mu - p^2)$. 
     203    f(x) = \frac{1}{\text{Norm}}\frac{1}{x\sigma} 
     204            \exp\left(-\frac{1}{2} 
     205                        \bigg(\frac{\ln(x) - \mu}{\sigma}\bigg)^2\right) 
     206 
     207where *Norm* is a normalization factor which will be determined during 
     208the numerical calculation, $\mu=\ln(x_\text{med})$ and $x_\text{med}$ 
     209is the *median* value of the *lognormal* distribution, but $\sigma$ is 
     210a parameter describing the width of the underlying *normal* distribution. 
     211 
     212$x_\text{med}$ will be the value given for the respective size parameter 
     213in sasmodels, for example, *radius=60*. 
     214 
     215The polydispersity in sasmodels is given by 
     216 
     217.. math:: \text{PD} = p = \sigma / x_\text{med} 
     218 
     219The mean value of the distribution is given by $\bar x = \exp(\mu+ p^2/2)$ 
     220and the peak value by $\max x = \exp(\mu - p^2)$. 
     221 
     222The variance (the square of the standard deviation) of the *lognormal* 
     223distribution is given by 
     224 
     225.. math:: 
     226 
     227    \nu = [\exp({\sigma}^2) - 1] \exp({2\mu + \sigma^2}) 
     228 
     229Note that larger values of PD might need a larger number of points 
     230and $N_\sigma$. 
    170231 
    171232.. figure:: pd_lognormal.jpg 
     
    173234    Lognormal distribution. 
    174235 
    175 This distribution function spreads more, and the peak shifts to the left, as 
    176 $p$ increases, so it requires higher values of $N_\sigma$ and more points 
    177 in the distribution. 
     236For further information on the Lognormal distribution see: 
     237http://en.wikipedia.org/wiki/Log-normal_distribution and 
     238http://mathworld.wolfram.com/LogNormalDistribution.html 
    178239 
    179240.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     
    182243^^^^^^^^^^^^^^^^^^^ 
    183244 
     245The Schulz (sometimes written Schultz) distribution is similar to the 
     246Lognormal distribution, in that it is also skewed towards larger values of 
     247$x$, but which has computational advantages over the Lognormal distribution. 
     248 
    184249The Schulz distribution is defined as 
    185250 
    186251.. math:: 
    187252 
    188     f(x) = \frac{1}{\text{Norm}} 
    189            (z+1)^{z+1}(x/\bar x)^z\frac{\exp[-(z+1)x/\bar x]}{\bar x\Gamma(z+1)} 
    190  
    191 where $\bar x$ is the mean of the distribution and *Norm* is a normalization 
    192 factor which is determined during the numerical calculation, and $z$ is a 
    193 measure of the width of the distribution such that 
     253    f(x) = \frac{1}{\text{Norm}} (z+1)^{z+1}(x/\bar x)^z 
     254            \frac{\exp[-(z+1)x/\bar x]}{\bar x\Gamma(z+1)} 
     255 
     256where $\bar x$ ($x_\text{mean}$ in the figure) is the mean of the 
     257distribution, *Norm* is a normalization factor which is determined 
     258during the numerical calculation, and $z$ is a measure of the width 
     259of the distribution such that 
    194260 
    195261.. math:: z = (1-p^2) / p^2 
    196262 
    197 The polydispersity is 
    198  
    199 .. math:: p = \sigma / \bar x 
    200  
    201 Note that larger values of PD might need larger number of points and $N_\sigma$. 
    202 For example, at PD=0.7 and radius=60 |Ang|, Npts>=160 and Nsigmas>=15 at least. 
     263where $p$ is the polydispersity in sasmodels given by 
     264 
     265.. math:: PD = p = \sigma / \bar x 
     266 
     267and $\sigma$ is the RMS deviation from $\bar x$. 
     268 
     269Note that larger values of PD might need a larger number of points 
     270and $N_\sigma$. For example, for PD=0.7 with radius=60 |Ang|, at least 
     271Npts>=160 and Nsigmas>=15 are required. 
    203272 
    204273.. figure:: pd_schulz.jpg 
     
    207276 
    208277For further information on the Schulz distribution see: 
    209 M Kotlarchyk & S-H Chen, *J Chem Phys*, (1983), 79, 2461. 
     278M Kotlarchyk & S-H Chen, *J Chem Phys*, (1983), 79, 2461 and 
     279M Kotlarchyk, RB Stephens, and JS Huang, *J Phys Chem*, (1988), 92, 1533 
    210280 
    211281.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     
    237307.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
    238308 
    239 Boltzmann Distribution 
    240 ^^^^^^^^^^^^^^^^^^^^^^ 
    241  
    242 The Boltzmann Distribution is defined as 
    243  
    244 .. math:: 
    245  
    246     f(x) = \frac{1}{\text{Norm}} 
    247            \exp\left(-\frac{ | x - \bar x | }{\sigma}\right) 
    248  
    249 where $\bar x$ is the mean of the distribution and *Norm* is a normalization 
    250 factor which is determined during the numerical calculation. 
    251 The width is defined as 
    252  
    253 .. math:: \sigma=\frac{k T}{E} 
    254  
    255 which is the inverse Boltzmann factor, 
    256 where $k$ is the Boltzmann constant, $T$ the temperature in Kelvin and $E$ a 
    257 characteristic energy per particle. 
    258  
    259 .. figure:: pd_boltzmann.jpg 
    260  
    261     Boltzmann distribution. 
    262  
    263 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
    264  
    265309Note about DLS polydispersity 
    266310^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 
     
    273317related) except when the DLS polydispersity parameter is <0.13. 
    274318 
     319.. math:: 
     320 
     321    p_{DLS} = \sqrt(\nu / \bar x^2) 
     322 
     323where $\nu$ is the variance of the distribution and $\bar x$ is the mean 
     324value of $x$. 
     325 
    275326For more information see: 
    276327S King, C Washington & R Heenan, *Phys Chem Chem Phys*, (2005), 7, 143 
     
    282333| 2015-05-01 Steve King 
    283334| 2017-05-08 Paul Kienzle 
     335| 2018-03-20 Steve King 
  • example/SiO2_100pc_H2O_0pc_D2O.ses

    r31c64d9 rb314f89  
    1 name    SiO2 stober                                              
    2 sample  SiO2 100pcH2O                                            
    3 collimation     unknown                                          
    4 ID      CPD                                              
    5 Date    di 27 jan 2015 18:17:50                                          
    6 Method  Offspec                                          
    7 Thickness [mm]  1                                                
    8 z-acceptance [nm^-1]    0.3                                              
    9 y-acceptance [nm^-1]    0.3                                              
     1FileFormatVersion       1.0 
     2DataFileTitle           SiO2 stober 
     3Sample                  SiO2 100pcH2O 
     4collimation             unknown 
     5ID                      CPD 
     6Date                    di 27 jan 2015 18:17:50 
     7Method                  Offspec 
     8Thickness               1 
     9Thickness_unit          mm 
     10Theta_zmax              0.0100 
     11Theta_zmax_unit         radians 
     12Theta_ymax              0.0100 
     13Theta_ymax_unit         radians 
     14Orientation             Z 
     15SpinEchoLength_unit     A 
     16Depolarisation_unit     A-2 cm-1 
     17Wavelength_unit         A 
    1018 
    11 spin echo length [nm]   error spin-echo length  wavelength [nm] error wavelength        Sample P        Sample P -error          
    12 244.098 5       0.220907401     0.006627222     0.96321 0.0113507       0.029882023     29.882023 
    13 340.136 5       0.260768096     0.007823043     0.973305        0.0034846       0.085257531     85.257531 
    14 452.181 5       0.300665994     0.00901998      0.951588        0.00287498      0.140798634     140.798634 
    15 580.232 5       0.340587727     0.010217632     0.911935        0.00310965      0.196560502     196.560502 
    16 724.29  5       0.380526057     0.011415782     0.856129        0.00356166      0.252528125     252.528125 
    17 884.354 5       0.420476016     0.01261428      0.78817 0.0036651       0.308729274     308.729274 
    18 1060.42 5       0.460433709     0.013813011     0.719608        0.00386121      0.365037117     365.037117 
    19 1252.5  5       0.50039968      0.01501199      0.653424        0.00418035      0.421684677     421.684677 
    20 1460.58 5       0.540369504     0.016211085     0.603456        0.00472218      0.478564852     478.564852 
    21 1684.67 5       0.580344105     0.017410323     0.558174        0.00537231      0.535715521     535.715521 
    22 1924.77 5       0.620322561     0.018609677     0.532672        0.00617699      0.59324408      593.24408 
    23 2180.87 5       0.660302658     0.01980908      0.505018        0.00707792      0.650985498     650.985498 
    24 2452.98 5       0.700285542     0.021008566     0.475536        0.00829962      0.709203958     709.203958 
    25 2741.1  5       0.740270761     0.022208123     0.440819        0.00957178      0.767809943     767.809943 
    26 3045.22 5       0.780256676     0.0234077       0.397642        0.0111225       0.826762925     826.762925 
    27 3365.35 5       0.820244402     0.024607332     0.363717        0.0132055       0.886302296     886.302296 
    28 3701.48 5       0.860232527     0.025806976     0.302206        0.0158338       0.946236366     946.236366 
    29 4053.62 5       0.900222106     0.027006663     0.302188        0.0204351       1.006784115     1006.784115 
    30 4421.77 5       0.940212955     0.028206389     0.263252        0.0264158       1.067891213     1067.891213 
    31 4805.92 5       0.980203897     0.029406117     0.230149        0.0339972       1.129598722     1129.598722 
    32 5206.08 5       1.020195903     0.030605877     0.268749        0.0480167       1.192022694     1192.022694 
    33 5622.25 5       1.060188851     0.031805666     0.340439        0.0701945       1.255271282     1255.271282 
    34 6054.42 5       1.10018173      0.033005452     0.238197        0.0986631       1.319307134     1319.307134 
    35 6502.6  5       1.140175425     0.034205263     0.0985987       0.170273        1.384197821     1384.197821 
    36 6966.79 5       1.180169852     0.035405096     0.0814573       0.256765        1.448518618     1448.518618 
     19BEGIN_DATA 
     20 SpinEchoLength  Depolarisation  Depolarisation_error   Wavelength  Wavelength_error  SpinEchoLength_error  Polarisation  Polarisation_error  
     21 2440.98   -7.6810986e-3          2.4147998e-3   2.20907401        0.06627222                    50       0.96321           0.0113507  
     22 3401.36   -3.9790857e-3          5.2649599e-4   2.60768096        0.07823043                    50      0.973305           0.0034846  
     23 4521.81   -5.4892798e-3          3.3420831e-4   3.00665994         0.0901998                    50      0.951588          0.00287498  
     24 5802.32   -7.9471175e-3          2.9396095e-4   3.40587727        0.10217632                    50      0.911935          0.00310965  
     25 7242.9    -0.010727495          2.8730584e-4   3.80526057        0.11415782                    50      0.856129          0.00356166  
     26 8843.54    -0.013463878          2.6301679e-4   4.20476016         0.1261428                    50       0.78817           0.0036651  
     27 10604.2    -0.015521222          2.5310062e-4   4.60433709        0.13813011                    50      0.719608          0.00386121  
     2812525.    -0.016993983          2.5549565e-4    5.0039968         0.1501199                    50      0.653424          0.00418035  
     2914605.8    -0.017297381          2.6798795e-4   5.40369504        0.16211085                    50      0.603456          0.00472218  
     3016846.7    -0.017312523          2.8577242e-4   5.80344105        0.17410323                    50      0.558174          0.00537231  
     3119247.7    -0.016368225          3.0135741e-4   6.20322561        0.18609677                    50      0.532672          0.00617699  
     3221808.7    -0.015668849          3.2144946e-4   6.60302658         0.1980908                    50      0.505018          0.00707792  
     3324529.8    -0.015157278          3.5589713e-4   7.00285542        0.21008566                    50      0.475536          0.00829962  
     3427411.    -0.014947440          3.9623352e-4   7.40270761        0.22208123                    50      0.440819          0.00957178  
     3530452.2    -0.015147872          4.5944674e-4   7.80256676          0.234077                    50      0.397642           0.0111225  
     3633653.5    -0.015032370          5.3964070e-4   8.20244402        0.24607332                    50      0.363717           0.0132055  
     3737014.8    -0.016170897          7.0802787e-4   8.60232527        0.25806976                    50      0.302206           0.0158338  
     3840536.2    -0.014766858          8.3444978e-4   9.00222106        0.27006663                    50      0.302188           0.0204351  
     3944217.7    -0.015097771          1.1351144e-3   9.40212955        0.28206389                    50      0.263252           0.0264158  
     4048059.2    -0.015289642          1.5374507e-3   9.80203897        0.29406117                    50      0.230149           0.0339972  
     4152060.8    -0.012624691          1.7166363e-3  10.20195903        0.30605877                    50      0.268749           0.0480167  
     4256222.5   -9.5864674e-3          1.8344138e-3  10.60188851        0.31805666                    50      0.340439           0.0701945  
     4360544.2    -0.011852755          3.4220757e-3   11.0018173        0.33005452                    50      0.238197           0.0986631  
     4465026.    -0.017820748           0.013284073  11.40175425        0.34205263                    50     0.0985987            0.170273  
     4569667.9    -0.018004557           0.022631679  11.80169852        0.35405096                    50     0.0814573            0.256765  
  • example/core_shell.ses

    r5be92e8 re0721e7  
    1 name    se009051.dat                                             
    2 sample  "SiO2 pH=6 & NiO pH=10, nanosized, in D2O, Sine ++ only."                                                
    3 collimation     "D1=D2=20x8 mm,Ds = 16x10 mm (WxH), GF1 =scanning, GF2 = 2.5 A. "                                                
    4 ID      CPD                                              
    5 Date    di 27 jan 2015 18:17:50                                          
    6 Method  sine one element scan                                            
    7 Thickness [mm]  2                                                
    8 z-acceptance [nm^-1]    0.3                                              
    9 y-acceptance [nm^-1]    0.3                                              
     1FileFormatVersion       1.0 
     2DataFileTitle           se009051.dat                                             
     3Sample                  "SiO2 pH=6 & NiO pH=10, nanosized, in D2O, Sine ++ only."                                                
     4collimation             "D1=D2=20x8 mm,Ds = 16x10 mm (WxH), GF1 =scanning, GF2 = 2.5 A. "                                                
     5ID                      CPD                                              
     6Date                    di 27 jan 2015 18:17:50 
     7Method                  sine one element scan 
     8Thickness               10 
     9Thickness_unit          mm 
     10Theta_zmax              0.0168 
     11Theta_zmax_unit         radians 
     12Theta_ymax              0.0168 
     13Theta_ymax_unit         radians 
     14Orientation             Z 
     15SpinEchoLength_unit     A 
     16Depolarisation_unit     A-2 cm-1 
     17Wavelength_unit         A 
    1018                                                         
    11 spin echo length [um]   error spin-echo length  wavelength [nm] error wavelength        Sample 5        Sample 5 -error          
    12 26      5       0.161245        0.01    0.996315        0.00528445      0.161245        26 
    13 28.08   5       0.167571        0.01    0.995937        0.00522962      0.167571        28.08 
    14 30.3264 5       0.174145        0.01    0.995039        0.00371164      0.174145        30.3264 
    15 32.7525 5       0.180977        0.01    0.99448 0.00381089      0.180977        32.7525 
    16 35.3727 5       0.188076        0.01    0.992143        0.00319011      0.188076        35.3727 
    17 38.2025 5       0.195455        0.01    0.991403        0.0032496       0.195455        38.2025 
    18 41.2587 5       0.203122        0.01    0.990106        0.002978        0.203122        41.2587 
    19 44.5594 5       0.211091        0.01    0.98857 0.00297338      0.211091        44.5594 
    20 48.1242 5       0.219372        0.01    0.986236        0.00286669      0.219372        48.1242 
    21 51.9741 5       0.227978        0.01    0.982739        0.00283988      0.227978        51.9741 
    22 56.132  5       0.236922        0.01    0.979995        0.00287147      0.236922        56.132 
    23 60.6226 5       0.246217        0.01    0.976516        0.00290667      0.246217        60.6226 
    24 65.4724 5       0.255876        0.01    0.971858        0.00300969      0.255876        65.4724 
    25 70.7102 5       0.265914        0.01    0.967518        0.00310597      0.265914        70.7102 
    26 76.367  5       0.276346        0.01    0.963198        0.00310409      0.276346        76.367 
    27 82.4764 5       0.287187        0.01    0.957071        0.00306271      0.287187        82.4764 
    28 89.0745 5       0.298454        0.01    0.952784        0.00299587      0.298454        89.0745 
    29 96.2005 5       0.310162        0.01    0.947462        0.0029896       0.310162        96.2005 
    30 103.897 5       0.322331        0.01    0.941226        0.00300217      0.322331        103.897 
    31 112.208 5       0.334975        0.01    0.936151        0.00305677      0.334975        112.208 
    32 121.185 5       0.348116        0.01    0.930884        0.00307969      0.348116        121.185 
    33 130.88  5       0.361773        0.01    0.927992        0.00316999      0.361773        130.88 
    34 141.35  5       0.375965        0.01    0.926511        0.00326096      0.375965        141.35 
    35 152.658 5       0.390715        0.01    0.925098        0.00340349      0.390715        152.658 
    36 164.871 5       0.406043        0.01    0.924369        0.0035662       0.406043        164.871 
    37 178.06  5       0.421972        0.01    0.925632        0.00372489      0.421972        178.06 
    38 192.305 5       0.438526        0.01    0.922762        0.00390394      0.438526        192.305 
    39 207.69  5       0.45573 0.01    0.918753        0.00412162      0.45573 207.69 
    40 224.305 5       0.473608        0.01    0.90663 0.0043316       0.473608        224.305 
    41 242.249 5       0.492188        0.01    0.893251        0.00454417      0.492188        242.249 
    42 261.629 5       0.511497        0.01    0.878299        0.00473364      0.511497        261.629 
    43 282.559 5       0.531563        0.01    0.867266        0.00497459      0.531563        282.559 
    44 305.164 5       0.552417        0.01    0.859537        0.00521977      0.552417        305.164 
    45 329.577 5       0.574088        0.01    0.855935        0.0055573       0.574088        329.577 
    46 355.943 5       0.59661 0.01    0.851389        0.00581848      0.59661 355.943 
    47 384.419 5       0.620015        0.01    0.836311        0.00620483      0.620015        384.419 
    48 415.172 5       0.644338        0.01    0.821362        0.00668373      0.644338        415.172 
    49 448.386 5       0.669616        0.01    0.803833        0.0071725       0.669616        448.386 
    50 484.257 5       0.695886        0.01    0.792211        0.00786449      0.695886        484.257 
    51 522.998 5       0.723186        0.01    0.787407        0.00860688      0.723186        522.998 
    52 564.838 5       0.751557        0.01    0.765977        0.00938856      0.751557        564.838 
    53 610.025 5       0.781041        0.01    0.746618        0.0101567       0.781041        610.025 
    54 658.827 5       0.811682        0.01    0.734672        0.0110357       0.811682        658.827 
    55 711.533 5       0.843524        0.01    0.720351        0.0118912       0.843524        711.533 
    56 768.455 5       0.876616        0.01    0.692587        0.0130927       0.876616        768.455 
    57 829.932 5       0.911006        0.01    0.674767        0.0137763       0.911006        829.932 
    58 896.326 5       0.946745        0.01    0.664497        0.0148902       0.946745        896.326 
    59 968.032 5       0.983886        0.01    0.634464        0.0158459       0.983886        968.032 
    60 1045.47 5       1.02248 0.01    0.604792        0.0166925       1.02248 1045.47 
    61 1129.11 5       1.0626  0.01    0.591534        0.0179667       1.0626  1129.11 
    62 1219.44 5       1.10428 0.01    0.582625        0.0198223       1.10428 1219.44 
    63 1317    5       1.14761 0.01    0.549232        0.0217725       1.14761 1317 
    64 1422.36 5       1.19263 0.01    0.53863 0.024516        1.19263 1422.36 
    65 1536.15 5       1.23942 0.01    0.521353        0.0281108       1.23942 1536.15 
    66 1659.04 5       1.28804 0.01    0.460045        0.0314452       1.28804 1659.04 
    67 1791.76 5       1.33857 0.01    0.411185        0.0366899       1.33857 1791.76 
    68 1930.34 5       1.38937 0.01    0.414685        0.0478689       1.38937 1930.34 
     19BEGIN_DATA 
     20SpinEchoLength  SpinEchoLength_error  Wavelength  Wavelength_Error  Polarisation  Polarisation_error  Depolarisation  Depolarisation_error  
     21298.82023 50 2.095 0.1 0.997817556 0.00887342 -4.9779370e-5 2.0261512e-4  
     22852.57531 50 2.095 0.1 1.0026184 0.009572307 5.9579929e-5 2.1752686e-4  
     231407.9863 50 2.095 0.1 0.996013172 0.012119508 -9.1017859e-5 2.7723742e-4  
     241965.6050 50 2.095 0.1 0.991752656 0.011651473 -1.8868750e-4 2.6767598e-4  
     252525.2813 50 2.095 0.1 0.995429571 0.012193294 -1.0437182e-4 2.7908883e-4  
     263087.2927 50 2.095 0.1 0.995119819 0.009621277 -1.1146275e-4 2.2028721e-4  
     273650.3712 50 2.095 0.1 0.997497767 0.012518842 -5.7082583e-5 2.8594610e-4  
     284216.8468 50 2.095 0.1 0.994733865 0.010585926 -1.2030120e-4 2.4246770e-4  
     294785.6485 50 2.095 0.1 0.992696275 0.010677724 -1.6701950e-4 2.4507231e-4  
     305357.1552 50 2.095 0.1 0.994534294 0.012909556 -1.2487278e-4 2.9574914e-4  
     315932.4408 50 2.095 0.1 0.986412268 0.014651894 -3.1170682e-4 3.3842875e-4  
     326509.8550 50 2.095 0.1 0.988788566 0.015736468 -2.5688520e-4 3.6260666e-4  
     337092.0396 50 2.095 0.1 0.989501168 0.013611615 -2.4047103e-4 3.1341898e-4  
     347678.0994 50 2.095 0.1 0.99203933 0.016501891 -1.8210252e-4 3.7899787e-4  
     358267.6293 50 2.095 0.1 0.994062723 0.010276207 -1.3567871e-4 2.3553259e-4  
     368863.0230 50 2.095 0.1 0.979647192 0.011089421 -4.6850452e-4 2.5791174e-4  
     379462.3637 50 2.095 0.1 0.97982075 0.013168527 -4.6446835e-4 3.0621222e-4  
     3810067.841 50 2.095 0.1 0.977927712 0.014362819 -5.0853039e-4 3.3463000e-4  
     3910678.912 50 2.095 0.1 0.978351462 0.013239476 -4.9865985e-4 3.0832436e-4  
     4011295.987 50 2.095 0.1 0.981246471 0.013896898 -4.3133968e-4 3.2267975e-4  
     4111920.227 50 2.095 0.1 0.978275164 0.013747481 -5.0043677e-4 3.2017989e-4  
     4212552.713 50 2.095 0.1 0.976818842 0.013487944 -5.3437989e-4 3.1460359e-4  
     4313193.071 50 2.095 0.1 0.981546068 0.011972943 -4.2438423e-4 2.7792152e-4  
     4413841.978 50 2.095 0.1 0.96445854 0.013357572 -8.2452102e-4 3.1555561e-4  
     4514500.513 50 2.095 0.1 0.972756158 0.014756189 -6.2933879e-4 3.4562263e-4  
     4615169.786 50 2.095 0.1 0.971010184 0.014210504 -6.7027011e-4 3.3343996e-4  
     4715850.446 50 2.095 0.1 0.975009829 0.013648839 -5.7661387e-4 3.1894710e-4  
     4816543.562 50 2.095 0.1 0.969575209 0.014454336 -7.0396574e-4 3.3966327e-4  
     4917249.754 50 2.095 0.1 0.959907267 0.012806944 -9.3229353e-4 3.0398222e-4  
     5017969.627 50 2.095 0.1 0.96219203 0.011845496 -8.7812744e-4 2.8049391e-4  
     5118706.130 50 2.095 0.1 0.960157966 0.011721155 -9.2634378e-4 2.7813758e-4  
     5219459.212 50 2.095 0.1 0.95089937 0.009967287 -1.1471121e-3 2.3882201e-4  
     5320230.984 50 2.095 0.1 0.955584642 0.01104368 -1.0351259e-3 2.6331561e-4  
     5421021.899 50 2.095 0.1 0.950786938 0.011651582 -1.1498062e-3 2.7921171e-4  
     5521835.345 50 2.095 0.1 0.951403607 0.008784149 -1.1350335e-3 2.1036178e-4  
     5622671.730 50 2.095 0.1 0.94561823 0.009392383 -1.2740040e-3 2.2630383e-4  
     5723533.930 50 2.095 0.1 0.945882787 0.009468264 -1.2676305e-3 2.2806833e-4  
     5824423.504 50 2.095 0.1 0.939583158 0.009164239 -1.4198814e-3 2.2222511e-4  
     5925343.343 50 2.095 0.1 0.93731257 0.008621568 -1.4750079e-3 2.0957224e-4  
     6026294.734 50 2.095 0.1 0.936639557 0.010408821 -1.4913733e-3 2.5319842e-4  
     6127282.004 50 2.095 0.1 0.932091884 0.007112674 -1.6022666e-3 1.7386258e-4  
     6228307.499 50 2.095 0.1 0.933852763 0.009200431 -1.5592642e-3 2.2447176e-4  
     6329373.630 50 2.095 0.1 0.930283437 0.01022719 -1.6465153e-3 2.5047996e-4  
     6430485.110 50 2.095 0.1 0.930121334 0.007055747 -1.6504858e-3 1.7283645e-4  
     6531645.899 50 2.095 0.1 0.925944326 0.0078917 -1.7530356e-3 1.9418588e-4  
     6632858.438 50 2.095 0.1 0.92351759 0.005522582 -1.8128270e-3 1.3624763e-4  
     6734128.058 50 2.095 0.1 0.918228311 0.006917328 -1.9436940e-3 1.7164045e-4  
     6835460.168 50 2.095 0.1 0.908621563 0.006852313 -2.1833230e-3 1.7182490e-4  
     6936858.762 50 2.095 0.1 0.919087792 0.006995961 -1.9223776e-3 1.7342924e-4  
     7038331.748 50 2.095 0.1 0.910132214 0.006107336 -2.1454742e-3 1.5289007e-4  
     7139882.345 50 2.095 0.1 0.904491462 0.007078101 -2.2871233e-3 1.7829708e-4  
     7241519.404 50 2.095 0.1 0.90056919 0.005934428 -2.3861400e-3 1.5013907e-4  
     7343249.023 50 2.095 0.1 0.903155701 0.006249069 -2.3207959e-3 1.5764661e-4  
     7445079.637 50 2.095 0.1 0.894919827 0.006196232 -2.5295172e-3 1.5775222e-4  
     7547019.670 50 2.095 0.1 0.896358908 0.007324999 -2.4929085e-3 1.8619052e-4  
     7649077.851 50 2.095 0.1 0.88807923 0.004530465 -2.7043436e-3 1.1623128e-4  
     7751264.711 50 2.095 0.1 0.886649039 0.008924412 -2.7410654e-3 2.2932944e-4  
     7853590.598 50 2.095 0.1 0.882051947 0.006055081 -2.8595036e-3 1.5640756e-4  
     7956067.403 50 2.095 0.1 0.882573371 0.005727419 -2.8460388e-3 1.4785638e-4  
     8058709.036 50 2.095 0.1 0.876289825 0.006062306 -3.0088321e-3 1.5762389e-4  
     8161527.362 50 2.095 0.1 0.877318199 0.005307783 -2.9821094e-3 1.3784403e-4  
     8264538.932 50 2.095 0.1 0.873610284 0.006918104 -3.0786086e-3 1.8042690e-4  
     8367758.354 50 2.095 0.1 0.865954455 0.005625863 -3.2791557e-3 1.4802192e-4  
     8471205.306 50 2.095 0.1 0.868037308 0.008662141 -3.2244196e-3 2.2736248e-4  
     8574897.359 50 2.095 0.1 0.86676404 0.005761209 -3.2578647e-3 1.5144143e-4  
     8678855.560 50 2.095 0.1 0.85655072 0.005731411 -3.5279304e-3 1.5245456e-4  
     8783102.902 50 2.095 0.1 0.857936274 0.006954572 -3.4911046e-3 1.8469168e-4  
     8887663.154 50 2.095 0.1 0.85520525 0.006559622 -3.5637478e-3 1.7475934e-4  
     8992562.717 50 2.095 0.1 0.849739829 0.008907377 -3.7098230e-3 2.3883381e-4  
     9097830.316 50 2.095 0.1 0.841487161 0.006547659 -3.9321836e-3 1.7728439e-4  
     91103497.14 50 2.095 0.1 0.84801051 0.007574866 -3.7562386e-3 2.0351933e-4  
     92109596.79 50 2.095 0.1 0.843342861 0.006411993 -3.8819940e-3 1.7322909e-4  
     93116165.97 50 2.095 0.1 0.837488454 0.008141353 -4.0407107e-3 2.2148775e-4  
     94123244.47 50 2.095 0.1 0.839214922 0.009987535 -3.9937900e-3 2.7115465e-4  
     95130874.72 50 2.095 0.1 0.834336972 0.011467406 -4.1266093e-3 3.1315233e-4  
     96139102.96 50 2.095 0.1 0.828775634 0.012483365 -4.2789870e-3 3.4318369e-4  
     97147980.51 50 2.095 0.1 0.823088812 0.016035848 -4.4358638e-3 4.4389186e-4  
     98157560.98 50 2.095 0.1 0.824329178 0.014838138 -4.4015548e-3 4.1011975e-4  
     99167904.68 50 2.095 0.1 0.82023172 0.015286187 -4.5150892e-3 4.2461424e-4  
     100179076.29 50 2.095 0.1 0.827559752 0.012612741 -4.3124376e-3 3.4724985e-4  
  • example/se008724_01.ses

    r42ade62 rb314f89  
    1 DataFileTitle   Polystyrene of Markus Strobl,  Full Sine, ++ only  
    2 Sample  Polystyrene 2 um in 53% H2O, 47% D2O  
    3 Settings        D1=D2=20x8 mm,Ds = 16x10 mm (WxH), GF1 =scanning, GF2 = 2.5 A. 2 um polystyrene in 53% H2O, 47% D2O; 8.55% contrast  
    4 Operator        CPD  
    5 Date    ma 7 jul 2014 18:54:43  
    6 ScanType        sine one element scan  
    7 Thickness [mm]  2  
    8 Q_zmax [\AA^-1]         0.05  
    9 Q_ymax [\AA^-1]         0.05  
    10    
    11 spin echo length [nm]    error SEL       wavelength [nm]         error wavelength        polarisation    error pol  
    12 49.778  2.4889  0.211   0.01055 0.99782 0.0044367 
    13 63.041  3.152   0.211   0.01055 1.0026  0.0047862 
    14 76.487  3.8244  0.211   0.01055 0.99601 0.0060598 
    15 89.847  4.4924  0.211   0.01055 0.99175 0.0058257 
    16 103.41  5.1705  0.211   0.01055 0.99543 0.0060966 
    17 116.95  5.8475  0.211   0.01055 0.99512 0.0048106 
    18 130.61  6.5303  0.211   0.01055 0.9975  0.0062594 
    19 144.37  7.2184  0.211   0.01055 0.99473 0.005293 
    20 158.2   7.9102  0.211   0.01055 0.9927  0.0053389 
    21 172.12  8.6062  0.211   0.01055 0.99453 0.0064548 
    22 186.17  9.3087  0.211   0.01055 0.98641 0.0073259 
    23 200.28  10.014  0.211   0.01055 0.98879 0.0078682 
    24 214.46  10.723  0.211   0.01055 0.9895  0.0068058 
    25 228.73  11.436  0.211   0.01055 0.99204 0.0082509 
    26 243.12  12.156  0.211   0.01055 0.99406 0.0051381 
    27 257.55  12.878  0.211   0.01055 0.97965 0.0055447 
    28 272.22  13.611  0.211   0.01055 0.97982 0.0065843 
    29 286.9   14.345  0.211   0.01055 0.97793 0.0071814 
    30 301.73  15.087  0.211   0.01055 0.97835 0.0066197 
    31 316.75  15.838  0.211   0.01055 0.98125 0.0069484 
    32 331.82  16.591  0.211   0.01055 0.97828 0.0068737 
    33 347.16  17.358  0.211   0.01055 0.97682 0.006744 
    34 362.45  18.122  0.211   0.01055 0.98155 0.0059865 
    35 378.09  18.904  0.211   0.01055 0.96446 0.0066788 
    36 393.74  19.687  0.211   0.01055 0.97276 0.0073781 
    37 409.61  20.481  0.211   0.01055 0.97101 0.0071053 
    38 425.55  21.278  0.211   0.01055 0.97501 0.0068244 
    39 441.91  22.096  0.211   0.01055 0.96958 0.0072272 
    40 458.12  22.906  0.211   0.01055 0.95991 0.0064035 
    41 474.77  23.739  0.211   0.01055 0.96219 0.0059227 
    42 491.52  24.576  0.211   0.01055 0.96016 0.0058606 
    43 508.51  25.426  0.211   0.01055 0.9509  0.0049836 
    44 525.68  26.284  0.211   0.01055 0.95558 0.0055218 
    45 543.08  27.154  0.211   0.01055 0.95079 0.0058258 
    46 560.74  28.037  0.211   0.01055 0.9514  0.0043921 
    47 578.69  28.935  0.211   0.01055 0.94562 0.0046962 
    48 596.75  29.838  0.211   0.01055 0.94588 0.0047341 
    49 615.17  30.758  0.211   0.01055 0.93958 0.0045821 
    50 633.77  31.688  0.211   0.01055 0.93731 0.0043108 
    51 652.82  32.641  0.211   0.01055 0.93664 0.0052044 
    52 672.04  33.602  0.211   0.01055 0.93209 0.0035563 
    53 691.57  34.578  0.211   0.01055 0.93385 0.0046002 
    54 711.48  35.574  0.211   0.01055 0.93028 0.0051136 
    55 731.67  36.583  0.211   0.01055 0.93012 0.0035279 
    56 752.17  37.608  0.211   0.01055 0.92594 0.0039458 
    57 773.1   38.655  0.211   0.01055 0.92352 0.0027613 
    58 794.42  39.721  0.211   0.01055 0.91823 0.0034587 
    59 816.14  40.807  0.211   0.01055 0.90862 0.0034262 
    60 838.19  41.91   0.211   0.01055 0.91909 0.003498 
    61 860.69  43.034  0.211   0.01055 0.91013 0.0030537 
    62 883.74  44.187  0.211   0.01055 0.90449 0.0035391 
    63 907.04  45.352  0.211   0.01055 0.90057 0.0029672 
    64 930.95  46.547  0.211   0.01055 0.90316 0.0031245 
    65 955.38  47.769  0.211   0.01055 0.89492 0.0030981 
    66 980.25  49.013  0.211   0.01055 0.89636 0.0036625 
    67 1005.7  50.284  0.211   0.01055 0.88808 0.0022652 
    68 1031.7  51.586  0.211   0.01055 0.88665 0.0044622 
    69 1058.3  52.914  0.211   0.01055 0.88205 0.0030275 
    70 1085.5  54.276  0.211   0.01055 0.88257 0.0028637 
    71 1113.4  55.669  0.211   0.01055 0.87629 0.0030312 
    72 1141.9  57.093  0.211   0.01055 0.87732 0.0026539 
    73 1171    58.55   0.211   0.01055 0.87361 0.0034591 
    74 1201    60.052  0.211   0.01055 0.86595 0.0028129 
    75 1231.6  61.582  0.211   0.01055 0.86804 0.0043311 
    76 1263    63.151  0.211   0.01055 0.86676 0.0028806 
    77 1295.2  64.762  0.211   0.01055 0.85655 0.0028657 
    78 1328.4  66.419  0.211   0.01055 0.85794 0.0034773 
    79 1362.3  68.113  0.211   0.01055 0.85521 0.0032798 
    80 1397.1  69.854  0.211   0.01055 0.84974 0.0044537 
    81 1432.9  71.644  0.211   0.01055 0.84149 0.0032738 
    82 1469.7  73.487  0.211   0.01055 0.84801 0.0037874 
    83 1507.5  75.376  0.211   0.01055 0.84334 0.003206 
    84 1546.4  77.318  0.211   0.01055 0.83749 0.0040707 
    85 1586.4  79.322  0.211   0.01055 0.83921 0.0049938 
    86 1627.6  81.381  0.211   0.01055 0.83434 0.0057337 
    87 1669.9  83.497  0.211   0.01055 0.82878 0.0062417 
    88 1713.6  85.678  0.211   0.01055 0.82309 0.0080179 
    89 1758.5  87.927  0.211   0.01055 0.82433 0.0074191 
    90 1804.8  90.239  0.211   0.01055 0.82023 0.0076431 
    91 1852.5  92.627  0.211   0.01055 0.82756 0.0063064 
    92 1901.7  95.087  0.211   0.01055 0.82584 0.0052944 
    93 1952.4  97.622  0.211   0.01055 0.82799 0.0050662 
    94 2004.8  100.24  0.211   0.01055 0.82345 0.0043127 
    95 2058.8  102.94  0.211   0.01055 0.82296 0.0038 
    96 2114.5  105.72  0.211   0.01055 0.81987 0.0034072 
    97 2172    108.6   0.211   0.01055 0.82021 0.0036752 
    98 2231.4  111.57  0.211   0.01055 0.82765 0.0028851 
    99 2292.8  114.64  0.211   0.01055 0.82664 0.0038942 
    100 2356.2  117.81  0.211   0.01055 0.82702 0.0047371 
    101 2421.8  121.09  0.211   0.01055 0.81593 0.0043772 
    102 2489.6  124.48  0.211   0.01055 0.8251  0.0028026 
    103 2559.5  127.98  0.211   0.01055 0.8292  0.0024574 
    104 2631.9  131.59  0.211   0.01055 0.82626 0.0036198 
    105 2706.8  135.34  0.211   0.01055 0.8208  0.0032314 
    106 2784.3  139.22  0.211   0.01055 0.81959 0.0042731 
    107 2864.5  143.23  0.211   0.01055 0.82653 0.002699 
    108 2947.5  147.38  0.211   0.01055 0.82401 0.0036726 
    109 3033.5  151.67  0.211   0.01055 0.82361 0.0048224 
    110 3122.4  156.12  0.211   0.01055 0.82358 0.0041221 
    111 3214.5  160.73  0.211   0.01055 0.82187 0.0028807 
    112 3310.1  165.5   0.211   0.01055 0.82644 0.003516 
    113 3409    170.45  0.211   0.01055 0.82355 0.0021166 
    114 3511.4  175.57  0.211   0.01055 0.82513 0.0033911 
    115 3617.6  180.88  0.211   0.01055 0.82802 0.0015342 
    116 3727.6  186.38  0.211   0.01055 0.82663 0.0029222 
    117 3841.7  192.08  0.211   0.01055 0.82026 0.0020755 
    118 3960    198     0.211   0.01055 0.83079 0.0026394 
    119 4082.7  204.13  0.211   0.01055 0.82665 0.0027466 
    120 4209.9  210.5   0.211   0.01055 0.82774 0.0025199 
    121 4341.9  217.09  0.211   0.01055 0.83489 0.0030619 
    122 4478.7  223.94  0.211   0.01055 0.81987 0.0020988 
    123 4620.8  231.04  0.211   0.01055 0.8253  0.0023899 
    124 4768.2  238.41  0.211   0.01055 0.82653 0.0022851 
    125 4921.1  246.06  0.211   0.01055 0.82442 0.003383 
    126 5079.8  253.99  0.211   0.01055 0.82827 0.0015979 
    127 5244.7  262.23  0.211   0.01055 0.82494 0.0031129 
    128 5415.7  270.79  0.211   0.01055 0.82183 0.0030149 
    129 5593.3  279.67  0.211   0.01055 0.83217 0.0046976 
    130 5777.8  288.89  0.211   0.01055 0.82227 0.005574 
    131 5969.3  298.46  0.211   0.01055 0.82338 0.0025569 
     1FileFormatVersion       1.0 
     2DataFileTitle           Polystyrene of Markus Strobl,  Full Sine, ++ only 
     3Sample                  Polystyrene 2 um in 53% H2O, 47% D2O 
     4Settings                D1=D2=20x8 mm,Ds = 16x10 mm (WxH), GF1 =scanning, GF2 = 2.5 A. 2 um polystyrene in 53% H2O, 47% D2O; 8.55% contrast 
     5Operator                CPD 
     6Date                    ma 7 jul 2014 18:54:43 
     7ScanType                sine one element scan 
     8Thickness               2 
     9Thickness_unit          mm 
     10Theta_zmax              0.0168 
     11Theta_zmax_unit         radians 
     12Theta_ymax              0.0168 
     13Theta_ymax_unit         radians 
     14Orientation             Z 
     15SpinEchoLength_unit     A 
     16Depolarisation_unit     A-2 cm-1 
     17Wavelength_unit         A 
     18 
     19BEGIN_DATA 
     20SpinEchoLength Depolarisation Depolarisation_error Wavelength Wavelength_error SpinEchoLength_error Polarisation  Polarisation_error 
     21497.78  -2.4509553e-4  4.9935908e-4  2.11  0.1055  24.889  0.99782  0.0044367  
     22630.41   2.9161810e-4  5.3612769e-4  2.11  0.1055   31.52   1.0026  0.0047862  
     23764.87  -4.4899949e-4  6.8328154e-4  2.11  0.1055  38.244  0.99601  0.0060598  
     24898.47  -9.3037214e-4  6.5970686e-4  2.11  0.1055  44.924  0.99175  0.0058257  
     251034.1  -5.1441728e-4  6.8783151e-4  2.11  0.1055  51.705  0.99543  0.0060966  
     261169.5  -5.4939760e-4  5.4291131e-4  2.11  0.1055  58.475  0.99512  0.0048106  
     271306.1  -2.8111792e-4  7.0473347e-4  2.11  0.1055  65.303   0.9975  0.0062594  
     281443.7  -5.9342057e-4  5.9758787e-4  2.11  0.1055  72.184  0.99473   0.005293  
     291582.  -8.2284488e-4  6.0400267e-4  2.11  0.1055  79.102   0.9927  0.0053389  
     301721.2  -6.1600315e-4  7.2890343e-4  2.11  0.1055  86.062  0.99453  0.0064548  
     311861.7  -1.5367118e-3  8.3408174e-4  2.11  0.1055  93.087  0.98641  0.0073259  
     322002.8  -1.2660661e-3  8.9366844e-4  2.11  0.1055  100.14  0.98879  0.0078682  
     332144.6  -1.1854534e-3  7.7244662e-4  2.11  0.1055  107.23   0.9895  0.0068058  
     342287.3  -8.9753711e-4  9.3406529e-4  2.11  0.1055  114.36  0.99204  0.0082509  
     352431.2  -6.6909009e-4  5.8049041e-4  2.11  0.1055  121.56  0.99406  0.0051381  
     362575.5  -2.3090130e-3  6.3564144e-4  2.11  0.1055  128.78  0.97965  0.0055447  
     372722.2  -2.2895260e-3  7.5468967e-4  2.11  0.1055  136.11  0.97982  0.0065843  
     382869.  -2.5063662e-3  8.2471984e-4  2.11  0.1055  143.45  0.97793  0.0071814  
     393017.3  -2.4581433e-3  7.5988724e-4  2.11  0.1055  150.87  0.97835  0.0066197  
     403167.5  -2.1257395e-3  7.9526201e-4  2.11  0.1055  158.38  0.98125  0.0069484  
     413318.2  -2.4661790e-3  7.8910082e-4  2.11  0.1055  165.91  0.97828  0.0068737  
     423471.6  -2.6339122e-3  7.7536843e-4  2.11  0.1055  173.58  0.97682   0.006744  
     433624.5  -2.0914090e-3  6.8496070e-4  2.11  0.1055  181.22  0.98155  0.0059865  
     443780.9  -4.0640282e-3  7.7771292e-4  2.11  0.1055  189.04  0.96446  0.0066788  
     453937.4  -3.1016697e-3  8.5181234e-4  2.11  0.1055  196.87  0.97276  0.0073781  
     464096.1  -3.3038917e-3  8.2179560e-4  2.11  0.1055  204.81  0.97101  0.0071053  
     474255.5  -2.8422039e-3  7.8606869e-4  2.11  0.1055  212.78  0.97501  0.0068244  
     484419.1  -3.4694067e-3  8.3712733e-4  2.11  0.1055  220.96  0.96958  0.0072272  
     494581.2  -4.5951067e-3  7.4919003e-4  2.11  0.1055  229.06  0.95991  0.0064035  
     504747.7  -4.3286699e-3  6.9129591e-4  2.11  0.1055  237.39  0.96219  0.0059227  
     514915.2  -4.5658612e-3  6.8549385e-4  2.11  0.1055  245.76  0.96016  0.0058606  
     525085.1  -5.6542277e-3  5.8859074e-4  2.11  0.1055  254.26   0.9509  0.0049836  
     535256.8  -5.1028496e-3  6.4896117e-4  2.11  0.1055  262.84  0.95558  0.0055218  
     545430.8  -5.6672201e-3  6.8813882e-4  2.11  0.1055  271.54  0.95079  0.0058258  
     555607.4  -5.5951905e-3  5.1845870e-4  2.11  0.1055  280.37   0.9514  0.0043921  
     565786.9  -6.2795627e-3  5.5774416e-4  2.11  0.1055  289.35  0.94562  0.0046962  
     575967.5  -6.2486880e-3  5.6209080e-4  2.11  0.1055  298.38  0.94588  0.0047341  
     586151.7  -6.9992040e-3  5.4769136e-4  2.11  0.1055  307.58  0.93958  0.0045821  
     596337.7  -7.2708619e-3  5.1651117e-4  2.11  0.1055  316.88  0.93731  0.0043108  
     606528.2  -7.3511686e-3  6.2402654e-4  2.11  0.1055  326.41  0.93664  0.0052044  
     616720.4  -7.8980596e-3  4.2849488e-4  2.11  0.1055  336.02  0.93209  0.0035563  
     626915.7  -7.6861990e-3  5.5322868e-4  2.11  0.1055  345.78  0.93385  0.0046002  
     637114.8  -8.1163566e-3  6.1733111e-4  2.11  0.1055  355.74  0.93028  0.0051136  
     647316.7  -8.1356741e-3  4.2597330e-4  2.11  0.1055  365.83  0.93012  0.0035279  
     657521.7  -8.6415221e-3  4.7858305e-4  2.11  0.1055  376.08  0.92594  0.0039458  
     667731.  -8.9354263e-3  3.3579357e-4  2.11  0.1055  386.55  0.92352  0.0027613  
     677944.2  -9.5805772e-3  4.2302546e-4  2.11  0.1055  397.21  0.91823  0.0034587  
     688161.4   -0.010762148  4.2348254e-4  2.11  0.1055  408.07  0.90862  0.0034262  
     698381.9  -9.4754418e-3  4.2743183e-4  2.11  0.1055   419.1  0.91909   0.003498  
     708606.9   -0.010575665  3.7681487e-4  2.11  0.1055  430.34  0.91013  0.0030537  
     718837.4   -0.011273784  4.3943451e-4  2.11  0.1055  441.87  0.90449  0.0035391  
     729070.4   -0.011761571  3.7002787e-4  2.11  0.1055  453.52  0.90057  0.0029672  
     739309.5   -0.011439046  3.8852675e-4  2.11  0.1055  465.47  0.90316  0.0031245  
     749553.8   -0.012468380  3.8879110e-4  2.11  0.1055  477.69  0.89492  0.0030981  
     759802.5   -0.012287815  4.5888119e-4  2.11  0.1055  490.13  0.89636  0.0036625  
     7610057.   -0.013330052  2.8645708e-4  2.11  0.1055  502.84  0.88808  0.0022652  
     7710317.   -0.013511036  5.6519968e-4  2.11  0.1055  515.86  0.88665  0.0044622  
     7810583.   -0.014095206  3.8547484e-4  2.11  0.1055  529.14  0.88205  0.0030275  
     7910855.   -0.014029017  3.6440427e-4  2.11  0.1055  542.76  0.88257  0.0028637  
     8011134.   -0.014831000  3.8848283e-4  2.11  0.1055  556.69  0.87629  0.0030312  
     8111419.   -0.014699072  3.3972822e-4  2.11  0.1055  570.93  0.87732  0.0026539  
     8211710   -0.015174999  4.4468309e-4  2.11  0.1055   585.5  0.87361  0.0034591  
     8312010   -0.016164070  3.6480986e-4  2.11  0.1055  600.52  0.86595  0.0028129  
     8412316   -0.015893340  5.6035541e-4  2.11  0.1055  615.82  0.86804  0.0043311  
     8512630   -0.016059068  3.7324087e-4  2.11  0.1055  631.51  0.86676  0.0028806  
     8612952.   -0.017389837  3.7573625e-4  2.11  0.1055  647.62  0.85655  0.0028657  
     8713284.   -0.017207735  4.5518751e-4  2.11  0.1055  664.19  0.85794  0.0034773  
     8813623.   -0.017565669  4.3070477e-4  2.11  0.1055  681.13  0.85521  0.0032798  
     8913971.   -0.018286298  5.8862675e-4  2.11  0.1055  698.54  0.84974  0.0044537  
     9014329.   -0.019381994  4.3692639e-4  2.11  0.1055  716.44  0.84149  0.0032738  
     9114697.   -0.018515178  5.0158587e-4  2.11  0.1055  734.87  0.84801  0.0037874  
     9215075.   -0.019135361  4.2693908e-4  2.11  0.1055  753.76  0.84334   0.003206  
     9315464.   -0.019917113  5.4587670e-4  2.11  0.1055  773.18  0.83749  0.0040707  
     9415864.   -0.019686699  6.6829096e-4  2.11  0.1055  793.22  0.83921  0.0049938  
     9516276.   -0.020340321  7.7178617e-4  2.11  0.1055  813.81  0.83434  0.0057337  
     9616699.   -0.021091231  8.4580203e-4  2.11  0.1055  834.97  0.82878  0.0062417  
     9717136.   -0.021864932  1.0940027e-3  2.11  0.1055  856.78  0.82309  0.0080179  
     9817585.   -0.021695868  1.0107767e-3  2.11  0.1055  879.27  0.82433  0.0074191  
     9918048.   -0.022255844  1.0464994e-3  2.11  0.1055  902.39  0.82023  0.0076431  
     10018525.   -0.021256673  8.5582923e-4  2.11  0.1055  926.27  0.82756  0.0063064  
     10119017.   -0.021490334  7.1998911e-4  2.11  0.1055  950.87  0.82584  0.0052944  
     10219524.   -0.021198334  6.8716706e-4  2.11  0.1055  976.22  0.82799  0.0050662  
     10320048.   -0.021815823  5.8818928e-4  2.11  0.1055  1002.4  0.82345  0.0043127  
     10420588.   -0.021882671  5.1857307e-4  2.11  0.1055  1029.4  0.82296     0.0038  
     10521145.   -0.022305147  4.6672141e-4  2.11  0.1055  1057.2  0.81987  0.0034072  
     10621720   -0.022258583  5.0322361e-4  2.11  0.1055   1086.  0.82021  0.0036752  
     10722314.   -0.021244460  3.9148871e-4  2.11  0.1055  1115.7  0.82765  0.0028851  
     10822928.   -0.021381594  5.2906244e-4  2.11  0.1055  1146.4  0.82664  0.0038942  
     10923562.   -0.021329979  6.4328235e-4  2.11  0.1055  1178.1  0.82702  0.0047371  
     11024218.   -0.022846153  6.0248825e-4  2.11  0.1055  1210.9  0.81593  0.0043772  
     11124896.   -0.021591012  3.8146933e-4  2.11  0.1055  1244.8   0.8251  0.0028026  
     11225595.   -0.021034332  3.3282938e-4  2.11  0.1055  1279.8   0.8292  0.0024574  
     11326319.   -0.021433232  4.9200888e-4  2.11  0.1055  1315.9  0.82626  0.0036198  
     11427068.   -0.022177827  4.4213864e-4  2.11  0.1055  1353.4   0.8208  0.0032314  
     11527843.   -0.022343508  5.8553317e-4  2.11  0.1055  1392.2  0.81959  0.0042731  
     11628645.   -0.021396539  3.6673246e-4  2.11  0.1055  1432.3  0.82653   0.002699  
     11729475.   -0.021739473  5.0054859e-4  2.11  0.1055  1473.8  0.82401  0.0036726  
     11830335.   -0.021794003  6.5757715e-4  2.11  0.1055  1516.7  0.82361  0.0048224  
     11931224.   -0.021798094  5.6210549e-4  2.11  0.1055  1561.2  0.82358  0.0041221  
     12032145.   -0.022031519  3.9364070e-4  2.11  0.1055  1607.3  0.82187  0.0028807  
     12133101.   -0.021408769  4.7779613e-4  2.11  0.1055   1655.  0.82644   0.003516  
     12234090   -0.021802185  2.8863827e-4  2.11  0.1055  1704.5  0.82355  0.0021166  
     12335114.   -0.021586929  4.6155484e-4  2.11  0.1055  1755.7  0.82513  0.0033911  
     12436176.   -0.021194265  2.0808762e-4  2.11  0.1055  1808.8  0.82802  0.0015342  
     12537276.   -0.021382952  3.9701221e-4  2.11  0.1055  1863.8  0.82663  0.0029222  
     12638417.   -0.022251737  2.8416874e-4  2.11  0.1055  1920.8  0.82026  0.0020755  
     12739600   -0.020819189  3.5679523e-4  2.11  0.1055  1980.0  0.83079  0.0026394  
     12840827.   -0.021380235  3.7314604e-4  2.11  0.1055  2041.3  0.82665  0.0027466  
     12942099.   -0.021232248  3.4189634e-4  2.11  0.1055   2105.  0.82774  0.0025199  
     13043419.   -0.020266312  4.1187633e-4  2.11  0.1055  2170.9  0.83489  0.0030619  
     13144787.   -0.022305147  2.8749557e-4  2.11  0.1055  2239.4  0.81987  0.0020988  
     13246208.   -0.021563793  3.2521680e-4  2.11  0.1055  2310.4   0.8253  0.0023899  
     13347682.   -0.021396539  3.1049291e-4  2.11  0.1055  2384.1  0.82653  0.0022851  
     13449211.   -0.021683607  4.6084892e-4  2.11  0.1055  2460.6  0.82442   0.003383  
     13550798.   -0.021160361  2.1666201e-4  2.11  0.1055  2539.9  0.82827  0.0015979  
     13652447.   -0.021612792  4.2378726e-4  2.11  0.1055  2622.3  0.82494  0.0031129  
     13754157.   -0.022036985  4.1199886e-4  2.11  0.1055  2707.9  0.82183  0.0030149  
     13855933.   -0.020632795  6.3397053e-4  2.11  0.1055  2796.7  0.83217  0.0046976  
     13957778.   -0.021976873  7.6130313e-4  2.11  0.1055  2888.9  0.82227   0.005574  
     14059693.   -0.021825370  3.4875346e-4  2.11  0.1055  2984.6  0.82338  0.0025569  
  • example/se008731_01_40pcorr.ses

    r2f8ee5f rb314f89  
    1 DataFileTitle   "Polystyrene of Markus Strobl,  Full Sine, ++ only "                                             
    2 Sample  "Polystyrene 2 um in 53% H2O, 47% D2O "                                          
    3 Settings        "D1=D2=20x8 mm,Ds = 16x10 mm (WxH), GF1 =scanning, GF2 = 2.5 A. 2 um polystyrene in 53% H2O, 47% D2O; 8.55% contrast "                                           
    4 Operator        CPD                                              
    5 Date    do 10 jul 2014 16:37:30                                                  
    6 ScanType        sine one element scan                                            
    7 Thickness [cm]  2.00E-01                                                 
    8 Q_zmax [\A^-1]  0.05                                             
    9 Q_ymax [\A^-1]  0.05                                             
    10                                                          
    11 spin echo length [A]     Depolarisation [A-2 cm-1]       error depol [A-2 cm-1]          error SEL [A]   wavelength [A]          error wavelength [A]    polarisation    error pol  
    12 391.56  0.0041929       0.0036894       19.578  2.11    0.1055  1.0037  0.0032974 
    13 1564    -0.0046571      0.0038185       78.2    2.11    0.1055  0.99586 0.003386 
    14 2735.6  -0.017007       0.0038132       136.78  2.11    0.1055  0.98497 0.0033444 
    15 3907.9  -0.033462       0.0035068       195.39  2.11    0.1055  0.97064 0.0030309 
    16 5080.2  -0.047483       0.0038208       254.01  2.11    0.1055  0.9586  0.0032613 
    17 6251.8  -0.070375       0.00376 312.59  2.11    0.1055  0.93926 0.0031446 
    18 7423.2  -0.092217       0.0037927       371.16  2.11    0.1055  0.92117 0.0031108 
    19 8595.5  -0.10238        0.004006        429.77  2.11    0.1055  0.91287 0.0032562 
    20 9767.7  -0.12672        0.0038534       488.39  2.11    0.1055  0.8933  0.0030651 
    21 10940   -0.1374 0.004243        546.98  2.11    0.1055  0.88484 0.003343 
    22 12112   -0.16072        0.0045837       605.58  2.11    0.1055  0.86666 0.0035372 
    23 13284   -0.16623        0.0045613       664.2   2.11    0.1055  0.86242 0.0035027 
    24 14456   -0.18468        0.0044918       722.79  2.11    0.1055  0.84837 0.0033931 
    25 15628   -0.19143        0.0048967       781.38  2.11    0.1055  0.84328 0.0036768 
    26 16800   -0.20029        0.0045421       840.02  2.11    0.1055  0.83666 0.0033837 
    27 17971   -0.19798        0.0046642       898.56  2.11    0.1055  0.83838 0.0034819 
    28 19143   -0.21442        0.0047052       957.17  2.11    0.1055  0.82619 0.0034614 
    29 20316   -0.20885        0.0044931       1015.8  2.11    0.1055  0.8303  0.0033218 
    30 21488   -0.21393        0.0049186       1074.4  2.11    0.1055  0.82655 0.00362 
    31 22660   -0.20685        0.004423        1133    2.11    0.1055  0.83179 0.0032758 
    32 23832   -0.20802        0.0046979       1191.6  2.11    0.1055  0.83092 0.0034758 
    33 25003   -0.19848        0.0045953       1250.2  2.11    0.1055  0.838   0.0034289 
    34 26175   -0.21117        0.0044567       1308.8  2.11    0.1055  0.82859 0.0032881 
    35 27347   -0.21283        0.004137        1367.4  2.11    0.1055  0.82736 0.0030477 
    36 28520   -0.2042 0.0044587       1426    2.11    0.1055  0.83375 0.0033101 
    37 29692   -0.2112 0.0042852       1484.6  2.11    0.1055  0.82857 0.0031615 
    38 30864   -0.20319        0.0043483       1543.2  2.11    0.1055  0.8345  0.003231 
    39 32036   -0.20752        0.0044297       1601.8  2.11    0.1055  0.83129 0.0032788 
    40 33207   -0.20654        0.0043188       1660.4  2.11    0.1055  0.83201 0.0031995 
    41 34380   -0.20126        0.0046375       1719    2.11    0.1055  0.83593 0.0034518 
    42 35551   -0.20924        0.0042871       1777.6  2.11    0.1055  0.83001 0.0031684 
    43 36724   -0.21323        0.0045471       1836.2  2.11    0.1055  0.82707 0.0033487 
    44 37895   -0.21324        0.0045354       1894.7  2.11    0.1055  0.82706 0.00334 
    45 39067   -0.19905        0.0044141       1953.4  2.11    0.1055  0.83758 0.003292 
    46 40239   -0.1991 0.0047441       2012    2.11    0.1055  0.83754 0.003538 
    47 41411   -0.20359        0.0050136       2070.5  2.11    0.1055  0.8342  0.003724 
    48 42583   -0.21032        0.0049474       2129.1  2.11    0.1055  0.82922 0.0036529 
    49 43755   -0.20689        0.0048203       2187.8  2.11    0.1055  0.83176 0.00357 
    50 44927   -0.21075        0.0052337       2246.4  2.11    0.1055  0.8289  0.0038628 
    51 46099   -0.19956        0.0047827       2304.9  2.11    0.1055  0.8372  0.0035653 
     1FileFormatVersion       1.0 
     2DataFileTitle           Polystyrene of Markus Strobl,  Full Sine, ++ only 
     3Sample                  Polystyrene 2 um in 53% H2O, 47% D2O 
     4Settings                "D1=D2=20x8 mm,Ds = 16x10 mm (WxH), GF1 =scanning, GF2 = 2.5 A. 2 um polystyrene in 53% H2O, 47% D2O; 8.55% contrast "                                           
     5Operator                CPD 
     6Date                    do 10 jul 2014 16:37:30 
     7ScanType                sine one element scan 
     8Thickness               2 
     9Thickness_unit          mm 
     10Theta_zmax              0.0168 
     11Theta_zmax_unit         radians 
     12Theta_ymax              0.0168 
     13Theta_ymax_unit         radians 
     14Orientation             Z 
     15SpinEchoLength_unit     A 
     16Depolarisation_unit     A-2 cm-1 
     17Wavelength_unit         A 
     18 
     19BEGIN_DATA 
     20SpinEchoLength Depolarisation Depolarisation_error Polarisation Polarisation_error SpinEchoLength_error Wavelength Wavelength_error  
     21391.56 0.0041929 0.0036894 1.0037 0.0032974 19.578 2.11 0.1055  
     221564 -0.0046571 0.0038185 0.99586 0.003386 78.2 2.11 0.1055  
     232735.6 -0.017007 0.0038132 0.98497 0.0033444 136.78 2.11 0.1055  
     243907.9 -0.033462 0.0035068 0.97064 0.0030309 195.39 2.11 0.1055  
     255080.2 -0.047483 0.0038208 0.9586 0.0032613 254.01 2.11 0.1055  
     266251.8 -0.070375 0.00376 0.93926 0.0031446 312.59 2.11 0.1055  
     277423.2 -0.092217 0.0037927 0.92117 0.0031108 371.16 2.11 0.1055  
     288595.5 -0.10238 0.004006 0.91287 0.0032562 429.77 2.11 0.1055  
     299767.7 -0.12672 0.0038534 0.8933 0.0030651 488.39 2.11 0.1055  
     3010940 -0.1374 0.004243 0.88484 0.003343 546.98 2.11 0.1055  
     3112112 -0.16072 0.0045837 0.86666 0.0035372 605.58 2.11 0.1055  
     3213284 -0.16623 0.0045613 0.86242 0.0035027 664.2 2.11 0.1055  
     3314456 -0.18468 0.0044918 0.84837 0.0033931 722.79 2.11 0.1055  
     3415628 -0.19143 0.0048967 0.84328 0.0036768 781.38 2.11 0.1055  
     3516800 -0.20029 0.0045421 0.83666 0.0033837 840.02 2.11 0.1055  
     3617971 -0.19798 0.0046642 0.83838 0.0034819 898.56 2.11 0.1055  
     3719143 -0.21442 0.0047052 0.82619 0.0034614 957.17 2.11 0.1055  
     3820316 -0.20885 0.0044931 0.8303 0.0033218 1015.8 2.11 0.1055  
     3921488 -0.21393 0.0049186 0.82655 0.00362 1074.4 2.11 0.1055  
     4022660 -0.20685 0.004423 0.83179 0.0032758 1133 2.11 0.1055  
     4123832 -0.20802 0.0046979 0.83092 0.0034758 1191.6 2.11 0.1055  
     4225003 -0.19848 0.0045953 0.838 0.0034289 1250.2 2.11 0.1055  
     4326175 -0.21117 0.0044567 0.82859 0.0032881 1308.8 2.11 0.1055  
     4427347 -0.21283 0.004137 0.82736 0.0030477 1367.4 2.11 0.1055  
     4528520 -0.2042 0.0044587 0.83375 0.0033101 1426 2.11 0.1055  
     4629692 -0.2112 0.0042852 0.82857 0.0031615 1484.6 2.11 0.1055  
     4730864 -0.20319 0.0043483 0.8345 0.003231 1543.2 2.11 0.1055  
     4832036 -0.20752 0.0044297 0.83129 0.0032788 1601.8 2.11 0.1055  
     4933207 -0.20654 0.0043188 0.83201 0.0031995 1660.4 2.11 0.1055  
     5034380 -0.20126 0.0046375 0.83593 0.0034518 1719 2.11 0.1055  
     5135551 -0.20924 0.0042871 0.83001 0.0031684 1777.6 2.11 0.1055  
     5236724 -0.21323 0.0045471 0.82707 0.0033487 1836.2 2.11 0.1055  
     5337895 -0.21324 0.0045354 0.82706 0.00334 1894.7 2.11 0.1055  
     5439067 -0.19905 0.0044141 0.83758 0.003292 1953.4 2.11 0.1055  
     5540239 -0.1991 0.0047441 0.83754 0.003538 2012 2.11 0.1055  
     5641411 -0.20359 0.0050136 0.8342 0.003724 2070.5 2.11 0.1055  
     5742583 -0.21032 0.0049474 0.82922 0.0036529 2129.1 2.11 0.1055  
     5843755 -0.20689 0.0048203 0.83176 0.00357 2187.8 2.11 0.1055  
     5944927 -0.21075 0.0052337 0.8289 0.0038628 2246.4 2.11 0.1055  
     6046099 -0.19956 0.0047827 0.8372 0.0035653 2304.9 2.11 0.1055  
  • example/sphere.ses

    ra98958b re0721e7  
    1 name    se009051.dat                                             
    2 sample  "SiO2 pH=6 & NiO pH=10, nanosized, in D2O, Sine ++ only."                                                
    3 collimation     "D1=D2=20x8 mm,Ds = 16x10 mm (WxH), GF1 =scanning, GF2 = 2.5 A. "                                                
    4 ID      CPD                                              
    5 Date    di 27 jan 2015 18:17:50                                          
    6 Method  sine one element scan                                            
    7 Thickness [mm]  10                                               
    8 z-acceptance [nm^-1]    0.3                                              
    9 y-acceptance [nm^-1]    0.3                                              
     1FileFormatVersion       1.0 
     2DataFileTitle           se009051.dat                                             
     3Sample                  "SiO2 pH=6 & NiO pH=10, nanosized, in D2O, Sine ++ only."                                                
     4collimation             "D1=D2=20x8 mm,Ds = 16x10 mm (WxH), GF1 =scanning, GF2 = 2.5 A. "                                                
     5ID                      CPD                                              
     6Date                    di 27 jan 2015 18:17:50 
     7Method                  sine one element scan 
     8Thickness               10 
     9Thickness_unit          mm 
     10Theta_zmax              0.0168 
     11Theta_zmax_unit         radians 
     12Theta_ymax              0.0168 
     13Theta_ymax_unit         radians 
     14Orientation             Z 
     15SpinEchoLength_unit     A 
     16Depolarisation_unit     A-2 cm-1 
     17Wavelength_unit         A 
    1018                                                         
    11 spin echo length [um]   error spin-echo length  wavelength [nm] error wavelength        Sample 5        Sample 5 -error          
    12 29.882023       5       0.2095  0.01    0.997817556     0.00887342      0.029882023     29.882023 
    13 85.257531       5       0.2095  0.01    1.0026184       0.009572307     0.085257531     85.257531 
    14 140.798634      5       0.2095  0.01    0.996013172     0.012119508     0.140798634     140.798634 
    15 196.560502      5       0.2095  0.01    0.991752656     0.011651473     0.196560502     196.560502 
    16 252.528125      5       0.2095  0.01    0.995429571     0.012193294     0.252528125     252.528125 
    17 308.729274      5       0.2095  0.01    0.995119819     0.009621277     0.308729274     308.729274 
    18 365.037117      5       0.2095  0.01    0.997497767     0.012518842     0.365037117     365.037117 
    19 421.684677      5       0.2095  0.01    0.994733865     0.010585926     0.421684677     421.684677 
    20 478.564852      5       0.2095  0.01    0.992696275     0.010677724     0.478564852     478.564852 
    21 535.715521      5       0.2095  0.01    0.994534294     0.012909556     0.535715521     535.715521 
    22 593.24408       5       0.2095  0.01    0.986412268     0.014651894     0.59324408      593.24408 
    23 650.985498      5       0.2095  0.01    0.988788566     0.015736468     0.650985498     650.985498 
    24 709.203958      5       0.2095  0.01    0.989501168     0.013611615     0.709203958     709.203958 
    25 767.809943      5       0.2095  0.01    0.99203933      0.016501891     0.767809943     767.809943 
    26 826.762925      5       0.2095  0.01    0.994062723     0.010276207     0.826762925     826.762925 
    27 886.302296      5       0.2095  0.01    0.979647192     0.011089421     0.886302296     886.302296 
    28 946.236366      5       0.2095  0.01    0.97982075      0.013168527     0.946236366     946.236366 
    29 1006.784115     5       0.2095  0.01    0.977927712     0.014362819     1.006784115     1006.784115 
    30 1067.891213     5       0.2095  0.01    0.978351462     0.013239476     1.067891213     1067.891213 
    31 1129.598722     5       0.2095  0.01    0.981246471     0.013896898     1.129598722     1129.598722 
    32 1192.022694     5       0.2095  0.01    0.978275164     0.013747481     1.192022694     1192.022694 
    33 1255.271282     5       0.2095  0.01    0.976818842     0.013487944     1.255271282     1255.271282 
    34 1319.307134     5       0.2095  0.01    0.981546068     0.011972943     1.319307134     1319.307134 
    35 1384.197821     5       0.2095  0.01    0.96445854      0.013357572     1.384197821     1384.197821 
    36 1450.051342     5       0.2095  0.01    0.972756158     0.014756189     1.450051342     1450.051342 
    37 1516.978619     5       0.2095  0.01    0.971010184     0.014210504     1.516978619     1516.978619 
    38 1585.044577     5       0.2095  0.01    0.975009829     0.013648839     1.585044577     1585.044577 
    39 1654.356194     5       0.2095  0.01    0.969575209     0.014454336     1.654356194     1654.356194 
    40 1724.97535      5       0.2095  0.01    0.959907267     0.012806944     1.72497535      1724.97535 
    41 1796.962718     5       0.2095  0.01    0.96219203      0.011845496     1.796962718     1796.962718 
    42 1870.613025     5       0.2095  0.01    0.960157966     0.011721155     1.870613025     1870.613025 
    43 1945.921163     5       0.2095  0.01    0.95089937      0.009967287     1.945921163     1945.921163 
    44 2023.09841      5       0.2095  0.01    0.955584642     0.01104368      2.02309841      2023.09841 
    45 2102.189874     5       0.2095  0.01    0.950786938     0.011651582     2.102189874     2102.189874 
    46 2183.534527     5       0.2095  0.01    0.951403607     0.008784149     2.183534527     2183.534527 
    47 2267.173021     5       0.2095  0.01    0.94561823      0.009392383     2.267173021     2267.173021 
    48 2353.393035     5       0.2095  0.01    0.945882787     0.009468264     2.353393035     2353.393035 
    49 2442.350387     5       0.2095  0.01    0.939583158     0.009164239     2.442350387     2442.350387 
    50 2534.334343     5       0.2095  0.01    0.93731257      0.008621568     2.534334343     2534.334343 
    51 2629.473374     5       0.2095  0.01    0.936639557     0.010408821     2.629473374     2629.473374 
    52 2728.20036      5       0.2095  0.01    0.932091884     0.007112674     2.72820036      2728.20036 
    53 2830.74992      5       0.2095  0.01    0.933852763     0.009200431     2.83074992      2830.74992 
    54 2937.363026     5       0.2095  0.01    0.930283437     0.01022719      2.937363026     2937.363026 
    55 3048.510973     5       0.2095  0.01    0.930121334     0.007055747     3.048510973     3048.510973 
    56 3164.589926     5       0.2095  0.01    0.925944326     0.0078917       3.164589926     3164.589926 
    57 3285.843756     5       0.2095  0.01    0.92351759      0.005522582     3.285843756     3285.843756 
    58 3412.805801     5       0.2095  0.01    0.918228311     0.006917328     3.412805801     3412.805801 
    59 3546.016792     5       0.2095  0.01    0.908621563     0.006852313     3.546016792     3546.016792 
    60 3685.876213     5       0.2095  0.01    0.919087792     0.006995961     3.685876213     3685.876213 
    61 3833.174832     5       0.2095  0.01    0.910132214     0.006107336     3.833174832     3833.174832 
    62 3988.234456     5       0.2095  0.01    0.904491462     0.007078101     3.988234456     3988.234456 
    63 4151.940408     5       0.2095  0.01    0.90056919      0.005934428     4.151940408     4151.940408 
    64 4324.902332     5       0.2095  0.01    0.903155701     0.006249069     4.324902332     4324.902332 
    65 4507.963711     5       0.2095  0.01    0.894919827     0.006196232     4.507963711     4507.963711 
    66 4701.967049     5       0.2095  0.01    0.896358908     0.007324999     4.701967049     4701.967049 
    67 4907.785127     5       0.2095  0.01    0.88807923      0.004530465     4.907785127     4907.785127 
    68 5126.471149     5       0.2095  0.01    0.886649039     0.008924412     5.126471149     5126.471149 
    69 5359.059759     5       0.2095  0.01    0.882051947     0.006055081     5.359059759     5359.059759 
    70 5606.740304     5       0.2095  0.01    0.882573371     0.005727419     5.606740304     5606.740304 
    71 5870.903592     5       0.2095  0.01    0.876289825     0.006062306     5.870903592     5870.903592 
    72 6152.736235     5       0.2095  0.01    0.877318199     0.005307783     6.152736235     6152.736235 
    73 6453.893169     5       0.2095  0.01    0.873610284     0.006918104     6.453893169     6453.893169 
    74 6775.835415     5       0.2095  0.01    0.865954455     0.005625863     6.775835415     6775.835415 
    75 7120.530581     5       0.2095  0.01    0.868037308     0.008662141     7.120530581     7120.530581 
    76 7489.735939     5       0.2095  0.01    0.86676404      0.005761209     7.489735939     7489.735939 
    77 7885.556041     5       0.2095  0.01    0.85655072      0.005731411     7.885556041     7885.556041 
    78 8310.290162     5       0.2095  0.01    0.857936274     0.006954572     8.310290162     8310.290162 
    79 8766.315359     5       0.2095  0.01    0.85520525      0.006559622     8.766315359     8766.315359 
    80 9256.271706     5       0.2095  0.01    0.849739829     0.008907377     9.256271706     9256.271706 
    81 9783.031577     5       0.2095  0.01    0.841487161     0.006547659     9.783031577     9783.031577 
    82 10349.71409     5       0.2095  0.01    0.84801051      0.007574866     10.34971409     10349.71409 
    83 10959.67923     5       0.2095  0.01    0.843342861     0.006411993     10.95967923     10959.67923 
    84 11616.5969      5       0.2095  0.01    0.837488454     0.008141353     11.6165969      11616.5969 
    85 12324.44664     5       0.2095  0.01    0.839214922     0.009987535     12.32444664     12324.44664 
    86 13087.4723      5       0.2095  0.01    0.834336972     0.011467406     13.0874723      13087.4723 
    87 13910.29604     5       0.2095  0.01    0.828775634     0.012483365     13.91029604     13910.29604 
    88 14798.05061     5       0.2095  0.01    0.823088812     0.016035848     14.79805061     14798.05061 
    89 15756.09817     5       0.2095  0.01    0.824329178     0.014838138     15.75609817     15756.09817 
    90 16790.46783     5       0.2095  0.01    0.82023172      0.015286187     16.79046783     16790.46783 
    91 17907.62866     5       0.2095  0.01    0.827559752     0.012612741     17.90762866     17907.62866 
     19BEGIN_DATA 
     20SpinEchoLength  SpinEchoLength_error  Wavelength  Wavelength_Error  Polarisation  Polarisation_error  Depolarisation  Depolarisation_error  
     21298.82023 50 2.095 0.1 0.997817556 0.00887342 -4.9779370e-5 2.0261512e-4  
     22852.57531 50 2.095 0.1 1.0026184 0.009572307 5.9579929e-5 2.1752686e-4  
     231407.9863 50 2.095 0.1 0.996013172 0.012119508 -9.1017859e-5 2.7723742e-4  
     241965.6050 50 2.095 0.1 0.991752656 0.011651473 -1.8868750e-4 2.6767598e-4  
     252525.2813 50 2.095 0.1 0.995429571 0.012193294 -1.0437182e-4 2.7908883e-4  
     263087.2927 50 2.095 0.1 0.995119819 0.009621277 -1.1146275e-4 2.2028721e-4  
     273650.3712 50 2.095 0.1 0.997497767 0.012518842 -5.7082583e-5 2.8594610e-4  
     284216.8468 50 2.095 0.1 0.994733865 0.010585926 -1.2030120e-4 2.4246770e-4  
     294785.6485 50 2.095 0.1 0.992696275 0.010677724 -1.6701950e-4 2.4507231e-4  
     305357.1552 50 2.095 0.1 0.994534294 0.012909556 -1.2487278e-4 2.9574914e-4  
     315932.4408 50 2.095 0.1 0.986412268 0.014651894 -3.1170682e-4 3.3842875e-4  
     326509.8550 50 2.095 0.1 0.988788566 0.015736468 -2.5688520e-4 3.6260666e-4  
     337092.0396 50 2.095 0.1 0.989501168 0.013611615 -2.4047103e-4 3.1341898e-4  
     347678.0994 50 2.095 0.1 0.99203933 0.016501891 -1.8210252e-4 3.7899787e-4  
     358267.6293 50 2.095 0.1 0.994062723 0.010276207 -1.3567871e-4 2.3553259e-4  
     368863.0230 50 2.095 0.1 0.979647192 0.011089421 -4.6850452e-4 2.5791174e-4  
     379462.3637 50 2.095 0.1 0.97982075 0.013168527 -4.6446835e-4 3.0621222e-4  
     3810067.841 50 2.095 0.1 0.977927712 0.014362819 -5.0853039e-4 3.3463000e-4  
     3910678.912 50 2.095 0.1 0.978351462 0.013239476 -4.9865985e-4 3.0832436e-4  
     4011295.987 50 2.095 0.1 0.981246471 0.013896898 -4.3133968e-4 3.2267975e-4  
     4111920.227 50 2.095 0.1 0.978275164 0.013747481 -5.0043677e-4 3.2017989e-4  
     4212552.713 50 2.095 0.1 0.976818842 0.013487944 -5.3437989e-4 3.1460359e-4  
     4313193.071 50 2.095 0.1 0.981546068 0.011972943 -4.2438423e-4 2.7792152e-4  
     4413841.978 50 2.095 0.1 0.96445854 0.013357572 -8.2452102e-4 3.1555561e-4  
     4514500.513 50 2.095 0.1 0.972756158 0.014756189 -6.2933879e-4 3.4562263e-4  
     4615169.786 50 2.095 0.1 0.971010184 0.014210504 -6.7027011e-4 3.3343996e-4  
     4715850.446 50 2.095 0.1 0.975009829 0.013648839 -5.7661387e-4 3.1894710e-4  
     4816543.562 50 2.095 0.1 0.969575209 0.014454336 -7.0396574e-4 3.3966327e-4  
     4917249.754 50 2.095 0.1 0.959907267 0.012806944 -9.3229353e-4 3.0398222e-4  
     5017969.627 50 2.095 0.1 0.96219203 0.011845496 -8.7812744e-4 2.8049391e-4  
     5118706.130 50 2.095 0.1 0.960157966 0.011721155 -9.2634378e-4 2.7813758e-4  
     5219459.212 50 2.095 0.1 0.95089937 0.009967287 -1.1471121e-3 2.3882201e-4  
     5320230.984 50 2.095 0.1 0.955584642 0.01104368 -1.0351259e-3 2.6331561e-4  
     5421021.899 50 2.095 0.1 0.950786938 0.011651582 -1.1498062e-3 2.7921171e-4  
     5521835.345 50 2.095 0.1 0.951403607 0.008784149 -1.1350335e-3 2.1036178e-4  
     5622671.730 50 2.095 0.1 0.94561823 0.009392383 -1.2740040e-3 2.2630383e-4  
     5723533.930 50 2.095 0.1 0.945882787 0.009468264 -1.2676305e-3 2.2806833e-4  
     5824423.504 50 2.095 0.1 0.939583158 0.009164239 -1.4198814e-3 2.2222511e-4  
     5925343.343 50 2.095 0.1 0.93731257 0.008621568 -1.4750079e-3 2.0957224e-4  
     6026294.734 50 2.095 0.1 0.936639557 0.010408821 -1.4913733e-3 2.5319842e-4  
     6127282.004 50 2.095 0.1 0.932091884 0.007112674 -1.6022666e-3 1.7386258e-4  
     6228307.499 50 2.095 0.1 0.933852763 0.009200431 -1.5592642e-3 2.2447176e-4  
     6329373.630 50 2.095 0.1 0.930283437 0.01022719 -1.6465153e-3 2.5047996e-4  
     6430485.110 50 2.095 0.1 0.930121334 0.007055747 -1.6504858e-3 1.7283645e-4  
     6531645.899 50 2.095 0.1 0.925944326 0.0078917 -1.7530356e-3 1.9418588e-4  
     6632858.438 50 2.095 0.1 0.92351759 0.005522582 -1.8128270e-3 1.3624763e-4  
     6734128.058 50 2.095 0.1 0.918228311 0.006917328 -1.9436940e-3 1.7164045e-4  
     6835460.168 50 2.095 0.1 0.908621563 0.006852313 -2.1833230e-3 1.7182490e-4  
     6936858.762 50 2.095 0.1 0.919087792 0.006995961 -1.9223776e-3 1.7342924e-4  
     7038331.748 50 2.095 0.1 0.910132214 0.006107336 -2.1454742e-3 1.5289007e-4  
     7139882.345 50 2.095 0.1 0.904491462 0.007078101 -2.2871233e-3 1.7829708e-4  
     7241519.404 50 2.095 0.1 0.90056919 0.005934428 -2.3861400e-3 1.5013907e-4  
     7343249.023 50 2.095 0.1 0.903155701 0.006249069 -2.3207959e-3 1.5764661e-4  
     7445079.637 50 2.095 0.1 0.894919827 0.006196232 -2.5295172e-3 1.5775222e-4  
     7547019.670 50 2.095 0.1 0.896358908 0.007324999 -2.4929085e-3 1.8619052e-4  
     7649077.851 50 2.095 0.1 0.88807923 0.004530465 -2.7043436e-3 1.1623128e-4  
     7751264.711 50 2.095 0.1 0.886649039 0.008924412 -2.7410654e-3 2.2932944e-4  
     7853590.598 50 2.095 0.1 0.882051947 0.006055081 -2.8595036e-3 1.5640756e-4  
     7956067.403 50 2.095 0.1 0.882573371 0.005727419 -2.8460388e-3 1.4785638e-4  
     8058709.036 50 2.095 0.1 0.876289825 0.006062306 -3.0088321e-3 1.5762389e-4  
     8161527.362 50 2.095 0.1 0.877318199 0.005307783 -2.9821094e-3 1.3784403e-4  
     8264538.932 50 2.095 0.1 0.873610284 0.006918104 -3.0786086e-3 1.8042690e-4  
     8367758.354 50 2.095 0.1 0.865954455 0.005625863 -3.2791557e-3 1.4802192e-4  
     8471205.306 50 2.095 0.1 0.868037308 0.008662141 -3.2244196e-3 2.2736248e-4  
     8574897.359 50 2.095 0.1 0.86676404 0.005761209 -3.2578647e-3 1.5144143e-4  
     8678855.560 50 2.095 0.1 0.85655072 0.005731411 -3.5279304e-3 1.5245456e-4  
     8783102.902 50 2.095 0.1 0.857936274 0.006954572 -3.4911046e-3 1.8469168e-4  
     8887663.154 50 2.095 0.1 0.85520525 0.006559622 -3.5637478e-3 1.7475934e-4  
     8992562.717 50 2.095 0.1 0.849739829 0.008907377 -3.7098230e-3 2.3883381e-4  
     9097830.316 50 2.095 0.1 0.841487161 0.006547659 -3.9321836e-3 1.7728439e-4  
     91103497.14 50 2.095 0.1 0.84801051 0.007574866 -3.7562386e-3 2.0351933e-4  
     92109596.79 50 2.095 0.1 0.843342861 0.006411993 -3.8819940e-3 1.7322909e-4  
     93116165.97 50 2.095 0.1 0.837488454 0.008141353 -4.0407107e-3 2.2148775e-4  
     94123244.47 50 2.095 0.1 0.839214922 0.009987535 -3.9937900e-3 2.7115465e-4  
     95130874.72 50 2.095 0.1 0.834336972 0.011467406 -4.1266093e-3 3.1315233e-4  
     96139102.96 50 2.095 0.1 0.828775634 0.012483365 -4.2789870e-3 3.4318369e-4  
     97147980.51 50 2.095 0.1 0.823088812 0.016035848 -4.4358638e-3 4.4389186e-4  
     98157560.98 50 2.095 0.1 0.824329178 0.014838138 -4.4015548e-3 4.1011975e-4  
     99167904.68 50 2.095 0.1 0.82023172 0.015286187 -4.5150892e-3 4.2461424e-4  
     100179076.29 50 2.095 0.1 0.827559752 0.012612741 -4.3124376e-3 3.4724985e-4  
  • sasmodels/compare.py

    r3221de0 rd86f0fc  
    718718    model = core.build_model(model_info, dtype=dtype, platform="ocl") 
    719719    calculator = DirectModel(data, model, cutoff=cutoff) 
    720     engine_type = calculator._model.__class__.__name__.replace('Model','').upper() 
     720    engine_type = calculator._model.__class__.__name__.replace('Model', '').upper() 
    721721    bits = calculator._model.dtype.itemsize*8 
    722722    precision = "fast" if getattr(calculator._model, 'fast', False) else str(bits) 
     
    14911491            vmin, vmax = limits 
    14921492            self.limits = vmax*1e-7, 1.3*vmax 
    1493             import pylab; pylab.clf() 
     1493            import pylab 
     1494            pylab.clf() 
    14941495            plot_models(self.opts, result, limits=self.limits) 
    14951496 
  • sasmodels/data.py

    rf549e37 rd86f0fc  
    706706    else: 
    707707        vmin_scaled, vmax_scaled = vmin, vmax 
    708     nx, ny = len(data.x_bins), len(data.y_bins) 
     708    #nx, ny = len(data.x_bins), len(data.y_bins) 
    709709    x_bins, y_bins, image = _build_matrix(data, plottable) 
    710710    plt.imshow(image, 
     
    772772        if loop >= max_loop:  # this protects never-ending loop 
    773773            break 
    774         image = _fillup_pixels(self, image=image, weights=weights) 
     774        image = _fillup_pixels(image=image, weights=weights) 
    775775        loop += 1 
    776776 
     
    817817    return x_bins, y_bins 
    818818 
    819 def _fillup_pixels(self, image=None, weights=None): 
     819def _fillup_pixels(image=None, weights=None): 
    820820    """ 
    821821    Fill z values of the empty cells of 2d image matrix 
  • sasmodels/generate.py

    r6cbdcd4 rd86f0fc  
    169169 
    170170import sys 
    171 from os.path import abspath, dirname, join as joinpath, exists, getmtime 
     171from os import environ 
     172from os.path import abspath, dirname, join as joinpath, exists, getmtime, sep 
    172173import re 
    173174import string 
     
    289290    import loops. 
    290291    """ 
    291     if (info.source and any(lib.startswith('lib/gauss') for lib in info.source)): 
    292         import os.path 
     292    if info.source and any(lib.startswith('lib/gauss') for lib in info.source): 
    293293        from .gengauss import gengauss 
    294         path = os.path.join(MODEL_PATH, "lib", "gauss%d.c"%n) 
    295         if not os.path.exists(path): 
     294        path = joinpath(MODEL_PATH, "lib", "gauss%d.c"%n) 
     295        if not exists(path): 
    296296            gengauss(n, path) 
    297297        info.source = ["lib/gauss%d.c"%n if lib.startswith('lib/gauss') 
    298                         else lib for lib in info.source] 
     298                       else lib for lib in info.source] 
    299299 
    300300def format_units(units): 
     
    320320                     for w, h in zip(column_widths, PARTABLE_HEADERS)] 
    321321 
    322     sep = " ".join("="*w for w in column_widths) 
     322    underbar = " ".join("="*w for w in column_widths) 
    323323    lines = [ 
    324         sep, 
     324        underbar, 
    325325        " ".join("%-*s" % (w, h) 
    326326                 for w, h in zip(column_widths, PARTABLE_HEADERS)), 
    327         sep, 
     327        underbar, 
    328328        ] 
    329329    for p in pars: 
     
    334334            "%*g" % (column_widths[3], p.default), 
    335335            ])) 
    336     lines.append(sep) 
     336    lines.append(underbar) 
    337337    return "\n".join(lines) 
    338338 
     
    612612    """ 
    613613    spaces = " "*depth 
    614     sep = "\n" + spaces 
    615     return spaces + sep.join(s.split("\n")) 
     614    interline_separator = "\n" + spaces 
     615    return spaces + interline_separator.join(s.split("\n")) 
    616616 
    617617 
     
    619619def load_template(filename): 
    620620    # type: (str) -> str 
     621    """ 
     622    Load template file from sasmodels resource directory. 
     623    """ 
    621624    path = joinpath(DATA_PATH, filename) 
    622625    mtime = getmtime(path) 
     
    900903        kernel_module = load_custom_kernel_module(model_name) 
    901904    else: 
    902         from sasmodels import models 
    903         __import__('sasmodels.models.'+model_name) 
    904         kernel_module = getattr(models, model_name, None) 
     905        try: 
     906            from sasmodels import models 
     907            __import__('sasmodels.models.'+model_name) 
     908            kernel_module = getattr(models, model_name, None) 
     909        except ImportError: 
     910            # If the model isn't a built in model, try the plugin directory 
     911            plugin_path = environ.get('SAS_MODELPATH', None) 
     912            if plugin_path is not None: 
     913                file_name = model_name.split(sep)[-1] 
     914                model_name = plugin_path + sep + file_name + ".py" 
     915                kernel_module = load_custom_kernel_module(model_name) 
     916            else: 
     917                raise 
    905918    return kernel_module 
    906919 
  • sasmodels/guyou.py

    r0d5a655 rb3703f5  
    3131# 
    3232# 2017-11-01 Paul Kienzle 
    33 # * converted to python, using degrees rather than radians 
     33# * converted to python, with degrees rather than radians 
     34""" 
     35Convert between latitude-longitude and Guyou map coordinates. 
     36""" 
     37 
    3438from __future__ import division, print_function 
    3539 
    3640import numpy as np 
    37 from numpy import sqrt, pi, tan, cos, sin, log, exp, arctan2 as atan2, sign, radians, degrees 
     41from numpy import sqrt, pi, tan, cos, sin, sign, radians, degrees 
     42from numpy import sinh, arctan as atan 
     43 
     44# scipy version of special functions 
     45from scipy.special import ellipj as ellipticJ, ellipkinc as ellipticF 
    3846 
    3947_ = """ 
     
    5967""" 
    6068 
    61 # scipy version of special functions 
    62 from scipy.special import ellipj as ellipticJ, ellipkinc as ellipticF 
    63 from numpy import sinh, sign, arctan as atan 
    64  
    6569def ellipticJi(u, v, m): 
    6670    scalar = np.isscalar(u) and np.isscalar(v) and np.isscalar(m) 
    6771    u, v, m = np.broadcast_arrays(u, v, m) 
    68     result = np.empty_like([u,u,u], 'D') 
    69     real = v==0 
    70     imag = u==0 
     72    result = np.empty_like([u, u, u], 'D') 
     73    real = (v == 0) 
     74    imag = (u == 0) 
    7175    mixed = ~(real|imag) 
    7276    result[:, real] = _ellipticJi_real(u[real], m[real]) 
    7377    result[:, imag] = _ellipticJi_imag(v[imag], m[imag]) 
    7478    result[:, mixed] = _ellipticJi(u[mixed], v[mixed], m[mixed]) 
    75     return result[0,:] if scalar else result 
     79    return result[0, :] if scalar else result 
    7680 
    7781def _ellipticJi_real(u, m): 
     
    104108        result = np.empty_like(phi, 'D') 
    105109        index = (phi == 0) 
    106         result[index] = ellipticF(atan(sinh(abs(phi[index]))), 1-m[index]) * sign(psi[index]) 
     110        result[index] = ellipticF(atan(sinh(abs(phi[index]))), 
     111                                  1-m[index]) * sign(psi[index]) 
    107112        result[~index] = ellipticFi(phi[~index], psi[~index], m[~index]) 
    108113        return result.reshape(1)[0] if scalar else result 
     
    117122    cotlambda2 = (-b + sqrt(b * b - 4 * c)) / 2 
    118123    re = ellipticF(atan(1 / sqrt(cotlambda2)), m) * sign(phi) 
    119     im = ellipticF(atan(sqrt(np.maximum(0,(cotlambda2 / cotphi2 - 1) / m))), 1 - m) * sign(psi) 
     124    im = ellipticF(atan(sqrt(np.maximum(0, (cotlambda2 / cotphi2 - 1) / m))), 
     125                   1 - m) * sign(psi) 
    120126    return re + 1j*im 
    121127 
    122 sqrt2 = sqrt(2) 
     128SQRT2 = sqrt(2) 
    123129 
    124130# [PAK] renamed k_ => cos_u, k => sin_u, k*k => sinsq_u to avoid k,K confusion 
     
    127133# K = 3.165103454447431823666270142140819753058976299237578486994... 
    128134def guyou(lam, phi): 
     135    """Transform from (latitude, longitude) to point (x, y)""" 
    129136    # [PAK] wrap into [-pi/2, pi/2] radians 
    130137    x, y = np.asarray(lam), np.asarray(phi) 
     
    135142 
    136143    # Compute constant K 
    137     cos_u = (sqrt2 - 1) / (sqrt2 + 1) 
     144    cos_u = (SQRT2 - 1) / (SQRT2 + 1) 
    138145    sinsq_u = 1 - cos_u**2 
    139146    K = ellipticF(pi/2, sinsq_u) 
     
    144151    at = atan(r * (cos(lam) - 1j*sin(lam))) 
    145152    t = ellipticFi(at.real, at.imag, sinsq_u) 
    146     x, y = (-t.imag, sign(phi + (phi==0))*(0.5 * K - t.real)) 
     153    x, y = (-t.imag, sign(phi + (phi == 0))*(0.5 * K - t.real)) 
    147154 
    148155    # [PAK] convert to degrees, and return to original tile 
     
    150157 
    151158def guyou_invert(x, y): 
     159    """Transform from point (x, y) on plot to (latitude, longitude)""" 
    152160    # [PAK] wrap into [-pi/2, pi/2] radians 
    153161    x, y = np.asarray(x), np.asarray(y) 
     
    158166 
    159167    # compute constant K 
    160     cos_u = (sqrt2 - 1) / (sqrt2 + 1) 
     168    cos_u = (SQRT2 - 1) / (SQRT2 + 1) 
    161169    sinsq_u = 1 - cos_u**2 
    162170    K = ellipticF(pi/2, sinsq_u) 
     
    174182 
    175183def plot_grid(): 
     184    """Plot the latitude-longitude grid for Guyou transform""" 
    176185    import matplotlib.pyplot as plt 
    177186    from numpy import linspace 
     
    186195        plt.plot(x, y, 'g') 
    187196 
    188     for long in range(-limit, limit+1, step): 
    189         x, y = guyou(scale*long, scale*long_line) 
     197    for longitude in range(-limit, limit+1, step): 
     198        x, y = guyou(scale*longitude, scale*long_line) 
    190199        plt.plot(x, y, 'b') 
    191200    #plt.xlabel('longitude') 
    192201    plt.ylabel('latitude') 
     202    plt.title('forward transform') 
    193203 
    194204    plt.subplot(212) 
     
    202212    plt.xlabel('longitude') 
    203213    plt.ylabel('latitude') 
     214    plt.title('inverse transform') 
     215 
     216def main(): 
     217    """Show the Guyou transformation""" 
     218    plot_grid() 
     219    import matplotlib.pyplot as plt 
     220    plt.show() 
    204221 
    205222if __name__ == "__main__": 
    206     plot_grid() 
    207     import matplotlib.pyplot as plt; plt.show() 
    208  
     223    main() 
    209224 
    210225_ = """ 
  • sasmodels/jitter.py

    r199bd07 rb3703f5  
    88from __future__ import division, print_function 
    99 
    10 import sys, os 
    11 sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.realpath(__file__)))) 
    12  
    1310import argparse 
    1411 
     
    1916 
    2017import matplotlib.pyplot as plt 
    21 from matplotlib.widgets import Slider, CheckButtons 
    22 from matplotlib import cm 
     18from matplotlib.widgets import Slider 
    2319import numpy as np 
    2420from numpy import pi, cos, sin, sqrt, exp, degrees, radians 
    2521 
    26 def draw_beam(ax, view=(0, 0)): 
     22def draw_beam(axes, view=(0, 0)): 
    2723    """ 
    2824    Draw the beam going from source at (0, 0, 1) to detector at (0, 0, -1) 
    2925    """ 
    30     #ax.plot([0,0],[0,0],[1,-1]) 
    31     #ax.scatter([0]*100,[0]*100,np.linspace(1, -1, 100), alpha=0.8) 
     26    #axes.plot([0,0],[0,0],[1,-1]) 
     27    #axes.scatter([0]*100,[0]*100,np.linspace(1, -1, 100), alpha=0.8) 
    3228 
    3329    steps = 25 
     
    4642    x, y, z = [v.reshape(shape) for v in points] 
    4743 
    48     ax.plot_surface(x, y, z, rstride=4, cstride=4, color='y', alpha=0.5) 
    49  
    50 def draw_ellipsoid(ax, size, view, jitter, steps=25, alpha=1): 
     44    axes.plot_surface(x, y, z, rstride=4, cstride=4, color='y', alpha=0.5) 
     45 
     46def draw_ellipsoid(axes, size, view, jitter, steps=25, alpha=1): 
    5147    """Draw an ellipsoid.""" 
    52     a,b,c = size 
     48    a, b, c = size 
    5349    u = np.linspace(0, 2 * np.pi, steps) 
    5450    v = np.linspace(0, np.pi, steps) 
     
    5854    x, y, z = transform_xyz(view, jitter, x, y, z) 
    5955 
    60     ax.plot_surface(x, y, z, rstride=4, cstride=4, color='w', alpha=alpha) 
    61  
    62     draw_labels(ax, view, jitter, [ 
    63          ('c+', [ 0, 0, c], [ 1, 0, 0]), 
    64          ('c-', [ 0, 0,-c], [ 0, 0,-1]), 
    65          ('a+', [ a, 0, 0], [ 0, 0, 1]), 
    66          ('a-', [-a, 0, 0], [ 0, 0,-1]), 
    67          ('b+', [ 0, b, 0], [-1, 0, 0]), 
    68          ('b-', [ 0,-b, 0], [-1, 0, 0]), 
     56    axes.plot_surface(x, y, z, rstride=4, cstride=4, color='w', alpha=alpha) 
     57 
     58    draw_labels(axes, view, jitter, [ 
     59        ('c+', [+0, +0, +c], [+1, +0, +0]), 
     60        ('c-', [+0, +0, -c], [+0, +0, -1]), 
     61        ('a+', [+a, +0, +0], [+0, +0, +1]), 
     62        ('a-', [-a, +0, +0], [+0, +0, -1]), 
     63        ('b+', [+0, +b, +0], [-1, +0, +0]), 
     64        ('b-', [+0, -b, +0], [-1, +0, +0]), 
    6965    ]) 
    7066 
    71 def draw_sc(ax, size, view, jitter, steps=None, alpha=1): 
     67def draw_sc(axes, size, view, jitter, steps=None, alpha=1): 
     68    """Draw points for simple cubic paracrystal""" 
    7269    atoms = _build_sc() 
    73     _draw_crystal(ax, size, view, jitter, atoms=atoms) 
    74  
    75 def draw_fcc(ax, size, view, jitter, steps=None, alpha=1): 
     70    _draw_crystal(axes, size, view, jitter, atoms=atoms) 
     71 
     72def draw_fcc(axes, size, view, jitter, steps=None, alpha=1): 
     73    """Draw points for face-centered cubic paracrystal""" 
    7674    # Build the simple cubic crystal 
    7775    atoms = _build_sc() 
     
    8583    # y and z planes can be generated by substituting x for y and z respectively 
    8684    atoms.extend(zip(x+y+z, y+z+x, z+x+y)) 
    87     _draw_crystal(ax, size, view, jitter, atoms=atoms) 
    88  
    89 def draw_bcc(ax, size, view, jitter, steps=None, alpha=1): 
     85    _draw_crystal(axes, size, view, jitter, atoms=atoms) 
     86 
     87def draw_bcc(axes, size, view, jitter, steps=None, alpha=1): 
     88    """Draw points for body-centered cubic paracrystal""" 
    9089    # Build the simple cubic crystal 
    9190    atoms = _build_sc() 
     
    9897    ) 
    9998    atoms.extend(zip(x, y, z)) 
    100     _draw_crystal(ax, size, view, jitter, atoms=atoms) 
    101  
    102 def _draw_crystal(ax, size, view, jitter, steps=None, alpha=1, atoms=None): 
     99    _draw_crystal(axes, size, view, jitter, atoms=atoms) 
     100 
     101def _draw_crystal(axes, size, view, jitter, atoms=None): 
    103102    atoms, size = np.asarray(atoms, 'd').T, np.asarray(size, 'd') 
    104103    x, y, z = atoms*size[:, None] 
    105104    x, y, z = transform_xyz(view, jitter, x, y, z) 
    106     ax.scatter([x[0]], [y[0]], [z[0]], c='yellow', marker='o') 
    107     ax.scatter(x[1:], y[1:], z[1:], c='r', marker='o') 
     105    axes.scatter([x[0]], [y[0]], [z[0]], c='yellow', marker='o') 
     106    axes.scatter(x[1:], y[1:], z[1:], c='r', marker='o') 
    108107 
    109108def _build_sc(): 
     
    124123    return atoms 
    125124 
    126 def draw_parallelepiped(ax, size, view, jitter, steps=None, alpha=1): 
     125def draw_parallelepiped(axes, size, view, jitter, steps=None, alpha=1): 
    127126    """Draw a parallelepiped.""" 
    128127    a, b, c = size 
    129     x = a*np.array([ 1,-1, 1,-1, 1,-1, 1,-1]) 
    130     y = b*np.array([ 1, 1,-1,-1, 1, 1,-1,-1]) 
    131     z = c*np.array([ 1, 1, 1, 1,-1,-1,-1,-1]) 
     128    x = a*np.array([+1, -1, +1, -1, +1, -1, +1, -1]) 
     129    y = b*np.array([+1, +1, -1, -1, +1, +1, -1, -1]) 
     130    z = c*np.array([+1, +1, +1, +1, -1, -1, -1, -1]) 
    132131    tri = np.array([ 
    133132        # counter clockwise triangles 
    134133        # z: up/down, x: right/left, y: front/back 
    135         [0,1,2], [3,2,1], # top face 
    136         [6,5,4], [5,6,7], # bottom face 
    137         [0,2,6], [6,4,0], # right face 
    138         [1,5,7], [7,3,1], # left face 
    139         [2,3,6], [7,6,3], # front face 
    140         [4,1,0], [5,1,4], # back face 
     134        [0, 1, 2], [3, 2, 1], # top face 
     135        [6, 5, 4], [5, 6, 7], # bottom face 
     136        [0, 2, 6], [6, 4, 0], # right face 
     137        [1, 5, 7], [7, 3, 1], # left face 
     138        [2, 3, 6], [7, 6, 3], # front face 
     139        [4, 1, 0], [5, 1, 4], # back face 
    141140    ]) 
    142141 
    143142    x, y, z = transform_xyz(view, jitter, x, y, z) 
    144     ax.plot_trisurf(x, y, triangles=tri, Z=z, color='w', alpha=alpha) 
     143    axes.plot_trisurf(x, y, triangles=tri, Z=z, color='w', alpha=alpha) 
    145144 
    146145    # Draw pink face on box. 
     
    149148    # rotate that face. 
    150149    if 1: 
    151         x = a*np.array([ 1,-1, 1,-1, 1,-1, 1,-1]) 
    152         y = b*np.array([ 1, 1,-1,-1, 1, 1,-1,-1]) 
    153         z = c*np.array([ 1, 1, 1, 1,-1,-1,-1,-1]) 
     150        x = a*np.array([+1, -1, +1, -1, +1, -1, +1, -1]) 
     151        y = b*np.array([+1, +1, -1, -1, +1, +1, -1, -1]) 
     152        z = c*np.array([+1, +1, +1, +1, -1, -1, -1, -1]) 
    154153        x, y, z = transform_xyz(view, jitter, x, y, abs(z)+0.001) 
    155         ax.plot_trisurf(x, y, triangles=tri, Z=z, color=[1,0.6,0.6], alpha=alpha) 
    156  
    157     draw_labels(ax, view, jitter, [ 
    158          ('c+', [ 0, 0, c], [ 1, 0, 0]), 
    159          ('c-', [ 0, 0,-c], [ 0, 0,-1]), 
    160          ('a+', [ a, 0, 0], [ 0, 0, 1]), 
    161          ('a-', [-a, 0, 0], [ 0, 0,-1]), 
    162          ('b+', [ 0, b, 0], [-1, 0, 0]), 
    163          ('b-', [ 0,-b, 0], [-1, 0, 0]), 
     154        axes.plot_trisurf(x, y, triangles=tri, Z=z, color=[1, 0.6, 0.6], alpha=alpha) 
     155 
     156    draw_labels(axes, view, jitter, [ 
     157        ('c+', [+0, +0, +c], [+1, +0, +0]), 
     158        ('c-', [+0, +0, -c], [+0, +0, -1]), 
     159        ('a+', [+a, +0, +0], [+0, +0, +1]), 
     160        ('a-', [-a, +0, +0], [+0, +0, -1]), 
     161        ('b+', [+0, +b, +0], [-1, +0, +0]), 
     162        ('b-', [+0, -b, +0], [-1, +0, +0]), 
    164163    ]) 
    165164 
    166 def draw_sphere(ax, radius=10., steps=100): 
     165def draw_sphere(axes, radius=10., steps=100): 
    167166    """Draw a sphere""" 
    168167    u = np.linspace(0, 2 * np.pi, steps) 
     
    172171    y = radius * np.outer(np.sin(u), np.sin(v)) 
    173172    z = radius * np.outer(np.ones(np.size(u)), np.cos(v)) 
    174     ax.plot_surface(x, y, z, rstride=4, cstride=4, color='w') 
    175  
    176 def draw_jitter(ax, view, jitter, dist='gaussian', size=(0.1, 0.4, 1.0), 
     173    axes.plot_surface(x, y, z, rstride=4, cstride=4, color='w') 
     174 
     175def draw_jitter(axes, view, jitter, dist='gaussian', size=(0.1, 0.4, 1.0), 
    177176                draw_shape=draw_parallelepiped): 
    178177    """ 
     
    187186    cloud = [ 
    188187        [-1, -1, -1], 
    189         [-1, -1,  0], 
    190         [-1, -1,  1], 
    191         [-1,  0, -1], 
    192         [-1,  0,  0], 
    193         [-1,  0,  1], 
    194         [-1,  1, -1], 
    195         [-1,  1,  0], 
    196         [-1,  1,  1], 
    197         [ 0, -1, -1], 
    198         [ 0, -1,  0], 
    199         [ 0, -1,  1], 
    200         [ 0,  0, -1], 
    201         [ 0,  0,  0], 
    202         [ 0,  0,  1], 
    203         [ 0,  1, -1], 
    204         [ 0,  1,  0], 
    205         [ 0,  1,  1], 
    206         [ 1, -1, -1], 
    207         [ 1, -1,  0], 
    208         [ 1, -1,  1], 
    209         [ 1,  0, -1], 
    210         [ 1,  0,  0], 
    211         [ 1,  0,  1], 
    212         [ 1,  1, -1], 
    213         [ 1,  1,  0], 
    214         [ 1,  1,  1], 
     188        [-1, -1, +0], 
     189        [-1, -1, +1], 
     190        [-1, +0, -1], 
     191        [-1, +0, +0], 
     192        [-1, +0, +1], 
     193        [-1, +1, -1], 
     194        [-1, +1, +0], 
     195        [-1, +1, +1], 
     196        [+0, -1, -1], 
     197        [+0, -1, +0], 
     198        [+0, -1, +1], 
     199        [+0, +0, -1], 
     200        [+0, +0, +0], 
     201        [+0, +0, +1], 
     202        [+0, +1, -1], 
     203        [+0, +1, +0], 
     204        [+0, +1, +1], 
     205        [+1, -1, -1], 
     206        [+1, -1, +0], 
     207        [+1, -1, +1], 
     208        [+1, +0, -1], 
     209        [+1, +0, +0], 
     210        [+1, +0, +1], 
     211        [+1, +1, -1], 
     212        [+1, +1, +0], 
     213        [+1, +1, +1], 
    215214    ] 
    216215    dtheta, dphi, dpsi = jitter 
     
    221220    if dpsi == 0: 
    222221        cloud = [v for v in cloud if v[2] == 0] 
    223     draw_shape(ax, size, view, [0, 0, 0], steps=100, alpha=0.8) 
     222    draw_shape(axes, size, view, [0, 0, 0], steps=100, alpha=0.8) 
    224223    scale = {'gaussian':1, 'rectangle':1/sqrt(3), 'uniform':1/3}[dist] 
    225224    for point in cloud: 
    226225        delta = [scale*dtheta*point[0], scale*dphi*point[1], scale*dpsi*point[2]] 
    227         draw_shape(ax, size, view, delta, alpha=0.8) 
     226        draw_shape(axes, size, view, delta, alpha=0.8) 
    228227    for v in 'xyz': 
    229228        a, b, c = size 
    230         lim = np.sqrt(a**2+b**2+c**2) 
    231         getattr(ax, 'set_'+v+'lim')([-lim, lim]) 
    232         getattr(ax, v+'axis').label.set_text(v) 
     229        lim = np.sqrt(a**2 + b**2 + c**2) 
     230        getattr(axes, 'set_'+v+'lim')([-lim, lim]) 
     231        getattr(axes, v+'axis').label.set_text(v) 
    233232 
    234233PROJECTIONS = [ 
     
    238237    'azimuthal_equal_area', 
    239238] 
    240 def draw_mesh(ax, view, jitter, radius=1.2, n=11, dist='gaussian', 
     239def draw_mesh(axes, view, jitter, radius=1.2, n=11, dist='gaussian', 
    241240              projection='equirectangular'): 
    242241    """ 
     
    297296        Should allow free movement in theta, but phi is distorted. 
    298297    """ 
    299     theta, phi, psi = view 
    300     dtheta, dphi, dpsi = jitter 
    301  
    302     t = np.linspace(-1, 1, n) 
    303     weights = np.ones_like(t) 
     298    # TODO: try Kent distribution instead of a gaussian warped by projection 
     299 
     300    dist_x = np.linspace(-1, 1, n) 
     301    weights = np.ones_like(dist_x) 
    304302    if dist == 'gaussian': 
    305         t *= 3 
    306         weights = exp(-0.5*t**2) 
     303        dist_x *= 3 
     304        weights = exp(-0.5*dist_x**2) 
    307305    elif dist == 'rectangle': 
    308306        # Note: uses sasmodels ridiculous definition of rectangle width 
    309         t *= sqrt(3) 
     307        dist_x *= sqrt(3) 
    310308    elif dist == 'uniform': 
    311309        pass 
     
    314312 
    315313    if projection == 'equirectangular':  #define PROJECTION 1 
    316         def rotate(theta_i, phi_j): 
     314        def _rotate(theta_i, phi_j): 
    317315            return Rx(phi_j)*Ry(theta_i) 
    318         def weight(theta_i, phi_j, wi, wj): 
    319             return wi*wj*abs(cos(radians(theta_i))) 
     316        def _weight(theta_i, phi_j, w_i, w_j): 
     317            return w_i*w_j*abs(cos(radians(theta_i))) 
    320318    elif projection == 'sinusoidal':  #define PROJECTION 2 
    321         def rotate(theta_i, phi_j): 
     319        def _rotate(theta_i, phi_j): 
    322320            latitude = theta_i 
    323321            scale = cos(radians(latitude)) 
     
    325323            #print("(%+7.2f, %+7.2f) => (%+7.2f, %+7.2f)"%(theta_i, phi_j, latitude, longitude)) 
    326324            return Rx(longitude)*Ry(latitude) 
    327         def weight(theta_i, phi_j, wi, wj): 
     325        def _weight(theta_i, phi_j, w_i, w_j): 
    328326            latitude = theta_i 
    329327            scale = cos(radians(latitude)) 
    330             w = 1 if abs(phi_j) < abs(scale)*180 else 0 
    331             return w*wi*wj 
     328            active = 1 if abs(phi_j) < abs(scale)*180 else 0 
     329            return active*w_i*w_j 
    332330    elif projection == 'guyou':  #define PROJECTION 3  (eventually?) 
    333         def rotate(theta_i, phi_j): 
    334             from guyou import guyou_invert 
     331        def _rotate(theta_i, phi_j): 
     332            from .guyou import guyou_invert 
    335333            #latitude, longitude = guyou_invert([theta_i], [phi_j]) 
    336334            longitude, latitude = guyou_invert([phi_j], [theta_i]) 
    337335            return Rx(longitude[0])*Ry(latitude[0]) 
    338         def weight(theta_i, phi_j, wi, wj): 
    339             return wi*wj 
     336        def _weight(theta_i, phi_j, w_i, w_j): 
     337            return w_i*w_j 
    340338    elif projection == 'azimuthal_equidistance':  # Note: Rz Ry, not Rx Ry 
    341         def rotate(theta_i, phi_j): 
     339        def _rotate(theta_i, phi_j): 
    342340            latitude = sqrt(theta_i**2 + phi_j**2) 
    343341            longitude = degrees(np.arctan2(phi_j, theta_i)) 
    344342            #print("(%+7.2f, %+7.2f) => (%+7.2f, %+7.2f)"%(theta_i, phi_j, latitude, longitude)) 
    345343            return Rz(longitude)*Ry(latitude) 
    346         def weight(theta_i, phi_j, wi, wj): 
     344        def _weight(theta_i, phi_j, w_i, w_j): 
    347345            # Weighting for each point comes from the integral: 
    348346            #     \int\int I(q, lat, log) sin(lat) dlat dlog 
     
    374372            # the entire sphere, and treats theta and phi identically. 
    375373            latitude = sqrt(theta_i**2 + phi_j**2) 
    376             w = sin(radians(latitude))/latitude if latitude != 0 else 1 
    377             return w*wi*wj if latitude < 180 else 0 
     374            weight = sin(radians(latitude))/latitude if latitude != 0 else 1 
     375            return weight*w_i*w_j if latitude < 180 else 0 
    378376    elif projection == 'azimuthal_equal_area': 
    379         def rotate(theta_i, phi_j): 
    380             R = min(1, sqrt(theta_i**2 + phi_j**2)/180) 
    381             latitude = 180-degrees(2*np.arccos(R)) 
     377        def _rotate(theta_i, phi_j): 
     378            radius = min(1, sqrt(theta_i**2 + phi_j**2)/180) 
     379            latitude = 180-degrees(2*np.arccos(radius)) 
    382380            longitude = degrees(np.arctan2(phi_j, theta_i)) 
    383381            #print("(%+7.2f, %+7.2f) => (%+7.2f, %+7.2f)"%(theta_i, phi_j, latitude, longitude)) 
    384382            return Rz(longitude)*Ry(latitude) 
    385         def weight(theta_i, phi_j, wi, wj): 
     383        def _weight(theta_i, phi_j, w_i, w_j): 
    386384            latitude = sqrt(theta_i**2 + phi_j**2) 
    387             w = sin(radians(latitude))/latitude if latitude != 0 else 1 
    388             return w*wi*wj if latitude < 180 else 0 
     385            weight = sin(radians(latitude))/latitude if latitude != 0 else 1 
     386            return weight*w_i*w_j if latitude < 180 else 0 
    389387    else: 
    390388        raise ValueError("unknown projection %r"%projection) 
    391389 
    392390    # mesh in theta, phi formed by rotating z 
     391    dtheta, dphi, dpsi = jitter 
    393392    z = np.matrix([[0], [0], [radius]]) 
    394     points = np.hstack([rotate(theta_i, phi_j)*z 
    395                         for theta_i in dtheta*t 
    396                         for phi_j in dphi*t]) 
    397     # select just the active points (i.e., those with phi < 180 
    398     w = np.array([weight(theta_i, phi_j, wi, wj) 
    399                   for wi, theta_i in zip(weights, dtheta*t) 
    400                   for wj, phi_j in zip(weights, dphi*t)]) 
    401     #print(max(w), min(w), min(w[w>0])) 
    402     points = points[:, w>0] 
    403     w = w[w>0] 
    404     w /= max(w) 
    405  
    406     if 0: # Kent distribution 
    407         points = np.hstack([Rx(phi_j)*Ry(theta_i)*z for theta_i in 30*t for phi_j in 60*t]) 
    408         xp, yp, zp = [np.array(v).flatten() for v in points] 
    409         kappa = max(1e6, radians(dtheta)/(2*pi)) 
    410         beta = 1/max(1e-6, radians(dphi)/(2*pi))/kappa 
    411         w = exp(kappa*zp) #+ beta*(xp**2 + yp**2) 
    412         print(kappa, dtheta, radians(dtheta), min(w), max(w), sum(w)) 
    413         #w /= abs(cos(radians( 
    414         #w /= sum(w) 
     393    points = np.hstack([_rotate(theta_i, phi_j)*z 
     394                        for theta_i in dtheta*dist_x 
     395                        for phi_j in dphi*dist_x]) 
     396    dist_w = np.array([_weight(theta_i, phi_j, w_i, w_j) 
     397                       for w_i, theta_i in zip(weights, dtheta*dist_x) 
     398                       for w_j, phi_j in zip(weights, dphi*dist_x)]) 
     399    #print(max(dist_w), min(dist_w), min(dist_w[dist_w > 0])) 
     400    points = points[:, dist_w > 0] 
     401    dist_w = dist_w[dist_w > 0] 
     402    dist_w /= max(dist_w) 
    415403 
    416404    # rotate relative to beam 
     
    419407    x, y, z = [np.array(v).flatten() for v in points] 
    420408    #plt.figure(2); plt.clf(); plt.hist(z, bins=np.linspace(-1, 1, 51)) 
    421     ax.scatter(x, y, z, c=w, marker='o', vmin=0., vmax=1.) 
    422  
    423 def draw_labels(ax, view, jitter, text): 
     409    axes.scatter(x, y, z, c=dist_w, marker='o', vmin=0., vmax=1.) 
     410 
     411def draw_labels(axes, view, jitter, text): 
    424412    """ 
    425413    Draw text at a particular location. 
     
    435423    for label, p, zdir in zip(labels, zip(px, py, pz), zip(dx, dy, dz)): 
    436424        zdir = np.asarray(zdir).flatten() 
    437         ax.text(p[0], p[1], p[2], label, zdir=zdir) 
     425        axes.text(p[0], p[1], p[2], label, zdir=zdir) 
    438426 
    439427# Definition of rotation matrices comes from wikipedia: 
     
    441429def Rx(angle): 
    442430    """Construct a matrix to rotate points about *x* by *angle* degrees.""" 
    443     a = radians(angle) 
    444     R = [[1, 0, 0], 
    445          [0, +cos(a), -sin(a)], 
    446          [0, +sin(a), +cos(a)]] 
    447     return np.matrix(R) 
     431    angle = radians(angle) 
     432    rot = [[1, 0, 0], 
     433           [0, +cos(angle), -sin(angle)], 
     434           [0, +sin(angle), +cos(angle)]] 
     435    return np.matrix(rot) 
    448436 
    449437def Ry(angle): 
    450438    """Construct a matrix to rotate points about *y* by *angle* degrees.""" 
    451     a = radians(angle) 
    452     R = [[+cos(a), 0, +sin(a)], 
    453          [0, 1, 0], 
    454          [-sin(a), 0, +cos(a)]] 
    455     return np.matrix(R) 
     439    angle = radians(angle) 
     440    rot = [[+cos(angle), 0, +sin(angle)], 
     441           [0, 1, 0], 
     442           [-sin(angle), 0, +cos(angle)]] 
     443    return np.matrix(rot) 
    456444 
    457445def Rz(angle): 
    458446    """Construct a matrix to rotate points about *z* by *angle* degrees.""" 
    459     a = radians(angle) 
    460     R = [[+cos(a), -sin(a), 0], 
    461          [+sin(a), +cos(a), 0], 
    462          [0, 0, 1]] 
    463     return np.matrix(R) 
     447    angle = radians(angle) 
     448    rot = [[+cos(angle), -sin(angle), 0], 
     449           [+sin(angle), +cos(angle), 0], 
     450           [0, 0, 1]] 
     451    return np.matrix(rot) 
    464452 
    465453def transform_xyz(view, jitter, x, y, z): 
     
    469457    x, y, z = [np.asarray(v) for v in (x, y, z)] 
    470458    shape = x.shape 
    471     points = np.matrix([x.flatten(),y.flatten(),z.flatten()]) 
     459    points = np.matrix([x.flatten(), y.flatten(), z.flatten()]) 
    472460    points = apply_jitter(jitter, points) 
    473461    points = orient_relative_to_beam(view, points) 
     
    526514        return data[offset], data[-1] 
    527515 
    528 def draw_scattering(calculator, ax, view, jitter, dist='gaussian'): 
     516def draw_scattering(calculator, axes, view, jitter, dist='gaussian'): 
    529517    """ 
    530518    Plot the scattering for the particular view. 
    531519 
    532     *calculator* is returned from :func:`build_model`.  *ax* are the 3D axes 
     520    *calculator* is returned from :func:`build_model`.  *axes* are the 3D axes 
    533521    on which the data will be plotted.  *view* and *jitter* are the current 
    534522    orientation and orientation dispersity.  *dist* is one of the sasmodels 
     
    543531    theta, phi, psi = view 
    544532    theta_pd, phi_pd, psi_pd = [scale*v for v in jitter] 
    545     theta_pd_n, phi_pd_n, psi_pd_n = PD_N_TABLE[(theta_pd>0, phi_pd>0, psi_pd>0)] 
     533    theta_pd_n, phi_pd_n, psi_pd_n = PD_N_TABLE[(theta_pd > 0, phi_pd > 0, psi_pd > 0)] 
    546534    ## increase pd_n for testing jitter integration rather than simple viz 
    547535    #theta_pd_n, phi_pd_n, psi_pd_n = [5*v for v in (theta_pd_n, phi_pd_n, psi_pd_n)] 
     
    571559    if 0: 
    572560        level = np.asarray(255*(Iqxy - vmin)/(vmax - vmin), 'i') 
    573         level[level<0] = 0 
     561        level[level < 0] = 0 
    574562        colors = plt.get_cmap()(level) 
    575         ax.plot_surface(qx, qy, -1.1, rstride=1, cstride=1, facecolors=colors) 
     563        axes.plot_surface(qx, qy, -1.1, rstride=1, cstride=1, facecolors=colors) 
    576564    elif 1: 
    577         ax.contourf(qx/qx.max(), qy/qy.max(), Iqxy, zdir='z', offset=-1.1, 
    578                     levels=np.linspace(vmin, vmax, 24)) 
     565        axes.contourf(qx/qx.max(), qy/qy.max(), Iqxy, zdir='z', offset=-1.1, 
     566                      levels=np.linspace(vmin, vmax, 24)) 
    579567    else: 
    580         ax.pcolormesh(qx, qy, Iqxy) 
     568        axes.pcolormesh(qx, qy, Iqxy) 
    581569 
    582570def build_model(model_name, n=150, qmax=0.5, **pars): 
     
    595583    for details. 
    596584    """ 
    597     from sasmodels.core import load_model_info, build_model 
     585    from sasmodels.core import load_model_info, build_model as build_sasmodel 
    598586    from sasmodels.data import empty_data2D 
    599587    from sasmodels.direct_model import DirectModel 
    600588 
    601589    model_info = load_model_info(model_name) 
    602     model = build_model(model_info) #, dtype='double!') 
     590    model = build_sasmodel(model_info) #, dtype='double!') 
    603591    q = np.linspace(-qmax, qmax, n) 
    604592    data = empty_data2D(q, q) 
     
    618606    return calculator 
    619607 
    620 def select_calculator(model_name, n=150, size=(10,40,100)): 
     608def select_calculator(model_name, n=150, size=(10, 40, 100)): 
    621609    """ 
    622610    Create a model calculator for the given shape. 
     
    641629        radius = 0.5*c 
    642630        calculator = build_model('sc_paracrystal', n=n, dnn=dnn, 
    643                                   d_factor=d_factor, radius=(1-d_factor)*radius, 
    644                                   background=0) 
     631                                 d_factor=d_factor, radius=(1-d_factor)*radius, 
     632                                 background=0) 
    645633    elif model_name == 'fcc_paracrystal': 
    646634        a = b = c 
     
    650638        radius = sqrt(2)/4 * c 
    651639        calculator = build_model('fcc_paracrystal', n=n, dnn=dnn, 
    652                                   d_factor=d_factor, radius=(1-d_factor)*radius, 
    653                                   background=0) 
     640                                 d_factor=d_factor, radius=(1-d_factor)*radius, 
     641                                 background=0) 
    654642    elif model_name == 'bcc_paracrystal': 
    655643        a = b = c 
     
    659647        radius = sqrt(3)/2 * c 
    660648        calculator = build_model('bcc_paracrystal', n=n, dnn=dnn, 
    661                                   d_factor=d_factor, radius=(1-d_factor)*radius, 
    662                                   background=0) 
     649                                 d_factor=d_factor, radius=(1-d_factor)*radius, 
     650                                 background=0) 
    663651    elif model_name == 'cylinder': 
    664652        calculator = build_model('cylinder', n=n, qmax=0.3, radius=b, length=c) 
     
    685673    'cylinder', 
    686674    'fcc_paracrystal', 'bcc_paracrystal', 'sc_paracrystal', 
    687  ] 
     675] 
    688676 
    689677DRAW_SHAPES = { 
     
    751739    plt.gcf().canvas.set_window_title(projection) 
    752740    #gs = gridspec.GridSpec(2,1,height_ratios=[4,1]) 
    753     #ax = plt.subplot(gs[0], projection='3d') 
    754     ax = plt.axes([0.0, 0.2, 1.0, 0.8], projection='3d') 
     741    #axes = plt.subplot(gs[0], projection='3d') 
     742    axes = plt.axes([0.0, 0.2, 1.0, 0.8], projection='3d') 
    755743    try:  # CRUFT: not all versions of matplotlib accept 'square' 3d projection 
    756         ax.axis('square') 
     744        axes.axis('square') 
    757745    except Exception: 
    758746        pass 
     
    761749 
    762750    ## add control widgets to plot 
    763     axtheta = plt.axes([0.1, 0.15, 0.45, 0.04], axisbg=axcolor) 
    764     axphi = plt.axes([0.1, 0.1, 0.45, 0.04], axisbg=axcolor) 
    765     axpsi = plt.axes([0.1, 0.05, 0.45, 0.04], axisbg=axcolor) 
    766     stheta = Slider(axtheta, 'Theta', -90, 90, valinit=theta) 
    767     sphi = Slider(axphi, 'Phi', -180, 180, valinit=phi) 
    768     spsi = Slider(axpsi, 'Psi', -180, 180, valinit=psi) 
    769  
    770     axdtheta = plt.axes([0.75, 0.15, 0.15, 0.04], axisbg=axcolor) 
    771     axdphi = plt.axes([0.75, 0.1, 0.15, 0.04], axisbg=axcolor) 
    772     axdpsi= plt.axes([0.75, 0.05, 0.15, 0.04], axisbg=axcolor) 
     751    axes_theta = plt.axes([0.1, 0.15, 0.45, 0.04], axisbg=axcolor) 
     752    axes_phi = plt.axes([0.1, 0.1, 0.45, 0.04], axisbg=axcolor) 
     753    axes_psi = plt.axes([0.1, 0.05, 0.45, 0.04], axisbg=axcolor) 
     754    stheta = Slider(axes_theta, 'Theta', -90, 90, valinit=theta) 
     755    sphi = Slider(axes_phi, 'Phi', -180, 180, valinit=phi) 
     756    spsi = Slider(axes_psi, 'Psi', -180, 180, valinit=psi) 
     757 
     758    axes_dtheta = plt.axes([0.75, 0.15, 0.15, 0.04], axisbg=axcolor) 
     759    axes_dphi = plt.axes([0.75, 0.1, 0.15, 0.04], axisbg=axcolor) 
     760    axes_dpsi = plt.axes([0.75, 0.05, 0.15, 0.04], axisbg=axcolor) 
    773761    # Note: using ridiculous definition of rectangle distribution, whose width 
    774762    # in sasmodels is sqrt(3) times the given width.  Divide by sqrt(3) to keep 
    775763    # the maximum width to 90. 
    776764    dlimit = DIST_LIMITS[dist] 
    777     sdtheta = Slider(axdtheta, 'dTheta', 0, 2*dlimit, valinit=dtheta) 
    778     sdphi = Slider(axdphi, 'dPhi', 0, 2*dlimit, valinit=dphi) 
    779     sdpsi = Slider(axdpsi, 'dPsi', 0, 2*dlimit, valinit=dpsi) 
     765    sdtheta = Slider(axes_dtheta, 'dTheta', 0, 2*dlimit, valinit=dtheta) 
     766    sdphi = Slider(axes_dphi, 'dPhi', 0, 2*dlimit, valinit=dphi) 
     767    sdpsi = Slider(axes_dpsi, 'dPsi', 0, 2*dlimit, valinit=dpsi) 
    780768 
    781769 
     
    788776        limit = [0, 0, 0.5, 5][dims] 
    789777        jitter = [0 if v < limit else v for v in jitter] 
    790         ax.cla() 
    791         draw_beam(ax, (0, 0)) 
    792         draw_jitter(ax, view, jitter, dist=dist, size=size, draw_shape=draw_shape) 
    793         #draw_jitter(ax, view, (0,0,0)) 
    794         draw_mesh(ax, view, jitter, dist=dist, n=mesh, projection=projection) 
    795         draw_scattering(calculator, ax, view, jitter, dist=dist) 
     778        axes.cla() 
     779        draw_beam(axes, (0, 0)) 
     780        draw_jitter(axes, view, jitter, dist=dist, size=size, draw_shape=draw_shape) 
     781        #draw_jitter(axes, view, (0,0,0)) 
     782        draw_mesh(axes, view, jitter, dist=dist, n=mesh, projection=projection) 
     783        draw_scattering(calculator, axes, view, jitter, dist=dist) 
    796784        plt.gcf().canvas.draw() 
    797785 
    798786    ## bind control widgets to view updater 
    799     stheta.on_changed(lambda v: update(v,'theta')) 
     787    stheta.on_changed(lambda v: update(v, 'theta')) 
    800788    sphi.on_changed(lambda v: update(v, 'phi')) 
    801789    spsi.on_changed(lambda v: update(v, 'psi')) 
     
    815803        formatter_class=argparse.ArgumentDefaultsHelpFormatter, 
    816804        ) 
    817     parser.add_argument('-p', '--projection', choices=PROJECTIONS, default=PROJECTIONS[0], help='coordinate projection') 
    818     parser.add_argument('-s', '--size', type=str, default='10,40,100', help='a,b,c lengths') 
    819     parser.add_argument('-d', '--distribution', choices=DISTRIBUTIONS, default=DISTRIBUTIONS[0], help='jitter distribution') 
    820     parser.add_argument('-m', '--mesh', type=int, default=30, help='#points in theta-phi mesh') 
    821     parser.add_argument('shape', choices=SHAPES, nargs='?', default=SHAPES[0], help='oriented shape') 
     805    parser.add_argument('-p', '--projection', choices=PROJECTIONS, 
     806                        default=PROJECTIONS[0], 
     807                        help='coordinate projection') 
     808    parser.add_argument('-s', '--size', type=str, default='10,40,100', 
     809                        help='a,b,c lengths') 
     810    parser.add_argument('-d', '--distribution', choices=DISTRIBUTIONS, 
     811                        default=DISTRIBUTIONS[0], 
     812                        help='jitter distribution') 
     813    parser.add_argument('-m', '--mesh', type=int, default=30, 
     814                        help='#points in theta-phi mesh') 
     815    parser.add_argument('shape', choices=SHAPES, nargs='?', default=SHAPES[0], 
     816                        help='oriented shape') 
    822817    opts = parser.parse_args() 
    823818    size = tuple(int(v) for v in opts.size.split(',')) 
  • sasmodels/kernel_iq.c

    raadec17 rd86f0fc  
    173173// Apply the rotation matrix returned from qac_rotation to the point (qx,qy), 
    174174// returning R*[qx,qy]' = [qa,qc]' 
    175 static double 
     175static void 
    176176qac_apply( 
    177177    QACRotation *rotation, 
     
    246246// Apply the rotation matrix returned from qabc_rotation to the point (qx,qy), 
    247247// returning R*[qx,qy]' = [qa,qb,qc]' 
    248 static double 
     248static void 
    249249qabc_apply( 
    250250    QABCRotation *rotation, 
  • sasmodels/kernelcl.py

    r6cbdcd4 rd86f0fc  
    151151        if not HAVE_OPENCL: 
    152152            raise RuntimeError("OpenCL startup failed with ***" 
    153                             + OPENCL_ERROR + "***; using C compiler instead") 
     153                               + OPENCL_ERROR + "***; using C compiler instead") 
    154154        reset_environment() 
    155155        if ENV is None: 
  • sasmodels/models/core_shell_cylinder.c

    r108e70e rd86f0fc  
    4848 
    4949 
    50 double Iqac(double qab, double qc, 
     50static double 
     51Iqac(double qab, double qc, 
    5152    double core_sld, 
    5253    double shell_sld, 
  • sasmodels/models/hollow_rectangular_prism.c

    r108e70e rd86f0fc  
    1 double form_volume(double length_a, double b2a_ratio, double c2a_ratio, double thickness); 
    2 double Iq(double q, double sld, double solvent_sld, double length_a, 
    3           double b2a_ratio, double c2a_ratio, double thickness); 
    4  
    5 double form_volume(double length_a, double b2a_ratio, double c2a_ratio, double thickness) 
     1static double 
     2form_volume(double length_a, double b2a_ratio, double c2a_ratio, double thickness) 
    63{ 
    74    double length_b = length_a * b2a_ratio; 
     
    1613} 
    1714 
    18 double Iq(double q, 
     15static double 
     16Iq(double q, 
    1917    double sld, 
    2018    double solvent_sld, 
     
    8583} 
    8684 
    87 double Iqabc(double qa, double qb, double qc, 
     85static double 
     86Iqabc(double qa, double qb, double qc, 
    8887    double sld, 
    8988    double solvent_sld, 
  • sasmodels/models/hollow_rectangular_prism_thin_walls.c

    r74768cb rd86f0fc  
    1 double form_volume(double length_a, double b2a_ratio, double c2a_ratio); 
    2 double Iq(double q, double sld, double solvent_sld, double length_a, 
    3           double b2a_ratio, double c2a_ratio); 
    4  
    5 double form_volume(double length_a, double b2a_ratio, double c2a_ratio) 
     1static double 
     2form_volume(double length_a, double b2a_ratio, double c2a_ratio) 
    63{ 
    74    double length_b = length_a * b2a_ratio; 
     
    118} 
    129 
    13 double Iq(double q, 
     10static double 
     11Iq(double q, 
    1412    double sld, 
    1513    double solvent_sld, 
  • sasmodels/models/rectangular_prism.c

    r108e70e rd86f0fc  
    1 double form_volume(double length_a, double b2a_ratio, double c2a_ratio); 
    2 double Iq(double q, double sld, double solvent_sld, double length_a, 
    3           double b2a_ratio, double c2a_ratio); 
    4  
    5 double form_volume(double length_a, double b2a_ratio, double c2a_ratio) 
     1static double 
     2form_volume(double length_a, double b2a_ratio, double c2a_ratio) 
    63{ 
    74    return length_a * (length_a*b2a_ratio) * (length_a*c2a_ratio); 
    85} 
    96 
    10 double Iq(double q, 
     7static double 
     8Iq(double q, 
    119    double sld, 
    1210    double solvent_sld, 
     
    7169 
    7270 
    73 double Iqabc(double qa, double qb, double qc, 
     71static double 
     72Iqabc(double qa, double qb, double qc, 
    7473    double sld, 
    7574    double solvent_sld, 
  • sasmodels/multiscat.py

    r49d1f8b8 rb3703f5  
    7373import argparse 
    7474import time 
    75 import os.path 
    7675 
    7776import numpy as np 
     
    8180from sasmodels import core 
    8281from sasmodels import compare 
    83 from sasmodels import resolution2d 
    8482from sasmodels.resolution import Resolution, bin_edges 
    85 from sasmodels.data import empty_data1D, empty_data2D, plot_data 
    8683from sasmodels.direct_model import call_kernel 
    8784import sasmodels.kernelcl 
     
    106103USE_FAST = True  # OpenCL faster, less accurate math 
    107104 
    108 class NumpyCalculator: 
     105class ICalculator: 
     106    """ 
     107    Multiple scattering calculator 
     108    """ 
     109    def fft(self, Iq): 
     110        """ 
     111        Compute the forward FFT for an image, real -> complex. 
     112        """ 
     113        raise NotImplementedError() 
     114 
     115    def ifft(self, Iq): 
     116        """ 
     117        Compute the inverse FFT for an image, complex -> complex. 
     118        """ 
     119        raise NotImplementedError() 
     120 
     121    def mulitple_scattering(self, Iq): 
     122        r""" 
     123        Compute multiple scattering for I(q) given scattering probability p. 
     124 
     125        Given a probability p of scattering with the thickness, the expected 
     126        number of scattering events, $\lambda$ is $-\log(1 - p)$, giving a 
     127        Poisson weighted sum of single, double, triple, etc. scattering patterns. 
     128        The number of patterns used is based on coverage (default 99%). 
     129        """ 
     130        raise NotImplementedError() 
     131 
     132class NumpyCalculator(ICalculator): 
     133    """ 
     134    Multiple scattering calculator using numpy fft. 
     135    """ 
    109136    def __init__(self, dims=None, dtype=PRECISION): 
    110137        self.dtype = dtype 
    111138        self.complex_dtype = np.dtype('F') if dtype == np.dtype('f') else np.dtype('D') 
    112         pass 
    113139 
    114140    def fft(self, Iq): 
     
    127153 
    128154    def multiple_scattering(self, Iq, p, coverage=0.99): 
    129         r""" 
    130         Compute multiple scattering for I(q) given scattering probability p. 
    131  
    132         Given a probability p of scattering with the thickness, the expected 
    133         number of scattering events, $\lambda$ is $-\log(1 - p)$, giving a 
    134         Poisson weighted sum of single, double, triple, etc. scattering patterns. 
    135         The number of patterns used is based on coverage (default 99%). 
    136         """ 
    137155        #t0 = time.time() 
    138156        coeffs = scattering_coeffs(p, coverage) 
     
    140158        scale = np.sum(Iq) 
    141159        frame = _forward_shift(Iq/scale, dtype=self.dtype) 
    142         F = np.fft.fft2(frame) 
    143         F_convolved = F * np.polyval(poly, F) 
    144         frame = np.fft.ifft2(F_convolved) 
     160        fourier_frame = np.fft.fft2(frame) 
     161        convolved = fourier_frame * np.polyval(poly, fourier_frame) 
     162        frame = np.fft.ifft2(convolved) 
    145163        result = scale * _inverse_shift(frame.real, dtype=self.dtype) 
    146164        #print("numpy multiscat time", time.time()-t0) 
     
    173191""" 
    174192 
    175 class OpenclCalculator(NumpyCalculator): 
     193class OpenclCalculator(ICalculator): 
     194    """ 
     195    Multiple scattering calculator using OpenCL via pyfft. 
     196    """ 
    176197    polyval1f = None 
    177198    polyval1d = None 
     
    180201        context = env.get_context(dtype) 
    181202        if dtype == np.dtype('f'): 
    182             if self.polyval1f is None: 
     203            if OpenclCalculator.polyval1f is None: 
    183204                program = sasmodels.kernelcl.compile_model( 
    184205                    context, POLYVAL1_KERNEL, dtype, fast=USE_FAST) 
     
    187208            self.dtype = dtype 
    188209            self.complex_dtype = np.dtype('F') 
    189             self.polyval1 = self.polyval1f 
     210            self.polyval1 = OpenclCalculator.polyval1f 
    190211        else: 
    191             if self.polyval1d is None: 
     212            if OpenclCalculator.polyval1d is None: 
    192213                program = sasmodels.kernelcl.compile_model( 
    193214                    context, POLYVAL1_KERNEL, dtype, fast=False) 
     
    196217            self.dtype = dtype 
    197218            self.complex_type = np.dtype('D') 
    198             self.polyval1 = self.polyval1d 
     219            self.polyval1 = OpenclCalculator.polyval1d 
    199220        self.queue = env.get_queue(dtype) 
    200221        self.plan = pyfft.cl.Plan(dims, queue=self.queue) 
     
    229250        gpu_poly = cl_array.to_device(self.queue, poly) 
    230251        self.plan.execute(gpu_data.data) 
    231         degree, n = poly.shape[0], frame.shape[0]*frame.shape[1] 
     252        degree, data_size= poly.shape[0], frame.shape[0]*frame.shape[1] 
    232253        self.polyval1( 
    233             self.queue, [n], None, 
    234             np.int32(degree), gpu_poly.data, np.int32(n), gpu_data.data) 
     254            self.queue, [data_size], None, 
     255            np.int32(degree), gpu_poly.data, np.int32(data_size), gpu_data.data) 
    235256        self.plan.execute(gpu_data.data, inverse=True) 
    236257        frame = gpu_data.get() 
     
    251272    """ 
    252273    if transform is None: 
    253         nx, ny = Iq.shape 
    254         transform = Calculator(dims=(nx*2, ny*2), dtype=dtype) 
     274        n_x, n_y = Iq.shape 
     275        transform = Calculator(dims=(n_x*2, n_y*2), dtype=dtype) 
    255276    scale = np.sum(Iq) 
    256277    frame = _forward_shift(Iq/scale, dtype=dtype) 
     
    261282 
    262283def scattering_coeffs(p, coverage=0.99): 
     284    r""" 
     285    Return the coefficients of the scattering powers for transmission 
     286    probability *p*.  This is just the corresponding values for the 
     287    Poisson distribution for $\lambda = -\ln(1-p)$ such that 
     288    $\sum_{k = 0 \ldots n} P(k; \lambda)$ is larger than *coverage*. 
     289    """ 
    263290    L = -np.log(1-p) 
    264291    num_scatter = truncated_poisson_invcdf(coverage, L) 
     
    266293    return coeffs 
    267294 
    268 def truncated_poisson_invcdf(p, L): 
     295def truncated_poisson_invcdf(coverage, L): 
    269296    r""" 
    270     Return smallest k such that cdf(k; L) > p from the truncated Poisson 
     297    Return smallest k such that cdf(k; L) > coverage from the truncated Poisson 
    271298    probability excluding k=0 
    272299    """ 
     
    275302    pmf = -np.exp(-L) / np.expm1(-L) 
    276303    k = 0 
    277     while cdf < p: 
     304    while cdf < coverage: 
    278305        k += 1 
    279306        pmf *= L/k 
     
    305332 
    306333class MultipleScattering(Resolution): 
     334    r""" 
     335    Compute multiple scattering using Fourier convolution. 
     336 
     337    The fourier steps are determined by *qmax*, the maximum $q$ value 
     338    desired, *nq* the number of $q$ steps and *window*, the amount 
     339    of padding around the circular convolution.  The $q$ spacing 
     340    will be $\Delta q = 2 q_\mathrm{max} w / n_q$.  If *nq* is not 
     341    given it will use $n_q = 2^k$ such that $\Delta q < q_\mathrm{min}$. 
     342 
     343    *probability* is related to the expected number of scattering 
     344    events in the sample $\lambda$ as $p = 1 = e^{-\lambda}$.  As a 
     345    hack to allow probability to be a fitted parameter, the "value" 
     346    can be a function that takes no parameters and returns the current 
     347    value of the probability.  *coverage* determines how many scattering 
     348    steps to consider.  The default is 0.99, which sets $n$ such that 
     349    $1 \ldots n$ covers 99% of the Poisson probability mass function. 
     350 
     351    *is2d* is True then 2D scattering is used, otherwise it accepts 
     352    and returns 1D scattering. 
     353 
     354    *resolution* is the resolution function to apply after multiple 
     355    scattering.  If present, then the resolution $q$ vectors will provide 
     356    default values for *qmin*, *qmax* and *nq*. 
     357    """ 
    307358    def __init__(self, qmin=None, qmax=None, nq=None, window=2, 
    308359                 probability=None, coverage=0.99, 
    309360                 is2d=False, resolution=None, 
    310361                 dtype=PRECISION): 
    311         r""" 
    312         Compute multiple scattering using Fourier convolution. 
    313  
    314         The fourier steps are determined by *qmax*, the maximum $q$ value 
    315         desired, *nq* the number of $q$ steps and *window*, the amount 
    316         of padding around the circular convolution.  The $q$ spacing 
    317         will be $\Delta q = 2 q_\mathrm{max} w / n_q$.  If *nq* is not 
    318         given it will use $n_q = 2^k$ such that $\Delta q < q_\mathrm{min}$. 
    319  
    320         *probability* is related to the expected number of scattering 
    321         events in the sample $\lambda$ as $p = 1 = e^{-\lambda}$.  As a 
    322         hack to allow probability to be a fitted parameter, the "value" 
    323         can be a function that takes no parameters and returns the current 
    324         value of the probability.  *coverage* determines how many scattering 
    325         steps to consider.  The default is 0.99, which sets $n$ such that 
    326         $1 \ldots n$ covers 99% of the Poisson probability mass function. 
    327  
    328         *is2d* is True then 2D scattering is used, otherwise it accepts 
    329         and returns 1D scattering. 
    330  
    331         *resolution* is the resolution function to apply after multiple 
    332         scattering.  If present, then the resolution $q$ vectors will provide 
    333         default values for *qmin*, *qmax* and *nq*. 
    334         """ 
    335362        # Infer qmin, qmax from instrument resolution calculator, if present 
    336363        if resolution is not None: 
     
    424451        # Prepare the multiple scattering calculator (either numpy or OpenCL) 
    425452        self.transform = Calculator((2*nq, 2*nq), dtype=dtype) 
     453 
     454        # Iq and Iqxy will be set during apply 
     455        self.Iq = None # type: np.ndarray 
     456        self.Iqxy = None # type: np.ndarray 
    426457 
    427458    def apply(self, theory): 
     
    471502 
    472503    def radial_profile(self, Iqxy): 
     504        """ 
     505        Compute that radial profile for the given Iqxy grid.  The grid should 
     506        be defined as for 
     507        """ 
    473508        # circular average, no anti-aliasing 
    474509        Iq = np.histogram(self._radius, bins=self._edges, weights=Iqxy)[0]/self._norm 
     
    478513def annular_average(qxy, Iqxy, qbins): 
    479514    """ 
    480     Compute annular average of points at 
     515    Compute annular average of points in *Iqxy* at *qbins*.  The $q_x$, $q_y$ 
     516    coordinates for *Iqxy* are given in *qxy*. 
    481517    """ 
    482518    qxy, Iqxy = qxy.flatten(), Iqxy.flatten() 
     
    513549def parse_pars(model, opts): 
    514550    # type: (ModelInfo, argparse.Namespace) -> Dict[str, float] 
     551    """ 
     552    Parse par=val arguments from the command line. 
     553    """ 
    515554 
    516555    seed = np.random.randint(1000000) if opts.random and opts.seed < 0 else opts.seed 
     
    526565        'is2d': opts.is2d, 
    527566    } 
    528     pars, pars2 = compare.parse_pars(compare_opts) 
     567    # Note: sascomp allows comparison on a pair of models, so ignore the second. 
     568    pars, _ = compare.parse_pars(compare_opts) 
    529569    return pars 
    530570 
     
    535575        formatter_class=argparse.ArgumentDefaultsHelpFormatter, 
    536576        ) 
    537     parser.add_argument('-p', '--probability', type=float, default=0.1, help="scattering probability") 
    538     parser.add_argument('-n', '--nq', type=int, default=1024, help='number of mesh points') 
    539     parser.add_argument('-q', '--qmax', type=float, default=0.5, help='max q') 
    540     parser.add_argument('-w', '--window', type=float, default=2.0, help='q calc = q max * window') 
    541     parser.add_argument('-2', '--2d', dest='is2d', action='store_true', help='oriented sample') 
    542     parser.add_argument('-s', '--seed', default=-1, help='random pars with given seed') 
    543     parser.add_argument('-r', '--random', action='store_true', help='random pars with random seed') 
    544     parser.add_argument('-o', '--outfile', type=str, default="", help='random pars with random seed') 
    545     parser.add_argument('model', type=str, help='sas model name such as cylinder') 
    546     parser.add_argument('pars', type=str, nargs='*', help='model parameters such as radius=30') 
     577    parser.add_argument('-p', '--probability', type=float, default=0.1, 
     578                        help="scattering probability") 
     579    parser.add_argument('-n', '--nq', type=int, default=1024, 
     580                        help='number of mesh points') 
     581    parser.add_argument('-q', '--qmax', type=float, default=0.5, 
     582                        help='max q') 
     583    parser.add_argument('-w', '--window', type=float, default=2.0, 
     584                        help='q calc = q max * window') 
     585    parser.add_argument('-2', '--2d', dest='is2d', action='store_true', 
     586                        help='oriented sample') 
     587    parser.add_argument('-s', '--seed', default=-1, 
     588                        help='random pars with given seed') 
     589    parser.add_argument('-r', '--random', action='store_true', 
     590                        help='random pars with random seed') 
     591    parser.add_argument('-o', '--outfile', type=str, default="", 
     592                        help='random pars with random seed') 
     593    parser.add_argument('model', type=str, 
     594                        help='sas model name such as cylinder') 
     595    parser.add_argument('pars', type=str, nargs='*', 
     596                        help='model parameters such as radius=30') 
    547597    opts = parser.parse_args() 
    548598    assert opts.nq%2 == 0, "require even # points" 
     
    592642            plotxy((res._q_steps, res._q_steps), res.Iqxy+background) 
    593643            pylab.title("total scattering for p=%g" % probability) 
     644            if res.resolution is not None: 
     645                pylab.figure() 
     646                plotxy((res._q_steps, res._q_steps), result) 
     647                pylab.title("total scattering with resolution") 
    594648    else: 
    595649        q = res._q 
     
    609663            # Plot 1D pattern for partial scattering 
    610664            pylab.loglog(q, res.Iq+background, label="total for p=%g"%probability) 
     665            if res.resolution is not None: 
     666                pylab.loglog(q, result, label="total with dQ") 
    611667            #new_annulus = annular_average(res._radius, res.Iqxy, res._edges) 
    612668            #pylab.loglog(q, new_annulus+background, label="new total for p=%g"%probability) 
  • sasmodels/models/core_shell_parallelepiped.c

    re077231 rdbf1a60  
    5959 
    6060    // outer integral (with gauss points), integration limits = 0, 1 
     61    // substitute d_cos_alpha for sin_alpha d_alpha 
    6162    double outer_sum = 0; //initialize integral 
    6263    for( int i=0; i<GAUSS_N; i++) { 
    6364        const double cos_alpha = 0.5 * ( GAUSS_Z[i] + 1.0 ); 
    6465        const double mu = half_q * sqrt(1.0-cos_alpha*cos_alpha); 
    65  
    66         // inner integral (with gauss points), integration limits = 0, pi/2 
    6766        const double siC = length_c * sas_sinx_x(length_c * cos_alpha * half_q); 
    6867        const double siCt = tC * sas_sinx_x(tC * cos_alpha * half_q); 
     68 
     69        // inner integral (with gauss points), integration limits = 0, 1 
     70        // substitute beta = PI/2 u (so 2/PI * d_(PI/2 * beta) = d_beta) 
    6971        double inner_sum = 0.0; 
    7072        for(int j=0; j<GAUSS_N; j++) { 
    71             const double beta = 0.5 * ( GAUSS_Z[j] + 1.0 ); 
     73            const double u = 0.5 * ( GAUSS_Z[j] + 1.0 ); 
    7274            double sin_beta, cos_beta; 
    73             SINCOS(M_PI_2*beta, sin_beta, cos_beta); 
     75            SINCOS(M_PI_2*u, sin_beta, cos_beta); 
    7476            const double siA = length_a * sas_sinx_x(length_a * mu * sin_beta); 
    7577            const double siB = length_b * sas_sinx_x(length_b * mu * cos_beta); 
     
    9193            inner_sum += GAUSS_W[j] * f * f; 
    9294        } 
     95        // now complete change of inner integration variable (1-0)/(1-(-1))= 0.5 
    9396        inner_sum *= 0.5; 
    9497        // now sum up the outer integral 
    9598        outer_sum += GAUSS_W[i] * inner_sum; 
    9699    } 
     100    // now complete change of outer integration variable (1-0)/(1-(-1))= 0.5 
    97101    outer_sum *= 0.5; 
    98102 
  • sasmodels/models/core_shell_parallelepiped.py

    r97be877 r5bc6d21  
    1111.. math:: 
    1212 
    13     I(q) = \text{scale}\frac{\langle f^2 \rangle}{V} + \text{background} 
     13    I(q) = \frac{\text{scale}}{V} \langle P(q,\alpha,\beta) \rangle  
     14    + \text{background} 
    1415 
    1516where $\langle \ldots \rangle$ is an average over all possible orientations 
    16 of the rectangular solid. 
    17  
    18 The function calculated is the form factor of the rectangular solid below. 
     17of the rectangular solid, and the usual $\Delta \rho^2 \ V^2$ term cannot be 
     18pulled out of the form factor term due to the multiple slds in the model. 
     19 
    1920The core of the solid is defined by the dimensions $A$, $B$, $C$ such that 
    2021$A < B < C$. 
    2122 
    22 .. image:: img/core_shell_parallelepiped_geometry.jpg 
     23.. figure:: img/parallelepiped_geometry.jpg 
     24 
     25   Core of the core shell parallelepiped with the corresponding definition 
     26   of sides. 
     27 
    2328 
    2429There are rectangular "slabs" of thickness $t_A$ that add to the $A$ dimension 
    2530(on the $BC$ faces). There are similar slabs on the $AC$ $(=t_B)$ and $AB$ 
    26 $(=t_C)$ faces. The projection in the $AB$ plane is then 
    27  
    28 .. image:: img/core_shell_parallelepiped_projection.jpg 
    29  
    30 The volume of the solid is 
     31$(=t_C)$ faces. The projection in the $AB$ plane is 
     32 
     33.. figure:: img/core_shell_parallelepiped_projection.jpg 
     34 
     35   AB cut through the core-shell parallelipiped showing the cross secion of 
     36   four of the six shell slabs. As can be seen, this model leaves **"gaps"** 
     37   at the corners of the solid. 
     38 
     39 
     40The total volume of the solid is thus given as 
    3141 
    3242.. math:: 
    3343 
    3444    V = ABC + 2t_ABC + 2t_BAC + 2t_CAB 
    35  
    36 **meaning that there are "gaps" at the corners of the solid.** 
    3745 
    3846The intensity calculated follows the :ref:`parallelepiped` model, with the 
    3947core-shell intensity being calculated as the square of the sum of the 
    40 amplitudes of the core and the slabs on the edges. 
    41  
    42 the scattering amplitude is computed for a particular orientation of the 
    43 core-shell parallelepiped with respect to the scattering vector and then 
    44 averaged over all possible orientations, where $\alpha$ is the angle between 
    45 the $z$ axis and the $C$ axis of the parallelepiped, $\beta$ is 
    46 the angle between projection of the particle in the $xy$ detector plane 
    47 and the $y$ axis. 
    48  
    49 .. math:: 
    50  
    51     F(Q) 
     48amplitudes of the core and the slabs on the edges. The scattering amplitude is 
     49computed for a particular orientation of the core-shell parallelepiped with 
     50respect to the scattering vector and then averaged over all possible 
     51orientations, where $\alpha$ is the angle between the $z$ axis and the $C$ axis 
     52of the parallelepiped, and $\beta$ is the angle between the projection of the 
     53particle in the $xy$ detector plane and the $y$ axis. 
     54 
     55.. math:: 
     56 
     57    P(q)=\frac {\int_{0}^{\pi/2}\int_{0}^{\pi/2}F^2(q,\alpha,\beta) \ sin\alpha 
     58    \ d\alpha \ d\beta} {\int_{0}^{\pi/2} \ sin\alpha \ d\alpha \ d\beta} 
     59 
     60and 
     61 
     62.. math:: 
     63 
     64    F(q,\alpha,\beta) 
    5265    &= (\rho_\text{core}-\rho_\text{solvent}) 
    5366       S(Q_A, A) S(Q_B, B) S(Q_C, C) \\ 
    5467    &+ (\rho_\text{A}-\rho_\text{solvent}) 
    55         \left[S(Q_A, A+2t_A) - S(Q_A, Q)\right] S(Q_B, B) S(Q_C, C) \\ 
     68        \left[S(Q_A, A+2t_A) - S(Q_A, A)\right] S(Q_B, B) S(Q_C, C) \\ 
    5669    &+ (\rho_\text{B}-\rho_\text{solvent}) 
    5770        S(Q_A, A) \left[S(Q_B, B+2t_B) - S(Q_B, B)\right] S(Q_C, C) \\ 
     
    6376.. math:: 
    6477 
    65     S(Q, L) = L \frac{\sin \tfrac{1}{2} Q L}{\tfrac{1}{2} Q L} 
     78    S(Q_X, L) = L \frac{\sin (\tfrac{1}{2} Q_X L)}{\tfrac{1}{2} Q_X L} 
    6679 
    6780and 
     
    6982.. math:: 
    7083 
    71     Q_A &= \sin\alpha \sin\beta \\ 
    72     Q_B &= \sin\alpha \cos\beta \\ 
    73     Q_C &= \cos\alpha 
     84    Q_A &= q \sin\alpha \sin\beta \\ 
     85    Q_B &= q \sin\alpha \cos\beta \\ 
     86    Q_C &= q \cos\alpha 
    7487 
    7588 
    7689where $\rho_\text{core}$, $\rho_\text{A}$, $\rho_\text{B}$ and $\rho_\text{C}$ 
    77 are the scattering length of the parallelepiped core, and the rectangular 
     90are the scattering lengths of the parallelepiped core, and the rectangular 
    7891slabs of thickness $t_A$, $t_B$ and $t_C$, respectively. $\rho_\text{solvent}$ 
    7992is the scattering length of the solvent. 
     93 
     94.. note::  
     95 
     96   the code actually implements two substitutions: $d(cos\alpha)$ is 
     97   substituted for -$sin\alpha \ d\alpha$ (note that in the 
     98   :ref:`parallelepiped` code this is explicitly implemented with 
     99   $\sigma = cos\alpha$), and $\beta$ is set to $\beta = u \pi/2$ so that 
     100   $du = \pi/2 \ d\beta$.  Thus both integrals go from 0 to 1 rather than 0 
     101   to $\pi/2$. 
    80102 
    81103FITTING NOTES 
     
    94116based on the the averaged effective radius $(=\sqrt{(A+2t_A)(B+2t_B)/\pi})$ 
    95117and length $(C+2t_C)$ values, after appropriately sorting the three dimensions 
    96 to give an oblate or prolate particle, to give an effective radius, 
    97 for $S(Q)$ when $P(Q) * S(Q)$ is applied. 
     118to give an oblate or prolate particle, to give an effective radius 
     119for $S(q)$ when $P(q) * S(q)$ is applied. 
    98120 
    99121For 2d data the orientation of the particle is required, described using 
    100 angles $\theta$, $\phi$ and $\Psi$ as in the diagrams below, for further 
     122angles $\theta$, $\phi$ and $\Psi$ as in the diagrams below. For further 
    101123details of the calculation and angular dispersions see :ref:`orientation`. 
    102124The angle $\Psi$ is the rotational angle around the *long_c* axis. For example, 
    103125$\Psi = 0$ when the *short_b* axis is parallel to the *x*-axis of the detector. 
    104126 
    105 For 2d, constraints must be applied during fitting to ensure that the 
    106 inequality $A < B < C$ is not violated, and hence the correct definition 
    107 of angles is preserved. The calculation will not report an error, 
    108 but the results may be not correct. 
     127.. note:: For 2d, constraints must be applied during fitting to ensure that the 
     128   inequality $A < B < C$ is not violated, and hence the correct definition 
     129   of angles is preserved. The calculation will not report an error, 
     130   but the results may be not correct. 
    109131 
    110132.. figure:: img/parallelepiped_angle_definition.png 
     
    113135    Note that rotation $\theta$, initially in the $xz$ plane, is carried 
    114136    out first, then rotation $\phi$ about the $z$ axis, finally rotation 
    115     $\Psi$ is now around the axis of the cylinder. The neutron or X-ray 
     137    $\Psi$ is now around the axis of the particle. The neutron or X-ray 
    116138    beam is along the $z$ axis. 
    117139 
     
    120142    Examples of the angles for oriented core-shell parallelepipeds against the 
    121143    detector plane. 
     144 
     145 
     146Validation 
     147---------- 
     148 
     149Cross-checked against hollow rectangular prism and rectangular prism for equal 
     150thickness overlapping sides, and by Monte Carlo sampling of points within the 
     151shape for non-uniform, non-overlapping sides. 
     152 
    122153 
    123154References 
     
    135166 
    136167* **Author:** NIST IGOR/DANSE **Date:** pre 2010 
    137 * **Converted to sasmodels by:** Miguel Gonzales **Date:** February 26, 2016 
     168* **Converted to sasmodels by:** Miguel Gonzalez **Date:** February 26, 2016 
    138169* **Last Modified by:** Paul Kienzle **Date:** October 17, 2017 
    139 * Cross-checked against hollow rectangular prism and rectangular prism for 
    140   equal thickness overlapping sides, and by Monte Carlo sampling of points 
    141   within the shape for non-uniform, non-overlapping sides. 
    142170""" 
    143171 
  • sasmodels/models/parallelepiped.c

    r108e70e rdbf1a60  
    3838            inner_total += GAUSS_W[j] * square(si1 * si2); 
    3939        } 
     40        // now complete change of inner integration variable (1-0)/(1-(-1))= 0.5 
    4041        inner_total *= 0.5; 
    4142 
     
    4344        outer_total += GAUSS_W[i] * inner_total * si * si; 
    4445    } 
     46    // now complete change of outer integration variable (1-0)/(1-(-1))= 0.5 
    4547    outer_total *= 0.5; 
    4648 
  • sasmodels/models/parallelepiped.py

    ref07e95 r5bc6d21  
    22# Note: model title and parameter table are inserted automatically 
    33r""" 
    4 The form factor is normalized by the particle volume. 
    5 For information about polarised and magnetic scattering, see 
    6 the :ref:`magnetism` documentation. 
    7  
    84Definition 
    95---------- 
    106 
    117 This model calculates the scattering from a rectangular parallelepiped 
    12  (\:numref:`parallelepiped-image`\). 
    13  If you need to apply polydispersity, see also :ref:`rectangular-prism`. 
     8 (:numref:`parallelepiped-image`). 
     9 If you need to apply polydispersity, see also :ref:`rectangular-prism`. For 
     10 information about polarised and magnetic scattering, see 
     11the :ref:`magnetism` documentation. 
    1412 
    1513.. _parallelepiped-image: 
     
    2624error, or fixing of some dimensions at expected values, may help. 
    2725 
    28 The 1D scattering intensity $I(q)$ is calculated as: 
     26The form factor is normalized by the particle volume and the 1D scattering 
     27intensity $I(q)$ is then calculated as: 
    2928 
    3029.. Comment by Miguel Gonzalez: 
     
    3938 
    4039    I(q) = \frac{\text{scale}}{V} (\Delta\rho \cdot V)^2 
    41            \left< P(q, \alpha) \right> + \text{background} 
     40           \left< P(q, \alpha, \beta) \right> + \text{background} 
    4241 
    4342where the volume $V = A B C$, the contrast is defined as 
    44 $\Delta\rho = \rho_\text{p} - \rho_\text{solvent}$, 
    45 $P(q, \alpha)$ is the form factor corresponding to a parallelepiped oriented 
    46 at an angle $\alpha$ (angle between the long axis C and $\vec q$), 
    47 and the averaging $\left<\ldots\right>$ is applied over all orientations. 
     43$\Delta\rho = \rho_\text{p} - \rho_\text{solvent}$, $P(q, \alpha, \beta)$ 
     44is the form factor corresponding to a parallelepiped oriented 
     45at an angle $\alpha$ (angle between the long axis C and $\vec q$), and $\beta$ 
     46( the angle between the projection of the particle in the $xy$ detector plane 
     47and the $y$ axis) and the averaging $\left<\ldots\right>$ is applied over all 
     48orientations. 
    4849 
    4950Assuming $a = A/B < 1$, $b = B /B = 1$, and $c = C/B > 1$, the 
    50 form factor is given by (Mittelbach and Porod, 1961) 
     51form factor is given by (Mittelbach and Porod, 1961 [#Mittelbach]_) 
    5152 
    5253.. math:: 
     
    6667    \mu &= qB 
    6768 
    68 The scattering intensity per unit volume is returned in units of |cm^-1|. 
     69where substitution of $\sigma = cos\alpha$ and $\beta = \pi/2 \ u$ have been 
     70applied. 
    6971 
    7072NB: The 2nd virial coefficient of the parallelepiped is calculated based on 
     
    120122.. math:: 
    121123 
    122     P(q_x, q_y) = \left[\frac{\sin(\tfrac{1}{2}qA\cos\alpha)}{(\tfrac{1}{2}qA\cos\alpha)}\right]^2 
    123                   \left[\frac{\sin(\tfrac{1}{2}qB\cos\beta)}{(\tfrac{1}{2}qB\cos\beta)}\right]^2 
    124                   \left[\frac{\sin(\tfrac{1}{2}qC\cos\gamma)}{(\tfrac{1}{2}qC\cos\gamma)}\right]^2 
     124    P(q_x, q_y) = \left[\frac{\sin(\tfrac{1}{2}qA\cos\alpha)}{(\tfrac{1} 
     125                   {2}qA\cos\alpha)}\right]^2 
     126                  \left[\frac{\sin(\tfrac{1}{2}qB\cos\beta)}{(\tfrac{1} 
     127                   {2}qB\cos\beta)}\right]^2 
     128                  \left[\frac{\sin(\tfrac{1}{2}qC\cos\gamma)}{(\tfrac{1} 
     129                   {2}qC\cos\gamma)}\right]^2 
    125130 
    126131with 
     
    160165---------- 
    161166 
    162 P Mittelbach and G Porod, *Acta Physica Austriaca*, 14 (1961) 185-211 
    163  
    164 R Nayuk and K Huber, *Z. Phys. Chem.*, 226 (2012) 837-854 
     167.. [#Mittelbach] P Mittelbach and G Porod, *Acta Physica Austriaca*, 
     168   14 (1961) 185-211 
     169.. [#] R Nayuk and K Huber, *Z. Phys. Chem.*, 226 (2012) 837-854 
    165170 
    166171Authorship and Verification 
Note: See TracChangeset for help on using the changeset viewer.